diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue
index 06e0b197c..004d1a752 100644
--- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue
+++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue
@@ -50,19 +50,26 @@
-
-
-
-
+
{{ $t('activity.select_first_a_social_issue') }}
+
+
+
+
+
+
+ {{ $t('activity.social_action_list_empty') }}
+
+
+
@@ -85,7 +92,8 @@ export default {
data() {
return {
issueIsLoading: false,
- actionIsLoading: false
+ actionIsLoading: false,
+ actionAreLoaded: false,
}
},
computed: {
@@ -109,6 +117,7 @@ export default {
/* Load others issues in multiselect
*/
this.issueIsLoading = true;
+ this.actionAreLoaded = false;
getSocialIssues().then(response => new Promise((resolve, reject) => {
this.$store.commit('updateIssuesOther', response.results);
@@ -141,6 +150,7 @@ export default {
this.$store.commit('filterList', 'actions');
this.issueIsLoading = false;
+ this.actionAreLoaded = true;
resolve();
}));
},
diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js
index 37b9b356e..fa7da3203 100644
--- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js
+++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js
@@ -9,6 +9,7 @@ const activityMessages = {
choose_other_social_issue: "Ajouter une autre problématique sociale...",
social_actions: "Actions d'accompagnement",
select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale",
+ social_action_list_empty: "Aucune action sociale disponible",
//
add_persons: "Ajouter des personnes concernées",
diff --git a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php
index b6a070037..b67ba8ac4 100644
--- a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php
+++ b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidityValidator.php
@@ -10,10 +10,12 @@
namespace Chill\ActivityBundle\Validator\Constraints;
use Chill\ActivityBundle\Entity\Activity;
+use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
+use function array_merge;
class ActivityValidityValidator extends ConstraintValidator
{
@@ -118,9 +120,19 @@ class ActivityValidityValidator extends ConstraintValidator
}
if ($activity->getActivityType()->getSocialActionsVisible() === 2 && $activity->getSocialActions()->count() === 0) {
- $this->context
- ->buildViolation($constraint->socialActionsMessage)
- ->addViolation();
+ // check if a social action may be added
+ $actions = [];
+
+ foreach ($activity->getSocialIssues() as $socialIssue) {
+ /** @var SocialIssue $socialIssue */
+ $actions = array_merge($actions, $socialIssue->getRecursiveSocialActions()->toArray());
+ }
+
+ if (0 < count($actions)) {
+ $this->context
+ ->buildViolation($constraint->socialActionsMessage)
+ ->addViolation();
+ }
}
}
}
diff --git a/src/Bundle/ChillMainBundle/Pagination/Paginator.php b/src/Bundle/ChillMainBundle/Pagination/Paginator.php
index 3599a9257..9105b1dde 100644
--- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php
+++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php
@@ -103,6 +103,10 @@ class Paginator implements PaginatorInterface
public function countPages()
{
+ if (0 === $this->itemPerPage) {
+ return 1;
+ }
+
$nb = floor($this->totalItems / $this->itemPerPage);
if ($this->totalItems % $this->itemPerPage > 0) {