mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'master' into upgrade-php82
This commit is contained in:
commit
672418e70a
@ -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',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,12 +137,27 @@
|
|||||||
{{ activity.comment|chill_entity_render_box({
|
{{ activity.comment|chill_entity_render_box({
|
||||||
'disable_markdown': false,
|
'disable_markdown': false,
|
||||||
'limit_lines': 3,
|
'limit_lines': 3,
|
||||||
'metadata': false
|
'metadata': false,
|
||||||
}) }}
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) and activity.privateComment.hasCommentForUser(app.user) %}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
<h3>{{ 'Private comment'|trans }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
<section class="chill-entity entity-comment-embeddable">
|
||||||
|
<blockquote class="chill-user-quote private-quote">
|
||||||
|
{{ activity.privateComment.comments[app.user.id]|chill_markdown_to_html }}
|
||||||
|
</blockquote>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
||||||
durationTime
|
durationTime
|
||||||
travelTime
|
travelTime
|
||||||
|
@ -13,7 +13,6 @@ 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;
|
||||||
@ -25,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,
|
||||||
@ -85,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';
|
||||||
@ -100,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;
|
||||||
}
|
}
|
||||||
@ -117,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');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,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':
|
||||||
@ -174,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +186,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
'aside_activity_type',
|
'aside_activity_type',
|
||||||
'date',
|
'date',
|
||||||
'duration',
|
'duration',
|
||||||
'note'
|
'note',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,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;
|
||||||
@ -213,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')
|
||||||
@ -227,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;
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@ class CalculatorManager
|
|||||||
|
|
||||||
public function addCalculator(CalculatorInterface $calculator, bool $default)
|
public function addCalculator(CalculatorInterface $calculator, bool $default)
|
||||||
{
|
{
|
||||||
$this->calculators[$calculator::getAlias()] = $calculator;
|
$this->calculators[$calculator->getAlias()] = $calculator;
|
||||||
|
|
||||||
if ($default) {
|
if ($default) {
|
||||||
$this->defaultCalculator[] = $calculator::getAlias();
|
$this->defaultCalculator[] = $calculator->getAlias();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ class CalculatorManager
|
|||||||
$result = $calculator->calculate($elements);
|
$result = $calculator->calculate($elements);
|
||||||
|
|
||||||
if (null !== $result) {
|
if (null !== $result) {
|
||||||
$results[$calculator::getAlias()] = $result;
|
$results[$calculator->getAlias()] = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findOneByKind(string $kind): ?ResourceKind
|
public function findOneByKind(string $kind): ?ResourceKind
|
||||||
|
@ -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(
|
||||||
|
@ -16,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';
|
||||||
@ -28,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),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if ($isTest) {
|
if ($isTest) {
|
||||||
|
@ -11,18 +11,21 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
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(
|
parent::__construct(
|
||||||
"Could not generate the document",
|
'Could not generate the document',
|
||||||
15252,
|
15252,
|
||||||
$previous
|
$previous
|
||||||
);
|
);
|
||||||
|
@ -11,10 +11,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
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
|
||||||
);
|
);
|
||||||
|
@ -72,7 +72,6 @@ class ChillMainBundle extends Bundle
|
|||||||
$container->addCompilerPass(new NotificationCounterCompilerPass());
|
$container->addCompilerPass(new NotificationCounterCompilerPass());
|
||||||
$container->addCompilerPass(new MenuCompilerPass());
|
$container->addCompilerPass(new MenuCompilerPass());
|
||||||
$container->addCompilerPass(new ACLFlagsCompilerPass());
|
$container->addCompilerPass(new ACLFlagsCompilerPass());
|
||||||
$container->addCompilerPass(new GroupingCenterCompilerPass());
|
|
||||||
$container->addCompilerPass(new CRUDControllerCompilerPass());
|
$container->addCompilerPass(new CRUDControllerCompilerPass());
|
||||||
$container->addCompilerPass(new ShortMessageCompilerPass());
|
$container->addCompilerPass(new ShortMessageCompilerPass());
|
||||||
}
|
}
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<?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\MainBundle\DependencyInjection\CompilerPass;
|
|
||||||
|
|
||||||
use LogicException;
|
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
|
||||||
|
|
||||||
class GroupingCenterCompilerPass implements CompilerPassInterface
|
|
||||||
{
|
|
||||||
public function process(ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
if (false === $container->hasDefinition('chill.main.form.pick_centers_type')) {
|
|
||||||
throw new LogicException('The service chill.main.form.pick_centers_type does '
|
|
||||||
. 'not exists in container');
|
|
||||||
}
|
|
||||||
|
|
||||||
$pickCenterType = $container->getDefinition('chill.main.form.pick_centers_type');
|
|
||||||
|
|
||||||
foreach ($container->findTaggedServiceIds('chill.grouping_center') as $serviceId => $tagged) {
|
|
||||||
$pickCenterType->addMethodCall(
|
|
||||||
'addGroupingCenter',
|
|
||||||
[new Reference($serviceId)]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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\MainBundle\Form\Type\Export;
|
namespace Chill\MainBundle\Form\Type\Export;
|
||||||
|
|
||||||
use Chill\MainBundle\Center\GroupingCenterInterface;
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Regroupment;
|
use Chill\MainBundle\Entity\Regroupment;
|
||||||
use Chill\MainBundle\Export\ExportManager;
|
use Chill\MainBundle\Export\ExportManager;
|
||||||
@ -72,8 +71,10 @@ final class PickCenterType extends AbstractType
|
|||||||
return $c->getName();
|
return $c->getName();
|
||||||
},
|
},
|
||||||
'data' => $centers,
|
'data' => $centers,
|
||||||
])
|
]);
|
||||||
->add('regroupment', EntityType::class, [
|
|
||||||
|
if (count($this->regroupmentRepository->findAllActive()) > 0) {
|
||||||
|
$builder->add('regroupment', EntityType::class, [
|
||||||
'class' => Regroupment::class,
|
'class' => Regroupment::class,
|
||||||
'label' => 'regroupment',
|
'label' => 'regroupment',
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
@ -83,6 +84,7 @@ final class PickCenterType extends AbstractType
|
|||||||
return $r->getName();
|
return $r->getName();
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$builder->setDataMapper(new ExportPickCenterDataMapper());
|
$builder->setDataMapper(new ExportPickCenterDataMapper());
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ export default {
|
|||||||
// console.log('data original', data);
|
// console.log('data original', data);
|
||||||
data.parent = {type: "thirdparty", id: this.parent.id};
|
data.parent = {type: "thirdparty", id: this.parent.id};
|
||||||
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
||||||
data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null;
|
data.profession = data.profession !== '' ? data.profession : '';
|
||||||
} else {
|
} else {
|
||||||
type = this.$refs.castNew.radioType;
|
type = this.$refs.castNew.radioType;
|
||||||
data = this.$refs.castNew.castDataByType();
|
data = this.$refs.castNew.castDataByType();
|
||||||
@ -241,8 +241,8 @@ export default {
|
|||||||
if (typeof data.civility !== 'undefined' && null !== data.civility) {
|
if (typeof data.civility !== 'undefined' && null !== data.civility) {
|
||||||
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null;
|
||||||
}
|
}
|
||||||
if (typeof data.profession !== 'undefined' && null !== data.profession) {
|
if (typeof data.profession !== 'undefined' && '' !== data.profession) {
|
||||||
data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null;
|
data.profession = data.profession !== '' ? data.profession : '';
|
||||||
}
|
}
|
||||||
// console.log('onthefly data', data);
|
// console.log('onthefly data', data);
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,10 @@
|
|||||||
<h3 class="m-3">{{ 'Center'|trans }}</h3>
|
<h3 class="m-3">{{ 'Center'|trans }}</h3>
|
||||||
{{ form_widget(form.centers.center) }}
|
{{ form_widget(form.centers.center) }}
|
||||||
|
|
||||||
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
|
{% if form.centers.regroupment is defined %}
|
||||||
{{ form_widget(form.centers.regroupment) }}
|
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
|
||||||
|
{{ form_widget(form.centers.regroupment) }}
|
||||||
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<p>{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}</p>
|
<p>{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}</p>
|
||||||
|
@ -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;
|
||||||
|
@ -2,6 +2,29 @@
|
|||||||
<div class="vue-component">
|
<div class="vue-component">
|
||||||
<h2><a id="section-80"></a>{{ $t('referrer.title') }}</h2>
|
<h2><a id="section-80"></a>{{ $t('referrer.title') }}</h2>
|
||||||
|
|
||||||
|
<teleport to="body">
|
||||||
|
<modal v-if="modal.showModal"
|
||||||
|
:modalDialogClass="modal.modalDialogClass"
|
||||||
|
@close="cancelChange">
|
||||||
|
<template v-slot:header>
|
||||||
|
<h3 class="modal-title">{{ $t('confirm.title') }}</h3>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:body-head>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p v-html="$t('confirm.sure_referrer', { referrer: this.value.text })"></p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:footer>
|
||||||
|
<button class="btn btn-save"
|
||||||
|
@click.prevent="this.confirmReferrer">
|
||||||
|
{{ $t('confirm.ok_referrer')}}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</modal>
|
||||||
|
</teleport>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<label class="col-form-label" for="selectJob">
|
<label class="col-form-label" for="selectJob">
|
||||||
@ -35,6 +58,7 @@
|
|||||||
:searchable="true"
|
:searchable="true"
|
||||||
:placeholder="$t('referrer.placeholder')"
|
:placeholder="$t('referrer.placeholder')"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
|
@select="updateReferrer"
|
||||||
:options="users"
|
:options="users"
|
||||||
:select-label="$t('multiselect.select_label')"
|
:select-label="$t('multiselect.select_label')"
|
||||||
:deselect-label="$t('multiselect.deselect_label')"
|
:deselect-label="$t('multiselect.deselect_label')"
|
||||||
@ -78,16 +102,24 @@ import VueMultiselect from 'vue-multiselect';
|
|||||||
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods';
|
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
import {mapState, mapGetters} from 'vuex';
|
import {mapState, mapGetters} from 'vuex';
|
||||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
||||||
|
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Referrer",
|
name: "Referrer",
|
||||||
components: {
|
components: {
|
||||||
UserRenderBoxBadge,
|
UserRenderBoxBadge,
|
||||||
VueMultiselect,
|
VueMultiselect,
|
||||||
|
Modal
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
jobs: []
|
jobs: [],
|
||||||
|
modal: {
|
||||||
|
showModal: false,
|
||||||
|
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
||||||
|
},
|
||||||
|
value: this.$store.state.accompanyingCourse.user,
|
||||||
|
confirmed: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -118,22 +150,6 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
value: {
|
|
||||||
get() {
|
|
||||||
return this.$store.state.accompanyingCourse.user;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
console.log('set referrer', value);
|
|
||||||
this.$store.dispatch('updateReferrer', value)
|
|
||||||
.catch(({name, violations}) => {
|
|
||||||
if (name === 'ValidationException' || name === 'AccessException') {
|
|
||||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
|
||||||
} else {
|
|
||||||
this.$toast.open({message: 'An error occurred'})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getJobs();
|
this.getJobs();
|
||||||
@ -141,6 +157,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
updateReferrer(value) {
|
updateReferrer(value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
this.toggleModal();
|
||||||
},
|
},
|
||||||
getJobs() {
|
getJobs() {
|
||||||
const url = '/api/1.0/main/user-job.json';
|
const url = '/api/1.0/main/user-job.json';
|
||||||
@ -159,12 +176,27 @@ export default {
|
|||||||
const url = `/api/1.0/main/whoami.json`;
|
const url = `/api/1.0/main/whoami.json`;
|
||||||
makeFetch('GET', url)
|
makeFetch('GET', url)
|
||||||
.then(user => {
|
.then(user => {
|
||||||
this.value = user
|
// this.value = user
|
||||||
|
this.updateReferrer(user);
|
||||||
})
|
})
|
||||||
/*.catch((error) => {
|
},
|
||||||
commit('catchError', error);
|
toggleModal() {
|
||||||
this.$toast.open({message: error.body})
|
this.modal.showModal = !this.modal.showModal;
|
||||||
})*/
|
},
|
||||||
|
confirmReferrer() {
|
||||||
|
this.$store.dispatch('updateReferrer', this.value)
|
||||||
|
.catch(({name, violations}) => {
|
||||||
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.toggleModal()
|
||||||
|
},
|
||||||
|
cancelChange() {
|
||||||
|
this.value = this.$store.state.accompanyingCourse.user
|
||||||
|
this.toggleModal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ export default {
|
|||||||
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
|
body.civility = {type: 'chill_main_civility', id: payload.data.civility.id};
|
||||||
}
|
}
|
||||||
if (null !== payload.data.profession) {
|
if (null !== payload.data.profession) {
|
||||||
body.profession = {type: 'third_party_profession', id: payload.data.profession.id};
|
body.profession = payload.data.profession;
|
||||||
}
|
}
|
||||||
// console.log('body', body);
|
// console.log('body', body);
|
||||||
|
|
||||||
|
@ -139,8 +139,10 @@ const appMessages = {
|
|||||||
set_a_scope: "indiquez au moins un service",
|
set_a_scope: "indiquez au moins un service",
|
||||||
sure: "Êtes-vous sûr ?",
|
sure: "Êtes-vous sûr ?",
|
||||||
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
|
||||||
|
sure_referrer: "Êtes-vous sûr de vouloir assigner ce parcours à <b>{referrer}</b>",
|
||||||
ok: "Confirmer le parcours",
|
ok: "Confirmer le parcours",
|
||||||
delete: "Supprimer le parcours",
|
delete: "Supprimer le parcours",
|
||||||
|
ok_referrer: "Confirmer le référent",
|
||||||
no_suggested_referrer: "Il n'y a aucun référent qui puisse être suggéré pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si les données sont correctes, vous pouvez confirmer ce parcours.",
|
no_suggested_referrer: "Il n'y a aucun référent qui puisse être suggéré pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si les données sont correctes, vous pouvez confirmer ce parcours.",
|
||||||
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
|
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
|
||||||
choose_suggested_referrer: "Voulez-vous le désigner directement ?",
|
choose_suggested_referrer: "Voulez-vous le désigner directement ?",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container tpartycontainer">
|
<div class="container tpartycontainer">
|
||||||
<div class="tparty-identification">
|
<div class="tparty-identification">
|
||||||
<span v-if="item.result.profession" class="profession">{{ item.result.profession.name.fr }}</span>
|
<span v-if="item.result.profession" class="profession">{{ item.result.profession }}</span>
|
||||||
<span class="name">
|
<span class="name">
|
||||||
{{ item.result.text }}
|
{{ item.result.text }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -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.
|
||||||
|
@ -79,6 +79,11 @@ class SimilarPersonMatcher
|
|||||||
->where('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) >= :precision')
|
->where('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) >= :precision')
|
||||||
->andWhere($qb->expr()->in('p.center', ':centers'));
|
->andWhere($qb->expr()->in('p.center', ':centers'));
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->setParameter('fullName', $this->personRender->renderString($person, []))
|
||||||
|
->setParameter('centers', $centers)
|
||||||
|
->setParameter('precision', $precision);
|
||||||
|
|
||||||
if (null !== $person->getBirthdate()) {
|
if (null !== $person->getBirthdate()) {
|
||||||
$qb->andWhere($qb->expr()->orX(
|
$qb->andWhere($qb->expr()->orX(
|
||||||
$qb->expr()->eq('p.birthdate', ':personBirthdate'),
|
$qb->expr()->eq('p.birthdate', ':personBirthdate'),
|
||||||
@ -90,13 +95,13 @@ class SimilarPersonMatcher
|
|||||||
|
|
||||||
if ($person->getId() !== null) {
|
if ($person->getId() !== null) {
|
||||||
$qb->andWhere($qb->expr()->neq('p.id', ':personId'));
|
$qb->andWhere($qb->expr()->neq('p.id', ':personId'));
|
||||||
$query->setParameter('personId', $person->getId());
|
$qb->setParameter('personId', $person->getId());
|
||||||
|
|
||||||
$notDuplicatePersons = $this->personNotDuplicateRepository->findNotDuplicatePerson($person);
|
$notDuplicatePersons = $this->personNotDuplicateRepository->findNotDuplicatePerson($person);
|
||||||
|
|
||||||
if (count($notDuplicatePersons)) {
|
if (count($notDuplicatePersons)) {
|
||||||
$qb->andWhere($qb->expr()->notIn('p.id', ':notDuplicatePersons'));
|
$qb->andWhere($qb->expr()->notIn('p.id', ':notDuplicatePersons'));
|
||||||
$query->setParameter('notDuplicatePersons', $notDuplicatePersons);
|
$qb->setParameter('notDuplicatePersons', $notDuplicatePersons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,13 +114,10 @@ class SimilarPersonMatcher
|
|||||||
case self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY:
|
case self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY:
|
||||||
default:
|
default:
|
||||||
$qb->orderBy('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName)))', 'DESC');
|
$qb->orderBy('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName)))', 'DESC');
|
||||||
|
$qb->setParameter('fullName', $this->personRender->renderString($person, []));
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb
|
dump($qb->getQuery());
|
||||||
->setParameter('fullName', $this->personRender->renderString($person, []))
|
|
||||||
->setParameter('centers', $centers)
|
|
||||||
->setParameter('precision', $precision);
|
|
||||||
|
|
||||||
return $qb->getQuery()->getResult();
|
return $qb->getQuery()->getResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,21 +151,6 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'class' => \Chill\ThirdPartyBundle\Entity\ThirdPartyProfession::class,
|
|
||||||
// 'controller' => \Chill\MainBundle\Controller\ProfessionApiController::class,
|
|
||||||
'name' => 'profession',
|
|
||||||
'base_path' => '/api/1.0/thirdparty/professions',
|
|
||||||
'base_role' => 'ROLE_USER',
|
|
||||||
'actions' => [
|
|
||||||
'_index' => [
|
|
||||||
'methods' => [
|
|
||||||
Request::METHOD_GET => true,
|
|
||||||
Request::METHOD_HEAD => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -250,14 +250,11 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* [fr] Qualité.
|
* [fr] Qualité.
|
||||||
*
|
* @ORM\Column(name="profession", type="text", nullable=false)
|
||||||
* @var ThirdPartyProfession
|
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
|
|
||||||
* ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
|
|
||||||
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
||||||
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
||||||
*/
|
*/
|
||||||
private ?ThirdPartyProfession $profession = null;
|
private string $profession = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(name="telephone", type="phone_number", nullable=true)
|
* @ORM\Column(name="telephone", type="phone_number", nullable=true)
|
||||||
@ -491,9 +488,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ThirdPartyProfession
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getProfession(): ?ThirdPartyProfession
|
public function getProfession(): string
|
||||||
{
|
{
|
||||||
return $this->profession;
|
return $this->profession;
|
||||||
}
|
}
|
||||||
@ -811,7 +808,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
/**
|
/**
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setProfession(?ThirdPartyProfession $profession): ThirdParty
|
public function setProfession(string $profession): self
|
||||||
{
|
{
|
||||||
$this->profession = $profession;
|
$this->profession = $profession;
|
||||||
|
|
||||||
|
@ -20,14 +20,10 @@ use Chill\MainBundle\Form\Type\PickCivilityType;
|
|||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
|
|
||||||
use Chill\ThirdPartyBundle\Form\Type\PickThirdPartyTypeCategoryType;
|
use Chill\ThirdPartyBundle\Form\Type\PickThirdPartyTypeCategoryType;
|
||||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||||
use Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeManager;
|
use Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
@ -111,17 +107,8 @@ class ThirdPartyType extends AbstractType
|
|||||||
'placeholder' => 'thirdparty.choose civility',
|
'placeholder' => 'thirdparty.choose civility',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
])
|
])
|
||||||
->add('profession', EntityType::class, [
|
->add('profession', TextType::class, [
|
||||||
'label' => 'thirdparty.Profession',
|
'label' => 'thirdparty.Profession',
|
||||||
'class' => ThirdPartyProfession::class,
|
|
||||||
'choice_label' => function (ThirdPartyProfession $profession): string {
|
|
||||||
return $this->translatableStringHelper->localize($profession->getName());
|
|
||||||
},
|
|
||||||
'query_builder' => static function (EntityRepository $er): QueryBuilder {
|
|
||||||
return $er->createQueryBuilder('p')
|
|
||||||
->where('p.active = true');
|
|
||||||
},
|
|
||||||
'placeholder' => 'thirdparty.choose profession',
|
|
||||||
'required' => false,
|
'required' => false,
|
||||||
])
|
])
|
||||||
->add('contactDataAnonymous', CheckboxType::class, [
|
->add('contactDataAnonymous', CheckboxType::class, [
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<ul class="list-content fa-ul">
|
<ul class="list-content fa-ul">
|
||||||
<li v-if="getProfession.length > 0">
|
<li v-if="getProfession.length > 0">
|
||||||
<i class="fa fa-li fa-id-card"></i>
|
<i class="fa fa-li fa-id-card"></i>
|
||||||
<p><span v-for="p in getProfession" :key="p" class="list-item list-professions">{{ p[0].toUpperCase() + p.slice(1).toLowerCase() }}</span></p>
|
<p><span>{{ getProfession[0] }}</span></p>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="hasParent">
|
<li v-if="hasParent">
|
||||||
<i class="fa fa-li fa-hand-o-right"></i>
|
<i class="fa fa-li fa-hand-o-right"></i>
|
||||||
@ -136,13 +136,14 @@ export default {
|
|||||||
getProfession() {
|
getProfession() {
|
||||||
let profession = []
|
let profession = []
|
||||||
if (this.hasParent && this.thirdparty.profession) {
|
if (this.hasParent && this.thirdparty.profession) {
|
||||||
profession.push(this.thirdparty.profession.name.fr)
|
profession.push(this.thirdparty.profession)
|
||||||
return profession;
|
return profession;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.hasParent && this.thirdparty.category) {
|
if (!this.hasParent && this.thirdparty.category) {
|
||||||
profession = this.thirdparty.category.map((category) => category.text);
|
profession = this.thirdparty.category.map((category) => category.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return profession;
|
return profession;
|
||||||
}
|
}
|
||||||
/* TODO need backend normalizer to serve children without circular reference
|
/* TODO need backend normalizer to serve children without circular reference
|
||||||
|
@ -73,13 +73,13 @@
|
|||||||
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
|
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-3 input-section">
|
<div class="input-group mb-3 input-section">
|
||||||
<select class="form-select form-select-lg" id="profession"
|
<input class="form-control form-control-lg"
|
||||||
v-model="thirdparty.profession">
|
v-model="thirdparty.profession"
|
||||||
<option selected disabled :value="null">{{ $t('thirdparty.profession') }}</option>
|
v-bind:placeholder="$t('thirdparty.profession')"
|
||||||
<option v-for="profession in professions" :key="profession.id" :value="profession">{{ profession.name.fr }}</option>
|
v-bind:aria-label="$t('thirdparty.profession')"
|
||||||
</select>
|
aria-describedby="profession" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="child-info">
|
<div class="child-info">
|
||||||
<div class="input-section">
|
<div class="input-section">
|
||||||
@ -192,9 +192,8 @@ export default {
|
|||||||
name: '',
|
name: '',
|
||||||
telephone: '',
|
telephone: '',
|
||||||
civility: null,
|
civility: null,
|
||||||
profession: null,
|
profession: '',
|
||||||
},
|
},
|
||||||
professions: [],
|
|
||||||
civilities: [],
|
civilities: [],
|
||||||
addAddress: {
|
addAddress: {
|
||||||
options: {
|
options: {
|
||||||
@ -274,18 +273,6 @@ export default {
|
|||||||
this.$toast.open({message: error.body})
|
this.$toast.open({message: error.body})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadProfessions() {
|
|
||||||
const url = `/api/1.0/thirdparty/professions.json`;
|
|
||||||
return makeFetch('GET', url)
|
|
||||||
.then(response => {
|
|
||||||
this.$data.professions = response.results;
|
|
||||||
return Promise.resolve();
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error)
|
|
||||||
this.$toast.open({message: error.body})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
submitAddress(payload) {
|
submitAddress(payload) {
|
||||||
console.log('submitAddress', payload);
|
console.log('submitAddress', payload);
|
||||||
if (typeof payload.addressId !== 'undefined') { // <--
|
if (typeof payload.addressId !== 'undefined') { // <--
|
||||||
@ -311,7 +298,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let dependencies = [];
|
let dependencies = [];
|
||||||
dependencies.push(this.loadProfessions());
|
|
||||||
dependencies.push(this.loadCivilities());
|
dependencies.push(this.loadCivilities());
|
||||||
if (this.action !== 'create') {
|
if (this.action !== 'create') {
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
|
@ -112,14 +112,3 @@ paths:
|
|||||||
description: "OK"
|
description: "OK"
|
||||||
422:
|
422:
|
||||||
description: "Object with validation errors"
|
description: "Object with validation errors"
|
||||||
|
|
||||||
/1.0/thirdparty/professions.json:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- thirdparty
|
|
||||||
summary: Return all thirdparty professions
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "ok"
|
|
||||||
401:
|
|
||||||
description: "Unauthorized"
|
|
||||||
|
@ -7,7 +7,3 @@ services:
|
|||||||
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyCategory:
|
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyCategory:
|
||||||
tags:
|
tags:
|
||||||
- { 'name': doctrine.fixture.orm }
|
- { 'name': doctrine.fixture.orm }
|
||||||
|
|
||||||
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyProfession:
|
|
||||||
tags:
|
|
||||||
- { 'name': doctrine.fixture.orm }
|
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
<?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\Migrations\ThirdParty;
|
||||||
|
|
||||||
|
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
|
final class Version20230215175150 extends AbstractMigration implements ContainerAwareInterface
|
||||||
|
{
|
||||||
|
public ContainerInterface $container;
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
|
||||||
|
// $this->addSql('ALTER TABLE chill_3party.third_party ADD profession_id INT DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Change profession to a string field and transfer values';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function setContainer(?ContainerInterface $container = null)
|
||||||
|
{
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_3party.third_party ADD profession TEXT DEFAULT \'\' NOT NULL');
|
||||||
|
|
||||||
|
$em = $this->container->get('doctrine.orm.entity_manager');
|
||||||
|
$professions = $em->getRepository(ThirdPartyProfession::class)->findAll();
|
||||||
|
|
||||||
|
foreach ($professions as $p) {
|
||||||
|
$id = $p->getId();
|
||||||
|
$name = $p->getName()['fr'];
|
||||||
|
|
||||||
|
$this->addSql(
|
||||||
|
'UPDATE chill_3party.third_party SET profession = :profession
|
||||||
|
WHERE chill_3party.third_party.profession_id = :id;',
|
||||||
|
['profession' => $name, 'id' => $id],
|
||||||
|
['profession' => Types::STRING, 'id' => Types::INTEGER]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user