Fix validation agreement check

This commit is contained in:
Romain Neutron
2013-02-01 11:03:20 +01:00
parent 08f036a25d
commit e19e5854d5

View File

@@ -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);