From 75b78d3c991630308269fdb4e8133c1fdbaa4164 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 28 Nov 2023 17:27:26 +0100 Subject: [PATCH 1/4] add paginator to budget admin pages --- .../ChillBudgetBundle/Controller/Admin/ChargeKindController.php | 2 +- .../Controller/Admin/ResourceKindController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php b/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php index 642b7cc61..a84d54e40 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php @@ -23,6 +23,6 @@ class ChargeKindController extends CRUDController /* @var QueryBuilder $query */ $query->addOrderBy('e.ordering', 'ASC'); - return $query; + return parent::orderQuery($action, $query, $request, $paginator); } } diff --git a/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php b/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php index 0762f8252..ffef467f9 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php @@ -23,6 +23,6 @@ class ResourceKindController extends CRUDController /* @var QueryBuilder $query */ $query->addOrderBy('e.ordering', 'ASC'); - return $query; + return parent::orderQuery($action, $query, $request, $paginator); } } From eef93b8a0d8c17a6525eeacc7c644d4e9b7c0186 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 29 Nov 2023 11:33:26 +0100 Subject: [PATCH 2/4] add changie --- .changes/unreleased/UX-20231129-113317.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/UX-20231129-113317.yaml diff --git a/.changes/unreleased/UX-20231129-113317.yaml b/.changes/unreleased/UX-20231129-113317.yaml new file mode 100644 index 000000000..95e798080 --- /dev/null +++ b/.changes/unreleased/UX-20231129-113317.yaml @@ -0,0 +1,5 @@ +kind: UX +body: Add a paginator to budget elements (resource and charge types) in the admin +time: 2023-11-29T11:33:17.144530042+01:00 +custom: + Issue: "100" From fffc4a9c33981893198930938f42659d7970299f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 29 Nov 2023 22:17:20 +0100 Subject: [PATCH 3/4] Fix error on listEvaluation - force default calcDate - Export / UserHelper: handle case when a single user is given, when we expect more than one user --- .changes/unreleased/Fixed-20231129-221501.yaml | 5 +++++ src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php | 5 +++++ .../ChillPersonBundle/Export/Export/ListEvaluation.php | 7 ++++--- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Fixed-20231129-221501.yaml diff --git a/.changes/unreleased/Fixed-20231129-221501.yaml b/.changes/unreleased/Fixed-20231129-221501.yaml new file mode 100644 index 000000000..f26209afe --- /dev/null +++ b/.changes/unreleased/Fixed-20231129-221501.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: Fix error in ListEvaluation when "handling agents" are alone +time: 2023-11-29T22:15:01.627103072+01:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index 46e19c2d1..39fb83c57 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -92,6 +92,11 @@ class UserHelper } $asStrings = []; + if (array_key_exists('uid', $decoded) || is_numeric($decoded)) { + // this is a single value. We have to wrap it into an array + $decoded = [$decoded]; + } + foreach ($decoded as $userId) { if (is_array($userId)) { $uid = $userId['uid']; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index 6b3eba107..a2bedcddd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -193,6 +193,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $centers = array_map(static fn ($el) => $el['center'], $acl); + $calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY); $qb = $this->entityManager->createQueryBuilder(); @@ -208,7 +209,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL') // get participants at the given date ->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)') - ->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date'])); + ->setParameter('calc_date', $this->rollingDateConverter->convert($calcDate)); if ($this->filterStatsByCenters) { $qb @@ -224,7 +225,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); - $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate)); return $qb; } @@ -278,7 +279,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface // referrers => at date XXXX $qb ->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. - 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calc_date AND (history.endDate IS NULL OR history.endDate > :calc_date)) AS referrers'); + 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calc_date AND (history.endDate IS NULL OR history.endDate > :calc_date)) AS acpw_referrers'); // persons $qb From f4d258882f16832868a6b35c36320c854110a7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 29 Nov 2023 22:23:42 +0100 Subject: [PATCH 4/4] Release 2.14.1 --- .changes/unreleased/Fixed-20231127-210138.yaml | 5 ----- .changes/unreleased/Fixed-20231129-221501.yaml | 5 ----- .changes/unreleased/UX-20231129-113317.yaml | 5 ----- .changes/v2.14.1.md | 5 +++++ 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 .changes/unreleased/Fixed-20231127-210138.yaml delete mode 100644 .changes/unreleased/Fixed-20231129-221501.yaml delete mode 100644 .changes/unreleased/UX-20231129-113317.yaml create mode 100644 .changes/v2.14.1.md diff --git a/.changes/unreleased/Fixed-20231127-210138.yaml b/.changes/unreleased/Fixed-20231127-210138.yaml deleted file mode 100644 index 84f629161..000000000 --- a/.changes/unreleased/Fixed-20231127-210138.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Fixed -body: 'Export: fix list person with custom fields' -time: 2023-11-27T21:01:38.260730706+01:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Fixed-20231129-221501.yaml b/.changes/unreleased/Fixed-20231129-221501.yaml deleted file mode 100644 index f26209afe..000000000 --- a/.changes/unreleased/Fixed-20231129-221501.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Fixed -body: Fix error in ListEvaluation when "handling agents" are alone -time: 2023-11-29T22:15:01.627103072+01:00 -custom: - Issue: "" diff --git a/.changes/unreleased/UX-20231129-113317.yaml b/.changes/unreleased/UX-20231129-113317.yaml deleted file mode 100644 index 95e798080..000000000 --- a/.changes/unreleased/UX-20231129-113317.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: UX -body: Add a paginator to budget elements (resource and charge types) in the admin -time: 2023-11-29T11:33:17.144530042+01:00 -custom: - Issue: "100" diff --git a/.changes/v2.14.1.md b/.changes/v2.14.1.md new file mode 100644 index 000000000..4400953fd --- /dev/null +++ b/.changes/v2.14.1.md @@ -0,0 +1,5 @@ +## v2.14.1 - 2023-11-29 +### Fixed +* Export: fix list person with custom fields +* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin +* Fix error in ListEvaluation when "handling agents" are alone