diff --git a/changelog.md b/changelog.md index f8a053a..cd48baf 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ | 2021-03-31 | 3 | Hotfix | [v1.0.2](#Hotfix-v1.0.2) | | 2021-04-06 | 4 | Release | [v1.0.3](#Release-v1.0.3) | | 2021-04-13 | 5 | Release | [v1.0.4](#Release-v1.0.4) | +| 2021-04-16 | 6 | Release | [v1.0.4](#Release-v1.0.5) | ## Changes ### Release v1.0.0 @@ -44,9 +45,13 @@ - Cache clear in update.bat - Cache clear in README -### Next +### Release v1.0.5 #### Feature - Add licencing +#### Improve +- Add unassigned filter to activities + #### Fix -- Doctrine deprecation \ No newline at end of file +- Doctrine deprecation +- Activity filter does not shows unassigned activities \ No newline at end of file diff --git a/composer.lock b/composer.lock index 935b7d0..8c169a3 100644 --- a/composer.lock +++ b/composer.lock @@ -1508,16 +1508,16 @@ }, { "name": "laminas/laminas-code", - "version": "4.1.0", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-code.git", - "reference": "5b553c274b94af3f880cbaaf8fbab047f279a31c" + "reference": "e7e8f8a9c267520051d8026ff1da74823a3d8b97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-code/zipball/5b553c274b94af3f880cbaaf8fbab047f279a31c", - "reference": "5b553c274b94af3f880cbaaf8fbab047f279a31c", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/e7e8f8a9c267520051d8026ff1da74823a3d8b97", + "reference": "e7e8f8a9c267520051d8026ff1da74823a3d8b97", "shasum": "" }, "require": { @@ -1575,7 +1575,7 @@ "type": "community_bridge" } ], - "time": "2021-03-27T13:55:31+00:00" + "time": "2021-04-14T22:05:06+00:00" }, { "name": "laminas/laminas-eventmanager", diff --git a/src/Form/Activity/ActivityFilterForm.php b/src/Form/Activity/ActivityFilterForm.php index 17d7efe..ebf6f46 100644 --- a/src/Form/Activity/ActivityFilterForm.php +++ b/src/Form/Activity/ActivityFilterForm.php @@ -31,6 +31,7 @@ $this->actors = $data['actors']; $formBuilder->setData([ 'actor' => null, + 'unassigned' => false, 'followed' => false, 'status' => null, @@ -53,17 +54,25 @@ { $data = $this->getData(); + // Create query + $query = $activityRepository->createQueryBuilder('activity'); + // Create filter $criteria = new Criteria(); // Filter actors + if ($data['followed']) { + $query->join(ActorEntity::class, 'actor', Join::WITH, 'activity.actor = actor'); + $criteria->andWhere($criteria->expr() + ->eq('actor.followed', true)); + } if (!is_null($data['actor'])) { $criteria->andWhere($criteria->expr() ->eq('activity.actor', $data['actor'])); } - if ($data['followed']) { + if ($data['unassigned']) { $criteria->andWhere($criteria->expr() - ->eq('actor.followed', true)); + ->isNull('activity.actor')); } // Filter status @@ -90,13 +99,10 @@ if (!is_null($data['startBefore'])) { $criteria->andWhere($criteria->expr() ->orX($criteria->expr() - ->isNull('activity.realStartDate'), $criteria->expr() - ->lt('activity.realStartDate', $data['startBefore']))); + ->isNull('activity.realStartDate'), $criteria->expr() + ->lt('activity.realStartDate', $data['startBefore']))); } - // Create query - $query = $activityRepository->createQueryBuilder('activity'); - $query->join(ActorEntity::class, 'actor', Join::WITH, 'activity.actor = actor'); $query->addCriteria($criteria); return $query->getQuery()->execute([], Query::HYDRATE_OBJECT); @@ -132,6 +138,9 @@ 'choice_label' => 'displayName', 'required' => false, ]) + ->add('unassigned', CheckboxType::class, [ + 'required' => false, + ]) ->add('followed', CheckboxType::class, [ 'required' => false, ]); diff --git a/templates/_includes/html/form/activity/filter.html.twig b/templates/_includes/html/form/activity/filter.html.twig index 37e9dc9..f3d3e1f 100644 --- a/templates/_includes/html/form/activity/filter.html.twig +++ b/templates/_includes/html/form/activity/filter.html.twig @@ -6,8 +6,12 @@ {{ form_widget(form.actor, {attr: {class: 'w-100'}}) }}
+ {{ form_widget(form.unassigned) }} + {{ form_label(form.unassigned, 'Non assigné') }} +
+
{{ form_widget(form.followed) }} - {{ form_label(form.followed, 'Acteurs suivis') }} + {{ form_label(form.followed, 'Acteur suivi') }}
@@ -17,7 +21,7 @@
{{ form_widget(form.active) }} - {{ form_label(form.active, 'Actifs') }} + {{ form_label(form.active, 'Actif') }}
{{ form_widget(form.notClosed) }}