From 4bc61c67d9c4f1cee2f78bbeaca137cec8964f5c Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 12 Sep 2013 11:56:33 +0000 Subject: [PATCH] Infolog: Validate the startdate and enddate, to make sure that startdate is not set after the enddate. --- infolog/inc/class.infolog_ui.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index da9c77cfdd..031414bc45 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1552,6 +1552,16 @@ class infolog_ui $button = 'apply'; // need to store infolog first } } + //Validate the enddate must be grather than startdate + if (isset($content['info_enddate']) && isset($content['info_startdate'])) + { + $duration_date = $content['info_enddate']-$content['info_startdate']; + if (isset($duration_date) && $duration_date < 0 ) + { + $this->tmpl->set_validation_error('info_startdate', lang('Startdate must be before Enddate!!!')); + $button = $action = ''; // stop save or apply + } + } //echo "

infolog_ui::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content); if (($button == 'save' || $button == 'apply') && isset($content['info_subject']) && empty($content['info_subject'])) {