diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index e3e447a683c..077e157c664 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -343,10 +342,17 @@ class PaiementCharge function create($user) { global $conf; - $error = 0; - $this->db->begin(); + // Validation parametres + if (! $this->datepaye) + { + $this->error='ErrorBadValueForParameters'; + return -1; + } + + $this->db->begin(); + $total=0; foreach ($this->amounts as $key => $value) { @@ -359,7 +365,7 @@ class PaiementCharge { $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(), "; - $sql.= $this->db->idate($this->date_ech).", "; + $sql.= $this->db->idate($this->datepaye).", "; $sql.= price2num($total).", $this->paiementtype, '$this->num_paiement', '".addslashes($this->note)."', $user->id)"; dolibarr_syslog("PaiementCharge::create sql=".$sql); diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 8ce20f560cc..cda8d0013ef 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** @@ -57,7 +56,6 @@ if ($_POST["action"] == 'add_paiement') if ($_POST["paiementtype"] > 0) { $datepaye = dolibarr_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - //print "x".dolibarr_print_date($datepaye,'dayhour'); $paiement_id = 0; $amounts = array(); diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index fe65832270e..3d2886403d4 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /**