40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
52if (isModEnabled(
"product") || isModEnabled(
"service")) {
53 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
55if (isModEnabled(
"propal")) {
56 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
58if (isModEnabled(
'productbatch')) {
59 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
61if (isModEnabled(
'project')) {
62 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
67$langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'productbatch'));
69if (isModEnabled(
'incoterm')) {
70 $langs->load(
'incoterm');
72if (isModEnabled(
'productbatch')) {
73 $langs->load(
'productbatch');
76$origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'expedition';
79if (empty($origin_id)) {
82if (empty($origin_id)) {
89$action =
GETPOST(
'action',
'alpha');
90$confirm =
GETPOST(
'confirm',
'alpha');
91$cancel =
GETPOST(
'cancel',
'alpha');
103$extrafields->fetch_name_optionals_label(
$object->table_element);
104$extrafields->fetch_name_optionals_label(
$object->table_element_line);
105$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
108include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
111$hookmanager->initHooks(array(
'expeditioncard',
'globalcard'));
115if ($id > 0 || !empty($ref)) {
123 $socid = $user->socid;
128$permissiondellink = $user->hasRight(
'expedition',
'delivery',
'creer');
129$permissiontoadd = $user->hasRight(
'expedition',
'creer');
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
142if (empty($reshook)) {
144 if ($origin && $origin_id > 0) {
145 if ($origin ==
'commande') {
146 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
155 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
158 $upload_dir = $conf->expedition->dir_output.
'/sending';
159 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
162 if ($action ==
'setdraft' && $user->hasRight(
'expedition',
'creer')) {
164 $result =
$object->setDraft($user, 0);
168 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
173 if ($action ==
'reopen' && $user->hasRight(
'expedition',
'creer')) {
179 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
185 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm')) {
189 if ($action ==
'setref_customer') {
195 $result =
$object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
198 $action =
'editref_customer';
200 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
205 if ($action ==
'update_extras' && $user->hasRight(
'expedition',
'creer')) {
209 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
216 $result =
$object->insertExtraFields(
'SHIPMENT_MODIFY');
224 $action =
'edit_extras';
229 if ($action ==
'add' && $user->hasRight(
'expedition',
'creer')) {
237 $object->origin_id = $origin_id;
249 $classname = ucfirst(
$object->origin);
250 $objectsrc =
new $classname($db);
251 $objectsrc->fetch(
$object->origin_id);
253 $object->socid = $objectsrc->socid;
256 $object->date_delivery = $date_delivery;
257 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
263 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
265 $batch_line = array();
266 $stockLine = array();
267 $array_options = array();
269 $num = count($objectsrc->lines);
272 $product_batch_used = array();
274 for ($i = 0; $i < $num; $i++) {
281 $batch =
"batchl".$i.
"_0";
282 $stockLocation =
"ent1".$i.
"_0";
285 $is_batch_or_serial = 0;
286 if (!empty($objectsrc->lines[$i]->fk_product)) {
287 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
288 if ($resultFetch < 0) {
291 $is_batch_or_serial = $product->status_batch;
295 if (isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
296 if (GETPOSTISSET($batch)) {
299 while (GETPOSTISSET($batch)) {
302 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
303 $subtotalqty += $sub_qty[$j][
'q'];
311 if ($is_batch_or_serial == 2 && ($sub_qty[$j][
'q'] > 1 || ($sub_qty[$j][
'q'] > 0 && in_array($sub_qty[$j][
'id_batch'], $product_batch_used)))) {
312 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
317 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 0) {
319 $product_batch_used[$j] = $sub_qty[$j][
'id_batch'];
323 $batch =
"batchl".$i.
"_".$j;
324 $qty =
"qtyl".$i.
'_'.$j;
327 $batch_line[$i][
'detail'] = $sub_qty;
328 $batch_line[$i][
'qty'] = $subtotalqty;
331 $totalqty += $subtotalqty;
338 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
342 } elseif (GETPOSTISSET($stockLocation)) {
345 while (GETPOSTISSET($stockLocation)) {
348 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
349 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
355 $stockLocation =
"ent1".$i.
"_".$j;
356 $qty =
"qtyl".$i.
'_'.$j;
367 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
368 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
374 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
376 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
378 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
379 unset($_POST[
"options_".$key]);
385 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
386 for ($i = 0; $i < $num; $i++) {
389 if (!isset($batch_line[$i])) {
391 if (isset($stockLine[$i])) {
393 $nbstockline = count($stockLine[$i]);
394 for ($j = 0; $j < $nbstockline; $j++) {
395 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
396 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
408 if ($entrepot_id < 0) {
411 if (!($objectsrc->lines[$i]->fk_product > 0)) {
424 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
425 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
434 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
447 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
448 if (isModEnabled(
'stock')) {
449 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
451 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
457 header(
"Location: card.php?id=".
$object->id);
464 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
468 $result =
$object->create_delivery($user);
472 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&token='.
newToken().
'&id='.$result);
479 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' &&
480 ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
481 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate')))
485 $result =
$object->valid($user);
492 $outputlangs = $langs;
495 $newlang =
GETPOST(
'lang_id',
'aZ09');
498 $newlang =
$object->thirdparty->default_lang;
500 if (!empty($newlang)) {
502 $outputlangs->setDefaultLang($newlang);
507 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
513 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
514 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
515 $result =
$object->cancel(0, $also_update_stock);
517 $result =
$object->setStatut(-1);
521 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
522 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
523 $result =
$object->delete($user, 0, $also_update_stock);
525 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
539 } elseif ($action ==
'setdate_livraison' && $user->hasRight(
'expedition',
'creer')) {
543 $result =
$object->setDeliveryDate($user, $datedelivery);
547 } elseif (($action ==
'settracking_number'
548 || $action ==
'settracking_url'
549 || $action ==
'settrueWeight'
550 || $action ==
'settrueWidth'
551 || $action ==
'settrueHeight'
552 || $action ==
'settrueDepth'
553 || $action ==
'setshipping_method_id')
554 && $user->hasRight(
'expedition',
'creer')
559 if ($action ==
'settracking_number') {
560 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
562 if ($action ==
'settracking_url') {
563 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
565 if ($action ==
'settrueWeight') {
569 if ($action ==
'settrueWidth') {
572 if ($action ==
'settrueHeight') {
576 if ($action ==
'settrueDepth') {
579 if ($action ==
'setshipping_method_id') {
584 if (
$object->update($user) >= 0) {
585 header(
"Location: card.php?id=".
$object->id);
592 } elseif ($action ==
'classifybilled') {
594 $result =
$object->setBilled();
596 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
600 } elseif ($action ==
'classifyclosed') {
602 $result =
$object->setClosed();
604 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
608 } elseif ($action ==
'deleteline' && !empty($line_id)) {
613 $line->fk_expedition =
$object->id;
615 $num_prod = count($lines);
616 for ($i = 0; $i < $num_prod; $i++) {
617 if ($lines[$i]->
id == $line_id) {
618 if (count($lines[$i]->details_entrepot) > 1) {
620 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
621 $line->id = $details_entrepot->line_id;
622 if (!$error && $line->delete($user) < 0) {
628 $line->id = $line_id;
629 if (!$error && $line->delete($user) < 0) {
634 unset($_POST[
"lineid"]);
638 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
643 } elseif ($action ==
'updateline' && $user->hasRight(
'expedition',
'creer') &&
GETPOST(
'save')) {
651 $num_prod = count($lines);
652 for ($i = 0; $i < $num_prod; $i++) {
653 if ($lines[$i]->
id == $line_id) {
654 $update_done =
false;
656 $line->fk_expedition =
$object->id;
659 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
661 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
662 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
663 unset($_POST[
"options_".$key]);
666 $line->fk_product = $lines[$i]->fk_product;
667 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
669 foreach ($lines[$i]->detail_batch as $detail_batch) {
671 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
672 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
675 if (!empty($batch_id)) {
676 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
677 if ($lines[$i]->entrepot_id != 0) {
679 $line->entrepot_id = $lotStock->warehouseid;
683 if (empty($line->detail_batch)) {
684 $line->detail_batch =
new stdClass();
687 $line->detail_batch->fk_origin_stock = $batch_id;
688 $line->detail_batch->batch = $lotStock->batch;
689 $line->detail_batch->id = $detail_batch->id;
690 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
691 $line->detail_batch->qty = $batch_qty;
692 if ($line->update($user) < 0) {
703 unset($_POST[$batch]);
708 $batch =
"batchl".$line_id.
"_0";
709 $qty =
"qtyl".$line_id.
"_0";
713 if ($batch_qty > 0 && !empty($batch_id)) {
714 if ($lotStock->fetch($batch_id) > 0) {
716 if ($lines[$i]->entrepot_id > 0) {
718 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
719 $lineIdToAddLot = $line_id;
721 } elseif (count($lines[$i]->details_entrepot) > 1) {
723 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
724 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
725 $lineIdToAddLot = $detail_entrepot->line_id;
729 if ($lineIdToAddLot) {
731 if ($line->fetch($lineIdToAddLot) > 0) {
732 $line->detail_batch->fk_origin_stock = $batch_id;
733 $line->detail_batch->batch = $lotStock->batch;
734 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
735 $line->detail_batch->qty = $batch_qty;
736 if ($line->update($user) < 0) {
748 $line->origin_line_id = $lines[$i]->origin_line_id;
749 $line->entrepot_id = $lotStock->warehouseid;
751 $line->detail_batch[0]->fk_origin_stock = $batch_id;
752 $line->detail_batch[0]->batch = $lotStock->batch;
753 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
754 $line->detail_batch[0]->qty = $batch_qty;
755 if (
$object->create_line_batch($line, $line->array_options) < 0) {
768 if ($lines[$i]->fk_product > 0) {
770 if ($lines[$i]->entrepot_id == 0) {
772 $stockLocation =
"entl".$line_id;
773 $qty =
"qtyl".$line_id;
774 $line->id = $line_id;
775 $line->entrepot_id =
GETPOSTINT($stockLocation);
777 if ($line->update($user) < 0) {
781 unset($_POST[$stockLocation]);
783 } elseif ($lines[$i]->entrepot_id > 0) {
785 $stockLocation =
"entl".$line_id;
786 $qty =
"qtyl".$line_id;
787 $line->id = $line_id;
788 $line->entrepot_id =
GETPOSTINT($stockLocation);
790 if ($line->update($user) < 0) {
794 unset($_POST[$stockLocation]);
796 } elseif (count($lines[$i]->details_entrepot) > 1) {
798 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
800 $stockLocation =
"entl".$detail_entrepot->line_id;
801 $qty =
"qtyl".$detail_entrepot->line_id;
803 if (!empty($warehouse)) {
804 $line->id = $detail_entrepot->line_id;
805 $line->entrepot_id = $warehouse;
807 if ($line->update($user) < 0) {
814 unset($_POST[$stockLocation]);
818 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
819 $qty =
"qtyl".$line_id;
820 $line->id = $line_id;
822 $line->entrepot_id = 0;
823 if ($line->update($user) < 0) {
833 $qty =
"qtyl".$line_id;
834 $line->id = $line_id;
836 $line->entrepot_id = 0;
837 if ($line->update($user) < 0) {
847 if (empty($update_done)) {
848 $line->id = $lines[$i]->id;
849 $line->insertExtraFields();
854 unset($_POST[
"lineid"]);
859 $outputlangs = $langs;
862 $newlang =
GETPOST(
'lang_id',
'aZ09');
865 $newlang =
$object->thirdparty->default_lang;
867 if (!empty($newlang)) {
869 $outputlangs->setDefaultLang($newlang);
873 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
876 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
879 } elseif ($action ==
'updateline' && $user->hasRight(
'expedition',
'creer') &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
880 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
884 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
890 $triggersendname =
'SHIPPING_SENTBYMAIL';
892 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
893 $mode =
'emailfromshipment';
894 $trackid =
'shi'.$object->id;
895 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
903$title =
$object->ref.
' - '.$langs->trans(
"Shipment");
904if ($action ==
'create2') {
905 $title = $langs->trans(
"CreateShipment");
907$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
915$form =
new Form($db);
918if (isModEnabled(
'project')) {
922$product_static =
new Product($db);
924$warehousestatic =
new Entrepot($db);
926if ($action ==
'create2') {
929 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
936if ($action ==
'create') {
946 $classname = ucfirst($origin);
949 if (
$object->fetch($origin_id)) {
953 $author =
new User($db);
954 $author->fetch(
$object->user_author_id);
956 if (isModEnabled(
'stock')) {
960 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
961 print
'<input type="hidden" name="token" value="'.newToken().
'">';
962 print
'<input type="hidden" name="action" value="add">';
963 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
964 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
966 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
971 print
'<table class="border centpercent">';
974 print
'<tr><td class="titlefieldcreate fieldrequired">';
975 if ($origin ==
'commande' && isModEnabled(
'order')) {
976 print $langs->trans(
"RefOrder");
978 if ($origin ==
'propal' && isModEnabled(
"propal")) {
979 print $langs->trans(
"RefProposal");
981 print
'</td><td colspan="3">';
988 if ($origin ==
'commande') {
989 print $langs->trans(
'RefCustomerOrder');
990 } elseif ($origin ==
'propal') {
991 print $langs->trans(
'RefCustomerOrder');
993 print $langs->trans(
'RefCustomer');
995 print
'</td><td colspan="3">';
996 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
1001 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
1002 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
1006 if (isModEnabled(
'project')) {
1008 if (empty($projectid) && !empty(
$object->fk_project)) {
1009 $projectid =
$object->fk_project;
1011 if ($origin ==
'project') {
1012 $projectid = ($originid ? $originid : 0);
1015 $langs->load(
"projects");
1017 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1018 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1019 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
1020 print
' <a class="paddingleft" href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$soc->id.
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create&socid='.$soc->id).
'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
1026 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1027 print
'<td colspan="3">';
1028 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1029 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1030 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1035 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1036 print
'<td colspan="3">';
1037 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1038 print $doleditor->Create(1);
1042 if (
$object->note_private && !$user->socid) {
1043 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1044 print
'<td colspan="3">';
1045 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1046 print $doleditor->Create(1);
1052 print $langs->trans(
"Weight");
1053 print
'</td><td colspan="3">';
1054 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1055 print
'<input name="weight" size="4" value="'.GETPOSTINT(
'weight').
'"> ';
1056 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
1057 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1058 print $form->textwithpicto($text, $htmltext);
1062 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1063 print
' </td><td colspan="3">';
1064 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1065 print
'<input name="sizeW" size="4" value="'.GETPOSTINT(
'sizeW').
'">';
1066 print
' x <input name="sizeH" size="4" value="'.GETPOSTINT(
'sizeH').
'">';
1067 print
' x <input name="sizeS" size="4" value="'.GETPOSTINT(
'sizeS').
'">';
1069 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
1070 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1071 print $form->textwithpicto($text, $htmltext);
1075 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1076 print
'<td colspan="3">';
1077 $expe->fetch_delivery_methods();
1078 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1079 print $form->selectarray(
"shipping_method_id", $expe->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1081 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1083 print
"</td></tr>\n";
1086 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1087 print
'<td colspan="3">';
1088 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1089 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1090 print
"</td></tr>\n";
1093 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1094 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $expe, $action);
1095 print $hookmanager->resPrint;
1097 if (empty($reshook)) {
1099 if (
$object->fetch_optionals() > 0) {
1100 $expe->array_options = array_merge($expe->array_options,
$object->array_options);
1102 print $expe->showOptionals($extrafields,
'edit', $parameters);
1107 if (isModEnabled(
'incoterm')) {
1109 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1110 print
'<td colspan="3" class="maxwidthonsmartphone">';
1111 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1112 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1117 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1119 if (is_countable($list) && count($list) > 1) {
1120 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1121 print
'<td colspan="3">';
1122 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1123 print $form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1124 print
"</td></tr>\n";
1134 $numAsked = count(
$object->lines);
1136 print
'<script type="text/javascript">'.
"\n";
1137 print
'jQuery(document).ready(function() {'.
"\n";
1138 print
'jQuery("#autofill").click(function() {';
1140 while ($i < $numAsked) {
1141 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1142 if (isModEnabled(
'productbatch')) {
1143 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1147 print
'return false; });'.
"\n";
1148 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1149 print
'return false; });'.
"\n";
1151 print
'</script>'.
"\n";
1155 print
'<table class="noborder centpercent">';
1161 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1164 print
'<tr class="liste_titre">';
1165 print
'<td>'.$langs->trans(
"Description").
'</td>';
1166 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1167 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1168 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1169 if (empty($conf->productbatch->enabled)) {
1170 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1175 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1177 if (isModEnabled(
'stock')) {
1178 if (empty($conf->productbatch->enabled)) {
1179 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1181 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1185 print
'<td class="left">'.$langs->trans(
'StockEntryDate').
'</td>';
1191 $warehousePicking = array();
1193 if ($warehouse_id > 0) {
1194 $warehousePicking[] = $warehouse_id;
1196 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1200 while ($indiceAsked < $numAsked) {
1203 $line =
$object->lines[$indiceAsked];
1205 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1206 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
1211 if (empty($reshook)) {
1213 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1216 if (!empty($line->date_start)) {
1219 if (!empty($line->date_end)) {
1223 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1224 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1227 if ($line->fk_product > 0) {
1228 $res = $product->fetch($line->fk_product);
1232 $product->load_stock(
'warehouseopen');
1236 print
'<a name="'.$line->id.
'"></a>';
1239 $product_static->type = $line->fk_product_type;
1240 $product_static->id = $line->fk_product;
1241 $product_static->ref = $line->ref;
1242 $product_static->status = $line->product_tosell;
1243 $product_static->status_buy = $line->product_tobuy;
1244 $product_static->status_batch = $line->product_tobatch;
1246 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1248 $text = $product_static->getNomUrl(1);
1249 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1252 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1255 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1258 if ($showdescinproductdesc) {
1259 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1266 $text =
img_object($langs->trans(
'Service'),
'service');
1268 $text =
img_object($langs->trans(
'Product'),
'product');
1271 if (!empty($line->label)) {
1272 $text .=
' <strong>'.$line->label.
'</strong>';
1273 print $form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1275 print $text.
' '.nl2br($line->desc);
1279 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1290 print
'<td class="center">'.$line->qty;
1291 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1292 print
''.$unit_order.
'</td>';
1293 $qtyProdCom = $line->qty;
1296 print
'<td class="center">';
1297 $quantityDelivered = isset(
$object->expeditions[$line->id]) ?
$object->expeditions[$line->id] :
'';
1298 print $quantityDelivered;
1299 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1300 print
''.$unit_order.
'</td>';
1303 $quantityAsked = $line->qty;
1305 $quantityToBeDelivered = 0;
1307 if (is_numeric($quantityDelivered)) {
1308 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1310 $quantityToBeDelivered = $quantityAsked;
1314 $warehouseObject =
null;
1315 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled(
'stock')) {
1316 print
'<!-- Case warehouse already known or product not a predefined product -->';
1318 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1320 $deliverableQty = $quantityToBeDelivered;
1322 $deliverableQty = min($quantityToBeDelivered, $stock);
1324 if ($deliverableQty < 0) {
1325 $deliverableQty = 0;
1327 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1329 print
'<td class="center">';
1332 $deliverableQty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1334 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1335 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.
'">';
1338 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1339 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1342 print $langs->trans(
"NA");
1347 if (isModEnabled(
'stock')) {
1348 print
'<td class="left">';
1351 $ent =
"entl".$indiceAsked;
1352 $idl =
"idl".$indiceAsked;
1354 if ($line->fk_product > 0) {
1355 print
'<!-- Show warehouse selection -->';
1361 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1363 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1365 if ($stock < $quantityToBeDelivered) {
1366 print
' '.img_warning($langs->trans(
"StockTooLow"));
1371 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span><input name="entl'.$indiceAsked.
'" id="entl'.$indiceAsked.
'" type="hidden" value="0">';
1382 $product->get_sousproduits_arbo();
1383 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1384 if (count($prods_arbo) > 0) {
1385 foreach ($prods_arbo as $key => $value) {
1388 if ($value[
'stock'] < $value[
'stock_alert']) {
1391 print
"<tr class=\"oddeven\"><td> ->
1392 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1393 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1394 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1404 print
'<td></td><td></td>';
1409 print
'<!-- Case product need lot -->';
1411 $staticwarehouse =
new Entrepot($db);
1412 if ($warehouse_id > 0) {
1413 $staticwarehouse->fetch($warehouse_id);
1419 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1420 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1424 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1425 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1426 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1428 $batchStock = + $dbatch->qty;
1429 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1432 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1433 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1435 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1436 $alreadyQtyBatchSetted[$line->fk_product] = array();
1439 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1440 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1443 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1446 if ($deliverableQty < 0) $deliverableQty = 0;
1448 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1449 if (GETPOSTISSET($inputName)) {
1450 $deliverableQty =
GETPOST($inputName,
'int');
1453 $tooltipClass = $tooltipTitle =
'';
1454 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1455 $tooltipClass =
' classfortooltip';
1456 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1458 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1460 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1462 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1463 print
'<td colspan="3" ></td><td class="center">';
1464 print
'<input class="qtyl '.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1467 print
'<!-- Show details of lot -->';
1468 print
'<td class="left">';
1470 print $staticwarehouse->getNomUrl(0).
' / ';
1472 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1475 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1477 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1480 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1482 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1486 $quantityToBeDelivered -= $deliverableQty;
1487 if ($quantityToBeDelivered < 0) {
1488 $quantityToBeDelivered = 0;
1493 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1498 print
'<!-- Case there is no details of lot at all -->';
1499 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1500 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1503 print
'<td class="left">';
1504 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1514 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1515 print
'<!-- Case warehouse not already known and product does not need lot -->';
1516 print
'<td></td><td></td>';
1522 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1527 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1528 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1532 $tmpwarehouseObject =
new Entrepot($db);
1533 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1535 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1540 $tmpwarehouseObject->fetch($warehouse_id);
1541 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1542 $stock = + $stock_warehouse->real;
1543 $deliverableQty = min($quantityToBeDelivered, $stock);
1544 $deliverableQty = max(0, $deliverableQty);
1546 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1547 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1549 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1550 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1552 if (!isset($alreadyQtySetted[$line->fk_product])) {
1553 $alreadyQtySetted[$line->fk_product] = array();
1556 $deliverableQty = min($quantityToBeDelivered, $stock);
1559 if ($deliverableQty < 0) {
1560 $deliverableQty = 0;
1563 $tooltipClass = $tooltipTitle =
'';
1564 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1565 $tooltipClass =
' classfortooltip';
1566 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1568 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1571 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1573 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1574 if (GETPOSTISSET($inputName)) {
1578 print
'<input class="qtyl'.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1579 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1582 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1585 print $langs->trans(
"NA");
1590 if (isModEnabled(
'stock')) {
1591 print
'<td class="left">';
1593 print $tmpwarehouseObject->getNomUrl(0).
' ';
1595 print
'<!-- Show details of stock -->';
1596 print
'('.$stock.
')';
1598 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1602 $quantityToBeDelivered -= $deliverableQty;
1603 if ($quantityToBeDelivered < 0) {
1604 $quantityToBeDelivered = 0;
1615 $product->get_sousproduits_arbo();
1616 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1617 if (count($prods_arbo) > 0) {
1618 foreach ($prods_arbo as $key => $value) {
1621 if ($value[
'stock'] < $value[
'stock_alert']) {
1624 print
'<tr class"oddeven"><td>';
1625 print
" ->
1626 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1627 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1628 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1637 print
'<!-- Case warehouse not already known and product need lot -->';
1638 print
'<td></td><td></td>';
1645 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1647 $tmpwarehouseObject =
new Entrepot($db);
1652 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1653 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1654 $nbofsuggested += count($stock_warehouse->detail_batch);
1658 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1660 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1665 $tmpwarehouseObject->fetch($warehouse_id);
1666 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1667 foreach ($stock_warehouse->detail_batch as $dbatch) {
1668 $batchStock = + $dbatch->qty;
1669 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1670 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1672 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1673 $alreadyQtyBatchSetted[$line->fk_product] = array();
1676 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1677 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1680 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1683 if ($deliverableQty < 0) {
1684 $deliverableQty = 0;
1687 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1688 if (GETPOSTISSET($inputName)) {
1692 $tooltipClass = $tooltipTitle =
'';
1693 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1694 $tooltipClass =
' classfortooltip';
1695 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1697 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1699 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1701 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1702 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1705 print
'<td class="left">';
1707 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1709 print
'<!-- Show details of lot -->';
1710 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1713 print $langs->trans(
"Batch").
': ';
1714 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1716 print $productlotObject->getNomUrl(1);
1718 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1721 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1724 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1726 print
' ('.$dbatch->qty.
')';
1727 $quantityToBeDelivered -= $deliverableQty;
1728 if ($quantityToBeDelivered < 0) {
1729 $quantityToBeDelivered = 0;
1735 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1743 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1745 print
'<!-- line not shown yet, we show it -->';
1746 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1750 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1751 $disabled =
'disabled="disabled"';
1753 if ($warehouse_selected_id <= 0) {
1754 $disabled =
'disabled="disabled"';
1756 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1758 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1762 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1763 $disabled =
'disabled="disabled"';
1765 if ($warehouse_selected_id <= 0) {
1766 $disabled =
'disabled="disabled"';
1768 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$quantityToBeDelivered.
'"'.($disabled ?
' '.$disabled :
'').
'> ';
1770 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1773 print $langs->trans(
"NA");
1777 print
'<td class="left">';
1779 if ($warehouse_selected_id > 0) {
1780 $warehouseObject =
new Entrepot($db);
1781 $warehouseObject->fetch($warehouse_selected_id);
1782 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1784 if ($line->fk_product) {
1785 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1791 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1803 if (!empty($extrafields)) {
1809 $srcLine->id = $line->id;
1810 $srcLine->fetch_optionals();
1812 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1814 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1825 print $form->buttonsSaveCancel(
"Create");
1842 $num_prod = count($lines);
1845 $typeobject =
$object->origin;
1847 $origin_id =
$object->origin_id;
1855 $res =
$object->fetch_optionals();
1863 if ($action ==
'delete') {
1864 $formquestion = array();
1866 $formquestion = array(
1868 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1869 'name' =>
'alsoUpdateStock',
1870 'type' =>
'checkbox',
1875 $formconfirm = $form->formconfirm(
1876 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1877 $langs->trans(
'DeleteSending'),
1878 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1887 if ($action ==
'valid') {
1888 $objectref = substr(
$object->ref, 1, 4);
1889 if ($objectref ==
'PROV') {
1890 $numref =
$object->getNextNumRef($soc);
1895 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1897 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1899 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1902 if (isModEnabled(
'notification')) {
1903 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1904 $notify =
new Notify($db);
1906 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1909 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1912 if ($action ==
'cancel') {
1913 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1917 $parameters = array(
'formConfirm' => $formconfirm);
1918 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1919 if (empty($reshook)) {
1920 $formconfirm .= $hookmanager->resPrint;
1921 } elseif ($reshook > 0) {
1922 $formconfirm = $hookmanager->resPrint;
1930 $tmparray =
$object->getTotalWeightVolume();
1931 $totalWeight = $tmparray[
'weight'];
1932 $totalVolume = $tmparray[
'volume'];
1934 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
'order')) {
1936 $objectsrc->fetch(
$object->origin_object->id);
1938 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
"propal")) {
1939 $objectsrc =
new Propal($db);
1940 $objectsrc->fetch(
$object->origin_object->id);
1944 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1945 $morehtmlref =
'<div class="refidno">';
1947 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1948 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ?
':' .
getDolGlobalString(
'THIRDPARTY_REF_INPUT_SIZE') :
''),
'', null, null,
'', 1);
1950 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1952 if (isModEnabled(
'project')) {
1953 $langs->load(
"projects");
1954 $morehtmlref .=
'<br>';
1956 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1957 if ($action !=
'classify') {
1958 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1960 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1962 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1964 $proj->fetch($objectsrc->fk_project);
1965 $morehtmlref .= $proj->getNomUrl(1);
1967 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1972 $morehtmlref .=
'</div>';
1975 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1978 print
'<div class="fichecenter">';
1979 print
'<div class="fichehalfleft">';
1980 print
'<div class="underbanner clearboth"></div>';
1982 print
'<table class="border tableforfield centpercent">';
1985 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
1987 print $langs->trans(
"RefOrder").
'</td>';
1988 print
'<td colspan="3">';
1989 print $objectsrc->getNomUrl(1,
'commande');
1993 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1995 print $langs->trans(
"RefProposal").
'</td>';
1996 print
'<td colspan="3">';
1997 print $objectsrc->getNomUrl(1,
'expedition');
2003 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
2004 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
2008 print
'<tr><td height="10">';
2009 print
'<table class="nobordernopadding centpercent"><tr><td>';
2010 print $langs->trans(
'DateDeliveryPlanned');
2013 if ($action !=
'editdate_livraison') {
2014 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_livraison&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetDeliveryDate'), 1).
'</a></td>';
2016 print
'</tr></table>';
2017 print
'</td><td colspan="2">';
2018 if ($action ==
'editdate_livraison') {
2019 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2020 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2021 print
'<input type="hidden" name="action" value="setdate_livraison">';
2022 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2023 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2033 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
2034 print
'</td><td colspan="3">';
2036 if ($action ==
'edittrueWeight') {
2037 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2038 print
'<input name="action" value="settrueWeight" type="hidden">';
2039 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2040 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2041 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
2042 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
2043 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2044 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2048 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2052 if ($totalWeight > 0) {
2053 if (!empty(
$object->trueWeight)) {
2054 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2056 print
showDimensionInBestUnit($totalWeight, 0,
"weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT :
'no');
2057 if (!empty(
$object->trueWeight)) {
2064 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2065 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2066 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2070 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2071 if ($action ==
'edittrueHeight') {
2072 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2073 print
'<input name="action" value="settrueHeight" type="hidden">';
2074 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2075 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2076 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2077 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2078 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2079 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2083 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2089 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2090 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2091 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2096 print $langs->trans(
"Volume");
2098 print
'<td colspan="3">';
2099 $calculatedVolume = 0;
2103 $volumeUnit =
$object->size_units * 3;
2106 if ($calculatedVolume > 0) {
2107 if ($volumeUnit < 50) {
2108 print
showDimensionInBestUnit($calculatedVolume, $volumeUnit,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
2113 if ($totalVolume > 0) {
2114 if ($calculatedVolume) {
2115 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2117 print
showDimensionInBestUnit($totalVolume, 0,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
2119 if ($calculatedVolume) {
2128 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2133 print
'<div class="fichehalfright">';
2134 print
'<div class="underbanner clearboth"></div>';
2136 print
'<table class="border centpercent tableforfield">';
2139 print
'<tr><td height="10">';
2140 print
'<table class="nobordernopadding centpercent"><tr><td>';
2141 print $langs->trans(
'SendingMethod');
2144 if ($action !=
'editshipping_method_id') {
2145 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editshipping_method_id&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetSendingMethod'), 1).
'</a></td>';
2147 print
'</tr></table>';
2148 print
'</td><td colspan="2">';
2149 if ($action ==
'editshipping_method_id') {
2150 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2151 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2152 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2153 $object->fetch_delivery_methods();
2154 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2156 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2158 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2161 if (
$object->shipping_method_id > 0) {
2163 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2164 print $langs->trans(
"SendingMethod".strtoupper($code));
2171 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2172 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2176 if (isModEnabled(
'incoterm')) {
2178 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2179 print $langs->trans(
'IncotermLabel');
2180 print
'<td><td class="right">';
2181 if ($user->hasRight(
'expedition',
'creer')) {
2182 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2186 print
'</td></tr></table>';
2188 print
'<td colspan="3">';
2189 if ($action !=
'editincoterm') {
2190 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2192 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2198 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2199 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2200 print $hookmanager->resPrint;
2207 print
'<div class="clearboth"></div>';
2212 if ($action ==
'editline') {
2213 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2214 <input type="hidden" name="token" value="' .
newToken().
'">
2215 <input type="hidden" name="action" value="updateline">
2216 <input type="hidden" name="mode" value="">
2217 <input type="hidden" name="id" value="' .
$object->id.
'">
2222 print
'<div class="div-table-responsive-no-min">';
2223 print
'<table class="noborder" width="100%" id="tablelines" >';
2225 print
'<tr class="liste_titre">';
2228 print
'<td width="5" class="center linecolnum"> </td>';
2231 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2233 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2234 if ($origin && $origin_id > 0) {
2235 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2237 if ($action ==
'editline') {
2239 if (!isModEnabled(
'stock')) {
2242 if (empty($conf->productbatch->enabled)) {
2245 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2247 print $langs->trans(
"QtyToShip").
' - ';
2249 print $langs->trans(
"QtyShipped").
' - ';
2251 if (isModEnabled(
'stock')) {
2252 print $langs->trans(
"WarehouseSource").
' - ';
2254 if (isModEnabled(
'productbatch')) {
2255 print $langs->trans(
"Batch");
2260 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2262 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2264 if (isModEnabled(
'stock')) {
2265 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2268 if (isModEnabled(
'productbatch')) {
2269 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2272 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2273 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2276 print
'<td class="linecoledit"></td>';
2277 print
'<td class="linecoldelete" width="10"></td>';
2282 $outputlangs = $langs;
2287 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2288 $newlang =
GETPOST(
'lang_id',
'aZ09');
2290 if (empty($newlang)) {
2291 $newlang =
$object->thirdparty->default_lang;
2293 if (!empty($newlang)) {
2294 $outputlangs =
new Translate(
"", $conf);
2295 $outputlangs->setDefaultLang($newlang);
2300 $alreadysent = array();
2301 if ($origin && $origin_id > 0) {
2302 $sql =
"SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end";
2303 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2304 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2306 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch';
2307 $sql .=
', p.description as product_desc';
2308 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2309 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2310 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2312 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2313 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2314 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2315 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2316 $sql .=
" AND ed.fk_expedition = e.rowid";
2318 $sql .=
" ORDER BY obj.fk_product";
2320 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2321 $resql = $db->query($sql);
2323 $num = $db->num_rows($resql);
2327 $obj = $db->fetch_object($resql);
2330 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2331 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2332 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2333 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2344 for ($i = 0; $i < $num_prod; $i++) {
2345 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2346 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
2351 if (empty($reshook)) {
2352 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2353 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2357 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2361 if ($lines[$i]->fk_product > 0) {
2365 $prod->fetch($lines[$i]->fk_product);
2366 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2368 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2371 print
'<td class="linecoldescription">';
2374 $product_static->type = $lines[$i]->fk_product_type;
2375 $product_static->id = $lines[$i]->fk_product;
2376 $product_static->ref = $lines[$i]->ref;
2377 $product_static->status = $lines[$i]->product_tosell;
2378 $product_static->status_buy = $lines[$i]->product_tobuy;
2379 $product_static->status_batch = $lines[$i]->product_tobatch;
2381 $product_static->weight = $lines[$i]->weight;
2382 $product_static->weight_units = $lines[$i]->weight_units;
2383 $product_static->length = $lines[$i]->length;
2384 $product_static->length_units = $lines[$i]->length_units;
2385 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2386 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2387 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2388 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2389 $product_static->surface = $lines[$i]->surface;
2390 $product_static->surface_units = $lines[$i]->surface_units;
2391 $product_static->volume = $lines[$i]->volume;
2392 $product_static->volume_units = $lines[$i]->volume_units;
2394 $text = $product_static->getNomUrl(1);
2395 $text .=
' - '.$label;
2397 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
2398 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2404 print
'<td class="linecoldescription" >';
2406 $text =
img_object($langs->trans(
'Service'),
'service');
2408 $text =
img_object($langs->trans(
'Product'),
'product');
2411 if (!empty($lines[$i]->label)) {
2412 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2413 print $form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2428 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2431 if ($origin && $origin_id > 0) {
2432 print
'<td class="linecolqtyinothershipments center nowrap">';
2434 $qtyalreadysent = 0;
2435 foreach ($alreadysent as $key => $val) {
2436 if ($lines[$i]->fk_elementdet == $key) {
2438 foreach ($val as $shipmentline_id => $shipmentline_var) {
2439 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2445 $htmltooltip .=
'<br>';
2447 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2448 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2449 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2450 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2457 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2460 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2464 print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2468 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2470 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2471 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2472 print
'<!-- case edit 1 -->';
2474 foreach ($lines[$i]->detail_batch as $detail_batch) {
2477 print
'<td><input class="qtyl right" name="qtyl'.$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id.
'" id="qtyl'.$line_id.
'_'.$detail_batch->id.
'" type="text" size="4" value="'.$detail_batch->qty.
'"></td>';
2479 if ($lines[$i]->entrepot_id == 0) {
2481 $line->fetch($detail_batch->fk_expeditiondet);
2483 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2484 print
'<td>'.$formproduct->selectLotStock($detail_batch->fk_origin_stock,
'batchl'.$detail_batch->fk_expeditiondet.
'_'.$detail_batch->fk_origin_stock,
'', 1, 0, $lines[$i]->fk_product, $entrepot_id).
'</td>';
2490 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2492 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2494 } elseif (isModEnabled(
'stock')) {
2495 if ($lines[$i]->fk_product > 0) {
2496 if ($lines[$i]->entrepot_id > 0) {
2497 print
'<!-- case edit 2 -->';
2500 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2502 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2504 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2506 } elseif (count($lines[$i]->details_entrepot) > 1) {
2507 print
'<!-- case edit 3 -->';
2508 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2511 print
'<td><input class="qtyl right" name="qtyl'.$detail_entrepot->line_id.
'" id="qtyl'.$detail_entrepot->line_id.
'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.
'">'.$unit_order.
'</td>';
2513 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2515 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2519 print
'<!-- case edit 4 -->';
2522 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2523 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2527 print
'<!-- case edit 5 -->';
2528 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2531 print
'<!-- case edit 6 -->';
2534 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2541 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2542 print
'<!-- case edit 7 -->';
2545 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2553 print
'</table></td>';
2556 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2559 if (isModEnabled(
'stock')) {
2560 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2562 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2563 } elseif ($lines[$i]->entrepot_id > 0) {
2565 $entrepot->fetch($lines[$i]->entrepot_id);
2566 print $entrepot->getNomUrl(1);
2567 } elseif (count($lines[$i]->details_entrepot) > 1) {
2569 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2570 if ($detail_entrepot->entrepot_id > 0) {
2572 $entrepot->fetch($detail_entrepot->entrepot_id);
2573 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2576 print $form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2582 if (isModEnabled(
'productbatch')) {
2583 if (isset($lines[$i]->detail_batch)) {
2584 print
'<!-- Detail of lot -->';
2585 print
'<td class="linecolbatch">';
2586 if ($lines[$i]->product_tobatch) {
2588 foreach ($lines[$i]->detail_batch as $dbatch) {
2589 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2591 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2594 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2596 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2599 print $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2601 print $langs->trans(
"NA");
2605 print
'<td class="linecolbatch" ></td>';
2611 print
'<td class="center linecolweight">';
2613 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2620 print
'<td class="center linecolvolume">';
2622 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2631 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2632 print
'<td class="center" colspan="2" valign="middle">';
2633 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2634 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2638 print
'<td class="linecoledit center">';
2639 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2641 print
'<td class="linecoldelete" width="10">';
2642 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2646 if (!empty($rowExtrafieldsStart)) {
2647 print $rowExtrafieldsStart;
2648 print $rowExtrafieldsView;
2656 if (!empty($extrafields)) {
2658 if ($origin && $origin_id > 0) {
2661 if (isModEnabled(
'productbatch')) {
2664 if (isModEnabled(
'stock')) {
2669 $line->fetch_optionals();
2672 if ($action ==
'editline' && $line->id == $line_id) {
2673 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2675 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2683 if (empty($num_prod)) {
2684 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2702 if (($user->socid == 0) && ($action !=
'presend')) {
2703 print
'<div class="tabsAction">';
2705 $parameters = array();
2706 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2708 if (empty($reshook)) {
2710 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2711 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2714 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2720 if ($user->hasRight(
'expedition',
'creer')) {
2725 if ($user->hasRight(
'expedition',
'creer')) {
2731 if (empty($user->socid)) {
2733 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2734 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2736 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2743 if ($user->hasRight(
'facture',
'creer')) {
2745 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2753 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2758 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2760 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2768 if ($user->hasRight(
'expedition',
'creer')) {
2769 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2774 if ($user->hasRight(
'expedition',
'supprimer')) {
2787 if ($action !=
'presend' && $action !=
'editline') {
2788 print
'<div class="fichecenter"><div class="fichehalfleft">';
2791 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2793 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2795 $genallowed = $user->hasRight(
'expedition',
'lire');
2796 $delallowed = $user->hasRight(
'expedition',
'creer');
2798 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2802 $linktoelem = $form->showLinkToObjectBlock(
$object,
null, array(
'shipping'));
2803 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2809 print
'<br><!-- Link to sign -->';
2810 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2811 print showOnlineSignatureUrl(
'expedition',
$object->ref,
$object).
'<br>';
2814 print
'</div><div class="fichehalfright">';
2817 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2819 $somethingshown = $formactions->showactions(
$object,
'shipping', $socid, 1);
2821 print
'</div></div>';
2830 if (
GETPOST(
'modelselected')) {
2831 $action =
'presend';
2835 $modelmail =
'shipping_send';
2836 $defaulttopic =
'SendShippingRef';
2837 $diroutput = $conf->expedition->dir_output.
'/sending';
2838 $trackid =
'shi'.$object->id;
2840 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage shipments.
const STATUS_DRAFT
Draft status.
const STATUS_CLOSED
Closed status -> parcel was received by customer / end of process prev status : validated or shipment...
const STATUS_VALIDATED
Validated status -> parcel is ready to be sent prev status : draft next status : closed or shipment_i...
Class to manage lines of shipment.
CRUD class for batch number management within shipment.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation models.
Class to manage the table of subscription to notifications.
Class to manage order lines.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
measuringUnitString($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
shipping_prepare_head($object)
Prepare array with list of tabs.