mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
Merge remote-tracking branch 'origin/master' into issue543_double_click_household
This commit is contained in:
commit
f98b35f009
20
CHANGELOG.md
20
CHANGELOG.md
@ -12,12 +12,30 @@ and this project adheres to
|
||||
|
||||
<!-- write down unreleased development here -->
|
||||
* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
|
||||
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
|
||||
* [docgen] add a new context with a list of activities in course
|
||||
* [docgen] add a comment in budget lines
|
||||
|
||||
|
||||
## Test releases
|
||||
|
||||
### 2021-04-07
|
||||
|
||||
* notification list: move action buttons outside of the toggle
|
||||
* fix detecting of non-read notification
|
||||
* filter users which are disabled in search user api
|
||||
* order query for location and add pagination in list
|
||||
* allow every person which has part for a workflow to see the workflow page
|
||||
* able to see the workflow if the evaluation document has been deleted
|
||||
* hardcode the list of supported mime types for edition with collabora
|
||||
* list of accompanying course: allow to see the pinned comment in list_item
|
||||
|
||||
### 2021-04-06
|
||||
|
||||
* [main] notification toggle read: correct js syntax for compilation in production (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/548)
|
||||
* [parcours] Display of interlocuteurs changed to flex-table in parcours edit page to prevent cut-off of information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/535)
|
||||
* [activity] espace entre les boutons pour supprimer les documents
|
||||
|
||||
## Test releases
|
||||
|
||||
### continuous release in February and March
|
||||
|
||||
|
@ -12,13 +12,20 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Repository;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\LocationType;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
@ -72,6 +79,86 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy);
|
||||
}
|
||||
|
||||
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
a.id AS activity_id,
|
||||
date,
|
||||
CASE WHEN durationtime IS NOT NULL THEN (EXTRACT(EPOCH from durationtime) / 60)::int ELSE 0 END AS durationtimeminute,
|
||||
attendee_id,
|
||||
comment_comment,
|
||||
emergency,
|
||||
sentreceived,
|
||||
CASE WHEN traveltime IS NOT NULL THEN (EXTRACT(EPOCH from traveltime) / 60)::int ELSE 0 END AS traveltimeminute,
|
||||
t.id AS type_id, t.name as type_name,
|
||||
p.id AS presence_id, p.name AS presence_name,
|
||||
location.id AS location_id, location.address_id, location.name AS location_name, location.phonenumber1, location.phonenumber2, location.email,
|
||||
location.locationtype_id, locationtype.title AS locationtype_title,
|
||||
users.userids AS userids,
|
||||
thirdparties.thirdpartyids,
|
||||
persons.personids,
|
||||
actions.socialactionids,
|
||||
issues.socialissueids
|
||||
|
||||
FROM activity a
|
||||
LEFT JOIN chill_main_location location ON a.location_id = location.id
|
||||
LEFT JOIN chill_main_location_type locationtype ON location.locationtype_id = locationtype.id
|
||||
LEFT JOIN activitytpresence p ON a.attendee_id = p.id
|
||||
LEFT JOIN activitytype t ON a.type_id = t.id
|
||||
LEFT JOIN LATERAL (SELECT jsonb_agg(user_id) userids, activity_id FROM activity_user AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS users ON TRUE
|
||||
LEFT JOIN LATERAL (SELECT jsonb_agg(thirdparty_id) thirdpartyids, activity_id FROM activity_thirdparty AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS thirdparties ON TRUE
|
||||
LEFT JOIN LATERAL (SELECT jsonb_agg(person_id) personids, activity_id FROM activity_person AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS persons ON TRUE
|
||||
LEFT JOIN LATERAL (SELECT jsonb_agg(socialaction_id) socialactionids, activity_id FROM chill_activity_activity_chill_person_socialaction AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS actions ON TRUE
|
||||
LEFT JOIN LATERAL (SELECT jsonb_agg(socialissue_id) socialissueids, activity_id FROM chill_activity_activity_chill_person_socialissue AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS issues ON TRUE
|
||||
|
||||
WHERE accompanyingperiod_id = ?
|
||||
ORDER BY a.date DESC, a.id DESC
|
||||
LIMIT ?
|
||||
';
|
||||
|
||||
$rsm
|
||||
->addEntityResult(Activity::class, 'a')
|
||||
->addFieldResult('a', 'activity_id', 'id')
|
||||
->addFieldResult('a', 'date', 'date')
|
||||
->addFieldResult('a', 'comment', 'comment')
|
||||
->addFieldResult('a', 'sentreceived', 'sentReceived')
|
||||
->addFieldResult('a', 'emergency', 'emergency')
|
||||
->addJoinedEntityResult(Location::class, 'location', 'a', 'location')
|
||||
->addFieldResult('location', 'location_id', 'id')
|
||||
->addFieldResult('location', 'location_name', 'name')
|
||||
->addFieldResult('location', 'phonenumber1', 'phonenumber1')
|
||||
->addFieldResult('location', 'phonenumber2', 'phonenumber2')
|
||||
->addFieldResult('location', 'email', 'email')
|
||||
->addJoinedEntityResult(LocationType::class, 'locationType', 'location', 'locationType')
|
||||
->addFieldResult('locationType', 'locationtype_id', 'id')
|
||||
->addFieldResult('locationType', 'locationtype_title', 'title')
|
||||
->addJoinedEntityResult(ActivityType::class, 'activityType', 'a', 'activityType')
|
||||
->addFieldResult('activityType', 'type_id', 'id')
|
||||
->addFieldResult('activityType', 'type_name', 'name')
|
||||
->addJoinedEntityResult(ActivityPresence::class, 'activityPresence', 'a', 'attendee')
|
||||
->addFieldResult('activityPresence', 'presence_id', 'id')
|
||||
->addFieldResult('activityPresence', 'presence_name', 'name')
|
||||
|
||||
// results which cannot be mapped into entity
|
||||
->addScalarResult('comment_comment', 'comment', Types::TEXT)
|
||||
->addScalarResult('userids', 'userIds', Types::JSON)
|
||||
->addScalarResult('thirdpartyids', 'thirdPartyIds', Types::JSON)
|
||||
->addScalarResult('personids', 'personIds', Types::JSON)
|
||||
->addScalarResult('socialactionids', 'socialActionIds', Types::JSON)
|
||||
->addScalarResult('socialissueids', 'socialIssueIds', Types::JSON)
|
||||
->addScalarResult('durationtimeminute', 'durationTimeMinute', Types::INTEGER)
|
||||
->addScalarResult('traveltimeminute', 'travelTimeMinute', Types::INTEGER);
|
||||
|
||||
$nq = $this->em->createNativeQuery($sql, $rsm);
|
||||
|
||||
$nq->setParameter(0, $period->getId())->setParameter(1, $limit);
|
||||
|
||||
return $nq->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $orderBy
|
||||
*
|
||||
|
@ -21,6 +21,15 @@ interface ActivityACLAwareRepositoryInterface
|
||||
*/
|
||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
|
||||
|
||||
/**
|
||||
* Return a list of activities, simplified as array (not object).
|
||||
*
|
||||
* The aim of this method is to get a long list of activities and keep performance.
|
||||
*
|
||||
* @return array an array of array, each item representing an activity
|
||||
*/
|
||||
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array;
|
||||
|
||||
/**
|
||||
* @return Activity[]|array
|
||||
*/
|
||||
|
@ -0,0 +1,286 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Service\DocGenerator;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
|
||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
|
||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Chill\PersonBundle\Service\DocGenerator\AccompanyingPeriodContext;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use DateTime;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class ListActivitiesByAccompanyingPeriodContext implements
|
||||
DocGeneratorContextWithAdminFormInterface,
|
||||
DocGeneratorContextWithPublicFormInterface
|
||||
{
|
||||
private AccompanyingPeriodContext $accompanyingPeriodContext;
|
||||
|
||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
||||
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private SocialActionRepository $socialActionRepository;
|
||||
|
||||
private SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodContext $accompanyingPeriodContext,
|
||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||
NormalizerInterface $normalizer,
|
||||
PersonRepository $personRepository,
|
||||
SocialActionRepository $socialActionRepository,
|
||||
SocialIssueRepository $socialIssueRepository,
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
UserRepository $userRepository
|
||||
) {
|
||||
$this->accompanyingPeriodContext = $accompanyingPeriodContext;
|
||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||
$this->normalizer = $normalizer;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->socialActionRepository = $socialActionRepository;
|
||||
$this->socialIssueRepository = $socialIssueRepository;
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function adminFormReverseTransform(array $data): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->adminFormReverseTransform($data);
|
||||
}
|
||||
|
||||
public function adminFormTransform(array $data): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->adminFormTransform($data);
|
||||
}
|
||||
|
||||
public function buildAdminForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->buildAdminForm($builder);
|
||||
}
|
||||
|
||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->buildPublicForm($builder, $template, $entity);
|
||||
}
|
||||
|
||||
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
|
||||
{
|
||||
$data = $this->accompanyingPeriodContext->getData($template, $entity, $contextGenerationData);
|
||||
|
||||
$data['activities'] = $this->getActivitiesSimplified($entity);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'docgen.Accompanying period with a list of activities description';
|
||||
}
|
||||
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return AccompanyingPeriod::class;
|
||||
}
|
||||
|
||||
public function getFormData(DocGeneratorTemplate $template, $entity): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->getFormData($template, $entity);
|
||||
}
|
||||
|
||||
public static function getKey(): string
|
||||
{
|
||||
return self::class;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return 'docgen.Accompanying period with a list of activities';
|
||||
}
|
||||
|
||||
public function hasAdminForm(): bool
|
||||
{
|
||||
return $this->accompanyingPeriodContext->hasAdminForm();
|
||||
}
|
||||
|
||||
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
||||
{
|
||||
return $this->accompanyingPeriodContext->hasPublicForm($template, $entity);
|
||||
}
|
||||
|
||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->storeGenerated($template, $storedObject, $entity, $contextGenerationData);
|
||||
}
|
||||
|
||||
private function getActivitiesSimplified(AccompanyingPeriod $period)
|
||||
{
|
||||
$activities =
|
||||
$this->activityACLAwareRepository->findByAccompanyingPeriodSimplified($period);
|
||||
$results = [];
|
||||
|
||||
foreach ($activities as $row) {
|
||||
$activity = $row[0];
|
||||
|
||||
$activity['date'] = $this->normalizer->normalize($activity['date'], 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => DateTime::class,
|
||||
]);
|
||||
|
||||
if (null === $activity['location']) {
|
||||
$activity['location'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => Location::class,
|
||||
]);
|
||||
$activity['location']['type'] = 'location';
|
||||
} else {
|
||||
$activity['location']['isNull'] = false;
|
||||
$activity['location']['type'] = 'location';
|
||||
|
||||
foreach (['1', '2'] as $key) {
|
||||
$activity['location']['phonenumber' . $key] = $this->normalizer->normalize(
|
||||
$activity['location']['phonenumber' . $key],
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => PhoneNumber::class]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($activity['location']['locationType']['id'])) {
|
||||
$activity['location']['locationType']['title'] = $this->translatableStringHelper->localize(
|
||||
$activity['location']['locationType']['title']
|
||||
);
|
||||
$activity['location']['locationType']['isNull'] = false;
|
||||
$activity['location']['locationType']['type'] = 'locationType';
|
||||
}
|
||||
|
||||
if (null !== $activity['activityType']) {
|
||||
$activity['activityType']['name'] = $this->translatableStringHelper->localize(
|
||||
$activity['activityType']['name']
|
||||
);
|
||||
$activity['activityType']['isNull'] = false;
|
||||
$activity['activityType']['type'] = 'activityType';
|
||||
} else {
|
||||
$activity['activityType'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityType::class,
|
||||
]);
|
||||
}
|
||||
|
||||
if (null !== $activity['attendee']) {
|
||||
$activity['attendee']['name'] = $this->translatableStringHelper->localize(
|
||||
$activity['attendee']['name']
|
||||
);
|
||||
$activity['attendee']['isNull'] = false;
|
||||
$activity['attendee']['type'] = 'activityPresence';
|
||||
} else {
|
||||
$activity['attendee'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityPresence::class,
|
||||
]);
|
||||
}
|
||||
|
||||
$activity['comment'] = (string) $row['comment'];
|
||||
$activity['travelTimeMinute'] = $row['travelTimeMinute'];
|
||||
$activity['durationTimeMinute'] = $row['durationTimeMinute'];
|
||||
|
||||
if (null !== $row['userIds']) {
|
||||
foreach ($row['userIds'] as $id) {
|
||||
$activity['users'][] = $this->normalizer->normalize(
|
||||
$this->userRepository->find($id),
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => User::class]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$activity['users'] = [];
|
||||
}
|
||||
|
||||
if (null !== $row['personIds']) {
|
||||
foreach ($row['personIds'] as $id) {
|
||||
$activity['persons'][] = $this->normalizer->normalize(
|
||||
$this->personRepository->find($id),
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => Person::class]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$activity['persons'] = [];
|
||||
}
|
||||
|
||||
if (null !== $row['thirdPartyIds']) {
|
||||
foreach ($row['thirdPartyIds'] as $id) {
|
||||
$activity['thirdParties'][] = $this->normalizer->normalize(
|
||||
$this->thirdPartyRepository->find($id),
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ThirdParty::class]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$activity['thirdParties'] = [];
|
||||
}
|
||||
|
||||
if (null !== $row['socialActionIds']) {
|
||||
foreach ($row['socialActionIds'] as $id) {
|
||||
$activity['socialActions'][] = $this->normalizer->normalize(
|
||||
$this->socialActionRepository->find($id),
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => SocialAction::class]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$activity['socialActions'] = [];
|
||||
}
|
||||
|
||||
if (null !== $row['socialIssueIds']) {
|
||||
foreach ($row['socialIssueIds'] as $id) {
|
||||
$activity['socialIssues'][] = $this->normalizer->normalize(
|
||||
$this->socialIssueRepository->find($id),
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => SocialIssue::class]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$activity['socialIssues'] = [];
|
||||
}
|
||||
|
||||
$results[] = $activity;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
@ -232,3 +232,5 @@ This is the minimal activity data: Activité n°
|
||||
docgen:
|
||||
Activity basic: Echange
|
||||
A basic context for activity: Contexte pour les échanges
|
||||
Accompanying period with a list of activities: Parcours d'accompagnement avec liste des échanges
|
||||
Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les échanges pour un parcours. Les échanges ne sont pas filtrés.
|
||||
|
@ -25,13 +25,13 @@ use function count;
|
||||
*/
|
||||
class SummaryBudget implements SummaryBudgetInterface
|
||||
{
|
||||
private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, type FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private const QUERY_CHARGE_BY_PERSON = 'select SUM(amount) AS sum, type FROM chill_budget.charge WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_CHARGE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.charge WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private const QUERY_RESOURCE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, type FROM chill_budget.resource WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_RESOURCE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.resource WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, type FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, type FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY type';
|
||||
|
||||
private array $chargeLabels;
|
||||
|
||||
@ -110,7 +110,8 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$rsm = new ResultSetMapping();
|
||||
$rsm
|
||||
->addScalarResult('sum', 'sum')
|
||||
->addScalarResult('type', 'type');
|
||||
->addScalarResult('type', 'type')
|
||||
->addScalarResult('comment', 'comment');
|
||||
|
||||
return $rsm;
|
||||
}
|
||||
@ -121,7 +122,7 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$labels = $this->chargeLabels;
|
||||
|
||||
return array_combine($keys, array_map(function ($i) use ($labels) {
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i])];
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i]), 'comment' => ''];
|
||||
}, $keys));
|
||||
}
|
||||
|
||||
@ -131,7 +132,7 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$labels = $this->resourcesLabels;
|
||||
|
||||
return array_combine($keys, array_map(function ($i) use ($labels) {
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i])];
|
||||
return ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($labels[$i]), 'comment' => ''];
|
||||
}, $keys));
|
||||
}
|
||||
|
||||
@ -158,6 +159,7 @@ class SummaryBudget implements SummaryBudgetInterface
|
||||
$result[$row['type']] = [
|
||||
'sum' => (float) $row['sum'],
|
||||
'label' => $this->translatableStringHelper->localize($label[$row['type']]),
|
||||
'comment' => (string) $row['comment'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,102 @@ use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\RuntimeExtensionInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function in_array;
|
||||
|
||||
final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
{
|
||||
public const SUPPORTED_MIMES = [
|
||||
'image/svg+xml',
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.sun.xml.writer',
|
||||
'application/vnd.oasis.opendocument.text',
|
||||
'application/vnd.oasis.opendocument.text-flat-xml',
|
||||
'application/vnd.sun.xml.calc',
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'application/vnd.oasis.opendocument.spreadsheet-flat-xml',
|
||||
'application/vnd.sun.xml.impress',
|
||||
'application/vnd.oasis.opendocument.presentation',
|
||||
'application/vnd.oasis.opendocument.presentation-flat-xml',
|
||||
'application/vnd.sun.xml.draw',
|
||||
'application/vnd.oasis.opendocument.graphics',
|
||||
'application/vnd.oasis.opendocument.graphics-flat-xml',
|
||||
'application/vnd.oasis.opendocument.chart',
|
||||
'application/vnd.sun.xml.writer.global',
|
||||
'application/vnd.oasis.opendocument.text-master',
|
||||
'application/vnd.sun.xml.writer.template',
|
||||
'application/vnd.oasis.opendocument.text-template',
|
||||
'application/vnd.oasis.opendocument.text-master-template',
|
||||
'application/vnd.sun.xml.calc.template',
|
||||
'application/vnd.oasis.opendocument.spreadsheet-template',
|
||||
'application/vnd.sun.xml.impress.template',
|
||||
'application/vnd.oasis.opendocument.presentation-template',
|
||||
'application/vnd.sun.xml.draw.template',
|
||||
'application/vnd.oasis.opendocument.graphics-template',
|
||||
'application/msword',
|
||||
'application/msword',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.ms-word.document.macroEnabled.12',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
'application/vnd.ms-word.template.macroEnabled.12',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
||||
'application/vnd.ms-excel.template.macroEnabled.12',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
||||
'application/vnd.ms-excel.sheet.macroEnabled.12',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.template',
|
||||
'application/vnd.ms-powerpoint.template.macroEnabled.12',
|
||||
'application/vnd.wordperfect',
|
||||
'application/x-aportisdoc',
|
||||
'application/x-hwp',
|
||||
'application/vnd.ms-works',
|
||||
'application/x-mswrite',
|
||||
'application/x-dif-document',
|
||||
'text/spreadsheet',
|
||||
'text/csv',
|
||||
'application/x-dbase',
|
||||
'application/vnd.lotus-1-2-3',
|
||||
'image/cgm',
|
||||
'image/vnd.dxf',
|
||||
'image/x-emf',
|
||||
'image/x-wmf',
|
||||
'application/coreldraw',
|
||||
'application/vnd.visio2013',
|
||||
'application/vnd.visio',
|
||||
'application/vnd.ms-visio.drawing',
|
||||
'application/x-mspublisher',
|
||||
'application/x-sony-bbeb',
|
||||
'application/x-gnumeric',
|
||||
'application/macwriteii',
|
||||
'application/x-iwork-numbers-sffnumbers',
|
||||
'application/vnd.oasis.opendocument.text-web',
|
||||
'application/x-pagemaker',
|
||||
'text/rtf',
|
||||
'text/plain',
|
||||
'application/x-fictionbook+xml',
|
||||
'application/clarisworks',
|
||||
'image/x-wpg',
|
||||
'application/x-iwork-pages-sffpages',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
||||
'application/x-iwork-keynote-sffkey',
|
||||
|
||||
'application/x-abiword',
|
||||
'image/x-freehand',
|
||||
'application/vnd.sun.xml.chart',
|
||||
'application/x-t602',
|
||||
'image/bmp',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/tiff',
|
||||
'image/jpg',
|
||||
'image/jpeg',
|
||||
'application/pdf',
|
||||
];
|
||||
|
||||
private const TEMPLATE = '@ChillDocStore/Button/wopi_edit_document.html.twig';
|
||||
|
||||
private DiscoveryInterface $discovery;
|
||||
@ -31,15 +123,7 @@ final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
|
||||
public function isEditable(StoredObject $document): bool
|
||||
{
|
||||
$mime_type = $this->discovery->discoverMimeType($document->getType());
|
||||
|
||||
foreach ($mime_type as $item) {
|
||||
if (array_key_exists('default', $item) && 'true' === $item['default']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return in_array($document->getType(), self::SUPPORTED_MIMES, true);
|
||||
}
|
||||
|
||||
public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class LocationController extends CRUDController
|
||||
@ -29,4 +30,9 @@ class LocationController extends CRUDController
|
||||
{
|
||||
$query->where('e.availableForUsers = true'); //TODO not working
|
||||
}
|
||||
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
return $query->addOrderBy('e.name', 'DESC');
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class SearchController extends AbstractController
|
||||
|
||||
public function searchAction(Request $request, $_format)
|
||||
{
|
||||
$pattern = $request->query->get('q', '');
|
||||
$pattern = trim($request->query->get('q', ''));
|
||||
|
||||
if ('' === $pattern) {
|
||||
switch ($_format) {
|
||||
|
@ -26,7 +26,7 @@ window.addEventListener('DOMContentLoaded', function (e) {
|
||||
buttonClass: el.dataset.buttonClass,
|
||||
buttonNoText: 'false' === el.dataset.buttonText,
|
||||
showUrl: el.dataset.showButtonUrl,
|
||||
isRead: 1 === el.dataset.notificationCurrentIsRead,
|
||||
isRead: 1 === Number.parseInt(el.dataset.notificationCurrentIsRead),
|
||||
container: el.dataset.container
|
||||
}
|
||||
},
|
||||
|
@ -47,6 +47,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ chill_pagination(paginator) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_crud_main_location_new') }}" class="btn btn-create">
|
||||
|
@ -61,13 +61,24 @@
|
||||
<div class="item-row">
|
||||
<div class="notification-content">
|
||||
{% if c.full_content is defined and c.full_content == true %}
|
||||
{% if c.notification.message is not empty %}
|
||||
{{ c.notification.message|chill_markdown_to_html }}
|
||||
{% else %}
|
||||
<p class="chill-no-data-statement">{{ 'Any comment'|trans }}</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if c.notification.message is not empty %}
|
||||
{{ c.notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }}
|
||||
<p class="read-more"><a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': c.notification.id}) }}">{{ 'Read more'|trans }}</a></p>
|
||||
{% else %}
|
||||
<p class="chill-no-data-statement">{{ 'Any comment'|trans }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro actions(c) %}
|
||||
{% if c.action_button is not defined or c.action_button != false %}
|
||||
<div class="item-row separator">
|
||||
<div class="item-col item-meta">
|
||||
@ -134,12 +145,13 @@
|
||||
data-bs-parent="#notification-fold">
|
||||
|
||||
{{ _self.content(_context) }}
|
||||
|
||||
</div>
|
||||
{{ _self.actions(_context) }}
|
||||
{% else %}
|
||||
{{ _self.title(_context) }}
|
||||
{{ _self.header(_context) }}
|
||||
{{ _self.content(_context) }}
|
||||
{{ _self.actions(_context) }}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
@ -49,11 +49,12 @@ class SearchUserApiProvider implements SearchApiInterface
|
||||
SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical))', [$pattern, $pattern])
|
||||
->setFromClause('users AS u')
|
||||
->setWhereClauses('
|
||||
u.enabled IS TRUE and (
|
||||
SIMILARITY(LOWER(UNACCENT(?)), u.usernamecanonical) > 0.15
|
||||
OR u.usernamecanonical LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\'
|
||||
OR SIMILARITY(LOWER(UNACCENT(?)), LOWER(UNACCENT(u.label))) > 0.15
|
||||
OR u.label LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\'
|
||||
', [$pattern, $pattern, $pattern, $pattern]);
|
||||
)', [$pattern, $pattern, $pattern, $pattern]);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
@ -59,7 +59,23 @@ class EntityWorkflowVoter extends Voter
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->security->isGranted($entityAttribute, $handler->getRelatedEntity($subject));
|
||||
$relatedEntity = $handler->getRelatedEntity($subject);
|
||||
|
||||
if (null === $relatedEntity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->security->isGranted($entityAttribute, $relatedEntity)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($subject->getSteps() as $step) {
|
||||
if ($step->getAllDestUser()->contains($token->getUser())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case self::DELETE:
|
||||
return $subject->getStep() === 'initial';
|
||||
|
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Serializer\Normalizer;
|
||||
|
||||
use Chill\MainBundle\Serializer\Normalizer\PhonenumberNormalizer;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PhonenumberNormalizerTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
public function dataProviderNormalizePhonenumber()
|
||||
{
|
||||
$phonenumberUtil = PhoneNumberUtil::getInstance();
|
||||
|
||||
yield [$phonenumberUtil->parse('+32486123465'), 'docgen', ['docgen:expects' => PhoneNumber::class], '0486 12 34 65'];
|
||||
|
||||
yield [null, 'docgen', ['docgen:expects' => PhoneNumber::class], ''];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProviderNormalizePhonenumber
|
||||
*
|
||||
* @param mixed $format
|
||||
* @param mixed $context
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function testNormalize(?Phonenumber $phonenumber, $format, $context, $expected)
|
||||
{
|
||||
$parameterBag = $this->prophesize(ParameterBagInterface::class);
|
||||
$parameterBag->get(Argument::exact('chill_main'))->willReturn(['phone_helper' => ['default_carrier_code' => 'BE']]);
|
||||
$normalizer = new PhonenumberNormalizer($parameterBag->reveal());
|
||||
|
||||
$this->assertEquals($expected, $normalizer->normalize($phonenumber, $format, $context));
|
||||
}
|
||||
}
|
@ -136,8 +136,11 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
|
||||
$andWhereSearchClause = [];
|
||||
$andWhereSearchClauseArgs = [];
|
||||
|
||||
if ('' !== $default) {
|
||||
if ('' !== trim($default)) {
|
||||
foreach (explode(' ', $default) as $str) {
|
||||
if ('' === trim($str)) {
|
||||
continue;
|
||||
}
|
||||
$pertinence[] =
|
||||
'STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), person.fullnamecanonical) + ' .
|
||||
"(person.fullnamecanonical LIKE '%' || LOWER(UNACCENT(?)) || '%')::int + " .
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
{{ chill_pagination(paginator) }}
|
||||
|
||||
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE') %}
|
||||
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE', accompanyingCourse) %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
|
||||
|
@ -116,14 +116,40 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_pinned_comment|default(false) and period.pinnedComment is not empty%}
|
||||
<div class="item-row separator comment">
|
||||
<div style="width: 100%">
|
||||
<h4 class="item-key visually-hidden">{{ 'Pinned comment'|trans }}</h4>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ period.pinnedComment.content|u.truncate(750, '…', false)|chill_markdown_to_html }}
|
||||
{% if period.pinnedComment.content|length > 750 %}
|
||||
<a href="{{ chill_path_add_return_path('chill_person_accompanying_period_comment_list', {'accompanying_period_id': period.id}) }}">{{ 'Read more'|trans }}</a>
|
||||
{% endif %}
|
||||
<div class="metadata">
|
||||
{{ 'Last updated by'| trans }}
|
||||
<span class="user">
|
||||
{{ period.pinnedComment.updatedBy|chill_entity_render_box }}
|
||||
</span>
|
||||
{{ 'on'|trans ~ ' ' }}
|
||||
<span class="date">
|
||||
{{ period.pinnedComment.updatedAt|format_datetime("medium", "short") }}
|
||||
</span>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="item-row separator">
|
||||
{% if itemMeta is not defined %}
|
||||
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %}
|
||||
{% if notif_counter.total > 0 %}
|
||||
<div class="item-col item-meta">
|
||||
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if itemMeta is defined %}
|
||||
{% else %}
|
||||
{{ itemMeta }}
|
||||
{% endif %}
|
||||
<div class="item-col">
|
||||
|
@ -1,6 +1,11 @@
|
||||
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
|
||||
|
||||
<div class="flex-table accompanying_course_work-list">
|
||||
{% if doc is null %}
|
||||
<div class="alert alert-warning">
|
||||
{{ 'workflow.doc for evaluation deleted'|trans }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="flex-table accompanying_course_work-list">
|
||||
<div class="item-bloc evaluation-item bg-chill-llight-gray">
|
||||
<div class="item-row mb-2">
|
||||
<h1>{{ doc.title }}</h1>
|
||||
@ -112,9 +117,9 @@
|
||||
{{ macro.updatedBy(evaluation) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if display_action is defined and display_action == true %}
|
||||
{% if display_action is defined and display_action == true %}
|
||||
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', evaluation.accompanyingPeriodWork) %}
|
||||
<ul class="record_actions">
|
||||
<li>{{ m.download_button(doc.storedObject, doc.title) }}</li>
|
||||
@ -130,4 +135,5 @@
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -23,6 +23,7 @@ use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
@ -71,6 +72,7 @@ class PersonDocGenNormalizer implements
|
||||
$dateContext = $context;
|
||||
$dateContext['docgen:expects'] = DateTimeInterface::class;
|
||||
$addressContext = array_merge($context, ['docgen:expects' => Address::class]);
|
||||
$phonenumberContext = array_merge($context, ['docgen:expects' => PhoneNumber::class]);
|
||||
$personResourceContext = array_merge($context, [
|
||||
'docgen:expects' => Person\PersonResource::class,
|
||||
// we simplify the list of attributes for the embedded persons
|
||||
@ -113,9 +115,9 @@ class PersonDocGenNormalizer implements
|
||||
'maritalStatus' => null !== ($ms = $person->getMaritalStatus()) ? $this->translatableStringHelper->localize($ms->getName()) : '',
|
||||
'maritalStatusDate' => $this->normalizer->normalize($person->getMaritalStatusDate(), $format, $dateContext),
|
||||
'email' => $person->getEmail(),
|
||||
'firstPhoneNumber' => $this->normalizer->normalize($person->getPhonenumber() ?? $person->getMobilenumber(), $format, $context),
|
||||
'fixPhoneNumber' => $this->normalizer->normalize($person->getPhonenumber(), $format, $context),
|
||||
'mobilePhoneNumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $context),
|
||||
'firstPhoneNumber' => $this->normalizer->normalize($person->getPhonenumber() ?? $person->getMobilenumber(), $format, $phonenumberContext),
|
||||
'fixPhoneNumber' => $this->normalizer->normalize($person->getPhonenumber(), $format, $phonenumberContext),
|
||||
'mobilePhoneNumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $phonenumberContext),
|
||||
'nationality' => null !== ($c = $person->getNationality()) ? $this->translatableStringHelper->localize($c->getName()) : '',
|
||||
'placeOfBirth' => $person->getPlaceOfBirth(),
|
||||
'memo' => $person->getMemo(),
|
||||
|
@ -152,8 +152,25 @@ class AccompanyingPeriodContext implements
|
||||
$options = $template->getOptions();
|
||||
$persons = $entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
||||
return $p->getPerson();
|
||||
})
|
||||
->toArray();
|
||||
});
|
||||
|
||||
foreach ($entity->getCurrentParticipations() as $p) {
|
||||
foreach ($p->getPerson()->getResources() as $r) {
|
||||
if (null !== $r->getPerson() && !$persons->contains($r->getPerson())) {
|
||||
$persons->add($r->getPerson());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $entity->getRequestorPerson() && !$persons->contains($entity->getRequestorPerson())) {
|
||||
$persons->add($entity->getRequestorPerson());
|
||||
}
|
||||
|
||||
foreach ($entity->getResources() as $r) {
|
||||
if (null !== $r->getPerson() && !$persons->contains($r->getPerson())) {
|
||||
$persons->add($r->getPerson());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (['mainPerson', 'person1', 'person2'] as $key) {
|
||||
if ($options[$key] ?? false) {
|
||||
|
@ -48,6 +48,12 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
|
||||
{
|
||||
$doc = $this->getRelatedEntity($entityWorkflow);
|
||||
|
||||
if (null === $doc) {
|
||||
return [
|
||||
'persons' => [],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'persons' => $doc->getAccompanyingPeriodWorkEvaluation()
|
||||
->getAccompanyingPeriodWork()->getPersons(),
|
||||
@ -58,6 +64,10 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
|
||||
{
|
||||
$doc = $this->getRelatedEntity($entityWorkflow);
|
||||
|
||||
if (null === $doc) {
|
||||
return $this->translator->trans('workflow.doc for evaluation deleted');
|
||||
}
|
||||
|
||||
return $this->translator->trans(
|
||||
'workflow.Doc for evaluation (n°%eval%)',
|
||||
['%eval%' => $entityWorkflow->getRelatedEntityId()]
|
||||
@ -98,7 +108,7 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
|
||||
|
||||
return [
|
||||
'entity_workflow' => $entityWorkflow,
|
||||
'evaluation' => $doc->getAccompanyingPeriodWorkEvaluation(),
|
||||
'evaluation' => null !== $doc ? $doc->getAccompanyingPeriodWorkEvaluation() : $doc,
|
||||
'doc' => $doc,
|
||||
];
|
||||
}
|
||||
|
@ -581,6 +581,7 @@ My accompanying periods in draft: Mes parcours brouillons
|
||||
|
||||
workflow:
|
||||
Doc for evaluation (n°%eval%): Document de l'évaluation n°%eval%
|
||||
doc for evaluation deleted: Document supprimé dans une évaluation
|
||||
|
||||
period_by_user_list:
|
||||
Period by user: Parcours d'accompagnement par utilisateur
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a class="btn btn-cancel" href={% if task.person is not null %}"{{ chill_return_path_or('chill_task_singletask_list', { 'person_id': task.person.id } ) }}"{% else %}"{{ chill_return_path_or('chill_task_singletask_courselist', {'course_id': task.course.id}) }}" {% endif %}>
|
||||
<a class="btn btn-cancel" href={% if task.person is not null %}"{{ chill_return_path_or('chill_task_singletask_list', { 'person_id': task.person.id } ) }}"{% else %}"{{ chill_return_path_or('chill_task_singletask_by-course_list', {'id': task.course.id}) }}" {% endif %}>
|
||||
{{ 'Cancel'|trans }}</a>
|
||||
</li>
|
||||
<li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user