From e19e5854d54c7a815dbd04763bbd5827c311e318 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Fri, 1 Feb 2013 11:03:20 +0100 Subject: [PATCH] Fix validation agreement check --- lib/Alchemy/Phrasea/Application/Lightbox.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application/Lightbox.php b/lib/Alchemy/Phrasea/Application/Lightbox.php index 996e98a550..b0eca1a335 100644 --- a/lib/Alchemy/Phrasea/Application/Lightbox.php +++ b/lib/Alchemy/Phrasea/Application/Lightbox.php @@ -508,13 +508,19 @@ return call_user_func( if ( ! $basket->getValidation()->getParticipant($user)->getCanAgree()) { throw new ControllerException('You have not right to agree'); } + + $agreed = false; /* @var $basket \Entities\Basket */ foreach ($basket->getElements() as $element) { - if (null === $element->getUserValidationDatas($user)->getAgreement()) { - throw new ControllerException(_('You have to give your feedback at least on one document to send a report')); + if (null !== $element->getUserValidationDatas($user)->getAgreement()) { + $agreed = true; } } + if (!$agreed) { + throw new ControllerException(_('You have to give your feedback at least on one document to send a report')); + } + /* @var $basket \Entities\Basket */ $participant = $basket->getValidation()->getParticipant($user);