From 4076a4a64303f6cce9c511e62a060de37e7454ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2014 14:51:56 +0200 Subject: [PATCH] Fix: select_date accepts -1, '' or a date but not '0' --- htdocs/commande/fiche.php | 6 +++--- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/facture.php | 4 ++-- htdocs/compta/paiement.php | 2 +- htdocs/fourn/facture/fiche.php | 6 +++--- htdocs/fourn/facture/paiement.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 43fe619bd1a6d..c1a6d38a58a35 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1548,7 +1548,7 @@ $demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:''); @@ -1567,7 +1567,7 @@ $demand_reason_id = $soc->demand_reason_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $projectid = 0; } $absolute_discount=$soc->getAvailableDiscounts(); @@ -1643,7 +1643,7 @@ if (empty($datedelivery)) { if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; } $form->select_date($datedelivery,'liv_','','','',"crea_commande",1,1); print ""; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 7b79a16bec116..5ea4e5b72cbee 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -373,7 +373,7 @@ $remise_percent = $soc->remise_percent; } $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $absolute_discount=$soc->getAvailableDiscounts(); print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 29f4e61c7c767..d685f9ad1ed3b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2082,7 +2082,7 @@ $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; //Replicate extrafields $objectsrc->fetch_optionals($originid); @@ -2095,7 +2095,7 @@ $mode_reglement_id = $soc->mode_reglement_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; } $absolute_discount=$soc->getAvailableDiscounts(); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 3b9d257314efa..7a149ed80fdda 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -397,7 +397,7 @@ function callForResult(imgId) // Date payment print ''.$langs->trans('Date').''; $datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment); + $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment); $form->select_date($datepayment,'','','',0,"add_paiement",1,1); print ''; print ''.$langs->trans('Comments').''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 402be19f17a94..966ab630adeaf 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1122,10 +1122,10 @@ $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp); + $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); } @@ -1135,7 +1135,7 @@ $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; $datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); - $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp); + $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=($datetmp==''?-1:$datetmp); } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 352c3150c5247..6f8c3bc192067 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -191,7 +191,7 @@ $object->fetch($facid); $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture); + $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture); $sql = 'SELECT s.nom, s.rowid as socid,'; $sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';