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 ==
'setdraft' && $user->rights->expedition->creer) {
163 $result = $object->setDraft($user, 0);
169 if ($action ==
'reopen' && $user->rights->expedition->creer) {
171 $result = $object->reOpen();
178 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm')) {
179 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
182 if ($action ==
'setref_customer') {
183 $result = $object->fetch($id);
188 $result = $object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
191 $action =
'editref_customer';
193 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
198 if ($action ==
'update_extras') {
202 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
209 $result = $object->insertExtraFields(
'SHIPMENT_MODIFY');
217 $action =
'edit_extras';
222 if ($action ==
'add' && $user->rights->expedition->creer) {
227 $object->note =
GETPOST(
'note',
'restricthtml');
228 $object->note_private =
GETPOST(
'note',
'restricthtml');
229 $object->origin = $origin;
230 $object->origin_id = $origin_id;
231 $object->fk_project =
GETPOST(
'projectid',
'int');
232 $object->weight =
GETPOST(
'weight',
'int') ==
'' ?
"NULL" :
GETPOST(
'weight',
'int');
233 $object->sizeH =
GETPOST(
'sizeH',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeH',
'int');
234 $object->sizeW =
GETPOST(
'sizeW',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeW',
'int');
235 $object->sizeS =
GETPOST(
'sizeS',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeS',
'int');
236 $object->size_units =
GETPOST(
'size_units',
'int');
237 $object->weight_units =
GETPOST(
'weight_units',
'int');
242 $classname = ucfirst($object->origin);
243 $objectsrc =
new $classname($db);
244 $objectsrc->fetch($object->origin_id);
246 $object->socid = $objectsrc->socid;
247 $object->ref_customer =
GETPOST(
'ref_customer',
'alpha');
248 $object->model_pdf =
GETPOST(
'model');
249 $object->date_delivery = $date_delivery;
250 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
251 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
252 $object->tracking_number =
GETPOST(
'tracking_number',
'alpha');
253 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
254 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
255 $object->fk_incoterms =
GETPOST(
'incoterm_id',
'int');
256 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
258 $batch_line = array();
259 $stockLine = array();
260 $array_options = array();
262 $num = count($objectsrc->lines);
265 for ($i = 0; $i < $num; $i++) {
272 $batch =
"batchl".$i.
"_0";
273 $stockLocation =
"ent1".$i.
"_0";
276 $is_batch_or_serial=0;
277 if (!empty($objectsrc->lines[$i]->fk_product)) {
278 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
279 if ($resultFetch < 0) {
282 $is_batch_or_serial = $product->status_batch;
286 if (
isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
293 $sub_qty[$j][
'id_batch'] =
GETPOST($batch,
'int');
294 $subtotalqty += $sub_qty[$j][
'q'];
302 if ($is_batch_or_serial==2 && $sub_qty[$j][
'q']>1) {
303 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
308 $batch =
"batchl".$i.
"_".$j;
309 $qty =
"qtyl".$i.
'_'.$j;
312 $batch_line[$i][
'detail'] = $sub_qty;
313 $batch_line[$i][
'qty'] = $subtotalqty;
314 $batch_line[$i][
'ix_l'] =
GETPOST($idl,
'int');
316 $totalqty += $subtotalqty;
323 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOST($idl,
'int').
')',
null,
'errors');
333 $stockLine[$i][$j][
'warehouse_id'] =
GETPOST($stockLocation,
'int');
334 $stockLine[$i][$j][
'ix_l'] =
GETPOST($idl,
'int');
339 $stockLocation =
"ent1".$i.
"_".$j;
340 $qty =
"qtyl".$i.
'_'.$j;
344 if (
GETPOST($qty,
'int') > 0) {
350 $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
352 if (isset($extrafields->attributes[$object->table_element_line][
'label']) && is_array($extrafields->attributes[$object->table_element_line][
'label'])) {
354 foreach ($extrafields->attributes[$object->table_element_line][
'label'] as $key => $value) {
355 unset($_POST[
"options_".$key]);
361 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
362 for ($i = 0; $i < $num; $i++) {
365 if (!isset($batch_line[$i])) {
367 if (isset($stockLine[$i])) {
369 $nbstockline = count($stockLine[$i]);
370 for ($j = 0; $j < $nbstockline; $j++) {
371 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
372 $ret = $object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
383 $entrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') :
GETPOST(
'entrepot_id',
'int');
384 if ($entrepot_id < 0) {
387 if (!($objectsrc->lines[$i]->fk_product > 0)) {
391 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
price2num(
GETPOST($qty,
'alpha'),
'MS'), $array_options[$i]);
400 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
401 $ret = $object->addline_batch($batch_line[$i], $array_options[$i]);
410 $ret = $extrafields->setOptionalsFromPost(
null, $object);
416 $ret = $object->create($user);
423 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
425 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
427 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
433 header(
"Location: card.php?id=".$object->id);
437 $_GET[
"commande_id"] =
GETPOST(
'commande_id',
'int');
440 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->rights->expedition->delivery->creer) {
444 $result = $object->create_delivery($user);
448 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&id='.$result);
455 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' &&
456 ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer))
457 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate)))
459 $object->fetch_thirdparty();
461 $result = $object->valid($user);
467 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
468 $outputlangs = $langs;
471 $newlang =
GETPOST(
'lang_id',
'aZ09');
474 $newlang = $object->thirdparty->default_lang;
476 if (!empty($newlang)) {
478 $outputlangs->setDefaultLang($newlang);
480 $model = $object->model_pdf;
481 $ret = $object->fetch($id);
483 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
489 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->rights->expedition->supprimer) {
490 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
491 $result = $object->cancel(0, $also_update_stock);
493 $result = $object->setStatut(-1);
497 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->expedition->supprimer) {
498 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
499 $result = $object->delete(0, $also_update_stock);
501 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
515 } elseif ($action ==
'setdate_livraison' && !empty($user->rights->expedition->creer)) {
516 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
519 $result = $object->setDeliveryDate($user, $datedelivery);
523 } elseif (($action ==
'settracking_number'
524 || $action ==
'settracking_url'
525 || $action ==
'settrueWeight'
526 || $action ==
'settrueWidth'
527 || $action ==
'settrueHeight'
528 || $action ==
'settrueDepth'
529 || $action ==
'setshipping_method_id')
530 && $user->rights->expedition->creer
535 if ($action ==
'settracking_number') {
536 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
538 if ($action ==
'settracking_url') {
539 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'int'));
541 if ($action ==
'settrueWeight') {
542 $object->trueWeight = trim(
GETPOST(
'trueWeight',
'int'));
543 $object->weight_units =
GETPOST(
'weight_units',
'int');
545 if ($action ==
'settrueWidth') {
546 $object->trueWidth = trim(
GETPOST(
'trueWidth',
'int'));
548 if ($action ==
'settrueHeight') {
549 $object->trueHeight = trim(
GETPOST(
'trueHeight',
'int'));
550 $object->size_units =
GETPOST(
'size_units',
'int');
552 if ($action ==
'settrueDepth') {
553 $object->trueDepth = trim(
GETPOST(
'trueDepth',
'int'));
555 if ($action ==
'setshipping_method_id') {
556 $object->shipping_method_id = trim(
GETPOST(
'shipping_method_id',
'int'));
560 if ($object->update($user) >= 0) {
561 header(
"Location: card.php?id=".$object->id);
568 } elseif ($action ==
'classifybilled') {
570 $result = $object->setBilled();
572 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
576 } elseif ($action ==
'classifyclosed') {
578 $result = $object->setClosed();
580 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
584 } elseif ($action ==
'deleteline' && !empty($line_id)) {
587 $lines = $object->lines;
589 $line->fk_expedition = $object->id;
591 $num_prod = count($lines);
592 for ($i = 0; $i < $num_prod; $i++) {
593 if ($lines[$i]->
id == $line_id) {
594 if (count($lines[$i]->details_entrepot) > 1) {
596 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
597 $line->id = $details_entrepot->line_id;
598 if (!$error && $line->delete($user) < 0) {
604 $line->id = $line_id;
605 if (!$error && $line->delete($user) < 0) {
610 unset($_POST[
"lineid"]);
614 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
619 } elseif ($action ==
'updateline' && $user->rights->expedition->creer &&
GETPOST(
'save')) {
626 $lines = $object->lines;
627 $num_prod = count($lines);
628 for ($i = 0; $i < $num_prod; $i++) {
629 if ($lines[$i]->
id == $line_id) {
630 $update_done =
false;
632 $line->fk_expedition = $object->id;
635 $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
637 if (is_array($extrafields->attributes[$object->table_element_line][
'label'])) {
638 foreach ($extrafields->attributes[$object->table_element_line][
'label'] as $key => $value) {
639 unset($_POST[
"options_".$key]);
642 $line->fk_product = $lines[$i]->fk_product;
643 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
645 foreach ($lines[$i]->detail_batch as $detail_batch) {
647 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
648 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
649 $batch_id =
GETPOST($batch,
'int');
650 $batch_qty =
GETPOST($qty,
'int');
651 if (!empty($batch_id)) {
652 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
653 if ($lines[$i]->entrepot_id != 0) {
655 $line->entrepot_id = $lotStock->warehouseid;
659 if (empty($line->detail_batch)) {
660 $line->detail_batch =
new stdClass();
663 $line->detail_batch->fk_origin_stock = $batch_id;
664 $line->detail_batch->batch = $lotStock->batch;
665 $line->detail_batch->id = $detail_batch->id;
666 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
667 $line->detail_batch->qty = $batch_qty;
668 if ($line->update($user) < 0) {
679 unset($_POST[$batch]);
684 $batch =
"batchl".$line_id.
"_0";
685 $qty =
"qtyl".$line_id.
"_0";
686 $batch_id =
GETPOST($batch,
'int');
687 $batch_qty =
GETPOST($qty,
'int');
689 if ($batch_qty > 0 && !empty($batch_id)) {
690 if ($lotStock->fetch($batch_id) > 0) {
692 if ($lines[$i]->entrepot_id > 0) {
694 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
695 $lineIdToAddLot = $line_id;
697 } elseif (count($lines[$i]->details_entrepot) > 1) {
699 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
700 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
701 $lineIdToAddLot = $detail_entrepot->line_id;
705 if ($lineIdToAddLot) {
707 if ($line->fetch($lineIdToAddLot) > 0) {
708 $line->detail_batch->fk_origin_stock = $batch_id;
709 $line->detail_batch->batch = $lotStock->batch;
710 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
711 $line->detail_batch->qty = $batch_qty;
712 if ($line->update($user) < 0) {
724 $line->origin_line_id = $lines[$i]->origin_line_id;
725 $line->entrepot_id = $lotStock->warehouseid;
727 $line->detail_batch[0]->fk_origin_stock = $batch_id;
728 $line->detail_batch[0]->batch = $lotStock->batch;
729 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
730 $line->detail_batch[0]->qty = $batch_qty;
731 if ($object->create_line_batch($line, $line->array_options) < 0) {
744 if ($lines[$i]->fk_product > 0) {
746 if ($lines[$i]->entrepot_id > 0) {
748 $stockLocation =
"entl".$line_id;
749 $qty =
"qtyl".$line_id;
750 $line->id = $line_id;
751 $line->entrepot_id =
GETPOST($stockLocation,
'int');
752 $line->qty =
GETPOST($qty,
'int');
753 if ($line->update($user) < 0) {
757 unset($_POST[$stockLocation]);
759 } elseif (count($lines[$i]->details_entrepot) > 1) {
761 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
763 $stockLocation =
"entl".$detail_entrepot->line_id;
764 $qty =
"qtyl".$detail_entrepot->line_id;
765 $warehouse =
GETPOST($stockLocation,
'int');
766 if (!empty($warehouse)) {
767 $line->id = $detail_entrepot->line_id;
768 $line->entrepot_id = $warehouse;
769 $line->qty =
GETPOST($qty,
'int');
770 if ($line->update($user) < 0) {
777 unset($_POST[$stockLocation]);
781 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
782 $qty =
"qtyl".$line_id;
783 $line->id = $line_id;
784 $line->qty =
GETPOST($qty,
'int');
785 $line->entrepot_id = 0;
786 if ($line->update($user) < 0) {
796 $qty =
"qtyl".$line_id;
797 $line->id = $line_id;
798 $line->qty =
GETPOST($qty,
'int');
799 $line->entrepot_id = 0;
800 if ($line->update($user) < 0) {
810 if (empty($update_done)) {
811 $line->id = $lines[$i]->id;
812 $line->insertExtraFields();
817 unset($_POST[
"lineid"]);
820 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
822 $outputlangs = $langs;
825 $newlang =
GETPOST(
'lang_id',
'aZ09');
828 $newlang = $object->thirdparty->default_lang;
830 if (!empty($newlang)) {
832 $outputlangs->setDefaultLang($newlang);
835 $ret = $object->fetch($object->id);
836 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
839 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
842 } elseif ($action ==
'updateline' && $user->rights->expedition->creer &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
843 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
847 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
853 $triggersendname =
'SHIPPING_SENTBYMAIL';
855 $mode =
'emailfromshipment';
856 $trackid =
'shi'.$object->id;
857 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
865 $title = $object->ref.
' - '.$langs->trans(
"Shipment");
866 if ($action ==
'create2') {
867 $title = $langs->trans(
"CreateShipment");
869 $help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
873 if (empty($action)) {
884 $product_static =
new Product($db);
886 $warehousestatic =
new Entrepot($db);
888 if ($action ==
'create2') {
891 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
892 $action =
''; $id =
''; $ref =
'';
896 if ($action ==
'create') {
906 $classname = ucfirst($origin);
908 $object =
new $classname($db);
909 if ($object->fetch($origin_id)) {
911 $soc->fetch($object->socid);
913 $author =
new User($db);
914 $author->fetch($object->user_author_id);
920 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
921 print
'<input type="hidden" name="token" value="'.newToken().
'">';
922 print
'<input type="hidden" name="action" value="add">';
923 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
924 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
925 if (
GETPOST(
'entrepot_id',
'int')) {
926 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
931 print
'<table class="border centpercent">';
934 print
'<tr><td class="titlefieldcreate fieldrequired">';
935 if ($origin ==
'commande' &&
isModEnabled(
'commande')) {
936 print $langs->trans(
"RefOrder");
939 print $langs->trans(
"RefProposal");
941 print
'</td><td colspan="3">';
942 print $object->getNomUrl(1);
948 if ($origin ==
'commande') {
949 print $langs->trans(
'RefCustomerOrder');
950 } elseif ($origin ==
'propal') {
951 print $langs->trans(
'RefCustomerOrder');
953 print $langs->trans(
'RefCustomer');
955 print
'</td><td colspan="3">';
956 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
961 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
962 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
967 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
968 if (empty($projectid) && !empty($object->fk_project)) {
969 $projectid = $object->fk_project;
971 if ($origin ==
'project') {
972 $projectid = ($originid ? $originid : 0);
975 $langs->load(
"projects");
977 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
978 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
979 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
980 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>';
986 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
987 print
'<td colspan="3">';
988 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
989 $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
990 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
995 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
996 print
'<td colspan="3">';
997 $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%');
998 print $doleditor->Create(1);
1002 if ($object->note_private && !$user->socid) {
1003 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1004 print
'<td colspan="3">';
1005 $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%');
1006 print $doleditor->Create(1);
1012 print $langs->trans(
"Weight");
1013 print
'</td><td colspan="3">';
1014 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1015 print
'<input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
1016 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
1017 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1018 print
$form->textwithpicto($text, $htmltext);
1022 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1023 print
' </td><td colspan="3">';
1024 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1025 print
'<input name="sizeW" size="4" value="'.GETPOST(
'sizeW',
'int').
'">';
1026 print
' x <input name="sizeH" size="4" value="'.GETPOST(
'sizeH',
'int').
'">';
1027 print
' x <input name="sizeS" size="4" value="'.GETPOST(
'sizeS',
'int').
'">';
1029 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
1030 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1031 print
$form->textwithpicto($text, $htmltext);
1035 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1036 print
'<td colspan="3">';
1037 $expe->fetch_delivery_methods();
1038 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1039 print
$form->selectarray(
"shipping_method_id", $expe->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
1041 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1043 print
"</td></tr>\n";
1046 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1047 print
'<td colspan="3">';
1048 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1049 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1050 print
"</td></tr>\n";
1053 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1054 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $expe, $action);
1055 print $hookmanager->resPrint;
1057 if (empty($reshook)) {
1059 if ($object->fetch_optionals() > 0) {
1060 $expe->array_options = array_merge($expe->array_options, $object->array_options);
1062 print $expe->showOptionals($extrafields,
'edit',
$parameters);
1069 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $object->label_incoterms, 1).
'</label></td>';
1070 print
'<td colspan="3" class="maxwidthonsmartphone">';
1071 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1072 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''));
1077 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1079 if (count($list) > 1) {
1080 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1081 print
'<td colspan="3">';
1082 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1083 print
$form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1084 print
"</td></tr>\n";
1094 $numAsked = count($object->lines);
1096 print
'<script type="text/javascript">'.
"\n";
1097 print
'jQuery(document).ready(function() {'.
"\n";
1098 print
'jQuery("#autofill").click(function() {';
1100 while ($i < $numAsked) {
1101 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1103 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1107 print
'return false; });'.
"\n";
1108 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1109 print
'return false; });'.
"\n";
1111 print
'</script>'.
"\n";
1115 print
'<table class="noborder centpercent">';
1118 $object->loadExpeditions();
1121 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1124 print
'<tr class="liste_titre">';
1125 print
'<td>'.$langs->trans(
"Description").
'</td>';
1126 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1127 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1128 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1129 if (empty($conf->productbatch->enabled)) {
1130 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1135 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1138 if (empty($conf->productbatch->enabled)) {
1139 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1141 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1147 $warehouse_id =
GETPOST(
'entrepot_id',
'int');
1148 $warehousePicking = array();
1150 if ($warehouse_id > 0) {
1151 $warehousePicking[] = $warehouse_id;
1153 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1157 while ($indiceAsked < $numAsked) {
1160 $line = $object->lines[$indiceAsked];
1162 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1163 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters, $object, $action);
1168 if (empty($reshook)) {
1170 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1173 if (!empty($line->date_start)) {
1176 if (!empty($line->date_end)) {
1180 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1181 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1184 if ($line->fk_product > 0) {
1185 $res = $product->fetch($line->fk_product);
1189 $product->load_stock(
'warehouseopen');
1193 print
'<a name="'.$line->id.
'"></a>';
1196 $product_static->type = $line->fk_product_type;
1197 $product_static->id = $line->fk_product;
1198 $product_static->ref = $line->ref;
1199 $product_static->status = $line->product_tosell;
1200 $product_static->status_buy = $line->product_tobuy;
1201 $product_static->status_batch = $line->product_tobatch;
1203 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1205 $text = $product_static->getNomUrl(1);
1206 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1209 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1212 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1215 if ($showdescinproductdesc) {
1216 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1223 $text =
img_object($langs->trans(
'Service'),
'service');
1225 $text =
img_object($langs->trans(
'Product'),
'product');
1228 if (!empty($line->label)) {
1229 $text .=
' <strong>'.$line->label.
'</strong>';
1230 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1232 print $text.
' '.nl2br($line->desc);
1236 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1242 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1247 print
'<td class="center">'.$line->qty;
1248 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1249 print
''.$unit_order.
'</td>';
1250 $qtyProdCom = $line->qty;
1253 print
'<td class="center">';
1254 $quantityDelivered = isset($object->expeditions[$line->id]) ? $object->expeditions[$line->id] :
'';
1255 print $quantityDelivered;
1256 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1257 print
''.$unit_order.
'</td>';
1260 $quantityAsked = $line->qty;
1261 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1262 $quantityToBeDelivered = 0;
1264 if (is_numeric($quantityDelivered)) {
1265 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1267 $quantityToBeDelivered = $quantityAsked;
1271 $warehouseObject =
null;
1272 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !
isModEnabled(
'stock')) {
1273 print
'<!-- Case warehouse already known or product not a predefined product -->';
1275 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1276 $deliverableQty = min($quantityToBeDelivered, $stock);
1277 if ($deliverableQty < 0) {
1278 $deliverableQty = 0;
1280 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1282 print
'<td class="center">';
1283 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1284 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1285 $deliverableQty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1287 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1288 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.
'">';
1291 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1292 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1295 print $langs->trans(
"NA");
1301 print
'<td class="left">';
1302 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1304 $ent =
"entl".$indiceAsked;
1305 $idl =
"idl".$indiceAsked;
1306 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1307 if ($line->fk_product > 0) {
1308 print
'<!-- Show warehouse selection -->';
1314 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1316 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1318 if ($stock < $quantityToBeDelivered) {
1319 print
' '.img_warning($langs->trans(
"StockTooLow"));
1324 print $langs->trans(
"Service");
1332 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
1333 $product->get_sousproduits_arbo();
1334 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1335 if (count($prods_arbo) > 0) {
1336 foreach ($prods_arbo as $key => $value) {
1339 if ($value[
'stock'] < $value[
'stock_alert']) {
1342 print
"<tr class=\"oddeven\"><td> ->
1343 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1344 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1345 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td></tr>";
1351 print
'<td></td><td></td></tr>';
1352 print
'<!-- Case product need lot -->';
1354 $staticwarehouse =
new Entrepot($db);
1355 if ($warehouse_id > 0) {
1356 $staticwarehouse->fetch($warehouse_id);
1362 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1363 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1367 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1368 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1369 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1371 $batchStock = + $dbatch->qty;
1372 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1373 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1374 print
'<td colspan="3" ></td><td class="center">';
1375 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1378 print
'<!-- Show details of lot -->';
1379 print
'<td class="left">';
1381 print $staticwarehouse->getNomUrl(0).
' / ';
1383 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1386 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1387 if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) {
1388 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1390 if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) {
1391 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1393 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1397 $quantityToBeDelivered -= $deliverableQty;
1398 if ($quantityToBeDelivered < 0) {
1399 $quantityToBeDelivered = 0;
1405 print
'<!-- Case there is no details of lot at all -->';
1406 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1407 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1410 print
'<td class="left">';
1411 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1417 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1418 print
'<!-- Case warehouse not already known and product does not need lot -->';
1419 print
'<td></td><td></td></tr>'.
"\n";
1421 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1426 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1427 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1431 $tmpwarehouseObject =
new Entrepot($db);
1432 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1434 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1439 $tmpwarehouseObject->fetch($warehouse_id);
1440 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1441 $stock = + $stock_warehouse->real;
1442 $deliverableQty = min($quantityToBeDelivered, $stock);
1443 $deliverableQty = max(0, $deliverableQty);
1445 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1446 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1447 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1448 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1449 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1451 if (!isset($alreadyQtySetted[$line->fk_product])) {
1452 $alreadyQtySetted[$line->fk_product] = array();
1455 $deliverableQty = min($quantityToBeDelivered, $stock);
1458 if ($deliverableQty < 0) $deliverableQty = 0;
1461 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1462 $tooltip =
' class="classfortooltip" title="'.$langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)].
'" ';
1464 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1467 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1469 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1471 $deliverableQty =
GETPOST($inputName,
'int');
1474 print
'<input '.$tooltip.
' class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1475 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1478 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1481 print $langs->trans(
"NA");
1487 print
'<td class="left">';
1488 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1489 print $tmpwarehouseObject->getNomUrl(0).
' ';
1491 print
'<!-- Show details of stock -->';
1492 print
'('.$stock.
')';
1494 print $langs->trans(
"Service");
1498 $quantityToBeDelivered -= $deliverableQty;
1499 if ($quantityToBeDelivered < 0) {
1500 $quantityToBeDelivered = 0;
1507 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
1508 $product->get_sousproduits_arbo();
1509 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1510 if (count($prods_arbo) > 0) {
1511 foreach ($prods_arbo as $key => $value) {
1514 if ($value[
'stock'] < $value[
'stock_alert']) {
1517 print
'<tr class"oddeven"><td>';
1518 print
" ->
1519 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1520 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1521 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1527 print
'<!-- Case warehouse not already known and product need lot -->';
1528 print
'<td></td><td></td></tr>';
1531 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1533 $tmpwarehouseObject =
new Entrepot($db);
1538 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1539 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1540 $nbofsuggested+=count($stock_warehouse->detail_batch);
1544 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1546 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1551 $tmpwarehouseObject->fetch($warehouse_id);
1552 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1553 foreach ($stock_warehouse->detail_batch as $dbatch) {
1554 $batchStock = + $dbatch->qty;
1555 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1556 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1558 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1559 $alreadyQtyBatchSetted[$line->fk_product] = array();
1562 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1563 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1566 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1569 if ($deliverableQty < 0) $deliverableQty = 0;
1571 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1573 $deliverableQty =
GETPOST($inputName,
'int');
1576 $tooltipClass = $tooltipTitle =
'';
1577 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1578 $tooltipClass =
' classfortooltip';
1579 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1581 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1583 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1585 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1586 print
'<input class="qtyl '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1589 print
'<td class="left">';
1591 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1593 print
'<!-- Show details of lot -->';
1594 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1597 print $langs->trans(
"Batch").
': ';
1598 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1600 print $productlotObject->getNomUrl(1);
1602 print
'TableLotIncompleteRunRepairWithParamStandardEqualConfirmed';
1604 if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) {
1605 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1607 if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) {
1608 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1610 print
' ('.$dbatch->qty.
')';
1611 $quantityToBeDelivered -= $deliverableQty;
1612 if ($quantityToBeDelivered < 0) {
1613 $quantityToBeDelivered = 0;
1623 $warehouse_selected_id =
GETPOST(
'entrepot_id',
'int');
1625 print
'<!-- line not shown yet, we show it -->';
1626 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1628 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1630 if (
isModEnabled(
'productbatch') && $product->hasbatch()) {
1631 $disabled =
'disabled="disabled"';
1633 if ($warehouse_selected_id <= 0) {
1634 $disabled =
'disabled="disabled"';
1636 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1637 if (empty($disabled) && !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1638 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1641 print $langs->trans(
"NA");
1645 print
'<td class="left">';
1646 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1647 if ($warehouse_selected_id > 0) {
1648 $warehouseObject =
new Entrepot($db);
1649 $warehouseObject->fetch($warehouse_selected_id);
1650 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1652 if ($line->fk_product) {
1653 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1659 print $langs->trans(
"Service");
1668 if (!empty($extrafields)) {
1674 $srcLine->id = $line->id;
1675 $srcLine->fetch_optionals();
1677 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1679 print $expLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="drag drop oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1690 print
$form->buttonsSaveCancel(
"Create");
1699 } elseif ($object->id > 0) {
1705 $lines = $object->lines;
1707 $num_prod = count($lines);
1709 if (!empty($object->origin) && $object->origin_id > 0) {
1710 $typeobject = $object->origin;
1711 $origin = $object->origin;
1712 $origin_id = $object->origin_id;
1713 $object->fetch_origin();
1717 $soc->fetch($object->socid);
1719 $res = $object->fetch_optionals();
1722 print
dol_get_fiche_head($head,
'shipping', $langs->trans(
"Shipment"), -1, $object->picto);
1727 if ($action ==
'delete') {
1728 $formquestion = array();
1730 $formquestion = array(
1732 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1733 'name' =>
'alsoUpdateStock',
1734 'type' =>
'checkbox',
1740 $_SERVER[
'PHP_SELF'].
'?id='.$object->id,
1741 $langs->trans(
'DeleteSending'),
1742 $langs->trans(
"ConfirmDeleteSending", $object->ref),
1751 if ($action ==
'valid') {
1752 $objectref = substr($object->ref, 1, 4);
1753 if ($objectref ==
'PROV') {
1754 $numref = $object->getNextNumRef($soc);
1756 $numref = $object->ref;
1759 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1761 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1763 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1767 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1768 $notify =
new Notify($db);
1770 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE', $object->socid, $object);
1773 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1776 if ($action ==
'cancel') {
1777 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending", $object->ref),
'confirm_cancel',
'', 0, 1);
1782 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1783 if (empty($reshook)) {
1785 } elseif ($reshook > 0) {
1794 $tmparray = $object->getTotalWeightVolume();
1795 $totalWeight = $tmparray[
'weight'];
1796 $totalVolume = $tmparray[
'volume'];
1799 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1801 $objectsrc->fetch($object->$typeobject->id);
1803 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1804 $objectsrc =
new Propal($db);
1805 $objectsrc->fetch($object->$typeobject->id);
1809 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1810 $morehtmlref =
'<div class="refidno">';
1812 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', 0, 1);
1813 $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);
1815 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1818 $langs->load(
"projects");
1819 $morehtmlref .=
'<br>';
1821 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1822 if ($action !=
'classify') {
1823 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1825 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1827 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1829 $proj->fetch($objectsrc->fk_project);
1830 $morehtmlref .= $proj->getNomUrl(1);
1832 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1837 $morehtmlref .=
'</div>';
1840 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1843 print
'<div class="fichecenter">';
1844 print
'<div class="fichehalfleft">';
1845 print
'<div class="underbanner clearboth"></div>';
1847 print
'<table class="border tableforfield" width="100%">';
1850 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1852 print $langs->trans(
"RefOrder").
'</td>';
1853 print
'<td colspan="3">';
1854 print $objectsrc->getNomUrl(1,
'commande');
1858 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1860 print $langs->trans(
"RefProposal").
'</td>';
1861 print
'<td colspan="3">';
1862 print $objectsrc->getNomUrl(1,
'expedition');
1868 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1869 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour").
"</td>\n";
1873 print
'<tr><td height="10">';
1874 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1875 print $langs->trans(
'DateDeliveryPlanned');
1878 if ($action !=
'editdate_livraison') {
1879 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>';
1881 print
'</tr></table>';
1882 print
'</td><td colspan="2">';
1883 if ($action ==
'editdate_livraison') {
1884 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1885 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1886 print
'<input type="hidden" name="action" value="setdate_livraison">';
1887 print
$form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1888 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
1891 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1898 print
$form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->expedition->creer);
1899 print
'</td><td colspan="3">';
1901 if ($action ==
'edittrueWeight') {
1902 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1903 print
'<input name="action" value="settrueWeight" type="hidden">';
1904 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1905 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1906 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
1907 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
1908 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1909 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1912 print $object->trueWeight;
1913 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1917 if ($totalWeight > 0) {
1918 if (!empty($object->trueWeight)) {
1919 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1921 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');
1922 if (!empty($object->trueWeight)) {
1929 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1930 print
$form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
1931 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1935 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1936 if ($action ==
'edittrueHeight') {
1937 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1938 print
'<input name="action" value="settrueHeight" type="hidden">';
1939 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1940 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1941 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
1942 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1943 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1944 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1947 print $object->trueHeight;
1948 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1954 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1955 print
$form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
1956 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1961 print $langs->trans(
"Volume");
1963 print
'<td colspan="3">';
1964 $calculatedVolume = 0;
1966 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1967 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1968 $volumeUnit = $object->size_units * 3;
1971 if ($calculatedVolume > 0) {
1972 if ($volumeUnit < 50) {
1973 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');
1978 if ($totalVolume > 0) {
1979 if ($calculatedVolume) {
1980 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1982 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');
1984 if ($calculatedVolume) {
1993 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1998 print
'<div class="fichehalfright">';
1999 print
'<div class="underbanner clearboth"></div>';
2001 print
'<table class="border centpercent tableforfield">';
2004 print
'<tr><td height="10">';
2005 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2006 print $langs->trans(
'SendingMethod');
2009 if ($action !=
'editshipping_method_id') {
2010 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>';
2012 print
'</tr></table>';
2013 print
'</td><td colspan="2">';
2014 if ($action ==
'editshipping_method_id') {
2015 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
2016 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2017 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2018 $object->fetch_delivery_methods();
2019 print
$form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
2021 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2023 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2026 if ($object->shipping_method_id > 0) {
2028 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2029 print $langs->trans(
"SendingMethod".strtoupper($code));
2036 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
2037 print
$form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer,
'safehtmlstring', $object->tracking_number);
2043 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2044 print $langs->trans(
'IncotermLabel');
2045 print
'<td><td class="right">';
2046 if ($user->rights->expedition->creer) {
2047 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2051 print
'</td></tr></table>';
2053 print
'<td colspan="3">';
2054 if ($action !=
'editincoterm') {
2055 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
2057 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
2063 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2064 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
2065 print $hookmanager->resPrint;
2072 print
'<div class="clearboth"></div>';
2077 if ($action ==
'editline') {
2078 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
2079 <input type="hidden" name="token" value="' .
newToken().
'">
2080 <input type="hidden" name="action" value="updateline">
2081 <input type="hidden" name="mode" value="">
2082 <input type="hidden" name="id" value="' . $object->id.
'">
2087 print
'<div class="div-table-responsive-no-min">';
2088 print
'<table class="noborder" width="100%" id="tablelines" >';
2090 print
'<tr class="liste_titre">';
2092 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
2093 print
'<td width="5" class="center linecolnum"> </td>';
2096 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2098 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2099 if ($origin && $origin_id > 0) {
2100 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2102 if ($action ==
'editline') {
2107 if (empty($conf->productbatch->enabled)) {
2110 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2111 if ($object->statut <= 1) {
2112 print $langs->trans(
"QtyToShip").
' - ';
2114 print $langs->trans(
"QtyShipped").
' - ';
2117 print $langs->trans(
"WarehouseSource").
' - ';
2120 print $langs->trans(
"Batch");
2124 if ($object->statut <= 1) {
2125 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2127 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2130 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2134 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2137 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2138 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2140 if ($object->statut == 0) {
2141 print
'<td class="linecoledit"></td>';
2142 print
'<td class="linecoldelete" width="10"></td>';
2147 $outputlangs = $langs;
2149 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
2150 $object->fetch_thirdparty();
2152 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2153 $newlang =
GETPOST(
'lang_id',
'aZ09');
2155 if (empty($newlang)) {
2156 $newlang = $object->thirdparty->default_lang;
2158 if (!empty($newlang)) {
2159 $outputlangs =
new Translate(
"", $conf);
2160 $outputlangs->setDefaultLang($newlang);
2165 $alreadysent = array();
2166 if ($origin && $origin_id > 0) {
2167 $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";
2168 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot";
2169 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2171 $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';
2172 $sql .=
', p.description as product_desc';
2173 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2174 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2175 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2177 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2178 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2179 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2180 $sql .=
" AND obj.rowid = ed.fk_origin_line";
2181 $sql .=
" AND ed.fk_expedition = e.rowid";
2183 $sql .=
" ORDER BY obj.fk_product";
2185 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2186 $resql = $db->query(
$sql);
2188 $num = $db->num_rows($resql);
2192 $obj = $db->fetch_object($resql);
2195 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2196 'shipment_ref'=>$obj->shipment_ref,
'shipment_id'=>$obj->shipment_id,
'warehouse'=>$obj->fk_entrepot,
'qty_shipped'=>$obj->qty_shipped,
2197 'product_tosell'=>$obj->product_tosell,
'product_tobuy'=>$obj->product_tobuy,
'product_tobatch'=>$obj->product_tobatch,
2198 'date_valid'=>$db->jdate($obj->date_valid),
'date_delivery'=>$db->jdate($obj->date_delivery));
2209 for ($i = 0; $i < $num_prod; $i++) {
2210 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2211 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters, $object, $action);
2216 if (empty($reshook)) {
2217 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2218 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2221 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
2222 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2226 if ($lines[$i]->fk_product > 0) {
2228 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
2230 $prod->fetch($lines[$i]->fk_product);
2231 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2233 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2236 print
'<td class="linecoldescription">';
2239 $product_static->type = $lines[$i]->fk_product_type;
2240 $product_static->id = $lines[$i]->fk_product;
2241 $product_static->ref = $lines[$i]->ref;
2242 $product_static->status = $lines[$i]->product_tosell;
2243 $product_static->status_buy = $lines[$i]->product_tobuy;
2244 $product_static->status_batch = $lines[$i]->product_tobatch;
2246 $product_static->weight = $lines[$i]->weight;
2247 $product_static->weight_units = $lines[$i]->weight_units;
2248 $product_static->length = $lines[$i]->length;
2249 $product_static->length_units = $lines[$i]->length_units;
2250 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2251 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2252 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2253 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2254 $product_static->surface = $lines[$i]->surface;
2255 $product_static->surface_units = $lines[$i]->surface_units;
2256 $product_static->volume = $lines[$i]->volume;
2257 $product_static->volume_units = $lines[$i]->volume_units;
2259 $text = $product_static->getNomUrl(1);
2260 $text .=
' - '.$label;
2262 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
2263 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2269 print
'<td class="linecoldescription" >';
2271 $text =
img_object($langs->trans(
'Service'),
'service');
2273 $text =
img_object($langs->trans(
'Product'),
'product');
2276 if (!empty($lines[$i]->label)) {
2277 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2278 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2288 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
2293 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2296 if ($origin && $origin_id > 0) {
2297 print
'<td class="linecolqtyinothershipments center nowrap">';
2299 $qtyalreadysent = 0;
2300 foreach ($alreadysent as $key => $val) {
2301 if ($lines[$i]->fk_origin_line == $key) {
2303 foreach ($val as $shipmentline_id => $shipmentline_var) {
2304 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2310 $htmltooltip .=
'<br>';
2312 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2313 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2314 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2315 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2322 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2325 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2329 print
$form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2333 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2335 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2336 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2337 print
'<!-- case edit 1 -->';
2339 foreach ($lines[$i]->detail_batch as $detail_batch) {
2342 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>';
2344 if ($lines[$i]->entrepot_id == 0) {
2346 $line->fetch($detail_batch->fk_expeditiondet);
2348 $entrepot_id = !empty($detail_batch->entrepot_id)?$detail_batch->entrepot_id:$lines[$i]->entrepot_id;
2349 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>';
2355 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2357 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2360 if ($lines[$i]->fk_product > 0) {
2361 if ($lines[$i]->entrepot_id > 0) {
2362 print
'<!-- case edit 2 -->';
2365 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>';
2367 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2369 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2371 } elseif (count($lines[$i]->details_entrepot) > 1) {
2372 print
'<!-- case edit 3 -->';
2373 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2376 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>';
2378 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2380 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2384 print
'<!-- case edit 4 -->';
2385 print
'<tr><td colspan="3">'.$langs->trans(
"NotEnoughStock").
'</td></tr>';
2388 print
'<!-- case edit 5 -->';
2391 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>';
2398 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2399 print
'<!-- case edit 6 -->';
2402 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2410 print
'</table></td>';
2413 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2417 print
'<td class="linecolwarehousesource left">';
2418 if ($lines[$i]->entrepot_id > 0) {
2420 $entrepot->fetch($lines[$i]->entrepot_id);
2421 print $entrepot->getNomUrl(1);
2422 } elseif (count($lines[$i]->details_entrepot) > 1) {
2424 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2425 if ($detail_entrepot->entrepot_id > 0) {
2427 $entrepot->fetch($detail_entrepot->entrepot_id);
2428 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2431 print
$form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2438 if (isset($lines[$i]->detail_batch)) {
2439 print
'<!-- Detail of lot -->';
2440 print
'<td class="linecolbatch">';
2441 if ($lines[$i]->product_tobatch) {
2443 foreach ($lines[$i]->detail_batch as $dbatch) {
2444 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2445 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
2446 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2448 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2449 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2451 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2454 print
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2456 print $langs->trans(
"NA");
2460 print
'<td class="linecolbatch" ></td>';
2466 print
'<td class="center linecolweight">';
2468 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2475 print
'<td class="center linecolvolume">';
2477 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2486 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2487 print
'<td class="center" colspan="2" valign="middle">';
2488 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2489 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2493 print
'<td class="linecoledit center">';
2494 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2496 print
'<td class="linecoldelete" width="10">';
2497 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2501 if (!empty($rowExtrafieldsStart)) {
2502 print $rowExtrafieldsStart;
2503 print $rowExtrafieldsView;
2511 if (!empty($extrafields)) {
2513 if ($origin && $origin_id > 0) {
2524 $line->fetch_optionals();
2527 if ($action ==
'editline' && $line->id == $line_id) {
2528 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2530 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2538 if (empty($num_prod)) {
2539 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2550 $object->fetchObjectLinked($object->id, $object->element);
2557 if (($user->socid == 0) && ($action !=
'presend')) {
2558 print
'<div class="tabsAction">';
2561 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
2563 if (empty($reshook)) {
2565 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer))
2566 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) {
2567 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=valid&token='.
newToken().
'&id='.$object->id,
'');
2569 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2576 if ($user->hasRight(
'expedition',
'creer')) {
2577 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?action=setdraft&token='.
newToken().
'&id='.$object->id,
'');
2581 if ($user->hasRight(
'expedition',
'creer')) {
2582 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
2583 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyUnbilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
2585 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
2591 if (empty($user->socid)) {
2592 if ($object->statut > 0) {
2593 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) {
2594 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
2596 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2603 if ($user->hasRight(
'facture',
'creer')) {
2606 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid,
'');
2613 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.$object->id,
'');
2617 if ($user->rights->expedition->creer && $object->statut > 0 && !$object->billed) {
2618 $label =
"Close"; $paramaction =
'classifyclosed';
2620 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
2621 $label =
"ClassifyBilled";
2622 $paramaction =
'classifybilled';
2624 print
dolGetButtonAction(
'', $langs->trans($label),
'default', $_SERVER[
"PHP_SELF"].
'?action='. $paramaction .
'&token='.
newToken().
'&id='.$object->id,
'');
2630 if ($user->rights->expedition->supprimer) {
2631 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
2636 if ($user->rights->expedition->supprimer) {
2637 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'');
2649 if ($action !=
'presend' && $action !=
'editline') {
2650 print
'<div class="fichecenter"><div class="fichehalfleft">';
2653 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2655 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2657 $genallowed = $user->rights->expedition->lire;
2658 $delallowed = $user->rights->expedition->creer;
2660 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2664 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'shipping'));
2665 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
2668 print
'</div><div class="fichehalfright">';
2671 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2673 $somethingshown =
$formactions->showactions($object,
'shipping', $socid, 1);
2675 print
'</div></div>';
2684 if (
GETPOST(
'modelselected')) {
2685 $action =
'presend';
2689 $modelmail =
'shipping_send';
2690 $defaulttopic = $langs->trans(
'SendShippingRef');
2691 $diroutput = $conf->expedition->dir_output.
'/sending';
2692 $trackid =
'shi'.$object->id;
2694 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') && $user->hasRight('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') && $user->hasRight('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)) $sql
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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_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.
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.
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.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.