diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index b3f92cd2f17..a78838d0524 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -111,7 +111,13 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("DateDelivery").''; print ''; if(DATE_LIVRAISON_WEEK_DELAY != "") - $form->select_date(time() + ((7*DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60),'liv_','','','',"addprop"); + { + $tmpdte = time() + ((7*DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + $syear = date("Y", $tmpdte); + $smonth = date("m", $tmpdte); + $sday = date("d", $tmpdte); + $form->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); + } else $form->select_date('','liv_','','','',"addprop"); print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 4d9723f3ee0..e0c70631378 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -111,7 +111,7 @@ if ($_POST['action'] == 'setdate_livraison') { $propal = new Propal($db); $propal->fetch($_GET['propalid']); - $result=$propal->set_date_livraison($user,mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $result=$propal->set_date_livraison($user,$_POST['liv_year']."-".$_POST['liv_month']."-".$_POST['liv_day']); if ($result < 0) dolibarr_print_error($db,$propal->error); } @@ -120,8 +120,7 @@ if ($_POST['action'] == 'add') { $propal = new Propal($db, $_GET['socidp']); $propal->datep = mktime(12, 1, 1, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $propal->date_livraison = mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); - + $propal->date_livraison = $_POST['liv_year']."-".$_POST['liv_month']."-".$_POST['liv_day']; $propal->duree_validite = $_POST['duree_validite']; $propal->cond_reglement_id = $_POST['cond_reglement_id']; $propal->mode_reglement_id = $_POST['mode_reglement_id']; diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 421fe086d7a..bee7f0be150 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -109,7 +109,7 @@ class Commande $this->soc_id = $propal->soc_id; $this->cond_reglement_id = $propal->cond_reglement_id; $this->mode_reglement_id = $propal->mode_reglement_id; - + $this->date_livraison = $propal->date_livraison; /* Définit la société comme un client */ $soc = new Societe($this->db); @@ -241,8 +241,7 @@ class Commande $this->projetid = 0; } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, ref_client, model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison) '; - $sql .= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.', '.$this->db->idate($this->date_commande).', '.$this->source.', \''.$this->note.'\', \''.$this->ref_client.'\', \''.$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\', \''.$this->db->idate($this->date_livraison).'\')'; - + $sql .= ' VALUES ('.$this->soc_id.', now(), '.$user->id.', '.$this->projetid.', '.$this->db->idate($this->date_commande).', '.$this->source.', \''.$this->note.'\', \''.$this->ref_client.'\', \''.$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\', \''.$this->date_livraison.'\')'; if ( $this->db->query($sql) ) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande'); @@ -813,7 +812,7 @@ class Commande { if ($user->rights->commande->creer) { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET date_livraison = ".$this->db->idate($date_livraison); + $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET date_livraison = '".$date_livraison."'"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; if ($this->db->query($sql) ) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 7c1784f532b..6b344eb7848 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -90,7 +90,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) $commande->modelpdf = $_POST['model']; $commande->cond_reglement_id = $_POST['cond_reglement_id']; $commande->mode_reglement_id = $_POST['mode_reglement_id']; - $commande->date_livraison = mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); + $commande->date_livraison = $_POST['liv_year']."-".$_POST['liv_month']."-".$_POST['liv_day']; $commande->add_product($_POST['idprod1'],$_POST['qty1'],$_POST['remise_percent1']); $commande->add_product($_POST['idprod2'],$_POST['qty2'],$_POST['remise_percent2']); @@ -133,7 +133,7 @@ if ($_POST['action'] == 'setdate_livraison' && $user->rights->commande->creer) { $commande = new Commande($db); $commande->fetch($_GET['id']); - $commande->set_date_livraison($user,mktime(12, 1, 1, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $commande->set_date_livraison($user,$_POST['liv_year']."-".$_POST['liv_month']."-".$_POST['liv_day']); } if ($_POST['action'] == 'setmode' && $user->rights->commande->creer) @@ -340,7 +340,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) // date de livraison print "".$langs->trans("DateDelivery").""; if(DATE_LIVRAISON_WEEK_DELAY != "") - $html->select_date(time() + ((7*DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60),'liv_','','','',"crea_commande"); + { + $tmpdte = time() + ((7*DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + $syear = date("Y", $tmpdte); + $smonth = date("m", $tmpdte); + $sday = date("d", $tmpdte); + $html->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"crea_commande"); + } else $html->select_date('','liv_','','','',"crea_commande"); print ""; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index d690c266ad9..fdf5e330c05 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -386,7 +386,7 @@ class Propal $sql.= "'".addslashes($this->note)."',"; $sql.= "'".addslashes($this->note_public)."',"; $sql.= "'$this->modelpdf',".$this->db->idate($this->fin_validite).","; - $sql.= " $this->cond_reglement_id, $this->mode_reglement_id, ".$this->db->idate($this->date_livraison).")"; + $sql.= " $this->cond_reglement_id, $this->mode_reglement_id, '".$this->date_livraison."')"; $resql=$this->db->query($sql); if ($resql) @@ -754,7 +754,7 @@ class Propal { if ($user->rights->propale->creer) { - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET date_livraison = ".$this->db->idate($date_livraison); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET date_livraison = '".$date_livraison."'"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; if ($this->db->query($sql) )