diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e7c8e109890..ce73ad72a5b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1333,6 +1333,9 @@ class Commande extends CommonOrder $line->marge_tx = $marginInfos[1]; $line->marque_tx = $marginInfos[2]; + $line->origin = $object->element; + $line->origin_id = $object->lines[$i]->id; + // get extrafields from original line $object->lines[$i]->fetch_optionals(); foreach ($object->lines[$i]->array_options as $options_key => $value) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 2fa69230e4e..f4451d6572f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -324,7 +324,7 @@ if (empty($reshook)) { //var_dump($batch_line[2]); - if ($totalqty > 0) { // There is at least one thing to ship + if ($totalqty > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; @@ -334,7 +334,7 @@ if (empty($reshook)) { //shipment from multiple stock locations $nbstockline = count($stockLine[$i]); for ($j = 0; $j < $nbstockline; $j++) { - if ($stockLine[$i][$j]['qty'] > 0) { + if ($stockLine[$i][$j]['qty'] > 0 || ($stockLine[$i][$j]['qty'] == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) { $ret = $object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -343,7 +343,7 @@ if (empty($reshook)) { } } } else { - if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { + if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) { $ent = "entl".$i; $idl = "idl".$i; $entrepot_id = is_numeric(GETPOST($ent, 'int')) ?GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int');