39 require
'../main.inc.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
66 $langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal'));
69 $langs->load(
'incoterm');
72 $langs->load(
'productbatch');
75 $origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'expedition';
78 if (empty($origin_id)) {
79 $origin_id =
GETPOST(
'origin_id',
'int');
81 if (empty($origin_id)) {
82 $origin_id =
GETPOST(
'object_id',
'int');
85 $line_id =
GETPOST(
'lineid',
'int') ?
GETPOST(
'lineid',
'int') :
'';
86 $facid =
GETPOST(
'facid',
'int');
88 $action =
GETPOST(
'action',
'alpha');
89 $confirm =
GETPOST(
'confirm',
'alpha');
90 $cancel =
GETPOST(
'cancel',
'alpha');
93 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
94 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
95 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
102 $extrafields->fetch_name_optionals_label($object->table_element);
103 $extrafields->fetch_name_optionals_label($object->table_element_line);
104 $extrafields->fetch_name_optionals_label($objectorder->table_element_line);
107 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
110 $hookmanager->initHooks(array(
'expeditioncard',
'globalcard'));
112 $date_delivery =
dol_mktime(
GETPOST(
'date_deliveryhour',
'int'),
GETPOST(
'date_deliverymin',
'int'), 0,
GETPOST(
'date_deliverymonth',
'int'),
GETPOST(
'date_deliveryday',
'int'),
GETPOST(
'date_deliveryyear',
'int'));
114 if ($id > 0 || !empty($ref)) {
115 $object->fetch($id, $ref);
116 $object->fetch_thirdparty();
122 $socid = $user->socid;
127 $permissiondellink = $user->rights->expedition->delivery->creer;
128 $permissiontoadd = $user->rights->expedition->creer;
136 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
141 if (empty($reshook)) {
143 if ($origin && $origin_id > 0) {
144 if ($origin ==
'commande') {
145 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
154 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
157 $upload_dir = $conf->expedition->dir_output.
'/sending';
158 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
161 if ($action ==
'reopen' && $user->rights->expedition->creer) {
163 $result = $object->reOpen();
167 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm')) {
168 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
171 if ($action ==
'setref_customer') {
172 $result = $object->fetch($id);
177 $result = $object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
180 $action =
'editref_customer';
182 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
187 if ($action ==
'update_extras') {
191 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
198 $result = $object->insertExtraFields(
'SHIPMENT_MODIFY');
206 $action =
'edit_extras';
211 if ($action ==
'add' && $user->rights->expedition->creer) {
216 $object->note =
GETPOST(
'note',
'alpha');
217 $object->origin = $origin;
218 $object->origin_id = $origin_id;
219 $object->fk_project =
GETPOST(
'projectid',
'int');
220 $object->weight =
GETPOST(
'weight',
'int') ==
'' ?
"NULL" :
GETPOST(
'weight',
'int');
221 $object->sizeH =
GETPOST(
'sizeH',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeH',
'int');
222 $object->sizeW =
GETPOST(
'sizeW',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeW',
'int');
223 $object->sizeS =
GETPOST(
'sizeS',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeS',
'int');
224 $object->size_units =
GETPOST(
'size_units',
'int');
225 $object->weight_units =
GETPOST(
'weight_units',
'int');
230 $classname = ucfirst($object->origin);
231 $objectsrc =
new $classname($db);
232 $objectsrc->fetch($object->origin_id);
234 $object->socid = $objectsrc->socid;
235 $object->ref_customer =
GETPOST(
'ref_customer',
'alpha');
236 $object->model_pdf =
GETPOST(
'model');
237 $object->date_delivery = $date_delivery;
238 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
239 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
240 $object->tracking_number =
GETPOST(
'tracking_number',
'alpha');
241 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
242 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
243 $object->fk_incoterms =
GETPOST(
'incoterm_id',
'int');
244 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
246 $batch_line = array();
247 $stockLine = array();
248 $array_options = array();
250 $num = count($objectsrc->lines);
253 for ($i = 0; $i < $num; $i++) {
260 $batch =
"batchl".$i.
"_0";
261 $stockLocation =
"ent1".$i.
"_0";
264 $is_batch_or_serial=0;
265 if (!empty($objectsrc->lines[$i]->fk_product)) {
266 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
267 if ($resultFetch < 0) {
270 $is_batch_or_serial = $product->status_batch;
274 if (
isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
281 $sub_qty[$j][
'id_batch'] =
GETPOST($batch,
'int');
282 $subtotalqty += $sub_qty[$j][
'q'];
290 if ($is_batch_or_serial==2 && $sub_qty[$j][
'q']>1) {
291 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
296 $batch =
"batchl".$i.
"_".$j;
297 $qty =
"qtyl".$i.
'_'.$j;
300 $batch_line[$i][
'detail'] = $sub_qty;
301 $batch_line[$i][
'qty'] = $subtotalqty;
302 $batch_line[$i][
'ix_l'] =
GETPOST($idl,
'int');
304 $totalqty += $subtotalqty;
311 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOST($idl,
'int').
')',
null,
'errors');
321 $stockLine[$i][$j][
'warehouse_id'] =
GETPOST($stockLocation,
'int');
322 $stockLine[$i][$j][
'ix_l'] =
GETPOST($idl,
'int');
327 $stockLocation =
"ent1".$i.
"_".$j;
328 $qty =
"qtyl".$i.
'_'.$j;
332 if (
GETPOST($qty,
'int') > 0) {
338 $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
340 if (isset($extrafields->attributes[$object->table_element_line][
'label']) && is_array($extrafields->attributes[$object->table_element_line][
'label'])) {
342 foreach ($extrafields->attributes[$object->table_element_line][
'label'] as $key => $value) {
343 unset($_POST[
"options_".$key]);
349 if (($totalqty > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) && !$error) {
350 for ($i = 0; $i < $num; $i++) {
352 if (!isset($batch_line[$i])) {
354 if (isset($stockLine[$i])) {
356 $nbstockline = count($stockLine[$i]);
357 for ($j = 0; $j < $nbstockline; $j++) {
358 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) {
359 $ret = $object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
367 if (
GETPOST($qty,
'int') > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
370 $entrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') :
GETPOST(
'entrepot_id',
'int');
371 if ($entrepot_id < 0) {
374 if (!($objectsrc->lines[$i]->fk_product > 0)) {
378 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
price2num(
GETPOST($qty,
'alpha'),
'MS'), $array_options[$i]);
387 if ($batch_line[$i][
'qty'] > 0) {
388 $ret = $object->addline_batch($batch_line[$i], $array_options[$i]);
397 $ret = $extrafields->setOptionalsFromPost(
null, $object);
403 $ret = $object->create($user);
410 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
412 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
414 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
420 header(
"Location: card.php?id=".$object->id);
424 $_GET[
"commande_id"] =
GETPOST(
'commande_id',
'int');
427 } elseif ($action ==
'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) {
431 $result = $object->create_delivery($user);
435 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&id='.$result);
442 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' &&
443 ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer))
444 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate)))
446 $object->fetch_thirdparty();
448 $result = $object->valid($user);
454 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
455 $outputlangs = $langs;
458 $newlang =
GETPOST(
'lang_id',
'aZ09');
461 $newlang = $object->thirdparty->default_lang;
463 if (!empty($newlang)) {
465 $outputlangs->setDefaultLang($newlang);
467 $model = $object->model_pdf;
468 $ret = $object->fetch($id);
470 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
476 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->rights->expedition->supprimer) {
477 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
478 $result = $object->cancel(0, $also_update_stock);
480 $result = $object->setStatut(-1);
484 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->expedition->supprimer) {
485 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
486 $result = $object->delete(0, $also_update_stock);
488 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
502 } elseif ($action ==
'setdate_livraison' && !empty($user->rights->expedition->creer)) {
503 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
506 $result = $object->setDeliveryDate($user, $datedelivery);
510 } elseif (($action ==
'settracking_number'
511 || $action ==
'settracking_url'
512 || $action ==
'settrueWeight'
513 || $action ==
'settrueWidth'
514 || $action ==
'settrueHeight'
515 || $action ==
'settrueDepth'
516 || $action ==
'setshipping_method_id')
517 && $user->rights->expedition->creer
522 if ($action ==
'settracking_number') {
523 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
525 if ($action ==
'settracking_url') {
526 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'int'));
528 if ($action ==
'settrueWeight') {
529 $object->trueWeight = trim(
GETPOST(
'trueWeight',
'int'));
530 $object->weight_units =
GETPOST(
'weight_units',
'int');
532 if ($action ==
'settrueWidth') {
533 $object->trueWidth = trim(
GETPOST(
'trueWidth',
'int'));
535 if ($action ==
'settrueHeight') {
536 $object->trueHeight = trim(
GETPOST(
'trueHeight',
'int'));
537 $object->size_units =
GETPOST(
'size_units',
'int');
539 if ($action ==
'settrueDepth') {
540 $object->trueDepth = trim(
GETPOST(
'trueDepth',
'int'));
542 if ($action ==
'setshipping_method_id') {
543 $object->shipping_method_id = trim(
GETPOST(
'shipping_method_id',
'int'));
547 if ($object->update($user) >= 0) {
548 header(
"Location: card.php?id=".$object->id);
555 } elseif ($action ==
'classifybilled') {
557 $result = $object->setBilled();
559 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
563 } elseif ($action ==
'classifyclosed') {
565 $result = $object->setClosed();
567 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
571 } elseif ($action ==
'deleteline' && !empty($line_id)) {
574 $lines = $object->lines;
576 $line->fk_expedition = $object->id;
578 $num_prod = count($lines);
579 for ($i = 0; $i < $num_prod; $i++) {
580 if ($lines[$i]->
id == $line_id) {
581 if (count($lines[$i]->details_entrepot) > 1) {
583 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
584 $line->id = $details_entrepot->line_id;
585 if (!$error && $line->delete($user) < 0) {
591 $line->id = $line_id;
592 if (!$error && $line->delete($user) < 0) {
597 unset($_POST[
"lineid"]);
601 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
606 } elseif ($action ==
'updateline' && $user->rights->expedition->creer &&
GETPOST(
'save')) {
613 $lines = $object->lines;
614 $num_prod = count($lines);
615 for ($i = 0; $i < $num_prod; $i++) {
616 if ($lines[$i]->
id == $line_id) {
617 $update_done =
false;
619 $line->fk_expedition = $object->id;
622 $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
624 if (is_array($extrafields->attributes[$object->table_element_line][
'label'])) {
625 foreach ($extrafields->attributes[$object->table_element_line][
'label'] as $key => $value) {
626 unset($_POST[
"options_".$key]);
629 $line->fk_product = $lines[$i]->fk_product;
630 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
632 foreach ($lines[$i]->detail_batch as $detail_batch) {
634 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
635 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
636 $batch_id =
GETPOST($batch,
'int');
637 $batch_qty =
GETPOST($qty,
'int');
638 if (!empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->qty)) {
639 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
640 if ($lines[$i]->entrepot_id != 0) {
642 $line->entrepot_id = $lotStock->warehouseid;
646 if (empty($line->detail_batch)) {
647 $line->detail_batch =
new stdClass();
650 $line->detail_batch->fk_origin_stock = $batch_id;
651 $line->detail_batch->batch = $lotStock->batch;
652 $line->detail_batch->id = $detail_batch->id;
653 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
654 $line->detail_batch->qty = $batch_qty;
655 if ($line->update($user) < 0) {
666 unset($_POST[$batch]);
671 $batch =
"batchl".$line_id.
"_0";
672 $qty =
"qtyl".$line_id.
"_0";
673 $batch_id =
GETPOST($batch,
'int');
674 $batch_qty =
GETPOST($qty,
'int');
676 if ($batch_qty > 0 && !empty($batch_id)) {
677 if ($lotStock->fetch($batch_id) > 0) {
679 if ($lines[$i]->entrepot_id > 0) {
681 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
682 $lineIdToAddLot = $line_id;
684 } elseif (count($lines[$i]->details_entrepot) > 1) {
686 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
687 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
688 $lineIdToAddLot = $detail_entrepot->line_id;
692 if ($lineIdToAddLot) {
694 if ($line->fetch($lineIdToAddLot) > 0) {
695 $line->detail_batch->fk_origin_stock = $batch_id;
696 $line->detail_batch->batch = $lotStock->batch;
697 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
698 $line->detail_batch->qty = $batch_qty;
699 if ($line->update($user) < 0) {
711 $line->origin_line_id = $lines[$i]->origin_line_id;
712 $line->entrepot_id = $lotStock->warehouseid;
714 $line->detail_batch[0]->fk_origin_stock = $batch_id;
715 $line->detail_batch[0]->batch = $lotStock->batch;
716 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
717 $line->detail_batch[0]->qty = $batch_qty;
718 if ($object->create_line_batch($line, $line->array_options) < 0) {
731 if ($lines[$i]->fk_product > 0) {
733 if ($lines[$i]->entrepot_id > 0) {
735 $stockLocation =
"entl".$line_id;
736 $qty =
"qtyl".$line_id;
737 $line->id = $line_id;
738 $line->entrepot_id =
GETPOST($stockLocation,
'int');
739 $line->qty =
GETPOST($qty,
'int');
740 if ($line->update($user) < 0) {
744 unset($_POST[$stockLocation]);
746 } elseif (count($lines[$i]->details_entrepot) > 1) {
748 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
750 $stockLocation =
"entl".$detail_entrepot->line_id;
751 $qty =
"qtyl".$detail_entrepot->line_id;
752 $warehouse =
GETPOST($stockLocation,
'int');
753 if (!empty($warehouse)) {
754 $line->id = $detail_entrepot->line_id;
755 $line->entrepot_id = $warehouse;
756 $line->qty =
GETPOST($qty,
'int');
757 if ($line->update($user) < 0) {
764 unset($_POST[$stockLocation]);
768 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
769 $qty =
"qtyl".$line_id;
770 $line->id = $line_id;
771 $line->qty =
GETPOST($qty,
'int');
772 $line->entrepot_id = 0;
773 if ($line->update($user) < 0) {
783 $qty =
"qtyl".$line_id;
784 $line->id = $line_id;
785 $line->qty =
GETPOST($qty,
'int');
786 $line->entrepot_id = 0;
787 if ($line->update($user) < 0) {
797 if (empty($update_done)) {
798 $line->id = $lines[$i]->id;
799 $line->insertExtraFields();
804 unset($_POST[
"lineid"]);
807 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
809 $outputlangs = $langs;
812 $newlang =
GETPOST(
'lang_id',
'aZ09');
815 $newlang = $object->thirdparty->default_lang;
817 if (!empty($newlang)) {
819 $outputlangs->setDefaultLang($newlang);
822 $ret = $object->fetch($object->id);
823 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
826 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
829 } elseif ($action ==
'updateline' && $user->rights->expedition->creer &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
830 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
834 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
840 $triggersendname =
'SHIPPING_SENTBYMAIL';
842 $mode =
'emailfromshipment';
843 $trackid =
'shi'.$object->id;
844 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
852 $title = $langs->trans(
"Shipment");
853 if ($action ==
'create2') {
854 $title = $langs->trans(
"CreateShipment");
856 $help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
860 if (empty($action)) {
871 $product_static =
new Product($db);
873 $warehousestatic =
new Entrepot($db);
875 if ($action ==
'create2') {
878 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
879 $action =
''; $id =
''; $ref =
'';
883 if ($action ==
'create') {
893 $classname = ucfirst($origin);
895 $object =
new $classname($db);
896 if ($object->fetch($origin_id)) {
898 $soc->fetch($object->socid);
900 $author =
new User($db);
901 $author->fetch($object->user_author_id);
907 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
908 print
'<input type="hidden" name="token" value="'.newToken().
'">';
909 print
'<input type="hidden" name="action" value="add">';
910 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
911 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
912 if (
GETPOST(
'entrepot_id',
'int')) {
913 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
918 print
'<table class="border centpercent">';
921 print
'<tr><td class="titlefieldcreate fieldrequired">';
922 if ($origin ==
'commande' &&
isModEnabled(
'commande')) {
923 print $langs->trans(
"RefOrder");
926 print $langs->trans(
"RefProposal");
928 print
'</td><td colspan="3">';
929 print $object->getNomUrl(1);
935 if ($origin ==
'commande') {
936 print $langs->trans(
'RefCustomerOrder');
937 } elseif ($origin ==
'propal') {
938 print $langs->trans(
'RefCustomerOrder');
940 print $langs->trans(
'RefCustomer');
942 print
'</td><td colspan="3">';
943 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
948 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
949 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
954 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
955 if (empty($projectid) && !empty($object->fk_project)) {
956 $projectid = $object->fk_project;
958 if ($origin ==
'project') {
959 $projectid = ($originid ? $originid : 0);
962 $langs->load(
"projects");
964 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
966 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
967 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>';
973 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
974 print
'<td colspan="3">';
975 $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
976 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
981 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
982 print
'<td colspan="3">';
983 $doleditor =
new DolEditor(
'note_public', $object->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
984 print $doleditor->Create(1);
988 if ($object->note_private && !$user->socid) {
989 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
990 print
'<td colspan="3">';
991 $doleditor =
new DolEditor(
'note_private', $object->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
992 print $doleditor->Create(1);
998 print $langs->trans(
"Weight");
999 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
1000 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
1001 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1002 print
$form->textwithpicto($text, $htmltext);
1006 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1007 print
' </td><td colspan="3"><input name="sizeW" size="4" value="'.GETPOST(
'sizeW',
'int').
'">';
1008 print
' x <input name="sizeH" size="4" value="'.GETPOST(
'sizeH',
'int').
'">';
1009 print
' x <input name="sizeS" size="4" value="'.GETPOST(
'sizeS',
'int').
'">';
1011 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
1012 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1013 print
$form->textwithpicto($text, $htmltext);
1017 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1018 print
'<td colspan="3">';
1019 $expe->fetch_delivery_methods();
1020 print
$form->selectarray(
"shipping_method_id", $expe->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
1022 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1024 print
"</td></tr>\n";
1027 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1028 print
'<td colspan="3">';
1029 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1030 print
"</td></tr>\n";
1033 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1034 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $expe, $action);
1035 print $hookmanager->resPrint;
1037 if (empty($reshook)) {
1039 if ($object->fetch_optionals() > 0) {
1040 $expe->array_options = array_merge($expe->array_options, $object->array_options);
1042 print $expe->showOptionals($extrafields,
'edit',
$parameters);
1049 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $object->label_incoterms, 1).
'</label></td>';
1050 print
'<td colspan="3" class="maxwidthonsmartphone">';
1051 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''));
1056 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1058 if (count($list) > 1) {
1059 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1060 print
'<td colspan="3">';
1061 print
$form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1062 print
"</td></tr>\n";
1072 $numAsked = count($object->lines);
1074 print
'<script type="text/javascript">'.
"\n";
1075 print
'jQuery(document).ready(function() {'.
"\n";
1076 print
'jQuery("#autofill").click(function() {';
1078 while ($i < $numAsked) {
1079 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1081 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1085 print
'return false; });'.
"\n";
1086 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1087 print
'return false; });'.
"\n";
1089 print
'</script>'.
"\n";
1093 print
'<table class="noborder centpercent">';
1096 $object->loadExpeditions();
1099 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1102 print
'<tr class="liste_titre">';
1103 print
'<td>'.$langs->trans(
"Description").
'</td>';
1104 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1105 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1106 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1107 if (empty($conf->productbatch->enabled)) {
1108 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1113 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1116 if (empty($conf->productbatch->enabled)) {
1117 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1119 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1125 $warehouse_id =
GETPOST(
'entrepot_id',
'int');
1126 $warehousePicking = array();
1128 if ($warehouse_id > 0) {
1129 $warehousePicking[] = $warehouse_id;
1131 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1135 while ($indiceAsked < $numAsked) {
1138 $line = $object->lines[$indiceAsked];
1140 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1141 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters, $object, $action);
1146 if (empty($reshook)) {
1148 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1151 if (!empty($line->date_start)) {
1154 if (!empty($line->date_end)) {
1158 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1159 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1162 if ($line->fk_product > 0) {
1163 $res = $product->fetch($line->fk_product);
1167 $product->load_stock(
'warehouseopen');
1171 print
'<a name="'.$line->id.
'"></a>';
1174 $product_static->type = $line->fk_product_type;
1175 $product_static->id = $line->fk_product;
1176 $product_static->ref = $line->ref;
1177 $product_static->status = $line->product_tosell;
1178 $product_static->status_buy = $line->product_tobuy;
1179 $product_static->status_batch = $line->product_tobatch;
1181 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1183 $text = $product_static->getNomUrl(1);
1184 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1187 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1190 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1193 if ($showdescinproductdesc) {
1194 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1201 $text =
img_object($langs->trans(
'Service'),
'service');
1203 $text =
img_object($langs->trans(
'Product'),
'product');
1206 if (!empty($line->label)) {
1207 $text .=
' <strong>'.$line->label.
'</strong>';
1208 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1210 print $text.
' '.nl2br($line->desc);
1214 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1220 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1225 print
'<td class="center">'.$line->qty;
1226 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1227 print
''.$unit_order.
'</td>';
1228 $qtyProdCom = $line->qty;
1231 print
'<td class="center">';
1232 $quantityDelivered = isset($object->expeditions[$line->id]) ? $object->expeditions[$line->id] :
'';
1233 print $quantityDelivered;
1234 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1235 print
''.$unit_order.
'</td>';
1238 $quantityAsked = $line->qty;
1239 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1240 $quantityToBeDelivered = 0;
1242 if (is_numeric($quantityDelivered)) {
1243 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1245 $quantityToBeDelivered = $quantityAsked;
1249 $warehouseObject =
null;
1250 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !
isModEnabled(
'stock')) {
1251 print
'<!-- Case warehouse already known or product not a predefined product -->';
1253 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1254 $deliverableQty = min($quantityToBeDelivered, $stock);
1255 if ($deliverableQty < 0) {
1256 $deliverableQty = 0;
1258 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1260 print
'<td class="center">';
1261 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1262 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1263 $deliverableQty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1265 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1266 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.
'">';
1268 if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
1269 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1270 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1273 print $langs->trans(
"NA");
1279 print
'<td class="left">';
1280 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1282 $ent =
"entl".$indiceAsked;
1283 $idl =
"idl".$indiceAsked;
1284 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1285 if ($line->fk_product > 0) {
1286 print
'<!-- Show warehouse selection -->';
1289 if (empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1292 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1294 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1296 if ($stock < $quantityToBeDelivered) {
1297 print
' '.img_warning($langs->trans(
"StockTooLow"));
1302 print $langs->trans(
"Service");
1310 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
1311 $product->get_sousproduits_arbo();
1312 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1313 if (count($prods_arbo) > 0) {
1314 foreach ($prods_arbo as $key => $value) {
1317 if ($value[
'stock'] < $value[
'stock_alert']) {
1320 print
"<tr class=\"oddeven\"><td> ->
1321 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1322 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1323 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td></tr>";
1329 print
'<td></td><td></td></tr>';
1330 print
'<!-- Case product need lot -->';
1332 $staticwarehouse =
new Entrepot($db);
1333 if ($warehouse_id > 0) {
1334 $staticwarehouse->fetch($warehouse_id);
1340 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1341 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1345 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1346 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1347 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1349 $batchStock = + $dbatch->qty;
1350 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1351 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] :
'').
'>';
1352 print
'<td colspan="3" ></td><td class="center">';
1353 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1356 print
'<!-- Show details of lot -->';
1357 print
'<td class="left">';
1359 print $staticwarehouse->getNomUrl(0).
' / ';
1361 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1364 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1365 if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) {
1366 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1368 if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) {
1369 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1371 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1375 $quantityToBeDelivered -= $deliverableQty;
1376 if ($quantityToBeDelivered < 0) {
1377 $quantityToBeDelivered = 0;
1383 print
'<!-- Case there is no details of lot at all -->';
1384 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1385 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1388 print
'<td class="left">';
1389 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1395 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1396 print
'<!-- Case warehouse not already known and product does not need lot -->';
1397 print
'<td></td><td></td></tr>'.
"\n";
1399 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1404 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1405 if ($stock_warehouse->real > 0) {
1409 $tmpwarehouseObject =
new Entrepot($db);
1410 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1411 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1416 $tmpwarehouseObject->fetch($warehouse_id);
1417 if ($stock_warehouse->real > 0) {
1418 $stock = + $stock_warehouse->real;
1419 $deliverableQty = min($quantityToBeDelivered, $stock);
1420 $deliverableQty = max(0, $deliverableQty);
1422 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] :
'').
'>';
1423 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1424 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1425 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1426 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1428 if (!isset($alreadyQtySetted[$line->fk_product])) {
1429 $alreadyQtySetted[$line->fk_product] = array();
1432 $deliverableQty = min($quantityToBeDelivered, $stock);
1435 if ($deliverableQty < 0) $deliverableQty = 0;
1438 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1439 $tooltip =
' class="classfortooltip" title="'.$langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)].
'" ';
1442 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1444 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1446 $deliverableQty =
GETPOST($inputName,
'int');
1449 print
'<input '.$tooltip.
' class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1450 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1452 if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
1453 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1456 print $langs->trans(
"NA");
1462 print
'<td class="left">';
1463 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1464 print $tmpwarehouseObject->getNomUrl(0).
' ';
1466 print
'<!-- Show details of stock -->';
1467 print
'('.$stock.
')';
1469 print $langs->trans(
"Service");
1473 $quantityToBeDelivered -= $deliverableQty;
1474 if ($quantityToBeDelivered < 0) {
1475 $quantityToBeDelivered = 0;
1482 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
1483 $product->get_sousproduits_arbo();
1484 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1485 if (count($prods_arbo) > 0) {
1486 foreach ($prods_arbo as $key => $value) {
1489 if ($value[
'stock'] < $value[
'stock_alert']) {
1492 print
'<tr class"oddeven"><td>';
1493 print
" ->
1494 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1495 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1496 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1502 print
'<!-- Case warehouse not already known and product need lot -->';
1503 print
'<td></td><td></td></tr>';
1506 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1508 $tmpwarehouseObject =
new Entrepot($db);
1513 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1514 if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
1515 $nbofsuggested+=count($stock_warehouse->detail_batch);
1519 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1520 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1525 $tmpwarehouseObject->fetch($warehouse_id);
1526 if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
1527 foreach ($stock_warehouse->detail_batch as $dbatch) {
1528 $batchStock = + $dbatch->qty;
1529 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1530 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1532 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1533 $alreadyQtyBatchSetted[$line->fk_product] = array();
1536 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1537 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1540 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1543 if ($deliverableQty < 0) $deliverableQty = 0;
1545 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1547 $deliverableQty =
GETPOST($inputName,
'int');
1550 $tooltipClass = $tooltipTitle =
'';
1551 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1552 $tooltipClass =
' classfortooltip';
1553 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1555 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1557 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] :
'').
'><td colspan="3"></td><td class="center">';
1558 print
'<input class="qtyl '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1561 print
'<td class="left">';
1563 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1565 print
'<!-- Show details of lot -->';
1566 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1569 print $langs->trans(
"Batch").
': ';
1570 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1572 print $productlotObject->getNomUrl(1);
1574 print
'TableLotIncompleteRunRepairWithParamStandardEqualConfirmed';
1576 if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) {
1577 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1579 if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) {
1580 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1582 print
' ('.$dbatch->qty.
')';
1583 $quantityToBeDelivered -= $deliverableQty;
1584 if ($quantityToBeDelivered < 0) {
1585 $quantityToBeDelivered = 0;
1595 $warehouse_selected_id =
GETPOST(
'entrepot_id',
'int');
1597 print
'<!-- line not shown yet, we show it -->';
1598 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1600 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1602 if (
isModEnabled(
'productbatch') && $product->hasbatch()) {
1603 $disabled =
'disabled="disabled"';
1605 if ($warehouse_selected_id <= 0) {
1606 $disabled =
'disabled="disabled"';
1608 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1610 print $langs->trans(
"NA");
1614 print
'<td class="left">';
1615 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1616 if ($warehouse_selected_id > 0) {
1617 $warehouseObject =
new Entrepot($db);
1618 $warehouseObject->fetch($warehouse_selected_id);
1619 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1621 if ($line->fk_product) {
1622 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1628 print $langs->trans(
"Service");
1637 if (!empty($extrafields)) {
1643 $srcLine->id = $line->id;
1644 $srcLine->fetch_optionals();
1646 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1648 print $expLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="drag drop oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1659 print
$form->buttonsSaveCancel(
"Create");
1668 } elseif ($object->id > 0) {
1674 $lines = $object->lines;
1676 $num_prod = count($lines);
1678 if (!empty($object->origin) && $object->origin_id > 0) {
1679 $typeobject = $object->origin;
1680 $origin = $object->origin;
1681 $origin_id = $object->origin_id;
1682 $object->fetch_origin();
1686 $soc->fetch($object->socid);
1688 $res = $object->fetch_optionals();
1691 print
dol_get_fiche_head($head,
'shipping', $langs->trans(
"Shipment"), -1, $object->picto);
1696 if ($action ==
'delete') {
1697 $formquestion = array();
1699 $formquestion = array(
1701 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1702 'name' =>
'alsoUpdateStock',
1703 'type' =>
'checkbox',
1709 $_SERVER[
'PHP_SELF'].
'?id='.$object->id,
1710 $langs->trans(
'DeleteSending'),
1711 $langs->trans(
"ConfirmDeleteSending", $object->ref),
1720 if ($action ==
'valid') {
1721 $objectref = substr($object->ref, 1, 4);
1722 if ($objectref ==
'PROV') {
1723 $numref = $object->getNextNumRef($soc);
1725 $numref = $object->ref;
1728 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1731 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1732 $notify =
new Notify($db);
1734 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE', $object->socid, $object);
1737 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1);
1740 if ($action ==
'cancel') {
1741 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending", $object->ref),
'confirm_cancel',
'', 0, 1);
1746 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1747 if (empty($reshook)) {
1749 } elseif ($reshook > 0) {
1758 $tmparray = $object->getTotalWeightVolume();
1759 $totalWeight = $tmparray[
'weight'];
1760 $totalVolume = $tmparray[
'volume'];
1763 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1765 $objectsrc->fetch($object->$typeobject->id);
1767 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1768 $objectsrc =
new Propal($db);
1769 $objectsrc->fetch($object->$typeobject->id);
1773 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1774 $morehtmlref =
'<div class="refidno">';
1776 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', 0, 1);
1777 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer,
'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ?
':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE :
''),
'',
null,
null,
'', 1);
1779 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1782 $langs->load(
"projects");
1783 $morehtmlref .=
'<br>';
1785 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1786 if ($action !=
'classify') {
1787 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1789 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1791 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1793 $proj->fetch($objectsrc->fk_project);
1794 $morehtmlref .= $proj->getNomUrl(1);
1796 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1801 $morehtmlref .=
'</div>';
1804 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1807 print
'<div class="fichecenter">';
1808 print
'<div class="fichehalfleft">';
1809 print
'<div class="underbanner clearboth"></div>';
1811 print
'<table class="border tableforfield" width="100%">';
1814 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1816 print $langs->trans(
"RefOrder").
'</td>';
1817 print
'<td colspan="3">';
1818 print $objectsrc->getNomUrl(1,
'commande');
1822 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1824 print $langs->trans(
"RefProposal").
'</td>';
1825 print
'<td colspan="3">';
1826 print $objectsrc->getNomUrl(1,
'expedition');
1832 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1833 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour").
"</td>\n";
1837 print
'<tr><td height="10">';
1838 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1839 print $langs->trans(
'DateDeliveryPlanned');
1842 if ($action !=
'editdate_livraison') {
1843 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>';
1845 print
'</tr></table>';
1846 print
'</td><td colspan="2">';
1847 if ($action ==
'editdate_livraison') {
1848 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1849 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1850 print
'<input type="hidden" name="action" value="setdate_livraison">';
1851 print
$form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1852 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
1855 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1862 print
$form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->expedition->creer);
1863 print
'</td><td colspan="3">';
1865 if ($action ==
'edittrueWeight') {
1866 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1867 print
'<input name="action" value="settrueWeight" type="hidden">';
1868 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1869 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1870 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
1871 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
1872 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1873 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1876 print $object->trueWeight;
1877 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1881 if ($totalWeight > 0) {
1882 if (!empty($object->trueWeight)) {
1883 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1885 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');
1886 if (!empty($object->trueWeight)) {
1893 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1894 print
$form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
1895 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1899 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1900 if ($action ==
'edittrueHeight') {
1901 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1902 print
'<input name="action" value="settrueHeight" type="hidden">';
1903 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1904 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1905 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
1906 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1907 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1908 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1911 print $object->trueHeight;
1912 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1918 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1919 print
$form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
1920 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1925 print $langs->trans(
"Volume");
1927 print
'<td colspan="3">';
1928 $calculatedVolume = 0;
1930 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1931 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1932 $volumeUnit = $object->size_units * 3;
1935 if ($calculatedVolume > 0) {
1936 if ($volumeUnit < 50) {
1937 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');
1942 if ($totalVolume > 0) {
1943 if ($calculatedVolume) {
1944 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1946 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');
1948 if ($calculatedVolume) {
1957 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1962 print
'<div class="fichehalfright">';
1963 print
'<div class="underbanner clearboth"></div>';
1965 print
'<table class="border centpercent tableforfield">';
1968 print
'<tr><td height="10">';
1969 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1970 print $langs->trans(
'SendingMethod');
1973 if ($action !=
'editshipping_method_id') {
1974 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>';
1976 print
'</tr></table>';
1977 print
'</td><td colspan="2">';
1978 if ($action ==
'editshipping_method_id') {
1979 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1980 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1981 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1982 $object->fetch_delivery_methods();
1983 print
$form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1985 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1987 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
1990 if ($object->shipping_method_id > 0) {
1992 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1993 print $langs->trans(
"SendingMethod".strtoupper($code));
2000 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
2001 print
$form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer,
'safehtmlstring', $object->tracking_number);
2007 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2008 print $langs->trans(
'IncotermLabel');
2009 print
'<td><td class="right">';
2010 if ($user->rights->expedition->creer) {
2011 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2015 print
'</td></tr></table>';
2017 print
'<td colspan="3">';
2018 if ($action !=
'editincoterm') {
2019 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
2021 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
2027 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2028 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
2029 print $hookmanager->resPrint;
2036 print
'<div class="clearboth"></div>';
2041 if ($action ==
'editline') {
2042 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
2043 <input type="hidden" name="token" value="' .
newToken().
'">
2044 <input type="hidden" name="action" value="updateline">
2045 <input type="hidden" name="mode" value="">
2046 <input type="hidden" name="id" value="' . $object->id.
'">
2051 print
'<div class="div-table-responsive-no-min">';
2052 print
'<table class="noborder" width="100%" id="tablelines" >';
2054 print
'<tr class="liste_titre">';
2056 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
2057 print
'<td width="5" class="center linecolnum"> </td>';
2060 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2062 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2063 if ($origin && $origin_id > 0) {
2064 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2066 if ($action ==
'editline') {
2071 if (empty($conf->productbatch->enabled)) {
2074 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2075 if ($object->statut <= 1) {
2076 print $langs->trans(
"QtyToShip").
' - ';
2078 print $langs->trans(
"QtyShipped").
' - ';
2081 print $langs->trans(
"WarehouseSource").
' - ';
2084 print $langs->trans(
"Batch");
2088 if ($object->statut <= 1) {
2089 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2091 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2094 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2098 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2101 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2102 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2104 if ($object->statut == 0) {
2105 print
'<td class="linecoledit"></td>';
2106 print
'<td class="linecoldelete" width="10"></td>';
2111 $outputlangs = $langs;
2113 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
2114 $object->fetch_thirdparty();
2116 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2117 $newlang =
GETPOST(
'lang_id',
'aZ09');
2119 if (empty($newlang)) {
2120 $newlang = $object->thirdparty->default_lang;
2122 if (!empty($newlang)) {
2123 $outputlangs =
new Translate(
"", $conf);
2124 $outputlangs->setDefaultLang($newlang);
2129 $alreadysent = array();
2130 if ($origin && $origin_id > 0) {
2131 $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";
2132 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot";
2133 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2135 $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';
2136 $sql .=
', p.description as product_desc';
2137 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2138 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2139 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2141 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2142 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2143 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2144 $sql .=
" AND obj.rowid = ed.fk_origin_line";
2145 $sql .=
" AND ed.fk_expedition = e.rowid";
2147 $sql .=
" ORDER BY obj.fk_product";
2149 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2150 $resql = $db->query($sql);
2152 $num = $db->num_rows(
$resql);
2156 $obj = $db->fetch_object(
$resql);
2159 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2160 'shipment_ref'=>$obj->shipment_ref,
'shipment_id'=>$obj->shipment_id,
'warehouse'=>$obj->fk_entrepot,
'qty_shipped'=>$obj->qty_shipped,
2161 'product_tosell'=>$obj->product_tosell,
'product_tobuy'=>$obj->product_tobuy,
'product_tobatch'=>$obj->product_tobatch,
2162 'date_valid'=>$db->jdate($obj->date_valid),
'date_delivery'=>$db->jdate($obj->date_delivery));
2173 for ($i = 0; $i < $num_prod; $i++) {
2174 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2175 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters, $object, $action);
2180 if (empty($reshook)) {
2181 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2182 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2185 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
2186 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2190 if ($lines[$i]->fk_product > 0) {
2192 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
2194 $prod->fetch($lines[$i]->fk_product);
2195 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2197 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2200 print
'<td class="linecoldescription">';
2203 $product_static->type = $lines[$i]->fk_product_type;
2204 $product_static->id = $lines[$i]->fk_product;
2205 $product_static->ref = $lines[$i]->ref;
2206 $product_static->status = $lines[$i]->product_tosell;
2207 $product_static->status_buy = $lines[$i]->product_tobuy;
2208 $product_static->status_batch = $lines[$i]->product_tobatch;
2210 $product_static->weight = $lines[$i]->weight;
2211 $product_static->weight_units = $lines[$i]->weight_units;
2212 $product_static->length = $lines[$i]->length;
2213 $product_static->length_units = $lines[$i]->length_units;
2214 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2215 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2216 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2217 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2218 $product_static->surface = $lines[$i]->surface;
2219 $product_static->surface_units = $lines[$i]->surface_units;
2220 $product_static->volume = $lines[$i]->volume;
2221 $product_static->volume_units = $lines[$i]->volume_units;
2223 $text = $product_static->getNomUrl(1);
2224 $text .=
' - '.$label;
2226 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
2227 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2233 print
'<td class="linecoldescription" >';
2235 $text =
img_object($langs->trans(
'Service'),
'service');
2237 $text =
img_object($langs->trans(
'Product'),
'product');
2240 if (!empty($lines[$i]->label)) {
2241 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2242 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2252 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
2257 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2260 if ($origin && $origin_id > 0) {
2261 print
'<td class="linecolqtyinothershipments center nowrap">';
2262 foreach ($alreadysent as $key => $val) {
2263 if ($lines[$i]->fk_origin_line == $key) {
2265 foreach ($val as $shipmentline_id => $shipmentline_var) {
2266 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2274 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2275 print $shipment_static->getNomUrl(1);
2276 print
' - '.$shipmentline_var[
'qty_shipped'];
2277 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2278 if (
isModEnabled(
'stock') && $shipmentline_var[
'warehouse'] > 0) {
2279 $warehousestatic->fetch($shipmentline_var[
'warehouse']);
2280 $htmltext .=
'<br>'.$langs->trans(
"FromLocation").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
2282 print
' '.$form->textwithpicto(
'', $htmltext, 1);
2289 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2291 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2292 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2293 print
'<!-- case edit 1 -->';
2295 foreach ($lines[$i]->detail_batch as $detail_batch) {
2298 print
'<td><input class="qtyl" 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>';
2300 if ($lines[$i]->entrepot_id == 0) {
2302 $line->fetch($detail_batch->fk_expeditiondet);
2304 $entrepot_id = !empty($detail_batch->entrepot_id)?$detail_batch->entrepot_id:$lines[$i]->entrepot_id;
2305 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>';
2311 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2313 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2316 if ($lines[$i]->fk_product > 0) {
2317 if ($lines[$i]->entrepot_id > 0) {
2318 print
'<!-- case edit 2 -->';
2321 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2323 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2325 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2327 } elseif (count($lines[$i]->details_entrepot) > 1) {
2328 print
'<!-- case edit 3 -->';
2329 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2332 print
'<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.
'" id="qtyl'.$detail_entrepot->line_id.
'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.
'">'.$unit_order.
'</td>';
2334 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2336 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2340 print
'<!-- case edit 4 -->';
2341 print
'<tr><td colspan="3">'.$langs->trans(
"NotEnoughStock").
'</td></tr>';
2344 print
'<!-- case edit 5 -->';
2347 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2354 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2355 print
'<!-- case edit 6 -->';
2358 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2366 print
'</table></td>';
2369 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2373 print
'<td class="linecolwarehousesource left">';
2374 if ($lines[$i]->entrepot_id > 0) {
2376 $entrepot->fetch($lines[$i]->entrepot_id);
2377 print $entrepot->getNomUrl(1);
2378 } elseif (count($lines[$i]->details_entrepot) > 1) {
2380 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2381 if ($detail_entrepot->entrepot_id > 0) {
2383 $entrepot->fetch($detail_entrepot->entrepot_id);
2384 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->libelle, $detail_entrepot->qty_shipped).
'<br>';
2387 print
$form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2394 if (isset($lines[$i]->detail_batch)) {
2395 print
'<!-- Detail of lot -->';
2396 print
'<td class="linecolbatch">';
2397 if ($lines[$i]->product_tobatch) {
2399 foreach ($lines[$i]->detail_batch as $dbatch) {
2400 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2401 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
2402 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2404 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2405 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2407 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2410 print
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2412 print $langs->trans(
"NA");
2416 print
'<td class="linecolbatch" ></td>';
2422 print
'<td class="center linecolweight">';
2424 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2431 print
'<td class="center linecolvolume">';
2433 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2442 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2443 print
'<td class="center" colspan="2" valign="middle">';
2444 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2445 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2449 print
'<td class="linecoledit center">';
2450 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2452 print
'<td class="linecoldelete" width="10">';
2453 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2457 if (!empty($rowExtrafieldsStart)) {
2458 print $rowExtrafieldsStart;
2459 print $rowExtrafieldsView;
2467 if (!empty($extrafields)) {
2469 if ($origin && $origin_id > 0) {
2480 $line->fetch_optionals();
2483 if ($action ==
'editline' && $line->id == $line_id) {
2484 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2486 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2502 $object->fetchObjectLinked($object->id, $object->element);
2509 if (($user->socid == 0) && ($action !=
'presend')) {
2510 print
'<div class="tabsAction">';
2513 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
2515 if (empty($reshook)) {
2517 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer))
2518 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) {
2519 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=valid&token='.
newToken().
'&id='.$object->id,
'');
2521 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2528 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
2529 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyUnbilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
2531 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
2536 if (empty($user->socid)) {
2537 if ($object->statut > 0) {
2538 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) {
2539 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
2541 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2548 if ($user->rights->facture->creer) {
2551 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid,
'');
2558 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.$object->id,
'');
2562 if ($user->rights->expedition->creer && $object->statut > 0 && !$object->billed) {
2563 $label =
"Close"; $paramaction =
'classifyclosed';
2565 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
2566 $label =
"ClassifyBilled";
2567 $paramaction =
'classifybilled';
2569 print
dolGetButtonAction(
'', $langs->trans($label),
'default', $_SERVER[
"PHP_SELF"].
'?action='. $paramaction .
'&token='.
newToken().
'&id='.$object->id,
'');
2575 if ($user->rights->expedition->supprimer) {
2576 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
2581 if ($user->rights->expedition->supprimer) {
2582 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'');
2594 if ($action !=
'presend' && $action !=
'editline') {
2595 print
'<div class="fichecenter"><div class="fichehalfleft">';
2598 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2600 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2602 $genallowed = $user->rights->expedition->lire;
2603 $delallowed = $user->rights->expedition->creer;
2605 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2609 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'shipping'));
2610 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
2613 print
'</div><div class="fichehalfright">';
2616 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2618 $somethingshown =
$formactions->showactions($object,
'shipping', $socid, 1);
2620 print
'</div></div>';
2629 if (
GETPOST(
'modelselected')) {
2630 $action =
'presend';
2634 $modelmail =
'shipping_send';
2635 $defaulttopic = $langs->trans(
'SendShippingRef');
2636 $diroutput = $conf->expedition->dir_output.
'/sending';
2637 $trackid =
'shi'.$object->id;
2639 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif($action=='specimen') elseif($action=='setmodel') elseif($action=='del') elseif($action=='setdoc') $formactions
View.
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.
const STATUS_VALIDATED
Validated status.
Classe 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 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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
print_date_range($date_start, $date_end, $format='', $outputlangs='')
Format output for start and end date.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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...
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.