NEW shipment with product in cache

This commit is contained in:
VESSILLER 2025-02-07 16:52:46 +01:00
parent c316d1e5f3
commit ce2f46379a

View file

@ -2409,6 +2409,7 @@ if ($action == 'create') {
print '<tbody>';
// Loop on each product to send/sent
$conf->cache['product'] = array();
for ($i = 0; $i < $num_prod; $i++) {
$parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => !empty($editColspan) ? $editColspan : 0, 'outputlangs' => $outputlangs);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
@ -2429,8 +2430,14 @@ if ($action == 'create') {
if ($lines[$i]->fk_product > 0) {
// Define output language
if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
$prod = new Product($db);
$prod->fetch($lines[$i]->fk_product);
$product_id = $lines[$i]->fk_product;
if (!isset($conf->cache['product'][$product_id])) {
$prod = new Product($db);
$prod->fetch($product_id);
$conf->cache['product'][$product_id] = $prod;
} else {
$prod = $conf->cache['product'][$product_id];
}
$label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label;
} else {
$label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);