Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ msgstr "DefaultVerificationValidity"
msgid "error.ApprovalCollectors.comment"
msgstr "Comment is required"

msgid "error.attr.invalid"
msgstr "Please correct the following: {0}"

msgid "error.CouSelectors.cou_id.invalid"
msgstr "Requested COU {0} is not a valid option"

Expand Down Expand Up @@ -160,6 +163,9 @@ msgstr "This Invitation has already been processed"
msgid "information.ApprovalCollectors.review"
msgstr "Please approve or deny Petition {0}."

msgid "information.AttributeCollectors.mvea_optional"
msgstr "You may leave this {0} blank. If you provide any part of it, also provide all required fields: {1}."

msgid "information.EmailVerifiers.done"
msgstr "All email addresses in this Petition have been verified. You may continue on to the next Enrollment Step."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
namespace CoreEnroller\Controller;

use App\Controller\StandardEnrollerController;
use App\Lib\Exception\ValidationException;
use Cake\Event\EventInterface;
use Cake\Http\Response;
use Cake\ORM\TableRegistry;
Expand Down Expand Up @@ -76,6 +77,15 @@ public function dispatch(string $id) {
comment: __d('core_enroller', 'result.attr.saved')
);
}
catch(ValidationException $e) {
// List each invalid field, so the Enrollee can correct the values and resubmit
$items = array_map(fn($m) => '<li>' . h($m) . '</li>', $e->getMessages());

$this->Flash->error(
__d('core_enroller', 'error.attr.invalid', ['<ul>' . implode('', $items) . '</ul>']),
['escape' => false]
);
}
catch(\Exception $e) {
$this->Flash->error($e->getMessage());
}
Expand Down
Loading