debug date livraison

This commit is contained in:
Andre Cianfarani 2006-03-04 12:59:24 +00:00
parent 93d784614b
commit a94448e0df
5 changed files with 23 additions and 13 deletions

View File

@ -111,7 +111,13 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateDelivery").'</td>'; print '<tr><td>'.$langs->trans("DateDelivery").'</td>';
print '<td>'; print '<td>';
if(DATE_LIVRAISON_WEEK_DELAY != "") 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 else
$form->select_date('','liv_','','','',"addprop"); $form->select_date('','liv_','','','',"addprop");
print '</td></tr>'; print '</td></tr>';

View File

@ -111,7 +111,7 @@ if ($_POST['action'] == 'setdate_livraison')
{ {
$propal = new Propal($db); $propal = new Propal($db);
$propal->fetch($_GET['propalid']); $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); if ($result < 0) dolibarr_print_error($db,$propal->error);
} }
@ -120,8 +120,7 @@ if ($_POST['action'] == 'add')
{ {
$propal = new Propal($db, $_GET['socidp']); $propal = new Propal($db, $_GET['socidp']);
$propal->datep = mktime(12, 1, 1, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $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->duree_validite = $_POST['duree_validite'];
$propal->cond_reglement_id = $_POST['cond_reglement_id']; $propal->cond_reglement_id = $_POST['cond_reglement_id'];
$propal->mode_reglement_id = $_POST['mode_reglement_id']; $propal->mode_reglement_id = $_POST['mode_reglement_id'];

View File

@ -109,7 +109,7 @@ class Commande
$this->soc_id = $propal->soc_id; $this->soc_id = $propal->soc_id;
$this->cond_reglement_id = $propal->cond_reglement_id; $this->cond_reglement_id = $propal->cond_reglement_id;
$this->mode_reglement_id = $propal->mode_reglement_id; $this->mode_reglement_id = $propal->mode_reglement_id;
$this->date_livraison = $propal->date_livraison;
/* Définit la société comme un client */ /* Définit la société comme un client */
$soc = new Societe($this->db); $soc = new Societe($this->db);
@ -241,8 +241,7 @@ class Commande
$this->projetid = 0; $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 = '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) ) if ( $this->db->query($sql) )
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande'); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande');
@ -813,7 +812,7 @@ class Commande
{ {
if ($user->rights->commande->creer) 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"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
if ($this->db->query($sql) ) if ($this->db->query($sql) )

View File

@ -90,7 +90,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$commande->modelpdf = $_POST['model']; $commande->modelpdf = $_POST['model'];
$commande->cond_reglement_id = $_POST['cond_reglement_id']; $commande->cond_reglement_id = $_POST['cond_reglement_id'];
$commande->mode_reglement_id = $_POST['mode_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['idprod1'],$_POST['qty1'],$_POST['remise_percent1']);
$commande->add_product($_POST['idprod2'],$_POST['qty2'],$_POST['remise_percent2']); $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 = new Commande($db);
$commande->fetch($_GET['id']); $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) if ($_POST['action'] == 'setmode' && $user->rights->commande->creer)
@ -340,7 +340,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
// date de livraison // date de livraison
print "<tr><td>".$langs->trans("DateDelivery")."</td><td>"; print "<tr><td>".$langs->trans("DateDelivery")."</td><td>";
if(DATE_LIVRAISON_WEEK_DELAY != "") 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 else
$html->select_date('','liv_','','','',"crea_commande"); $html->select_date('','liv_','','','',"crea_commande");
print "</td></tr>"; print "</td></tr>";

View File

@ -386,7 +386,7 @@ class Propal
$sql.= "'".addslashes($this->note)."',"; $sql.= "'".addslashes($this->note)."',";
$sql.= "'".addslashes($this->note_public)."',"; $sql.= "'".addslashes($this->note_public)."',";
$sql.= "'$this->modelpdf',".$this->db->idate($this->fin_validite).","; $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); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -754,7 +754,7 @@ class Propal
{ {
if ($user->rights->propale->creer) 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"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
if ($this->db->query($sql) ) if ($this->db->query($sql) )