From e07984620afa2489d9d7a83a13ce05484e77732f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Thu, 29 Jul 2010 19:27:41 +0000 Subject: [PATCH] Check the date for the lettering --- html/ajax_misc.php | 21 +++++++++++++++++++++ include/lettering.account.inc.php | 4 ++++ include/lettering.card.inc.php | 5 +++++ include/lettering.gestion.inc.php | 5 +++++ 4 files changed, 35 insertions(+) diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 499137641..941a41d3e 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -338,6 +338,27 @@ jr_comment,j_montant, j_debit,jr_internal from jrnx join jrn on (j_grpt=jr_grpt_ if ( isset($_REQUEST['sc'])) $form.=HtmlInput::hidden('sc',$_REQUEST['sc']); if ( isset($_REQUEST['sb'])) $form.=HtmlInput::hidden('sb',$_REQUEST['sb']); if ( isset($_REQUEST['f_id'])) $form.=HtmlInput::hidden('f_id',$_REQUEST['f_id']); + /* check if date are valid */ + if ( (isset($search_end) && isDate($search_end) == null) || + (isset($search_start) && isDate ($search_start) == null)) + { + ob_start(); + alert(_('Date malformée, désolé')); + $html=ob_get_contents(); + ob_clean(); + + $html=escape_xml($html); + + header('Content-type: text/xml; charset=UTF-8'); +echo << + +detail +$html + +EOF; +exit(); + } // display a list of operation from the other side + box button if ( $ot == 'account') { diff --git a/include/lettering.account.inc.php b/include/lettering.account.inc.php index 1eeb7507e..186e0cc50 100644 --- a/include/lettering.account.inc.php +++ b/include/lettering.account.inc.php @@ -104,6 +104,10 @@ if ( isset($_POST['record'])) { // Show the result //-------------------------------------------------------------------------------- echo '
'; +if ( isDate($_GET['start']) == null || isDate($_GET['end']) == null ) { + echo alert(_('Date malformée, désolé')); + exit(); +} $letter=new Lettering_Account($cn); $letter->set_parameter('account',$_GET['acc']); $letter->set_parameter('start',$_GET['start']); diff --git a/include/lettering.card.inc.php b/include/lettering.card.inc.php index 356ed6b89..32c15c8b8 100644 --- a/include/lettering.card.inc.php +++ b/include/lettering.card.inc.php @@ -112,6 +112,11 @@ if ( isset($_POST['record'])) { // Show the result //-------------------------------------------------------------------------------- echo '
'; +if ( isDate($_GET['start']) == null || isDate($_GET['end']) == null ) { + echo alert(_('Date malformée, désolé')); + exit(); +} + $letter=new Lettering_Card($cn); $quick_code=strtoupper(trim($_GET['acc'])); $letter->set_parameter('quick_code',$quick_code); diff --git a/include/lettering.gestion.inc.php b/include/lettering.gestion.inc.php index 173b3465d..2367036b6 100644 --- a/include/lettering.gestion.inc.php +++ b/include/lettering.gestion.inc.php @@ -59,6 +59,11 @@ if ( isset($_POST['record'])) { //-------------------------------------------------------------------------------- // Show the result //-------------------------------------------------------------------------------- +if ( isDate($_GET['start']) == null || isDate($_GET['end']) == null ) { + echo alert(_('Date malformée, désolé')); + exit(); +} + echo '
'; $fiche=new Fiche($cn,$_REQUEST['f_id']); $quick_code=$fiche->get_quick_code();