Verified Commit 05030b47 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(supann-ext) Forbid start date being after end date

issue #5843
Showing with 15 additions and 0 deletions
+15 -0
...@@ -124,6 +124,21 @@ class supannStructureExt extends simplePlugin ...@@ -124,6 +124,21 @@ class supannStructureExt extends simplePlugin
$this->attributesAccess['fdSupannRelationEntite']->attribute->attributes[2]->setChoices($code_entites, $label_entites); $this->attributesAccess['fdSupannRelationEntite']->attribute->attributes[2]->setChoices($code_entites, $label_entites);
} }
function check ()
{
$errors = parent::check();
if (
($this->attributesAccess['fdSupannStartDate']->getValue() != '') &&
($this->attributesAccess['fdSupannEndDate']->getValue() != '') &&
($this->attributesAccess['fdSupannStartDate']->getDateValue() > $this->attributesAccess['fdSupannEndDate']->getDateValue())
) {
$errors[] = _('Start date must be smaller than end date');
}
return $errors;
}
protected function prepare_save () protected function prepare_save ()
{ {
$this->attributesAccess['fdSupannRelationEntite']->supannPrepareSave(); $this->attributesAccess['fdSupannRelationEntite']->supannPrepareSave();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment