From 2656ace64b0e66a64a97acc849fac9639cb24451 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Jul 2007 00:23:30 +0000 Subject: [PATCH] La date sur formulaire saisi charge est une date --- htdocs/chargesociales.class.php | 10 ++++++---- htdocs/compta/sociales/charges.php | 24 ++++++++++++++---------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index 726d3631ed1..e3e447a683c 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -120,8 +120,8 @@ class ChargeSociales $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount)"; $sql.= " VALUES (".$this->type.",'".addslashes($this->lib)."',"; - $sql.= "'".$this->date_ech."','".$this->periode."',"; - $sql.= " ".$newamount; + $sql.= " '".$this->db->idate($this->date_ech)."','".$this->periode."',"; + $sql.= " ".price2num($newamount); $sql.= ")"; dolibarr_syslog("ChargesSociales::create sql=".$sql); @@ -177,7 +177,7 @@ class ChargeSociales $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; $sql.= " SET libelle='".addslashes($this->lib)."',"; - $sql.= " date_ech='".$this->date_ech."',"; + $sql.= " date_ech='".$this->db->idate($this->date_ech)."',"; $sql.= " periode='".$this->periode."'"; $sql.= " WHERE rowid=".$this->id; @@ -358,7 +358,9 @@ class PaiementCharge if ($total > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_user_creat)"; - $sql .= " VALUES ($this->chid, now(), ".$this->db->idate($this->datepaye).", ".price2num($total).", $this->paiementtype, '$this->num_paiement', '$this->note', $user->id)"; + $sql.= " VALUES ($this->chid, now(), "; + $sql.= $this->db->idate($this->date_ech).", "; + $sql.= price2num($total).", $this->paiementtype, '$this->num_paiement', '".addslashes($this->note)."', $user->id)"; dolibarr_syslog("PaiementCharge::create sql=".$sql); $resql=$this->db->query($sql); diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 74e3892c5d2..fe65832270e 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -97,7 +97,8 @@ if ($_POST["action"] == 'confirm_delete') if ($_POST["action"] == 'add' && $user->rights->tax->charges->creer) { - if (! $_POST["date"]) + $dateech=@dolibarr_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]); + if (! $dateech) { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'
'; $_GET["action"] = 'create'; @@ -118,7 +119,7 @@ if ($_POST["action"] == 'add' && $user->rights->tax->charges->creer) $chargesociales->type=$_POST["type"]; $chargesociales->lib=$_POST["label"]; - $chargesociales->date_ech=$_POST["date"]; + $chargesociales->date_ech=$dateech; $chargesociales->periode=$_POST["period"]; $chargesociales->amount=$_POST["amount"]; @@ -137,7 +138,8 @@ if ($_POST["action"] == 'add' && $user->rights->tax->charges->creer) if ($_GET["action"] == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer) { - if (! $_POST["date"]) + $dateech=@dolibarr_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]); + if (! $dateech) { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")).'
'; $_GET["action"] = 'edit'; @@ -153,7 +155,7 @@ if ($_GET["action"] == 'update' && ! $_POST["cancel"] && $user->rights->tax->cha $result=$chargesociales->fetch($_GET["id"]); $chargesociales->lib=$_POST["label"]; - $chargesociales->date_ech=$_POST["date"]; + $chargesociales->date_ech=$dateech; $chargesociales->periode=$_POST["period"]; $result=$chargesociales->update($user); @@ -170,6 +172,8 @@ if ($_GET["action"] == 'update' && ! $_POST["cancel"] && $user->rights->tax->cha llxHeader(); +$html = new Form($db); + /* * Mode creation * @@ -183,7 +187,7 @@ if ($_GET["action"] == 'create') $var=false; - print '
'; + print ''; print ''; print ""; @@ -207,7 +211,9 @@ if ($_GET["action"] == 'create') print ''; print ''; - print ''; + print ''; print ''; print '
 
YYYYMMDD
'; + print $html->select_date('-1', 'ech', 0, 0, 0, 'charge', 1); + print '
YYYYMMDD
'; @@ -367,7 +371,7 @@ if ($chid > 0) print ''; print ''; print '"; } else {
'.$langs->trans("DateDue").""; - print "date_ech)."\">"; + print $html->select_date($cha->date_ech, 'ech', 0, 0, 0, 'charge', 1); print "