From a3607fff776b5f29af9790e42d061996d6bdcf3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 16:34:46 +0100 Subject: [PATCH] Fix customer ref of shipment --- htdocs/core/class/commonobject.class.php | 6 +++++- htdocs/expedition/card.php | 10 +++++----- htdocs/expedition/class/expedition.class.php | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5e89b32afb5..cdd8b89a1ad 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2798,7 +2798,11 @@ abstract class CommonObject if (! $error) { $this->db->commit(); - $this->statut = $status; + if (empty($elementId)) // If the element we update was $this (so $elementId is null) + { + $this->statut = $status; + $this->status = $status; + } return 1; } else diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 9a09e9b7750..b86d7cd0c0e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -202,9 +202,9 @@ if (empty($reshook)) $objectsrc->fetch($object->origin_id); $object->socid = $objectsrc->socid; - $object->ref_customer = $objectsrc->ref_client; + $object->ref_customer = ''; // We don't use $objectsrc->ref_client, this is ref or order not shipment $object->model_pdf = GETPOST('model'); - $object->date_delivery = $date_delivery; // Date delivery planed + $object->date_delivery = $date_delivery; // Date delivery planed $object->fk_delivery_address = $objectsrc->fk_delivery_address; $object->shipping_method_id = GETPOST('shipping_method_id','int'); $object->tracking_number = GETPOST('tracking_number','alpha'); @@ -413,9 +413,9 @@ if (empty($reshook)) ) { $object->fetch_thirdparty(); - + $result = $object->valid($user); - + if ($result < 0) { $langs->load("errors"); @@ -1332,7 +1332,7 @@ else if ($id || $ref) $objectsrc=new Propal($db); $objectsrc->fetch($object->$typeobject->id); } - + // Shipment card $linkback = ''.$langs->trans("BackToList").''; $morehtmlref='
'; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 4a6a50c7926..c5d84836f90 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -742,7 +742,8 @@ class Expedition extends CommonObject // Change status of order to "shipment in process" $ret = $this->setStatut(Commande::STATUS_SHIPMENTONPROCESS, $this->origin_id, $this->origin); - if (! $ret) + + if (! $ret) { $error++; }