mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'issue715_household_move_email' into 'master'
Issue715 household move email See merge request Chill-Projet/chill-bundles!495
This commit is contained in:
commit
c953da3fd0
@ -50,7 +50,7 @@ class LocationFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$builder->add('accepted_location', PickUserLocationType::class, [
|
$builder->add('accepted_location', PickUserLocationType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'label' => 'pick location'
|
'label' => 'pick location',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Chill\AsideActivityBundle\Export\Export;
|
namespace Chill\AsideActivityBundle\Export\Export;
|
||||||
|
|
||||||
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
use Chill\AsideActivityBundle\Export\Declarations;
|
use Chill\AsideActivityBundle\Export\Declarations;
|
||||||
use Chill\AsideActivityBundle\Form\AsideActivityCategoryType;
|
|
||||||
use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
|
use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
|
||||||
use Chill\AsideActivityBundle\Security\AsideActivityVoter;
|
use Chill\AsideActivityBundle\Security\AsideActivityVoter;
|
||||||
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
||||||
@ -16,32 +24,32 @@ use Chill\MainBundle\Export\Helper\UserHelper;
|
|||||||
use Chill\MainBundle\Export\ListInterface;
|
use Chill\MainBundle\Export\ListInterface;
|
||||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Closure;
|
use DateTimeInterface;
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private UserHelper $userHelper;
|
|
||||||
|
|
||||||
private DateTimeHelper $dateTimeHelper;
|
|
||||||
|
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
|
||||||
|
|
||||||
private CenterRepositoryInterface $centerRepository;
|
|
||||||
|
|
||||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
||||||
|
|
||||||
private CategoryRender $categoryRender;
|
private CategoryRender $categoryRender;
|
||||||
|
|
||||||
|
private CenterRepositoryInterface $centerRepository;
|
||||||
|
|
||||||
|
private DateTimeHelper $dateTimeHelper;
|
||||||
|
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private ScopeRepositoryInterface $scopeRepository;
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||||
|
|
||||||
|
private UserHelper $userHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
DateTimeHelper $dateTimeHelper,
|
DateTimeHelper $dateTimeHelper,
|
||||||
@ -76,11 +84,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
return 'export.aside_activity.List of aside activities';
|
return 'export.aside_activity.List of aside activities';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
|
||||||
{
|
|
||||||
return 'export.aside_activity.List of aside activities';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
return 'export.Exports of aside activities';
|
return 'export.Exports of aside activities';
|
||||||
@ -91,15 +94,16 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'id':
|
case 'id':
|
||||||
case 'note':
|
case 'note':
|
||||||
return function ($value) use ($key) {
|
return static function ($value) use ($key) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.' . $key;
|
return 'export.aside_activity.' . $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value ?? '';
|
return $value ?? '';
|
||||||
};
|
};
|
||||||
|
|
||||||
case 'duration':
|
case 'duration':
|
||||||
return function ($value) use ($key) {
|
return static function ($value) use ($key) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.' . $key;
|
return 'export.aside_activity.' . $key;
|
||||||
}
|
}
|
||||||
@ -108,7 +112,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value instanceof \DateTimeInterface) {
|
if ($value instanceof DateTimeInterface) {
|
||||||
return $value->format('H:i:s');
|
return $value->format('H:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +122,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
case 'createdAt':
|
case 'createdAt':
|
||||||
case 'updatedAt':
|
case 'updatedAt':
|
||||||
case 'date':
|
case 'date':
|
||||||
return $this->dateTimeHelper->getLabel('export.aside_activity.'.$key);
|
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
|
||||||
|
|
||||||
case 'agent_id':
|
case 'agent_id':
|
||||||
case 'creator_id':
|
case 'creator_id':
|
||||||
@ -165,7 +169,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new \LogicException('this key is not supported : ' . $key);
|
throw new LogicException('this key is not supported : ' . $key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +186,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
'aside_activity_type',
|
'aside_activity_type',
|
||||||
'date',
|
'date',
|
||||||
'duration',
|
'duration',
|
||||||
'note'
|
'note',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +199,11 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTitle()
|
||||||
|
{
|
||||||
|
return 'export.aside_activity.List of aside activities';
|
||||||
|
}
|
||||||
|
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
{
|
{
|
||||||
return Declarations::ASIDE_ACTIVITY_TYPE;
|
return Declarations::ASIDE_ACTIVITY_TYPE;
|
||||||
@ -204,8 +213,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
$qb = $this->em->createQueryBuilder()
|
$qb = $this->em->createQueryBuilder()
|
||||||
->from(AsideActivity::class, 'aside')
|
->from(AsideActivity::class, 'aside')
|
||||||
->leftJoin('aside.agent', 'agent')
|
->leftJoin('aside.agent', 'agent');
|
||||||
;
|
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->addSelect('aside.id AS id')
|
->addSelect('aside.id AS id')
|
||||||
@ -218,8 +226,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
->addSelect('IDENTITY(aside.type) AS aside_activity_type')
|
->addSelect('IDENTITY(aside.type) AS aside_activity_type')
|
||||||
->addSelect('aside.date')
|
->addSelect('aside.date')
|
||||||
->addSelect('aside.duration')
|
->addSelect('aside.duration')
|
||||||
->addSelect('aside.note')
|
->addSelect('aside.note');
|
||||||
;
|
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ use Chill\MainBundle\Form\Type\Export\FilterType;
|
|||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Form\FormError;
|
use Symfony\Component\Form\FormError;
|
||||||
|
@ -15,7 +15,6 @@ use Chill\AsideActivityBundle\Export\Declarations;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class ChargeKindType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('kind', TextType::class, [
|
->add('kind', TextType::class, [
|
||||||
'label' => 'budget.admin.form.Charge_kind_key',
|
'label' => 'budget.admin.form.Charge_kind_key',
|
||||||
'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document'
|
'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document',
|
||||||
])
|
])
|
||||||
->add('ordering', NumberType::class)
|
->add('ordering', NumberType::class)
|
||||||
->add('isActive', CheckboxType::class, [
|
->add('isActive', CheckboxType::class, [
|
||||||
|
@ -30,7 +30,7 @@ class ResourceKindType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('kind', TextType::class, [
|
->add('kind', TextType::class, [
|
||||||
'label' => 'budget.admin.form.Resource_kind_key',
|
'label' => 'budget.admin.form.Resource_kind_key',
|
||||||
'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document'
|
'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document',
|
||||||
])
|
])
|
||||||
->add('ordering', NumberType::class)
|
->add('ordering', NumberType::class)
|
||||||
->add('isActive', CheckboxType::class, [
|
->add('isActive', CheckboxType::class, [
|
||||||
|
@ -49,8 +49,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
|
|||||||
->where($qb->expr()->eq('c.isActive', 'true'))
|
->where($qb->expr()->eq('c.isActive', 'true'))
|
||||||
->orderBy('c.ordering', 'ASC')
|
->orderBy('c.ordering', 'ASC')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult()
|
->getResult();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,8 +28,6 @@ interface ChargeKindRepositoryInterface extends ObjectRepository
|
|||||||
*/
|
*/
|
||||||
public function findAllActive(): array;
|
public function findAllActive(): array;
|
||||||
|
|
||||||
public function findOneByKind(string $kind): ?ChargeKind;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return ChargeType[]
|
||||||
*/
|
*/
|
||||||
@ -45,5 +43,7 @@ interface ChargeKindRepositoryInterface extends ObjectRepository
|
|||||||
|
|
||||||
public function findOneBy(array $criteria): ?ChargeKind;
|
public function findOneBy(array $criteria): ?ChargeKind;
|
||||||
|
|
||||||
|
public function findOneByKind(string $kind): ?ChargeKind;
|
||||||
|
|
||||||
public function getClassName(): string;
|
public function getClassName(): string;
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
|
|||||||
->where($qb->expr()->eq('r.isActive', 'true'))
|
->where($qb->expr()->eq('r.isActive', 'true'))
|
||||||
->orderBy('r.ordering', 'ASC')
|
->orderBy('r.ordering', 'ASC')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult()
|
->getResult();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ class ResourceRepository extends EntityRepository
|
|||||||
//->andWhere('c.startDate < :date')
|
//->andWhere('c.startDate < :date')
|
||||||
// TODO: there is a misconception here, the end date must be lower or null. startDate are never null
|
// TODO: there is a misconception here, the end date must be lower or null. startDate are never null
|
||||||
//->andWhere('c.startDate < :date OR c.startDate IS NULL');
|
//->andWhere('c.startDate < :date OR c.startDate IS NULL');
|
||||||
;
|
;
|
||||||
|
|
||||||
if (null !== $sort) {
|
if (null !== $sort) {
|
||||||
$qb->orderBy($sort);
|
$qb->orderBy($sort);
|
||||||
|
@ -13,9 +13,7 @@ namespace Chill\BudgetBundle\Service\Summary;
|
|||||||
|
|
||||||
use Chill\BudgetBundle\Entity\ChargeKind;
|
use Chill\BudgetBundle\Entity\ChargeKind;
|
||||||
use Chill\BudgetBundle\Entity\ResourceKind;
|
use Chill\BudgetBundle\Entity\ResourceKind;
|
||||||
use Chill\BudgetBundle\Repository\ChargeKindRepository;
|
|
||||||
use Chill\BudgetBundle\Repository\ChargeKindRepositoryInterface;
|
use Chill\BudgetBundle\Repository\ChargeKindRepositoryInterface;
|
||||||
use Chill\BudgetBundle\Repository\ResourceKindRepository;
|
|
||||||
use Chill\BudgetBundle\Repository\ResourceKindRepositoryInterface;
|
use Chill\BudgetBundle\Repository\ResourceKindRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
|
@ -20,12 +20,15 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
|
use ReflectionClass;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -47,10 +50,9 @@ final class SummaryBudgetTest extends TestCase
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$queryCharges->setParameters(Argument::type('array'))
|
$queryCharges->setParameters(Argument::type('array'))
|
||||||
->will(function ($args, $query) {
|
->will(static function ($args, $query) {
|
||||||
return $query;
|
return $query;
|
||||||
})
|
});
|
||||||
;
|
|
||||||
|
|
||||||
$queryResources = $this->prophesize(AbstractQuery::class);
|
$queryResources = $this->prophesize(AbstractQuery::class);
|
||||||
$queryResources->getResult()->willReturn([
|
$queryResources->getResult()->willReturn([
|
||||||
@ -61,23 +63,23 @@ final class SummaryBudgetTest extends TestCase
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$queryResources->setParameters(Argument::type('array'))
|
$queryResources->setParameters(Argument::type('array'))
|
||||||
->will(function ($args, $query) {
|
->will(static function ($args, $query) {
|
||||||
return $query;
|
return $query;
|
||||||
})
|
});
|
||||||
;
|
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$em = $this->prophesize(EntityManagerInterface::class);
|
||||||
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
||||||
->will(function ($args) use ($queryResources, $queryCharges) {
|
->will(static function ($args) use ($queryResources, $queryCharges) {
|
||||||
if (false !== strpos($args[0], 'chill_budget.resource')) {
|
if (false !== strpos($args[0], 'chill_budget.resource')) {
|
||||||
return $queryResources->reveal();
|
return $queryResources->reveal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== strpos($args[0], 'chill_budget.charge')) {
|
if (false !== strpos($args[0], 'chill_budget.charge')) {
|
||||||
return $queryCharges->reveal();
|
return $queryCharges->reveal();
|
||||||
}
|
}
|
||||||
throw new \RuntimeException('this query does not have a stub counterpart: '.$args[0]);
|
|
||||||
})
|
throw new RuntimeException('this query does not have a stub counterpart: ' . $args[0]);
|
||||||
;
|
});
|
||||||
|
|
||||||
$chargeRepository = $this->prophesize(ChargeKindRepositoryInterface::class);
|
$chargeRepository = $this->prophesize(ChargeKindRepositoryInterface::class);
|
||||||
$chargeRepository->findAll()->willReturn([
|
$chargeRepository->findAll()->willReturn([
|
||||||
@ -98,24 +100,23 @@ final class SummaryBudgetTest extends TestCase
|
|||||||
$resourceRepository->findOneByKind('misc')->willReturn($misc);
|
$resourceRepository->findOneByKind('misc')->willReturn($misc);
|
||||||
|
|
||||||
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
|
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
|
||||||
$translatableStringHelper->localize(Argument::type('array'))->will(function ($arg) {
|
$translatableStringHelper->localize(Argument::type('array'))->will(static function ($arg) {
|
||||||
return $arg[0]['fr'];
|
return $arg[0]['fr'];
|
||||||
});
|
});
|
||||||
|
|
||||||
$person = new Person();
|
$person = new Person();
|
||||||
$personReflection = new \ReflectionClass($person);
|
$personReflection = new ReflectionClass($person);
|
||||||
$personIdReflection = $personReflection->getProperty('id');
|
$personIdReflection = $personReflection->getProperty('id');
|
||||||
$personIdReflection->setAccessible(true);
|
$personIdReflection->setAccessible(true);
|
||||||
$personIdReflection->setValue($person, 1);
|
$personIdReflection->setValue($person, 1);
|
||||||
|
|
||||||
$household = new Household();
|
$household = new Household();
|
||||||
$householdReflection = new \ReflectionClass($household);
|
$householdReflection = new ReflectionClass($household);
|
||||||
$householdId = $householdReflection->getProperty('id');
|
$householdId = $householdReflection->getProperty('id');
|
||||||
$householdId->setAccessible(true);
|
$householdId->setAccessible(true);
|
||||||
$householdId->setValue($household, 1);
|
$householdId->setValue($household, 1);
|
||||||
$householdMember = (new HouseholdMember())->setPerson($person)
|
$householdMember = (new HouseholdMember())->setPerson($person)
|
||||||
->setStartDate(new \DateTimeImmutable('1 month ago'))
|
->setStartDate(new DateTimeImmutable('1 month ago'));
|
||||||
;
|
|
||||||
$household->addMember($householdMember);
|
$household->addMember($householdMember);
|
||||||
|
|
||||||
$summaryBudget = new SummaryBudget(
|
$summaryBudget = new SummaryBudget(
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Chill\Migrations\Budget;
|
namespace Chill\Migrations\Budget;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
@ -9,6 +16,12 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20230209161546 extends AbstractMigration
|
final class Version20230209161546 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP INDEX resource_kind_unique_type_idx');
|
||||||
|
$this->addSql('DROP INDEX charge_kind_unique_type_idx');
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Budget: add unique constraint on kind for charge_kind and resource_kind';
|
return 'Budget: add unique constraint on kind for charge_kind and resource_kind';
|
||||||
@ -21,10 +34,4 @@ final class Version20230209161546 extends AbstractMigration
|
|||||||
$this->addSql('CREATE UNIQUE INDEX resource_kind_unique_type_idx ON chill_budget.resource_type (kind);');
|
$this->addSql('CREATE UNIQUE INDEX resource_kind_unique_type_idx ON chill_budget.resource_type (kind);');
|
||||||
$this->addSql('CREATE UNIQUE INDEX charge_kind_unique_type_idx ON chill_budget.charge_type (kind);');
|
$this->addSql('CREATE UNIQUE INDEX charge_kind_unique_type_idx ON chill_budget.charge_type (kind);');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('DROP INDEX resource_kind_unique_type_idx');
|
|
||||||
$this->addSql('DROP INDEX charge_kind_unique_type_idx');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
use function strlen;
|
use function strlen;
|
||||||
|
use const JSON_PRETTY_PRINT;
|
||||||
|
|
||||||
final class DocGeneratorTemplateController extends AbstractController
|
final class DocGeneratorTemplateController extends AbstractController
|
||||||
{
|
{
|
||||||
@ -255,7 +256,7 @@ final class DocGeneratorTemplateController extends AbstractController
|
|||||||
// if is test, render the data or generate the doc
|
// if is test, render the data or generate the doc
|
||||||
if ($isTest && isset($form) && $form['show_data']->getData()) {
|
if ($isTest && isset($form) && $form['show_data']->getData()) {
|
||||||
return $this->render('@ChillDocGenerator/Generator/debug_value.html.twig', [
|
return $this->render('@ChillDocGenerator/Generator/debug_value.html.twig', [
|
||||||
'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), JSON_PRETTY_PRINT)
|
'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), JSON_PRETTY_PRINT),
|
||||||
]);
|
]);
|
||||||
} elseif ($isTest) {
|
} elseif ($isTest) {
|
||||||
$generated = $this->generator->generateDocFromTemplate(
|
$generated = $this->generator->generateDocFromTemplate(
|
||||||
|
@ -1,19 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Service\Generator;
|
namespace Chill\DocGeneratorBundle\Service\Generator;
|
||||||
|
|
||||||
class GeneratorException extends \RuntimeException
|
use RuntimeException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class GeneratorException extends RuntimeException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var list<string>
|
* @var list<string>
|
||||||
*/
|
*/
|
||||||
private array $errors;
|
private array $errors;
|
||||||
|
|
||||||
public function __construct(array $errors = [], \Throwable $previous = null)
|
public function __construct(array $errors = [], ?Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$this->errors = $errors;
|
$this->errors = $errors;
|
||||||
parent::__construct("Could not generate the document", 15252,
|
parent::__construct(
|
||||||
$previous);
|
'Could not generate the document',
|
||||||
|
15252,
|
||||||
|
$previous
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Service\Generator;
|
namespace Chill\DocGeneratorBundle\Service\Generator;
|
||||||
|
|
||||||
class ObjectReadyException extends \RuntimeException
|
use RuntimeException;
|
||||||
|
|
||||||
|
class ObjectReadyException extends RuntimeException
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct("object is already ready", 6698856);
|
parent::__construct('object is already ready', 6698856);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Service\Generator;
|
namespace Chill\DocGeneratorBundle\Service\Generator;
|
||||||
|
|
||||||
class RelatedEntityNotFoundException extends \RuntimeException
|
use RuntimeException;
|
||||||
|
|
||||||
|
class RelatedEntityNotFoundException extends RuntimeException
|
||||||
{
|
{
|
||||||
public function __construct(string $relatedEntityClass, int $relatedEntityId, Throwable $previous = null)
|
public function __construct(string $relatedEntityClass, int $relatedEntityId, ?Throwable $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
sprintf("Related entity not found: %s, %s", $relatedEntityClass, $relatedEntityId),
|
sprintf('Related entity not found: %s, %s', $relatedEntityClass, $relatedEntityId),
|
||||||
99876652,
|
99876652,
|
||||||
$previous);
|
$previous
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Export;
|
namespace Chill\MainBundle\Export;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Export\Helper;
|
namespace Chill\MainBundle\Export\Helper;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use DateTimeInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class DateTimeHelper
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value instanceof \DateTimeInterface) {
|
if ($value instanceof DateTimeInterface) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#}{{ period.user.label }},
|
#}{{ period.user.label }},
|
||||||
|
|
||||||
L'usager {{ oldPersonLocation|chill_entity_render_string }} a déménagé.
|
L'usager {{ oldPersonLocation|chill_entity_render_string }} a déménagé.
|
||||||
|
{{ app.user|chill_entity_render_string }} a enregistré ce déménagement.
|
||||||
|
|
||||||
Son adresse était utilisée pour localiser le parcours n°{{ period.id }}, dont vous êtes
|
Son adresse était utilisée pour localiser le parcours n°{{ period.id }}, dont vous êtes
|
||||||
le référent.
|
le référent.
|
||||||
|
@ -24,10 +24,36 @@ use Prophecy\Argument;
|
|||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||||
|
|
||||||
class ParticipationOverlapValidatorTest extends ConstraintValidatorTestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class ParticipationOverlapValidatorTest extends ConstraintValidatorTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConstraint()
|
||||||
|
{
|
||||||
|
return new ParticipationOverlap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOneParticipation()
|
||||||
|
{
|
||||||
|
$period = new AccompanyingPeriod();
|
||||||
|
$person = new Person();
|
||||||
|
|
||||||
|
$collection = new ArrayCollection([
|
||||||
|
new AccompanyingPeriodParticipation($period, $person),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->validator->validate($collection, $this->getConstraint());
|
||||||
|
|
||||||
|
$this->assertNoViolation();
|
||||||
|
}
|
||||||
|
|
||||||
protected function createValidator()
|
protected function createValidator()
|
||||||
{
|
{
|
||||||
$personRender = $this->prophesize(PersonRenderInterface::class);
|
$personRender = $this->prophesize(PersonRenderInterface::class);
|
||||||
@ -37,26 +63,4 @@ class ParticipationOverlapValidatorTest extends ConstraintValidatorTestCase
|
|||||||
|
|
||||||
return new ParticipationOverlapValidator($personRender->reveal(), $thirdPartyRender->reveal());
|
return new ParticipationOverlapValidator($personRender->reveal(), $thirdPartyRender->reveal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOneParticipation()
|
|
||||||
{
|
|
||||||
$period = new AccompanyingPeriod();
|
|
||||||
$person = new Person();
|
|
||||||
|
|
||||||
$collection = new ArrayCollection([
|
|
||||||
new AccompanyingPeriodParticipation($period, $person)
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->validator->validate($collection, $this->getConstraint());
|
|
||||||
|
|
||||||
$this->assertNoViolation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getConstraint()
|
|
||||||
{
|
|
||||||
return new ParticipationOverlap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user