Fix the source object may have been modified with corrupted data.

This commit is contained in:
Laurent Destailleur 2021-01-08 01:56:23 +01:00
parent 8fca2ce2eb
commit b91bca7022
3 changed files with 3 additions and 6 deletions

View File

@ -188,7 +188,6 @@ if (empty($reshook))
if ($action == 'add' && $user->rights->expedition->creer)
{
$error = 0;
$predef = '';
$db->begin();
@ -215,7 +214,6 @@ if (empty($reshook))
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->tracking_number = GETPOST('tracking_number', 'alpha');
$object->ref_int = GETPOST('ref_int', 'alpha');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');

View File

@ -671,7 +671,7 @@ class Expedition extends CommonObject
// Protection
if ($this->statut)
{
dol_syslog(get_class($this)."::valid no draft status", LOG_WARNING);
dol_syslog(get_class($this)."::valid not in draft status", LOG_WARNING);
return 0;
}
@ -757,7 +757,7 @@ class Expedition extends CommonObject
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
$mouvS->origin = dol_clone($this, 1);
if (empty($obj->edbrowid))
{
@ -765,6 +765,7 @@ class Expedition extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref));
if ($result < 0) {
$error++;
$this->error = $mouvS->error;
@ -794,7 +795,6 @@ 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)
{
$error++;

View File

@ -666,7 +666,6 @@ class MouvementStock extends CommonObject
}
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
// $this->fetch_lines();