$detail .= $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby, "day"), dol_print_date($dbatch->sellby, "day"), $dbatch->dluo_qty) . '<br/>'; } print $form->textwithtooltip($langs->trans("DetailBatchNumber"), $detail); } else { print $langs->trans("NA"); } print '</td>'; } else { print '<td></td>'; } } print "</tr>"; //Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines) > 0) { $colspan = empty($conf->productbatch->enabled) ? 5 : 6; $line = new ExpeditionLigne($db); $line->fetch_optionals($lines[$i]->id, $extralabelslines); print '<tr ' . $bc[$var] . '>'; print $line->showOptionals($extrafieldsline, 'view', array('style' => $bc[$var], 'colspan' => $colspan), $indiceAsked); print '</tr>'; } $var = !$var; } } print "</table>\n"; print "\n</div>\n"; $object->fetchObjectLinked($object->id, $object->element); /* * Boutons actions */ if ($user->societe_id == 0 && $action != 'presend') {
/** * Create a expedition line * * @param int $entrepot_id Id of warehouse * @param int $origin_line_id Id of source line * @param int $qty Quantity * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ function create_line($entrepot_id, $origin_line_id, $qty, $array_options = 0) { global $conf; $error = 0; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "expeditiondet ("; $sql .= "fk_expedition"; $sql .= ", fk_entrepot"; $sql .= ", fk_origin_line"; $sql .= ", qty"; $sql .= ") VALUES ("; $sql .= $this->id; $sql .= ", " . ($entrepot_id ? $entrepot_id : 'null'); $sql .= ", " . $origin_line_id; $sql .= ", " . $qty; $sql .= ")"; dol_syslog(get_class($this) . "::create_line", LOG_DEBUG); if (!$this->db->query($sql)) { $error++; } if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) { $expeditionline = new ExpeditionLigne($this->db); $expeditionline->array_options = $array_options; $expeditionline->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $expeditionline->table_element); $result = $expeditionline->insertExtraFields(); if ($result < 0) { $this->error[] = $expeditionline->error; $error++; } } if (!$error) { return 1; } else { return -1; } }