40 require
'../main.inc.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
59 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
67 $langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'productbatch'));
70 $langs->load(
'incoterm');
73 $langs->load(
'productbatch');
76 $origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'expedition';
79 if (empty($origin_id)) {
82 if (empty($origin_id)) {
89 $action =
GETPOST(
'action',
'alpha');
90 $confirm =
GETPOST(
'confirm',
'alpha');
91 $cancel =
GETPOST(
'cancel',
'alpha');
103 $extrafields->fetch_name_optionals_label(
$object->table_element);
104 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
105 $extrafields->fetch_name_optionals_label($objectorder->table_element_line);
108 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
111 $hookmanager->initHooks(array(
'expeditioncard',
'globalcard'));
115 if ($id > 0 || !empty($ref)) {
123 $socid = $user->socid;
128 $permissiondellink = $user->hasRight(
'expedition',
'delivery',
'creer');
129 $permissiontoadd = $user->hasRight(
'expedition',
'creer');
142 if (empty($reshook)) {
144 if ($origin && $origin_id > 0) {
145 if ($origin ==
'commande') {
146 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
155 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
158 $upload_dir = $conf->expedition->dir_output.
'/sending';
159 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
162 if ($action ==
'setdraft' && $user->hasRight(
'expedition',
'creer')) {
164 $result =
$object->setDraft($user, 0);
170 if ($action ==
'reopen' && $user->hasRight(
'expedition',
'creer')) {
179 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm')) {
183 if ($action ==
'setref_customer') {
189 $result =
$object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
192 $action =
'editref_customer';
194 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
199 if ($action ==
'update_extras') {
203 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
210 $result =
$object->insertExtraFields(
'SHIPMENT_MODIFY');
218 $action =
'edit_extras';
223 if ($action ==
'add' && $user->hasRight(
'expedition',
'creer')) {
231 $object->origin_id = $origin_id;
243 $classname = ucfirst(
$object->origin);
244 $objectsrc =
new $classname($db);
245 $objectsrc->fetch(
$object->origin_id);
247 $object->socid = $objectsrc->socid;
250 $object->date_delivery = $date_delivery;
251 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
257 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
259 $batch_line = array();
260 $stockLine = array();
261 $array_options = array();
263 $num = count($objectsrc->lines);
266 for ($i = 0; $i < $num; $i++) {
273 $batch =
"batchl".$i.
"_0";
274 $stockLocation =
"ent1".$i.
"_0";
277 $is_batch_or_serial = 0;
278 if (!empty($objectsrc->lines[$i]->fk_product)) {
279 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
280 if ($resultFetch < 0) {
283 $is_batch_or_serial = $product->status_batch;
287 if (
isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
294 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
295 $subtotalqty += $sub_qty[$j][
'q'];
303 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 1) {
304 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
309 $batch =
"batchl".$i.
"_".$j;
310 $qty =
"qtyl".$i.
'_'.$j;
313 $batch_line[$i][
'detail'] = $sub_qty;
314 $batch_line[$i][
'qty'] = $subtotalqty;
317 $totalqty += $subtotalqty;
324 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
334 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
335 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
341 $stockLocation =
"ent1".$i.
"_".$j;
342 $qty =
"qtyl".$i.
'_'.$j;
353 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
354 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
360 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
362 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
364 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
365 unset($_POST[
"options_".$key]);
371 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
372 for ($i = 0; $i < $num; $i++) {
375 if (!isset($batch_line[$i])) {
377 if (isset($stockLine[$i])) {
379 $nbstockline = count($stockLine[$i]);
380 for ($j = 0; $j < $nbstockline; $j++) {
381 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
382 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
394 if ($entrepot_id < 0) {
397 if (!($objectsrc->lines[$i]->fk_product > 0)) {
410 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
411 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
420 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
433 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
435 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
437 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
443 header(
"Location: card.php?id=".
$object->id);
450 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
454 $result =
$object->create_delivery($user);
458 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&id='.$result);
465 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' &&
466 ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
467 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate')))
471 $result =
$object->valid($user);
478 $outputlangs = $langs;
481 $newlang =
GETPOST(
'lang_id',
'aZ09');
484 $newlang =
$object->thirdparty->default_lang;
486 if (!empty($newlang)) {
488 $outputlangs->setDefaultLang($newlang);
493 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
499 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
500 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
501 $result =
$object->cancel(0, $also_update_stock);
503 $result =
$object->setStatut(-1);
507 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
508 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
509 $result =
$object->delete($user, 0, $also_update_stock);
511 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
525 } elseif ($action ==
'setdate_livraison' && $user->hasRight(
'expedition',
'creer')) {
529 $result =
$object->setDeliveryDate($user, $datedelivery);
533 } elseif (($action ==
'settracking_number'
534 || $action ==
'settracking_url'
535 || $action ==
'settrueWeight'
536 || $action ==
'settrueWidth'
537 || $action ==
'settrueHeight'
538 || $action ==
'settrueDepth'
539 || $action ==
'setshipping_method_id')
540 && $user->hasRight(
'expedition',
'creer')
545 if ($action ==
'settracking_number') {
546 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
548 if ($action ==
'settracking_url') {
549 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
551 if ($action ==
'settrueWeight') {
555 if ($action ==
'settrueWidth') {
558 if ($action ==
'settrueHeight') {
562 if ($action ==
'settrueDepth') {
565 if ($action ==
'setshipping_method_id') {
570 if (
$object->update($user) >= 0) {
571 header(
"Location: card.php?id=".
$object->id);
578 } elseif ($action ==
'classifybilled') {
580 $result =
$object->setBilled();
582 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
586 } elseif ($action ==
'classifyclosed') {
588 $result =
$object->setClosed();
590 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
594 } elseif ($action ==
'deleteline' && !empty($line_id)) {
599 $line->fk_expedition =
$object->id;
601 $num_prod = count($lines);
602 for ($i = 0; $i < $num_prod; $i++) {
603 if ($lines[$i]->
id == $line_id) {
604 if (count($lines[$i]->details_entrepot) > 1) {
606 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
607 $line->id = $details_entrepot->line_id;
608 if (!$error && $line->delete($user) < 0) {
614 $line->id = $line_id;
615 if (!$error && $line->delete($user) < 0) {
620 unset($_POST[
"lineid"]);
624 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
629 } elseif ($action ==
'updateline' && $user->hasRight(
'expedition',
'creer') &&
GETPOST(
'save')) {
637 $num_prod = count($lines);
638 for ($i = 0; $i < $num_prod; $i++) {
639 if ($lines[$i]->
id == $line_id) {
640 $update_done =
false;
642 $line->fk_expedition =
$object->id;
645 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
647 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
648 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
649 unset($_POST[
"options_".$key]);
652 $line->fk_product = $lines[$i]->fk_product;
653 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
655 foreach ($lines[$i]->detail_batch as $detail_batch) {
657 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
658 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
661 if (!empty($batch_id)) {
662 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
663 if ($lines[$i]->entrepot_id != 0) {
665 $line->entrepot_id = $lotStock->warehouseid;
669 if (empty($line->detail_batch)) {
670 $line->detail_batch =
new stdClass();
673 $line->detail_batch->fk_origin_stock = $batch_id;
674 $line->detail_batch->batch = $lotStock->batch;
675 $line->detail_batch->id = $detail_batch->id;
676 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
677 $line->detail_batch->qty = $batch_qty;
678 if ($line->update($user) < 0) {
689 unset($_POST[$batch]);
694 $batch =
"batchl".$line_id.
"_0";
695 $qty =
"qtyl".$line_id.
"_0";
699 if ($batch_qty > 0 && !empty($batch_id)) {
700 if ($lotStock->fetch($batch_id) > 0) {
702 if ($lines[$i]->entrepot_id > 0) {
704 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
705 $lineIdToAddLot = $line_id;
707 } elseif (count($lines[$i]->details_entrepot) > 1) {
709 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
710 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
711 $lineIdToAddLot = $detail_entrepot->line_id;
715 if ($lineIdToAddLot) {
717 if ($line->fetch($lineIdToAddLot) > 0) {
718 $line->detail_batch->fk_origin_stock = $batch_id;
719 $line->detail_batch->batch = $lotStock->batch;
720 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
721 $line->detail_batch->qty = $batch_qty;
722 if ($line->update($user) < 0) {
734 $line->origin_line_id = $lines[$i]->origin_line_id;
735 $line->entrepot_id = $lotStock->warehouseid;
737 $line->detail_batch[0]->fk_origin_stock = $batch_id;
738 $line->detail_batch[0]->batch = $lotStock->batch;
739 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
740 $line->detail_batch[0]->qty = $batch_qty;
741 if (
$object->create_line_batch($line, $line->array_options) < 0) {
754 if ($lines[$i]->fk_product > 0) {
756 if ($lines[$i]->entrepot_id == 0) {
759 $qty =
"qtyl".$line_id;
760 $line->id = $line_id;
761 $line->entrepot_id =
GETPOSTINT($stockLocation);
763 if ($line->update($user) < 0) {
767 unset($_POST[$stockLocation]);
769 } elseif ($lines[$i]->entrepot_id > 0) {
771 $stockLocation =
"entl".$line_id;
772 $qty =
"qtyl".$line_id;
773 $line->id = $line_id;
774 $line->entrepot_id =
GETPOSTINT($stockLocation);
776 if ($line->update($user) < 0) {
780 unset($_POST[$stockLocation]);
782 } elseif (count($lines[$i]->details_entrepot) > 1) {
784 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
786 $stockLocation =
"entl".$detail_entrepot->line_id;
787 $qty =
"qtyl".$detail_entrepot->line_id;
789 if (!empty($warehouse)) {
790 $line->id = $detail_entrepot->line_id;
791 $line->entrepot_id = $warehouse;
793 if ($line->update($user) < 0) {
800 unset($_POST[$stockLocation]);
804 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
805 $qty =
"qtyl".$line_id;
806 $line->id = $line_id;
808 $line->entrepot_id = 0;
809 if ($line->update($user) < 0) {
819 $qty =
"qtyl".$line_id;
820 $line->id = $line_id;
822 $line->entrepot_id = 0;
823 if ($line->update($user) < 0) {
833 if (empty($update_done)) {
834 $line->id = $lines[$i]->id;
835 $line->insertExtraFields();
840 unset($_POST[
"lineid"]);
845 $outputlangs = $langs;
848 $newlang =
GETPOST(
'lang_id',
'aZ09');
851 $newlang =
$object->thirdparty->default_lang;
853 if (!empty($newlang)) {
855 $outputlangs->setDefaultLang($newlang);
859 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
862 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
865 } elseif ($action ==
'updateline' && $user->hasRight(
'expedition',
'creer') &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
866 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
870 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
876 $triggersendname =
'SHIPPING_SENTBYMAIL';
878 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
879 $mode =
'emailfromshipment';
880 $trackid =
'shi'.$object->id;
881 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
889 $title =
$object->ref.
' - '.$langs->trans(
"Shipment");
890 if ($action ==
'create2') {
891 $title = $langs->trans(
"CreateShipment");
893 $help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
897 if (empty($action)) {
908 $product_static =
new Product($db);
910 $warehousestatic =
new Entrepot($db);
912 if ($action ==
'create2') {
915 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
922 if ($action ==
'create') {
932 $classname = ucfirst($origin);
935 if (
$object->fetch($origin_id)) {
939 $author =
new User($db);
940 $author->fetch(
$object->user_author_id);
946 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
947 print
'<input type="hidden" name="token" value="'.newToken().
'">';
948 print
'<input type="hidden" name="action" value="add">';
949 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
950 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
952 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
957 print
'<table class="border centpercent">';
960 print
'<tr><td class="titlefieldcreate fieldrequired">';
962 print $langs->trans(
"RefOrder");
965 print $langs->trans(
"RefProposal");
967 print
'</td><td colspan="3">';
974 if ($origin ==
'commande') {
975 print $langs->trans(
'RefCustomerOrder');
976 } elseif ($origin ==
'propal') {
977 print $langs->trans(
'RefCustomerOrder');
979 print $langs->trans(
'RefCustomer');
981 print
'</td><td colspan="3">';
982 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
987 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
988 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
994 if (empty($projectid) && !empty(
$object->fk_project)) {
995 $projectid =
$object->fk_project;
997 if ($origin ==
'project') {
998 $projectid = ($originid ? $originid : 0);
1001 $langs->load(
"projects");
1003 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1004 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1005 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
1006 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>';
1012 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1013 print
'<td colspan="3">';
1014 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1015 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1016 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1021 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1022 print
'<td colspan="3">';
1023 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1024 print $doleditor->Create(1);
1028 if (
$object->note_private && !$user->socid) {
1029 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1030 print
'<td colspan="3">';
1031 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1032 print $doleditor->Create(1);
1038 print $langs->trans(
"Weight");
1039 print
'</td><td colspan="3">';
1040 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1041 print
'<input name="weight" size="4" value="'.GETPOSTINT(
'weight').
'"> ';
1042 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
1043 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1044 print
$form->textwithpicto($text, $htmltext);
1048 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1049 print
' </td><td colspan="3">';
1050 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1051 print
'<input name="sizeW" size="4" value="'.GETPOSTINT(
'sizeW').
'">';
1052 print
' x <input name="sizeH" size="4" value="'.GETPOSTINT(
'sizeH').
'">';
1053 print
' x <input name="sizeS" size="4" value="'.GETPOSTINT(
'sizeS').
'">';
1055 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
1056 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1057 print
$form->textwithpicto($text, $htmltext);
1061 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1062 print
'<td colspan="3">';
1063 $expe->fetch_delivery_methods();
1064 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1065 print
$form->selectarray(
"shipping_method_id", $expe->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1067 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1069 print
"</td></tr>\n";
1072 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1073 print
'<td colspan="3">';
1074 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1075 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1076 print
"</td></tr>\n";
1079 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1080 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $expe, $action);
1081 print $hookmanager->resPrint;
1083 if (empty($reshook)) {
1085 if (
$object->fetch_optionals() > 0) {
1086 $expe->array_options = array_merge($expe->array_options,
$object->array_options);
1088 print $expe->showOptionals($extrafields,
'edit',
$parameters);
1095 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1096 print
'<td colspan="3" class="maxwidthonsmartphone">';
1097 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1098 print
$form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1103 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1105 if (count($list) > 1) {
1106 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1107 print
'<td colspan="3">';
1108 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1109 print
$form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1110 print
"</td></tr>\n";
1120 $numAsked = count(
$object->lines);
1122 print
'<script type="text/javascript">'.
"\n";
1123 print
'jQuery(document).ready(function() {'.
"\n";
1124 print
'jQuery("#autofill").click(function() {';
1126 while ($i < $numAsked) {
1127 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1129 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1133 print
'return false; });'.
"\n";
1134 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1135 print
'return false; });'.
"\n";
1137 print
'</script>'.
"\n";
1141 print
'<table class="noborder centpercent">';
1147 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1150 print
'<tr class="liste_titre">';
1151 print
'<td>'.$langs->trans(
"Description").
'</td>';
1152 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1153 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1154 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1155 if (empty($conf->productbatch->enabled)) {
1156 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1161 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1164 if (empty($conf->productbatch->enabled)) {
1165 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1167 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1171 print
'<td class="left">'.$langs->trans(
'StockEntryDate').
'</td>';
1177 $warehousePicking = array();
1179 if ($warehouse_id > 0) {
1180 $warehousePicking[] = $warehouse_id;
1182 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1186 while ($indiceAsked < $numAsked) {
1189 $line =
$object->lines[$indiceAsked];
1191 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1192 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters,
$object, $action);
1197 if (empty($reshook)) {
1199 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1202 if (!empty($line->date_start)) {
1205 if (!empty($line->date_end)) {
1209 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1210 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1213 if ($line->fk_product > 0) {
1214 $res = $product->fetch($line->fk_product);
1218 $product->load_stock(
'warehouseopen');
1222 print
'<a name="'.$line->id.
'"></a>';
1225 $product_static->type = $line->fk_product_type;
1226 $product_static->id = $line->fk_product;
1227 $product_static->ref = $line->ref;
1228 $product_static->status = $line->product_tosell;
1229 $product_static->status_buy = $line->product_tobuy;
1230 $product_static->status_batch = $line->product_tobatch;
1232 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1234 $text = $product_static->getNomUrl(1);
1235 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1238 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1241 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1244 if ($showdescinproductdesc) {
1245 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1252 $text =
img_object($langs->trans(
'Service'),
'service');
1254 $text =
img_object($langs->trans(
'Product'),
'product');
1257 if (!empty($line->label)) {
1258 $text .=
' <strong>'.$line->label.
'</strong>';
1259 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1261 print $text.
' '.nl2br($line->desc);
1265 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1276 print
'<td class="center">'.$line->qty;
1277 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1278 print
''.$unit_order.
'</td>';
1279 $qtyProdCom = $line->qty;
1282 print
'<td class="center">';
1283 $quantityDelivered = isset(
$object->expeditions[$line->id]) ?
$object->expeditions[$line->id] :
'';
1284 print $quantityDelivered;
1285 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1286 print
''.$unit_order.
'</td>';
1289 $quantityAsked = $line->qty;
1291 $quantityToBeDelivered = 0;
1293 if (is_numeric($quantityDelivered)) {
1294 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1296 $quantityToBeDelivered = $quantityAsked;
1300 $warehouseObject =
null;
1301 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !
isModEnabled(
'stock')) {
1302 print
'<!-- Case warehouse already known or product not a predefined product -->';
1304 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1306 $deliverableQty = $quantityToBeDelivered;
1308 $deliverableQty = min($quantityToBeDelivered, $stock);
1310 if ($deliverableQty < 0) {
1311 $deliverableQty = 0;
1313 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1315 print
'<td class="center">';
1318 $deliverableQty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1320 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1321 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.
'">';
1324 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1325 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1328 print $langs->trans(
"NA");
1334 print
'<td class="left">';
1337 $ent =
"entl".$indiceAsked;
1338 $idl =
"idl".$indiceAsked;
1340 if ($line->fk_product > 0) {
1341 print
'<!-- Show warehouse selection -->';
1347 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1349 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1351 if ($stock < $quantityToBeDelivered) {
1352 print
' '.img_warning($langs->trans(
"StockTooLow"));
1357 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span><input name="entl'.$indiceAsked.
'" id="entl'.$indiceAsked.
'" type="hidden" value="0">';
1368 $product->get_sousproduits_arbo();
1369 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1370 if (count($prods_arbo) > 0) {
1371 foreach ($prods_arbo as $key => $value) {
1374 if ($value[
'stock'] < $value[
'stock_alert']) {
1377 print
"<tr class=\"oddeven\"><td> ->
1378 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1379 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1380 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1390 print
'<td></td><td></td>';
1395 print
'<!-- Case product need lot -->';
1397 $staticwarehouse =
new Entrepot($db);
1398 if ($warehouse_id > 0) {
1399 $staticwarehouse->fetch($warehouse_id);
1405 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1406 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1410 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1411 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1412 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1414 $batchStock = + $dbatch->qty;
1415 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1416 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1417 print
'<td colspan="3" ></td><td class="center">';
1418 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1421 print
'<!-- Show details of lot -->';
1422 print
'<td class="left">';
1424 print $staticwarehouse->getNomUrl(0).
' / ';
1426 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1429 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1431 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1434 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1436 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1440 $quantityToBeDelivered -= $deliverableQty;
1441 if ($quantityToBeDelivered < 0) {
1442 $quantityToBeDelivered = 0;
1447 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1452 print
'<!-- Case there is no details of lot at all -->';
1453 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1454 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1457 print
'<td class="left">';
1458 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1468 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1469 print
'<!-- Case warehouse not already known and product does not need lot -->';
1470 print
'<td></td><td></td>';
1476 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1481 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1482 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1486 $tmpwarehouseObject =
new Entrepot($db);
1487 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1489 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1494 $tmpwarehouseObject->fetch($warehouse_id);
1495 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1496 $stock = + $stock_warehouse->real;
1497 $deliverableQty = min($quantityToBeDelivered, $stock);
1498 $deliverableQty = max(0, $deliverableQty);
1500 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1501 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1503 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1504 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1506 if (!isset($alreadyQtySetted[$line->fk_product])) {
1507 $alreadyQtySetted[$line->fk_product] = array();
1510 $deliverableQty = min($quantityToBeDelivered, $stock);
1513 if ($deliverableQty < 0) {
1514 $deliverableQty = 0;
1518 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1519 $tooltip =
' class="classfortooltip" title="'.$langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)].
'" ';
1521 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1524 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1526 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1531 print
'<input '.$tooltip.
' class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1532 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1535 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1538 print $langs->trans(
"NA");
1544 print
'<td class="left">';
1546 print $tmpwarehouseObject->getNomUrl(0).
' ';
1548 print
'<!-- Show details of stock -->';
1549 print
'('.$stock.
')';
1551 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1555 $quantityToBeDelivered -= $deliverableQty;
1556 if ($quantityToBeDelivered < 0) {
1557 $quantityToBeDelivered = 0;
1568 $product->get_sousproduits_arbo();
1569 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1570 if (count($prods_arbo) > 0) {
1571 foreach ($prods_arbo as $key => $value) {
1574 if ($value[
'stock'] < $value[
'stock_alert']) {
1577 print
'<tr class"oddeven"><td>';
1578 print
" ->
1579 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1580 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1581 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1590 print
'<!-- Case warehouse not already known and product need lot -->';
1591 print
'<td></td><td></td>';
1598 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1600 $tmpwarehouseObject =
new Entrepot($db);
1605 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1606 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1607 $nbofsuggested += count($stock_warehouse->detail_batch);
1611 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1613 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1618 $tmpwarehouseObject->fetch($warehouse_id);
1619 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1620 foreach ($stock_warehouse->detail_batch as $dbatch) {
1621 $batchStock = + $dbatch->qty;
1622 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1623 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1625 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1626 $alreadyQtyBatchSetted[$line->fk_product] = array();
1629 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1630 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1633 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1636 if ($deliverableQty < 0) {
1637 $deliverableQty = 0;
1640 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1645 $tooltipClass = $tooltipTitle =
'';
1646 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1647 $tooltipClass =
' classfortooltip';
1648 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1650 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1652 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1654 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1655 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1658 print
'<td class="left">';
1660 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1662 print
'<!-- Show details of lot -->';
1663 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1666 print $langs->trans(
"Batch").
': ';
1667 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1669 print $productlotObject->getNomUrl(1);
1671 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1674 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1677 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1679 print
' ('.$dbatch->qty.
')';
1680 $quantityToBeDelivered -= $deliverableQty;
1681 if ($quantityToBeDelivered < 0) {
1682 $quantityToBeDelivered = 0;
1688 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1696 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1698 print
'<!-- line not shown yet, we show it -->';
1699 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1703 if (
isModEnabled(
'productbatch') && $product->hasbatch()) {
1704 $disabled =
'disabled="disabled"';
1706 if ($warehouse_selected_id <= 0) {
1707 $disabled =
'disabled="disabled"';
1709 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1711 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1714 print $langs->trans(
"NA");
1718 print
'<td class="left">';
1720 if ($warehouse_selected_id > 0) {
1721 $warehouseObject =
new Entrepot($db);
1722 $warehouseObject->fetch($warehouse_selected_id);
1723 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1725 if ($line->fk_product) {
1726 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1732 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1744 if (!empty($extrafields)) {
1750 $srcLine->id = $line->id;
1751 $srcLine->fetch_optionals();
1753 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1755 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1766 print
$form->buttonsSaveCancel(
"Create");
1783 $num_prod = count($lines);
1786 $typeobject =
$object->origin;
1788 $origin_id =
$object->origin_id;
1796 $res =
$object->fetch_optionals();
1804 if ($action ==
'delete') {
1805 $formquestion = array();
1807 $formquestion = array(
1809 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1810 'name' =>
'alsoUpdateStock',
1811 'type' =>
'checkbox',
1817 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1818 $langs->trans(
'DeleteSending'),
1819 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1828 if ($action ==
'valid') {
1829 $objectref = substr(
$object->ref, 1, 4);
1830 if ($objectref ==
'PROV') {
1831 $numref =
$object->getNextNumRef($soc);
1836 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1838 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1840 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1844 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1845 $notify =
new Notify($db);
1847 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1850 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1853 if ($action ==
'cancel') {
1854 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1860 if (empty($reshook)) {
1862 } elseif ($reshook > 0) {
1871 $tmparray =
$object->getTotalWeightVolume();
1872 $totalWeight = $tmparray[
'weight'];
1873 $totalVolume = $tmparray[
'volume'];
1875 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id &&
isModEnabled(
'order')) {
1877 $objectsrc->fetch(
$object->origin_object->id);
1879 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id &&
isModEnabled(
"propal")) {
1880 $objectsrc =
new Propal($db);
1881 $objectsrc->fetch(
$object->origin_object->id);
1885 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1886 $morehtmlref =
'<div class="refidno">';
1888 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1889 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ?
':' .
getDolGlobalString(
'THIRDPARTY_REF_INPUT_SIZE') :
''),
'', null, null,
'', 1);
1891 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1894 $langs->load(
"projects");
1895 $morehtmlref .=
'<br>';
1897 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1898 if ($action !=
'classify') {
1899 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1901 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1903 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1905 $proj->fetch($objectsrc->fk_project);
1906 $morehtmlref .= $proj->getNomUrl(1);
1908 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1913 $morehtmlref .=
'</div>';
1916 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1919 print
'<div class="fichecenter">';
1920 print
'<div class="fichehalfleft">';
1921 print
'<div class="underbanner clearboth"></div>';
1923 print
'<table class="border tableforfield centpercent">';
1926 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id &&
isModEnabled(
'order')) {
1928 print $langs->trans(
"RefOrder").
'</td>';
1929 print
'<td colspan="3">';
1930 print $objectsrc->getNomUrl(1,
'commande');
1934 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id &&
isModEnabled(
"propal")) {
1936 print $langs->trans(
"RefProposal").
'</td>';
1937 print
'<td colspan="3">';
1938 print $objectsrc->getNomUrl(1,
'expedition');
1944 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1945 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
1949 print
'<tr><td height="10">';
1950 print
'<table class="nobordernopadding centpercent"><tr><td>';
1951 print $langs->trans(
'DateDeliveryPlanned');
1954 if ($action !=
'editdate_livraison') {
1955 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>';
1957 print
'</tr></table>';
1958 print
'</td><td colspan="2">';
1959 if ($action ==
'editdate_livraison') {
1960 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1961 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1962 print
'<input type="hidden" name="action" value="setdate_livraison">';
1963 print
$form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
1964 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
1974 print
$form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
1975 print
'</td><td colspan="3">';
1977 if ($action ==
'edittrueWeight') {
1978 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1979 print
'<input name="action" value="settrueWeight" type="hidden">';
1980 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1981 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1982 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
1983 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
1984 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1985 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1989 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
1993 if ($totalWeight > 0) {
1994 if (!empty(
$object->trueWeight)) {
1995 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1997 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');
1998 if (!empty(
$object->trueWeight)) {
2005 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2006 print
$form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2007 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2011 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2012 if ($action ==
'edittrueHeight') {
2013 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2014 print
'<input name="action" value="settrueHeight" type="hidden">';
2015 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2016 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2017 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2018 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2019 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2020 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2024 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2030 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2031 print
$form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2032 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2037 print $langs->trans(
"Volume");
2039 print
'<td colspan="3">';
2040 $calculatedVolume = 0;
2044 $volumeUnit =
$object->size_units * 3;
2047 if ($calculatedVolume > 0) {
2048 if ($volumeUnit < 50) {
2049 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');
2054 if ($totalVolume > 0) {
2055 if ($calculatedVolume) {
2056 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2058 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');
2060 if ($calculatedVolume) {
2069 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2074 print
'<div class="fichehalfright">';
2075 print
'<div class="underbanner clearboth"></div>';
2077 print
'<table class="border centpercent tableforfield">';
2080 print
'<tr><td height="10">';
2081 print
'<table class="nobordernopadding centpercent"><tr><td>';
2082 print $langs->trans(
'SendingMethod');
2085 if ($action !=
'editshipping_method_id') {
2086 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>';
2088 print
'</tr></table>';
2089 print
'</td><td colspan="2">';
2090 if ($action ==
'editshipping_method_id') {
2091 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2092 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2093 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2094 $object->fetch_delivery_methods();
2095 print
$form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2097 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2099 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2102 if (
$object->shipping_method_id > 0) {
2104 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2105 print $langs->trans(
"SendingMethod".strtoupper($code));
2112 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2113 print
$form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2119 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2120 print $langs->trans(
'IncotermLabel');
2121 print
'<td><td class="right">';
2122 if ($user->hasRight(
'expedition',
'creer')) {
2123 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2127 print
'</td></tr></table>';
2129 print
'<td colspan="3">';
2130 if ($action !=
'editincoterm') {
2133 print
$form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2139 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2140 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters,
$object, $action);
2141 print $hookmanager->resPrint;
2148 print
'<div class="clearboth"></div>';
2153 if ($action ==
'editline') {
2154 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2155 <input type="hidden" name="token" value="' .
newToken().
'">
2156 <input type="hidden" name="action" value="updateline">
2157 <input type="hidden" name="mode" value="">
2158 <input type="hidden" name="id" value="' .
$object->id.
'">
2163 print
'<div class="div-table-responsive-no-min">';
2164 print
'<table class="noborder" width="100%" id="tablelines" >';
2166 print
'<tr class="liste_titre">';
2169 print
'<td width="5" class="center linecolnum"> </td>';
2172 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2174 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2175 if ($origin && $origin_id > 0) {
2176 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2178 if ($action ==
'editline') {
2183 if (empty($conf->productbatch->enabled)) {
2186 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2188 print $langs->trans(
"QtyToShip").
' - ';
2190 print $langs->trans(
"QtyShipped").
' - ';
2193 print $langs->trans(
"WarehouseSource").
' - ';
2196 print $langs->trans(
"Batch");
2201 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2203 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2206 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2210 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2213 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2214 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2217 print
'<td class="linecoledit"></td>';
2218 print
'<td class="linecoldelete" width="10"></td>';
2223 $outputlangs = $langs;
2228 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2229 $newlang =
GETPOST(
'lang_id',
'aZ09');
2231 if (empty($newlang)) {
2232 $newlang =
$object->thirdparty->default_lang;
2234 if (!empty($newlang)) {
2235 $outputlangs =
new Translate(
"", $conf);
2236 $outputlangs->setDefaultLang($newlang);
2241 $alreadysent = array();
2242 if ($origin && $origin_id > 0) {
2243 $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";
2244 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2245 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2247 $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';
2248 $sql .=
', p.description as product_desc';
2249 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2250 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2251 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2253 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2254 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2255 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2256 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2257 $sql .=
" AND ed.fk_expedition = e.rowid";
2259 $sql .=
" ORDER BY obj.fk_product";
2261 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2262 $resql = $db->query(
$sql);
2264 $num = $db->num_rows($resql);
2268 $obj = $db->fetch_object($resql);
2271 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2272 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2273 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2274 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2285 for ($i = 0; $i < $num_prod; $i++) {
2286 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2287 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters,
$object, $action);
2292 if (empty($reshook)) {
2293 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2294 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2298 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2302 if ($lines[$i]->fk_product > 0) {
2306 $prod->fetch($lines[$i]->fk_product);
2307 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2309 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2312 print
'<td class="linecoldescription">';
2315 $product_static->type = $lines[$i]->fk_product_type;
2316 $product_static->id = $lines[$i]->fk_product;
2317 $product_static->ref = $lines[$i]->ref;
2318 $product_static->status = $lines[$i]->product_tosell;
2319 $product_static->status_buy = $lines[$i]->product_tobuy;
2320 $product_static->status_batch = $lines[$i]->product_tobatch;
2322 $product_static->weight = $lines[$i]->weight;
2323 $product_static->weight_units = $lines[$i]->weight_units;
2324 $product_static->length = $lines[$i]->length;
2325 $product_static->length_units = $lines[$i]->length_units;
2326 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2327 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2328 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2329 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2330 $product_static->surface = $lines[$i]->surface;
2331 $product_static->surface_units = $lines[$i]->surface_units;
2332 $product_static->volume = $lines[$i]->volume;
2333 $product_static->volume_units = $lines[$i]->volume_units;
2335 $text = $product_static->getNomUrl(1);
2336 $text .=
' - '.$label;
2338 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
2339 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2345 print
'<td class="linecoldescription" >';
2347 $text =
img_object($langs->trans(
'Service'),
'service');
2349 $text =
img_object($langs->trans(
'Product'),
'product');
2352 if (!empty($lines[$i]->label)) {
2353 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2354 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2369 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2372 if ($origin && $origin_id > 0) {
2373 print
'<td class="linecolqtyinothershipments center nowrap">';
2375 $qtyalreadysent = 0;
2376 foreach ($alreadysent as $key => $val) {
2377 if ($lines[$i]->fk_elementdet == $key) {
2379 foreach ($val as $shipmentline_id => $shipmentline_var) {
2380 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2386 $htmltooltip .=
'<br>';
2388 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2389 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2390 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2391 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2398 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2401 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2405 print
$form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2409 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2411 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2412 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2413 print
'<!-- case edit 1 -->';
2415 foreach ($lines[$i]->detail_batch as $detail_batch) {
2418 print
'<td><input class="qtyl right" name="qtyl'.$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id.
'" id="qtyl'.$line_id.
'_'.$detail_batch->id.
'" type="text" size="4" value="'.$detail_batch->qty.
'"></td>';
2420 if ($lines[$i]->entrepot_id == 0) {
2422 $line->fetch($detail_batch->fk_expeditiondet);
2424 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2425 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>';
2431 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2433 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2436 if ($lines[$i]->fk_product > 0) {
2437 if ($lines[$i]->entrepot_id > 0) {
2438 print
'<!-- case edit 2 -->';
2441 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2443 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2445 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2447 } elseif (count($lines[$i]->details_entrepot) > 1) {
2448 print
'<!-- case edit 3 -->';
2449 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2452 print
'<td><input class="qtyl right" name="qtyl'.$detail_entrepot->line_id.
'" id="qtyl'.$detail_entrepot->line_id.
'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.
'">'.$unit_order.
'</td>';
2454 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2456 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2460 print
'<!-- case edit 4 -->';
2463 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2464 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2468 print
'<!-- case edit 5 -->';
2469 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2472 print
'<!-- case edit 6 -->';
2475 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2482 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2483 print
'<!-- case edit 7 -->';
2486 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2494 print
'</table></td>';
2497 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2501 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2503 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2504 } elseif ($lines[$i]->entrepot_id > 0) {
2506 $entrepot->fetch($lines[$i]->entrepot_id);
2507 print $entrepot->getNomUrl(1);
2508 } elseif (count($lines[$i]->details_entrepot) > 1) {
2510 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2511 if ($detail_entrepot->entrepot_id > 0) {
2513 $entrepot->fetch($detail_entrepot->entrepot_id);
2514 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2517 print
$form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2524 if (isset($lines[$i]->detail_batch)) {
2525 print
'<!-- Detail of lot -->';
2526 print
'<td class="linecolbatch">';
2527 if ($lines[$i]->product_tobatch) {
2529 foreach ($lines[$i]->detail_batch as $dbatch) {
2530 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2532 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2535 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2537 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2540 print
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2542 print $langs->trans(
"NA");
2546 print
'<td class="linecolbatch" ></td>';
2552 print
'<td class="center linecolweight">';
2554 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2561 print
'<td class="center linecolvolume">';
2563 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2572 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2573 print
'<td class="center" colspan="2" valign="middle">';
2574 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2575 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2579 print
'<td class="linecoledit center">';
2580 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2582 print
'<td class="linecoldelete" width="10">';
2583 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2587 if (!empty($rowExtrafieldsStart)) {
2588 print $rowExtrafieldsStart;
2589 print $rowExtrafieldsView;
2597 if (!empty($extrafields)) {
2599 if ($origin && $origin_id > 0) {
2610 $line->fetch_optionals();
2613 if ($action ==
'editline' && $line->id == $line_id) {
2614 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2616 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2624 if (empty($num_prod)) {
2625 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2643 if (($user->socid == 0) && ($action !=
'presend')) {
2644 print
'<div class="tabsAction">';
2647 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters,
$object, $action);
2649 if (empty($reshook)) {
2651 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2652 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2655 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2661 if ($user->hasRight(
'expedition',
'creer')) {
2666 if ($user->hasRight(
'expedition',
'creer')) {
2672 if (empty($user->socid)) {
2674 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2675 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2677 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2684 if ($user->hasRight(
'facture',
'creer')) {
2686 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2694 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2699 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2701 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2709 if ($user->hasRight(
'expedition',
'creer')) {
2710 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2715 if ($user->hasRight(
'expedition',
'supprimer')) {
2728 if ($action !=
'presend' && $action !=
'editline') {
2729 print
'<div class="fichecenter"><div class="fichehalfleft">';
2732 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2734 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2736 $genallowed = $user->hasRight(
'expedition',
'lire');
2737 $delallowed = $user->hasRight(
'expedition',
'creer');
2739 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2743 $linktoelem =
$form->showLinkToObjectBlock(
$object,
null, array(
'shipping'));
2744 $somethingshown =
$form->showLinkedObjectBlock(
$object, $linktoelem);
2747 print
'</div><div class="fichehalfright">';
2750 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2754 print
'</div></div>';
2763 if (
GETPOST(
'modelselected')) {
2764 $action =
'presend';
2768 $modelmail =
'shipping_send';
2769 $defaulttopic =
'SendShippingRef';
2770 $diroutput = $conf->expedition->dir_output.
'/sending';
2771 $trackid =
'shi'.$object->id;
2773 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
Class to manage lines of shipment.
CRUD class for batch number management within shipment.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation models.
Class to manage the table of subscription to notifications.
Class to manage order lines.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('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') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information in HTML 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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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 edit/modify 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.