From 6c42535eb25acf550d9f69d5fc2ad424a651fa8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Nov 2020 12:20:18 +0100 Subject: [PATCH] Maxi debug v13 --- htdocs/comm/propal/card.php | 26 ++++++++------ htdocs/comm/propal/class/propal.class.php | 31 ++++++++++------ htdocs/commande/card.php | 20 ++++++----- htdocs/commande/class/commande.class.php | 16 +++++---- htdocs/commande/list.php | 2 +- htdocs/compta/facture/class/facture.class.php | 4 +-- ...box_supplier_orders_awaiting_reception.php | 1 - .../commande/doc/pdf_einstein.modules.php | 4 +-- .../commande/doc/pdf_eratosthene.modules.php | 4 +-- .../modules/delivery/mod_delivery_saphir.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 4 +-- .../modules/propale/doc/pdf_cyan.modules.php | 4 +-- .../supplier_order/doc/pdf_cornas.modules.php | 4 +-- .../doc/pdf_muscadet.modules.php | 4 +-- .../doc/pdf_aurore.modules.php | 8 ++--- htdocs/expedition/card.php | 7 ++-- htdocs/expedition/list.php | 5 +-- htdocs/expedition/shipment.php | 8 ++--- .../class/fournisseur.commande.class.php | 35 ++++++++++++------- htdocs/fourn/commande/card.php | 13 +++---- htdocs/install/upgrade2.php | 10 +++--- htdocs/reception/card.php | 7 ++-- htdocs/reception/list.php | 34 +++++++++--------- htdocs/supplier_proposal/card.php | 6 ++-- .../class/supplier_proposal.class.php | 16 ++++++--- 25 files changed, 157 insertions(+), 118 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8613828f632..3a80ae22306 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -171,13 +171,14 @@ if (empty($reshook)) GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int') ); - if (!empty($object->date_livraison) && !empty($date_delivery)) + $date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + if (!empty($date_delivery_old) && !empty($date_delivery)) { //Attempt to get the date without possible hour rounding errors $old_date_delivery = dol_mktime(12, 0, 0, - dol_print_date($object->date_livraison, '%m'), - dol_print_date($object->date_livraison, '%d'), - dol_print_date($object->date_livraison, '%Y') + dol_print_date($date_delivery_old, '%m'), + dol_print_date($date_delivery_old, '%d'), + dol_print_date($date_delivery_old, '%Y') ); //Calculate the difference and apply if necessary $difference = $date_delivery - $old_date_delivery; @@ -341,7 +342,9 @@ if (empty($reshook)) if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) { $object->ref = GETPOST('ref'); $object->datep = $datep; - $object->date_livraison = $date_delivery; + $object->date = $datep; + $object->date_livraison = $date_delivery; // deprecated + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -355,8 +358,9 @@ if (empty($reshook)) $object->socid = GETPOST('socid', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); - $object->model_pdf = GETPOST('model'); + $object->model_pdf = GETPOST('model', 'alphanohtml'); $object->author = $user->id; // deprecated + $object->user_author_id = $user->id; $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); $object->statut = Propal::STATUS_DRAFT; @@ -372,7 +376,9 @@ if (empty($reshook)) $object->ref = GETPOST('ref'); $object->ref_client = GETPOST('ref_client'); $object->datep = $datep; + $object->date = $datep; $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id', 'int'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -1823,8 +1829,8 @@ if ($action == 'create') // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) ); - if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { - $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); + if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { + $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); } // Incomplete payment. We ask if reason = discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); @@ -2048,9 +2054,9 @@ if ($action == 'create') // Delivery date $langs->load('deliveries'); print ''; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 27f57569c3a..4f2159a200e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -991,6 +991,9 @@ class Propal extends CommonObject $this->multicurrency_tx = 1; } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + dol_syslog(get_class($this)."::create"); // Check parameters @@ -1078,7 +1081,7 @@ class Propal extends CommonObject $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", '".$this->db->escape($this->ref_client)."'"; - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL"); + $sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".$this->availability_id; $sql .= ", ".$this->demand_reason_id; @@ -1441,7 +1444,7 @@ class Propal extends CommonObject $sql .= ", p.date_valid as datev"; $sql .= ", p.datep as dp"; $sql .= ", p.fin_validite as dfv"; - $sql .= ", p.date_livraison as date_livraison"; + $sql .= ", p.date_livraison as delivery_date"; $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; @@ -1523,8 +1526,8 @@ class Propal extends CommonObject $this->date = $this->db->jdate($obj->dp); // Proposal date $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->delivery_date = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; @@ -2111,7 +2114,7 @@ class Propal extends CommonObject { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; - $this->date_delivery = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -3574,16 +3577,24 @@ class Propal extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_client)) + } + if (!empty($this->ref_client)) { $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index fd4c895caec..cb629e2c1f9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -120,6 +120,8 @@ if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WA $error = 0; +$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + /* * Actions @@ -274,7 +276,7 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated $object->delivery_date = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); @@ -539,10 +541,10 @@ if (empty($reshook)) } } elseif ($action == 'setdate_livraison' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->setDeliveryDate($user, $datedelivery); + $result = $object->setDeliveryDate($user, $date_delivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -1507,7 +1509,8 @@ if ($action == 'create' && $usercancreate) $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); + if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); if (!empty($conf->multicurrency->enabled)) { @@ -1620,8 +1623,7 @@ if ($action == 'create' && $usercancreate) // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -2138,12 +2140,12 @@ if ($action == 'create' && $usercancreate) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5c341ac0ffb..b77f7712f90 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -886,8 +886,9 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - // $date_commande is deprecated + // Set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); @@ -960,7 +961,7 @@ class Commande extends CommonOrder $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", ".($this->availability_id > 0 ? $this->availability_id : "null"); $sql .= ", ".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null"); - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($this->$delivery_date ? "'".$this->db->idate($this->$delivery_date)."'" : "null"); $sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL'); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL'); @@ -1359,7 +1360,7 @@ class Commande extends CommonOrder $this->fk_account = $object->fk_account; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; + $this->date_livraison = $object->date_livraison; // deprecated $this->delivery_date = $object->date_livraison; $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; @@ -1784,7 +1785,7 @@ class Commande extends CommonOrder $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql .= ', c.fk_account'; $sql .= ', c.date_commande, c.date_valid, c.tms'; - $sql .= ', c.date_livraison'; + $sql .= ', c.date_livraison as delivery_date'; $sql .= ', c.fk_shipping_method'; $sql .= ', c.fk_warehouse'; $sql .= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; @@ -1870,8 +1871,8 @@ class Commande extends CommonOrder $this->availability = $obj->availability_label; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->delivery_date = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; $this->fk_delivery_address = $obj->fk_delivery_address; @@ -3660,6 +3661,9 @@ class Commande extends CommonOrder if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $linkclose = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1c9cffcdacd..3e7a8d416cf 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -931,7 +931,7 @@ if ($resql) $generic_commande->statut = $obj->fk_statut; $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); - $generic_commande->date_livraison = $db->jdate($obj->date_delivery); + $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; $generic_commande->total_ht = $obj->total_ht; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9c78fa6acb9..51051625db6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1338,8 +1338,8 @@ class Facture extends CommonInvoice $this->mode_reglement_id = $object->mode_reglement_id; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; - $this->delivery_date = $object->date_livraison; + $this->delivery_date = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + $this->date_livraison = $object->delivery_date; // deprecated $this->fk_delivery_address = $object->fk_delivery_address; // deprecated $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 57656915d62..9aeba738caf 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -115,7 +115,6 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $delivery_date = $this->db->jdate($objp->delivery_date); $datem = $this->db->jdate($objp->tms); - $supplierorderstatic->date_livraison = $delivery_date; $supplierorderstatic->delivery_date = $delivery_date; $supplierorderstatic->statut = $objp->fk_statut; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9a618053ff2..114a3906392 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -741,7 +741,7 @@ class pdf_einstein extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -750,7 +750,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 28c255e973b..1f266851a0c 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -958,7 +958,7 @@ class pdf_eratosthene extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -967,7 +967,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index df1a15598b1..ca0de68a670 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -139,7 +139,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder return 0; } - $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison); + $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->delivery_date); return $numFinal; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index aff0e7c4457..3405b6a2774 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -870,7 +870,7 @@ class pdf_azur extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -879,7 +879,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 9be74e97fb9..8199f3ac11e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1006,7 +1006,7 @@ class pdf_cyan extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -1015,7 +1015,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 0d7cfcdb90d..681b5316682 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1276,11 +1276,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $posy += 4; $pdf->SetXY($posx - 90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index a496bd8ba87..13111da6fa9 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1190,11 +1190,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $posy += 4; $pdf->SetXY($posx - 90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index f6dc1d789f0..8a3880dc93e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -724,7 +724,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -733,7 +733,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -745,7 +745,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - //$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); + //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true); $pdf->MultiCell(80, 4, '', 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1325,7 +1325,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R'); */ if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 77e25704a6b..5fa0ebe26ea 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -105,6 +105,8 @@ $hookmanager->initHooks(array('expeditioncard', 'globalcard')); $permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -201,8 +203,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver $classname = ucfirst($object->origin); $objectsrc = new $classname($db); @@ -936,8 +936,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 09cec584c43..77a62bf8561 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -212,7 +212,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -618,6 +618,7 @@ if ($resql) $object = new Expedition($db); $object->fetch($obj->rowid); + print ''; // Ref @@ -705,7 +706,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "dayhour"); + print dol_print_date($db->jdate($obj->delivery_date), "dayhour"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 62e6181abcf..39772360227 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -354,7 +354,7 @@ if ($id > 0 || !empty($ref)) print ''.$langs->trans('Date').''; print ''; print dol_print_date($object->date, 'day'); - if ($object->hasDelay() && empty($object->date_livraison)) { + if ($object->hasDelay() && empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ''; @@ -374,12 +374,12 @@ if ($id > 0 || !empty($ref)) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'dayhour'); - if ($object->hasDelay() && !empty($object->date_livraison)) { + print dol_print_date($object->delivery_date, 'dayhour'); + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2bc539ea07e..5f2771594de 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -375,7 +375,7 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier - $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->remise_percent = $obj->remise_percent; $this->methode_commande_id = $obj->fk_input_method; @@ -778,16 +778,24 @@ class CommandeFournisseur extends CommonOrder if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_supplier)) + } + if (!empty($this->ref_supplier)) { $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $picto = 'order'; @@ -1257,9 +1265,10 @@ class CommandeFournisseur extends CommonOrder $error = 0; $now = dol_now(); - // $date_commande is deprecated + // set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set if (empty($date)) $date = $now; + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Clean parameters if (empty($this->source)) $this->source = 0; @@ -1308,7 +1317,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".$this->socid; $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", '".$this->db->idate($date)."'"; - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".$user->id; $sql .= ", ".self::STATUS_DRAFT; $sql .= ", ".$this->db->escape($this->source); @@ -2925,7 +2934,7 @@ class CommandeFournisseur extends CommonOrder { $response->nbtodo++; - $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); + $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $commandestatic->delivery_date = $this->db->jdate($obj->delivery_date); $commandestatic->date_commande = $this->db->jdate($obj->date_commande); $commandestatic->statut = $obj->fk_statut; @@ -3079,10 +3088,10 @@ class CommandeFournisseur extends CommonOrder { global $conf; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility $now = dol_now(); - $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; + $date_to_test = empty($this->delivery_date) ? $this->date_commande : $this->delivery_date; return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); } @@ -3096,9 +3105,9 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility - if (empty($this->date_delivery)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + if (empty($this->delivery_date)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day'); $text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today"); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ad4662a156c..b4f3570ff34 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1145,7 +1145,7 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated $object->delivery_date = $datelivraison; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -1200,7 +1200,8 @@ if (empty($reshook)) $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $object->setDeliveryDate($user, $srcobject->date_livraison); + $tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison); + $object->setDeliveryDate($user, $tmpdate); $object->set_id_projet($user, $srcobject->fk_project); $lines = $srcobject->lines; @@ -1552,7 +1553,7 @@ if ($action == 'create') $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 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '')); if (!empty($conf->multicurrency->enabled)) { @@ -2161,14 +2162,14 @@ if ($action == 'create') print ''; $usehourmin = 0; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 1; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); print ''; print ''; } else { $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 7b41e7030b1..a77606abb3f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2068,8 +2068,8 @@ function migrate_commande_livraison($db, $langs, $conf) $db->begin(); - $sql = "SELECT l.rowid, l.fk_commande"; - $sql .= ", c.ref_client, c.date_livraison"; + $sql = "SELECT l.rowid, l.fk_commande,"; + $sql .= " c.ref_client, c.date_livraison as delivery_date"; $sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c"; $sql .= " WHERE c.rowid = l.fk_commande"; $resql = $db->query($sql); @@ -2090,7 +2090,7 @@ function migrate_commande_livraison($db, $langs, $conf) if ($resql2) { - $delivery_date = $db->jdate($obj->date_livraison); + $delivery_date = $db->jdate($obj->delivery_date); $sqlu = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; $sqlu .= " ref_client='".$db->escape($obj->ref_client)."'"; @@ -3007,7 +3007,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) if ($db->query($sqlAdd1) && $db->query($sqlAdd2)) { - $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison"; + $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison as delivery_date"; $sqlSelect .= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sqlSelect .= ", ".MAIN_DB_PREFIX."element_element as el"; $sqlSelect .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = el.fk_source AND el.sourcetype = 'commande'"; @@ -3028,7 +3028,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) $sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sqlUpdate .= " ref_customer = '".$db->escape($obj->ref_client)."'"; - $sqlUpdate .= ", date_delivery = '".$db->escape($obj->date_livraison ? $obj->date_livraison : 'null')."'"; + $sqlUpdate .= ", date_delivery = '".$db->escape($obj->delivery_date ? $obj->delivery_date : 'null')."'"; $sqlUpdate .= " WHERE rowid = ".$obj->shipping_id; $result = $db->query($sqlUpdate); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 62fc287fba3..169ffd327ad 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -111,6 +111,8 @@ $hookmanager->initHooks(array('receptioncard', 'globalcard')); $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -226,8 +228,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // On va boucler sur chaque ligne du document d'origine pour completer objet reception // avec info diverses + qte a livrer @@ -777,8 +777,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b99ba707251..4df73cce925 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -409,7 +409,7 @@ $formfile = new FormFile($db); $helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones'; llxHeader('', $langs->trans('ListOfReceptions'), $helpurl); -$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; +$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,"; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -499,21 +499,21 @@ if ($resql) $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($sall) $param .= "&sall=".$sall; - if ($search_ref_rcp) $param .= "&search_ref_rcp=".$search_ref_rcp; - if ($search_ref_liv) $param .= "&search_ref_liv=".$search_ref_liv; - if ($search_company) $param .= "&search_company=".$search_company; - if ($optioncss != '') $param .= '&optioncss='.$optioncss; - if ($search_billed != '' && $search_billed >= 0)$param .= "&search_billed=".$search_billed; - if ($search_town) $param .= "&search_town=".$search_town; - if ($search_zip) $param .= "&search_zip=".$search_zip; - if ($search_state) $param .= "&search_state=".$search_state; - if ($search_status) $param .= "&search_status=".$search_status; - if ($search_country) $param .= "&search_country=".$search_country; - if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".$search_type_thirdparty; - if ($search_ref_supplier) $param .= "&search_ref_supplier=".$search_ref_supplier; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($sall) $param .= "&sall=".urlencode($sall); + if ($search_ref_rcp) $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); + if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_company) $param .= "&search_company=".urlencode($search_company); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_billed != '' && $search_billed >= 0) $param .= "&search_billed=".urlencode($search_billed); + if ($search_town) $param .= "&search_town=".urlencode($search_town); + if ($search_zip) $param .= "&search_zip=".urlencode($search_zip); + if ($search_state) $param .= "&search_state=".urlencode($search_state); + if ($search_status) $param .= "&search_status=".urlencode($search_status); + if ($search_country) $param .= "&search_country=".urlencode($search_country); + if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -838,7 +838,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "day"); + print dol_print_date($db->jdate($obj->delivery_date), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5a5e73a1927..eb918d8b3b4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -257,7 +257,7 @@ if (empty($reshook)) { if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) { $object->ref = GETPOST('ref'); - $object->date_livraison = $date_delivery; + $object->date_livraison = $date_delivery; // deprecated $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); @@ -1565,11 +1565,11 @@ if ($action == 'create') print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); + print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'daytext'); + print dol_print_date($object->delivery_date, 'daytext'); } print ''; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 59305cf7548..74bbf1afa7e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -109,6 +109,12 @@ class SupplierProposal extends CommonObject */ public $date; + /** + * @var integer|string date_livraison + * @deprecated + */ + public $date_livraison; + /** * @var integer|string date_livraison */ @@ -855,8 +861,6 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -3; } - - // Check parameters if (!empty($this->ref)) // We check that ref is not already used { $result = self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used @@ -869,6 +873,9 @@ class SupplierProposal extends CommonObject } } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + // Multicurrency if (!empty($this->multicurrency_code)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now); if (empty($this->fk_multicurrency)) @@ -923,7 +930,7 @@ class SupplierProposal extends CommonObject $sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL'); $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".$conf->entity; @@ -1256,7 +1263,7 @@ class SupplierProposal extends CommonObject $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date - $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; @@ -1538,6 +1545,7 @@ class SupplierProposal extends CommonObject if ($this->db->query($sql)) { $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; return 1; } else { $this->error = $this->db->error();