40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
52if (isModEnabled(
"product") || isModEnabled(
"service")) {
53 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
55if (isModEnabled(
"propal")) {
56 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
58if (isModEnabled(
'productbatch')) {
59 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
61if (isModEnabled(
'project')) {
62 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
75$langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'productbatch'));
77if (isModEnabled(
'incoterm')) {
78 $langs->load(
'incoterm');
80if (isModEnabled(
'productbatch')) {
81 $langs->load(
'productbatch');
84$origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'expedition';
87if (empty($origin_id)) {
90if (empty($origin_id)) {
97$action =
GETPOST(
'action',
'alpha');
98$confirm =
GETPOST(
'confirm',
'alpha');
99$cancel =
GETPOST(
'cancel',
'alpha');
111$extrafields->fetch_name_optionals_label(
$object->table_element);
112$extrafields->fetch_name_optionals_label(
$object->table_element_line);
113$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
116include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
119$hookmanager->initHooks(array(
'expeditioncard',
'globalcard'));
125if ($id > 0 || !empty($ref)) {
133 $socid = $user->socid;
138$permissiondellink = $user->hasRight(
'expedition',
'delivery',
'creer');
139$permissiontoadd = $user->hasRight(
'expedition',
'creer');
141$upload_dir =
$conf->expedition->dir_output.
'/sending';
153$parameters = array();
154$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
159if (empty($reshook)) {
161 if ($origin && $origin_id > 0) {
162 if ($origin ==
'commande') {
163 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
172 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
175 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
178 if ($action ==
'setdraft' && $permissiontoadd) {
180 $result =
$object->setDraft($user, 0);
184 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
189 if ($action ==
'reopen' && $permissiontoadd) {
195 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
201 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm') && $permissiontoadd) {
205 if ($action ==
'setref_customer' && $permissiontoadd) {
211 $result =
$object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
214 $action =
'editref_customer';
216 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
221 if ($action ==
'update_extras' && $permissiontoadd) {
223 $attribute_name =
GETPOST(
'attribute',
'restricthtml');
226 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
233 $result =
$object->updateExtraField($attribute_name,
'SHIPMENT_MODIFY');
241 $action =
'edit_extras';
246 if ($action ==
'add' && $permissiontoadd) {
252 $object->origin_id = $origin_id;
267 $classname = ucfirst(
$object->origin);
268 $objectsrc =
new $classname($db);
269 '@phan-var-force Facture|Commande $objectsrc';
270 $objectsrc->fetch(
$object->origin_id);
272 $object->socid = $objectsrc->socid;
275 $object->date_delivery = $date_delivery;
276 $object->date_shipping = $date_shipping;
277 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
283 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
285 $batch_line = array();
286 $stockLine = array();
287 $array_options = array();
289 $num = count($objectsrc->lines);
292 $product_batch_used = array();
294 for ($i = 0; $i < $num; $i++) {
301 $batch =
"batchl".$i.
"_0";
302 $stockLocation =
"ent1".$i.
"_0";
305 $is_batch_or_serial = 0;
306 if (!empty($objectsrc->lines[$i]->fk_product)) {
307 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
308 if ($resultFetch < 0) {
311 $is_batch_or_serial = $product->status_batch;
315 if (isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
316 if (GETPOSTISSET($batch)) {
319 while (GETPOSTISSET($batch)) {
322 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
323 $subtotalqty += $sub_qty[$j][
'q'];
331 if ($is_batch_or_serial == 2 && ($sub_qty[$j][
'q'] > 1 || ($sub_qty[$j][
'q'] > 0 && in_array($sub_qty[$j][
'id_batch'], $product_batch_used)))) {
332 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
337 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 0) {
339 $product_batch_used[$j] = $sub_qty[$j][
'id_batch'];
343 $batch =
"batchl".$i.
"_".$j;
344 $qty =
"qtyl".$i.
'_'.$j;
347 $batch_line[$i][
'detail'] = $sub_qty;
348 $batch_line[$i][
'qty'] = $subtotalqty;
351 $totalqty += $subtotalqty;
358 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
362 } elseif (GETPOSTISSET($stockLocation)) {
365 while (GETPOSTISSET($stockLocation)) {
368 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
369 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
375 $stockLocation =
"ent1".$i.
"_".$j;
376 $qty =
"qtyl".$i.
'_'.$j;
387 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
388 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
394 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
396 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
398 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
399 unset($_POST[
"options_".$key]);
405 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
406 for ($i = 0; $i < $num; $i++) {
409 if (!isset($batch_line[$i])) {
411 if (isset($stockLine[$i])) {
413 $nbstockline = count($stockLine[$i]);
414 for ($j = 0; $j < $nbstockline; $j++) {
415 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
416 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
428 if ($entrepot_id < 0) {
431 if (!($objectsrc->lines[$i]->fk_product > 0)) {
444 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
445 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
454 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
467 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
468 if (isModEnabled(
'stock')) {
469 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
471 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
477 header(
"Location: card.php?id=".
$object->id);
484 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
488 $result =
$object->create_delivery($user);
492 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&token='.
newToken().
'&id='.$result);
499 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
500 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate')))
504 $result =
$object->valid($user);
511 $outputlangs = $langs;
514 $newlang =
GETPOST(
'lang_id',
'aZ09');
517 $newlang =
$object->thirdparty->default_lang;
519 if (!empty($newlang)) {
521 $outputlangs->setDefaultLang($newlang);
526 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
532 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
533 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
534 $result =
$object->cancel(0, $also_update_stock);
536 $result =
$object->setStatut(-1);
540 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
541 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
542 $result =
$object->delete($user, 0, $also_update_stock);
544 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
558 } elseif ($action ==
'setdate_livraison' && $user->hasRight(
'expedition',
'creer')) {
562 $result =
$object->setDeliveryDate($user, $datedelivery);
566 } elseif ($action ==
'setdate_shipping' && $user->hasRight(
'expedition',
'creer')) {
570 $result =
$object->setShippingDate($user, $dateshipping);
574 } elseif (in_array($action, array(
'settracking_number',
'settracking_url',
'settrueWeight',
'settrueWidth',
'settrueHeight',
'settrueDepth',
'setshipping_method_id')) && $user->hasRight(
'expedition',
'creer')) {
578 if ($action ==
'settracking_number') {
579 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
581 if ($action ==
'settracking_url') {
582 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
584 if ($action ==
'settrueWeight') {
588 if ($action ==
'settrueWidth') {
591 if ($action ==
'settrueHeight') {
595 if ($action ==
'settrueDepth') {
598 if ($action ==
'setshipping_method_id') {
603 if (
$object->update($user) >= 0) {
604 header(
"Location: card.php?id=".
$object->id);
611 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
613 $result =
$object->setBilled();
615 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
619 } elseif ($action ==
'classifyclosed' && $permissiontoadd) {
621 $result =
$object->setClosed();
623 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
627 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoadd) {
632 $line->fk_expedition =
$object->id;
634 $num_prod = count($lines);
635 for ($i = 0; $i < $num_prod; $i++) {
636 if ($lines[$i]->
id == $line_id) {
637 if (count($lines[$i]->details_entrepot) > 1) {
639 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
640 $line->id = $details_entrepot->line_id;
641 if (!$error && $line->delete($user) < 0) {
647 $line->id = $line_id;
648 if (!$error && $line->delete($user) < 0) {
653 unset($_POST[
"lineid"]);
657 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
662 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save')) {
670 $num_prod = count($lines);
671 for ($i = 0; $i < $num_prod; $i++) {
672 if ($lines[$i]->
id == $line_id) {
673 $update_done =
false;
675 $line->fk_expedition =
$object->id;
678 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
680 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
681 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
682 unset($_POST[
"options_".$key]);
685 $line->fk_product = $lines[$i]->fk_product;
686 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
688 foreach ($lines[$i]->detail_batch as $detail_batch) {
690 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
691 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
694 if (!empty($batch_id)) {
695 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
696 if ($lines[$i]->entrepot_id != 0) {
698 $line->entrepot_id = $lotStock->warehouseid;
702 if (empty($line->detail_batch)) {
703 $line->detail_batch =
new stdClass();
706 $line->detail_batch->fk_origin_stock = $batch_id;
707 $line->detail_batch->batch = $lotStock->batch;
708 $line->detail_batch->id = $detail_batch->id;
709 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
710 $line->detail_batch->qty = $batch_qty;
711 if ($line->update($user) < 0) {
722 unset($_POST[$batch]);
727 $batch =
"batchl".$line_id.
"_0";
728 $qty =
"qtyl".$line_id.
"_0";
732 if ($batch_qty > 0 && !empty($batch_id)) {
733 if ($lotStock->fetch($batch_id) > 0) {
735 if ($lines[$i]->entrepot_id > 0) {
737 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
738 $lineIdToAddLot = $line_id;
740 } elseif (count($lines[$i]->details_entrepot) > 1) {
742 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
743 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
744 $lineIdToAddLot = $detail_entrepot->line_id;
748 if ($lineIdToAddLot) {
750 if ($line->fetch($lineIdToAddLot) > 0) {
751 $line->detail_batch->fk_origin_stock = $batch_id;
752 $line->detail_batch->batch = $lotStock->batch;
753 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
754 $line->detail_batch->qty = $batch_qty;
755 if ($line->update($user) < 0) {
767 $line->origin_line_id = $lines[$i]->origin_line_id;
768 $line->entrepot_id = $lotStock->warehouseid;
770 $line->detail_batch[0]->fk_origin_stock = $batch_id;
771 $line->detail_batch[0]->batch = $lotStock->batch;
772 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
773 $line->detail_batch[0]->qty = $batch_qty;
774 if (
$object->create_line_batch($line, $line->array_options) < 0) {
787 if ($lines[$i]->fk_product > 0) {
789 if ($lines[$i]->entrepot_id == 0) {
791 $stockLocation =
"entl".$line_id;
792 $qty =
"qtyl".$line_id;
793 $line->id = $line_id;
794 $line->entrepot_id =
GETPOSTINT((
string) $stockLocation);
796 if ($line->update($user) < 0) {
800 unset($_POST[$stockLocation]);
802 } elseif ($lines[$i]->entrepot_id > 0) {
804 $stockLocation =
"entl".$line_id;
805 $qty =
"qtyl".$line_id;
806 $line->id = $line_id;
807 $line->entrepot_id =
GETPOSTINT($stockLocation);
809 if ($line->update($user) < 0) {
813 unset($_POST[$stockLocation]);
815 } elseif (count($lines[$i]->details_entrepot) > 1) {
817 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
819 $stockLocation =
"entl".$detail_entrepot->line_id;
820 $qty =
"qtyl".$detail_entrepot->line_id;
822 if (!empty($warehouse)) {
823 $line->id = $detail_entrepot->line_id;
824 $line->entrepot_id = $warehouse;
826 if ($line->update($user) < 0) {
833 unset($_POST[$stockLocation]);
837 } elseif (!isModEnabled(
'stock') && empty(
$conf->productbatch->enabled)) {
838 $qty =
"qtyl".$line_id;
839 $line->id = $line_id;
841 $line->entrepot_id = 0;
842 if ($line->update($user) < 0) {
852 $qty =
"qtyl".$line_id;
853 $line->id = $line_id;
855 $line->entrepot_id = 0;
856 if ($line->update($user) < 0) {
866 if (empty($update_done)) {
867 $line->id = $lines[$i]->id;
868 $line->insertExtraFields();
873 unset($_POST[
"lineid"]);
878 $outputlangs = $langs;
881 $newlang =
GETPOST(
'lang_id',
'aZ09');
884 $newlang =
$object->thirdparty->default_lang;
886 if (!empty($newlang)) {
888 $outputlangs->setDefaultLang($newlang);
892 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
895 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
898 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
899 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
903 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
909 $triggersendname =
'SHIPPING_SENTBYMAIL';
911 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
912 $mode =
'emailfromshipment';
913 $trackid =
'shi'.$object->id;
914 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
922$title =
$object->ref.
' - '.$langs->trans(
"Shipment");
923if ($action ==
'create2') {
924 $title = $langs->trans(
"CreateShipment");
926$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
928llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-expedition page-card');
934$form =
new Form($db);
937if (isModEnabled(
'project')) {
943$product_static =
new Product($db);
945$warehousestatic =
new Entrepot($db);
947if ($action ==
'create2') {
950 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
957if ($action ==
'create') {
967 $classname = ucfirst($origin);
970 '@phan-var-force Commande|Facture $object';
971 if (
$object->fetch($origin_id)) {
975 $author =
new User($db);
976 $author->fetch(
$object->user_author_id);
978 if (isModEnabled(
'stock')) {
982 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
983 print
'<input type="hidden" name="token" value="'.newToken().
'">';
984 print
'<input type="hidden" name="action" value="add">';
985 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
986 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
988 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
993 print
'<table class="border centpercent">';
996 print
'<tr><td class="titlefieldcreate fieldrequired">';
997 if ($origin ==
'commande' && isModEnabled(
'order')) {
998 print $langs->trans(
"RefOrder");
1000 if ($origin ==
'propal' && isModEnabled(
"propal")) {
1001 print $langs->trans(
"RefProposal");
1003 print
'</td><td colspan="3">';
1010 if ($origin ==
'commande') {
1011 print $langs->trans(
'RefCustomerOrder');
1012 } elseif ($origin ==
'propal') {
1013 print $langs->trans(
'RefCustomerOrder');
1015 print $langs->trans(
'RefCustomer');
1017 print
'</td><td colspan="3">';
1018 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
1023 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
1024 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
1028 if (isModEnabled(
'project') && is_object($formproject)) {
1030 if (empty($projectid) && !empty(
$object->fk_project)) {
1031 $projectid =
$object->fk_project;
1033 if ($origin ==
'project') {
1034 $projectid = ($originid ? $originid : 0);
1037 $langs->load(
"projects");
1039 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1040 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1041 print $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'widthcentpercentminusxx');
1042 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>';
1048 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1049 print
'<td colspan="3">';
1050 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1051 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1052 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1057 print
'<tr><td>'.$langs->trans(
"DateShipping").
'</td>';
1058 print
'<td colspan="3">';
1059 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1060 $date_shipping = ($date_shipping ? $date_shipping :
$object->date_shipping);
1061 print $form->selectDate($date_shipping ? $date_shipping : -1,
'date_shipping', 1, 1, 1);
1066 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1067 print
'<td colspan="3">';
1068 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1069 print $doleditor->Create(1);
1073 if (
$object->note_private && !$user->socid) {
1074 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1075 print
'<td colspan="3">';
1076 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1077 print $doleditor->Create(1);
1083 print $langs->trans(
"Weight");
1084 print
'</td><td colspan="3">';
1085 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1086 print
'<input name="weight" size="4" value="'.dol_escape_htmltag(
GETPOST(
'weight',
'alpha')).
'"> ';
1087 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
1088 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1089 print $form->textwithpicto($text, $htmltext);
1093 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1094 print
' </td><td colspan="3">';
1095 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1096 print
'<input name="sizeW" size="4" value="'.GETPOSTINT(
'sizeW').
'">';
1097 print
' x <input name="sizeH" size="4" value="'.GETPOSTINT(
'sizeH').
'">';
1098 print
' x <input name="sizeS" size="4" value="'.GETPOSTINT(
'sizeS').
'">';
1100 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
1101 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1102 print $form->textwithpicto($text, $htmltext);
1106 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1107 print
'<td colspan="3">';
1108 $expe->fetch_delivery_methods();
1109 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1110 print $form->selectarray(
"shipping_method_id", $expe->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1, 0, 0,
'',
'widthcentpercentminusxx');
1112 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1114 print
"</td></tr>\n";
1117 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1118 print
'<td colspan="3">';
1119 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1120 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1121 print
"</td></tr>\n";
1124 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1125 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $expe, $action);
1126 print $hookmanager->resPrint;
1128 if (empty($reshook)) {
1130 if (
$object->fetch_optionals() > 0) {
1131 $expe->array_options = array_merge($expe->array_options,
$object->array_options);
1133 print $expe->showOptionals($extrafields,
'edit', $parameters);
1138 if (isModEnabled(
'incoterm')) {
1140 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1141 print
'<td colspan="3" class="maxwidthonsmartphone">';
1142 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1143 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1148 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1150 if (is_array($list) && count($list) > 1) {
1151 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1152 print
'<td colspan="3">';
1153 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1154 print $form->selectarray(
'model', $list,
getDolGlobalString(
'EXPEDITION_ADDON_PDF'), 0, 0, 0,
'', 0, 0, 0,
'',
'widthcentpercentminusx');
1155 print
"</td></tr>\n";
1165 $numAsked = count(
$object->lines);
1167 print
'<script type="text/javascript">'.
"\n";
1168 print
'jQuery(document).ready(function() {'.
"\n";
1169 print
'jQuery("#autofill").click(function() {';
1171 while ($i < $numAsked) {
1172 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1173 if (isModEnabled(
'productbatch')) {
1174 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1178 print
'return false; });'.
"\n";
1179 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1180 print
'return false; });'.
"\n";
1182 print
'</script>'.
"\n";
1186 print
'<div class="div-table-responsive-no-min">';
1187 print
'<table class="noborder centpercent">';
1193 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1196 print
'<tr class="liste_titre">';
1197 print
'<td>'.$langs->trans(
"Description").
'</td>';
1198 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1199 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1200 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1201 if (empty(
$conf->productbatch->enabled)) {
1202 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1207 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1209 if (isModEnabled(
'stock')) {
1210 if (empty(
$conf->productbatch->enabled)) {
1211 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1213 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1217 print
'<td class="left">'.$langs->trans(
'StockEntryDate').
'</td>';
1223 $warehousePicking = array();
1225 if ($warehouse_id > 0) {
1226 $warehousePicking[] = $warehouse_id;
1228 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1232 while ($indiceAsked < $numAsked) {
1235 $line =
$object->lines[$indiceAsked];
1237 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1238 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
1243 if (empty($reshook)) {
1245 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1248 if (!empty($line->date_start)) {
1251 if (!empty($line->date_end)) {
1255 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1256 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1259 if ($line->fk_product > 0) {
1260 $res = $product->fetch($line->fk_product);
1264 $product->load_stock(
'warehouseopen');
1268 print
'<a name="'.$line->id.
'"></a>';
1271 $product_static->type = $line->fk_product_type;
1272 $product_static->id = $line->fk_product;
1273 $product_static->ref = $line->ref;
1274 $product_static->status = $line->product_tosell;
1275 $product_static->status_buy = $line->product_tobuy;
1276 $product_static->status_batch = $line->product_tobatch;
1278 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1280 $text = $product_static->getNomUrl(1);
1281 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1284 print $form->textwithtooltip($text, $description, 3, 0,
'', $i);
1287 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1290 if ($showdescinproductdesc) {
1291 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1298 $text =
img_object($langs->trans(
'Service'),
'service');
1300 $text =
img_object($langs->trans(
'Product'),
'product');
1303 if (!empty($line->label)) {
1304 $text .=
' <strong>'.$line->label.
'</strong>';
1305 print $form->textwithtooltip($text, $line->desc, 3, 0,
'', $i);
1307 print $text.
' '.nl2br($line->desc);
1311 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1322 print
'<td class="center">'.$line->qty;
1323 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1324 print
''.$unit_order.
'</td>';
1325 $qtyProdCom = $line->qty;
1328 print
'<td class="center">';
1329 $quantityDelivered = isset(
$object->expeditions[$line->id]) ?
$object->expeditions[$line->id] :
'';
1330 print $quantityDelivered;
1331 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1332 print
''.$unit_order.
'</td>';
1335 $quantityAsked = $line->qty;
1337 $quantityToBeDelivered = 0;
1339 if (is_numeric($quantityDelivered)) {
1340 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1342 $quantityToBeDelivered = $quantityAsked;
1346 $warehouseObject =
null;
1347 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled(
'stock')) {
1348 print
'<!-- Case warehouse already known or product not a predefined product -->';
1350 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1352 $deliverableQty = $quantityToBeDelivered;
1354 $deliverableQty = min($quantityToBeDelivered, $stock);
1356 if ($deliverableQty < 0) {
1357 $deliverableQty = 0;
1359 if (empty(
$conf->productbatch->enabled) || !$product->hasbatch()) {
1361 print
'<td class="center">';
1363 if (GETPOSTISSET(
'qtyl'.$indiceAsked) &&
GETPOST(
'qtyl'.$indiceAsked) !==
'') {
1364 $deliverableQty =
GETPOSTFLOAT(
'qtyl'.$indiceAsked,
'MS');
1366 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1367 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.
'">';
1370 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1371 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1374 print $langs->trans(
"NA");
1379 if (isModEnabled(
'stock')) {
1380 print
'<td class="left">';
1383 $ent =
"entl".$indiceAsked;
1384 $idl =
"idl".$indiceAsked;
1386 if ($line->fk_product > 0) {
1387 print
'<!-- Show warehouse selection -->';
1393 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200', array(), 1, $stockMin,
'stock DESC, e.ref');
1395 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1397 if ($stock < $quantityToBeDelivered) {
1398 print
' '.img_warning($langs->trans(
"StockTooLow"));
1403 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span><input name="entl'.$indiceAsked.
'" id="entl'.$indiceAsked.
'" type="hidden" value="0">';
1414 $product->get_sousproduits_arbo();
1415 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1416 if (count($prods_arbo) > 0) {
1417 foreach ($prods_arbo as $key => $value) {
1420 if ($value[
'stock'] < $value[
'stock_alert']) {
1423 print
"<tr class=\"oddeven\"><td> ->
1424 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1425 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1426 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1436 print
'<td></td><td></td>';
1441 print
'<!-- Case product need lot -->';
1443 $staticwarehouse =
new Entrepot($db);
1444 if ($warehouse_id > 0) {
1445 $staticwarehouse->fetch($warehouse_id);
1451 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1452 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1456 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1457 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1458 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1460 $batchStock = + $dbatch->qty;
1461 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1464 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1465 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1467 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1468 $alreadyQtyBatchSetted[$line->fk_product] = array();
1471 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1472 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1475 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1478 if ($deliverableQty < 0) {
1479 $deliverableQty = 0;
1482 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1483 if (GETPOSTISSET($inputName)) {
1484 $deliverableQty =
GETPOST($inputName,
'int');
1487 $tooltipClass = $tooltipTitle =
'';
1488 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1489 $tooltipClass =
' classfortooltip';
1490 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1492 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1494 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1496 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1497 print
'<td colspan="3" ></td><td class="center">';
1498 print
'<input class="qtyl '.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1501 print
'<!-- Show details of lot -->';
1502 print
'<td class="left">';
1504 print $staticwarehouse->getNomUrl(0).
' / ';
1506 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1509 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1511 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1514 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1516 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1520 $quantityToBeDelivered -= $deliverableQty;
1521 if ($quantityToBeDelivered < 0) {
1522 $quantityToBeDelivered = 0;
1527 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1532 print
'<!-- Case there is no details of lot at all -->';
1533 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1534 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1537 print
'<td class="left">';
1538 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1548 if (empty(
$conf->productbatch->enabled) || !$product->hasbatch()) {
1549 print
'<!-- Case warehouse not already known and product does not need lot -->';
1550 print
'<td></td><td></td>';
1556 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1561 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1562 if ($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1566 $tmpwarehouseObject =
new Entrepot($db);
1567 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1569 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1574 $tmpwarehouseObject->fetch($warehouse_id);
1575 if ($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1576 $stock = + $stock_warehouse->real;
1577 $deliverableQty = min($quantityToBeDelivered, $stock);
1578 $deliverableQty = max(0, $deliverableQty);
1580 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1581 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1583 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1584 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1586 if (!isset($alreadyQtySetted[$line->fk_product])) {
1587 $alreadyQtySetted[$line->fk_product] = array();
1590 $deliverableQty = min($quantityToBeDelivered, $stock);
1593 if ($deliverableQty < 0) {
1594 $deliverableQty = 0;
1597 $tooltipClass = $tooltipTitle =
'';
1598 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1599 $tooltipClass =
' classfortooltip';
1600 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1602 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1605 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1607 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1608 if (GETPOSTISSET($inputName)) {
1612 print
'<input class="qtyl'.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1613 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1616 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1619 print $langs->trans(
"NA");
1624 if (isModEnabled(
'stock')) {
1625 print
'<td class="left">';
1627 print $tmpwarehouseObject->getNomUrl(0).
' ';
1629 print
'<!-- Show details of stock -->';
1630 print
'('.$stock.
')';
1632 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1636 $quantityToBeDelivered -= $deliverableQty;
1637 if ($quantityToBeDelivered < 0) {
1638 $quantityToBeDelivered = 0;
1649 $product->get_sousproduits_arbo();
1650 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1651 if (count($prods_arbo) > 0) {
1652 foreach ($prods_arbo as $key => $value) {
1655 if ($value[
'stock'] < $value[
'stock_alert']) {
1658 print
'<tr class"oddeven"><td>';
1659 print
" ->
1660 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1661 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1662 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1671 print
'<!-- Case warehouse not already known and product need lot -->';
1672 print
'<td></td><td></td>';
1679 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1681 $tmpwarehouseObject =
new Entrepot($db);
1686 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1687 if (($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1688 $nbofsuggested += count($stock_warehouse->detail_batch);
1692 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1694 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1699 $tmpwarehouseObject->fetch($warehouse_id);
1700 if (($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1701 foreach ($stock_warehouse->detail_batch as $dbatch) {
1702 $batchStock = + $dbatch->qty;
1703 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1704 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1706 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1707 $alreadyQtyBatchSetted[$line->fk_product] = array();
1710 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1711 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1714 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1717 if ($deliverableQty < 0) {
1718 $deliverableQty = 0;
1721 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1722 if (GETPOSTISSET($inputName)) {
1726 $tooltipClass = $tooltipTitle =
'';
1727 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1728 $tooltipClass =
' classfortooltip';
1729 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1731 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1733 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1735 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1736 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1739 print
'<td class="left">';
1741 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1743 print
'<!-- Show details of lot -->';
1744 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1747 print $langs->trans(
"Batch").
': ';
1748 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1750 print $productlotObject->getNomUrl(1);
1752 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1755 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1758 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1760 print
' ('.$dbatch->qty.
')';
1761 $quantityToBeDelivered -= $deliverableQty;
1762 if ($quantityToBeDelivered < 0) {
1763 $quantityToBeDelivered = 0;
1769 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1777 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1779 print
'<!-- line not shown yet, we show it -->';
1780 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1784 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1785 $disabled =
'disabled="disabled"';
1787 if ($warehouse_selected_id <= 0) {
1788 $disabled =
'disabled="disabled"';
1790 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1792 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1796 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1797 $disabled =
'disabled="disabled"';
1799 if ($warehouse_selected_id <= 0) {
1800 $disabled =
'disabled="disabled"';
1802 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$quantityToBeDelivered.
'"'.($disabled ?
' '.$disabled :
'').
'> ';
1804 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1807 print $langs->trans(
"NA");
1811 print
'<td class="left">';
1813 if ($warehouse_selected_id > 0) {
1814 $warehouseObject =
new Entrepot($db);
1815 $warehouseObject->fetch($warehouse_selected_id);
1816 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1818 if ($line->fk_product) {
1819 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1825 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1837 if (!empty($extrafields)) {
1843 $srcLine->id = $line->id;
1844 $srcLine->fetch_optionals();
1846 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1848 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1860 print $form->buttonsSaveCancel(
"Create");
1870 '@phan-var-force Expedition $object';
1876 $num_prod = count($lines);
1879 $typeobject =
$object->origin;
1881 $origin_id =
$object->origin_id;
1889 $res =
$object->fetch_optionals();
1897 if ($action ==
'delete') {
1898 $formquestion = array();
1900 $formquestion = array(
1902 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1903 'name' =>
'alsoUpdateStock',
1904 'type' =>
'checkbox',
1909 $formconfirm = $form->formconfirm(
1910 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1911 $langs->trans(
'DeleteSending'),
1912 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1921 if ($action ==
'valid') {
1922 $objectref = substr(
$object->ref, 1, 4);
1923 if ($objectref ==
'PROV') {
1924 $numref =
$object->getNextNumRef($soc);
1929 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1931 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1933 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1936 if (isModEnabled(
'notification')) {
1937 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1938 $notify =
new Notify($db);
1940 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1943 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1946 if ($action ==
'cancel') {
1947 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1951 $parameters = array(
'formConfirm' => $formconfirm);
1952 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1953 if (empty($reshook)) {
1954 $formconfirm .= $hookmanager->resPrint;
1955 } elseif ($reshook > 0) {
1956 $formconfirm = $hookmanager->resPrint;
1964 $tmparray =
$object->getTotalWeightVolume();
1965 $totalWeight = $tmparray[
'weight'];
1966 $totalVolume = $tmparray[
'volume'];
1968 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
'order')) {
1970 $objectsrc->fetch(
$object->origin_object->id);
1972 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
"propal")) {
1973 $objectsrc =
new Propal($db);
1974 $objectsrc->fetch(
$object->origin_object->id);
1978 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1979 $morehtmlref =
'<div class="refidno">';
1981 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1982 $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);
1984 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1986 if (isModEnabled(
'project')) {
1987 $langs->load(
"projects");
1988 $morehtmlref .=
'<br>';
1990 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1991 if ($action !=
'classify') {
1992 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1994 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1996 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1998 $proj->fetch($objectsrc->fk_project);
1999 $morehtmlref .= $proj->getNomUrl(1);
2001 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
2006 $morehtmlref .=
'</div>';
2009 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
2012 print
'<div class="fichecenter">';
2013 print
'<div class="fichehalfleft">';
2014 print
'<div class="underbanner clearboth"></div>';
2016 print
'<table class="border tableforfield centpercent">';
2019 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
2021 print $langs->trans(
"RefOrder").
'</td>';
2023 print $objectsrc->getNomUrl(1,
'commande');
2027 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
2029 print $langs->trans(
"RefProposal").
'</td>';
2031 print $objectsrc->getNomUrl(1,
'expedition');
2037 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"DateCreation").
'</td>';
2038 print
'<td>'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
2042 print
'<tr><td height="10">';
2043 print
'<table class="nobordernopadding centpercent"><tr><td>';
2044 print $langs->trans(
'DateDeliveryPlanned');
2046 if ($action !=
'editdate_livraison') {
2047 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>';
2049 print
'</tr></table>';
2051 if ($action ==
'editdate_livraison') {
2052 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2053 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2054 print
'<input type="hidden" name="action" value="setdate_livraison">';
2055 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2056 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2065 print
'<tr><td height="10">';
2066 print
'<table class="nobordernopadding centpercent"><tr><td>';
2067 print $langs->trans(
'DateShipping');
2069 if ($action !=
'editdate_shipping') {
2070 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_shipping&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetShippingDate'), 1).
'</a></td>';
2072 print
'</tr></table>';
2074 if ($action ==
'editdate_shipping') {
2075 print
'<form name="setdate_shipping" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2076 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2077 print
'<input type="hidden" name="action" value="setdate_shipping">';
2078 print $form->selectDate(
$object->date_shipping ?
$object->date_shipping : -1,
'ship_', 1, 1, 0,
"setdate_shipping", 1, 0);
2079 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2089 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
2092 if ($action ==
'edittrueWeight') {
2093 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2094 print
'<input name="action" value="settrueWeight" type="hidden">';
2095 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2096 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2097 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
2098 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
2099 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2100 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2104 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2108 if ($totalWeight > 0) {
2109 if (!empty(
$object->trueWeight)) {
2110 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2113 if (!empty(
$object->trueWeight)) {
2120 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2121 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2122 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2126 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2127 if ($action ==
'edittrueHeight') {
2128 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2129 print
'<input name="action" value="settrueHeight" type="hidden">';
2130 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2131 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2132 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2133 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2134 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2135 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2139 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2145 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2146 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2147 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2152 print $langs->trans(
"Volume");
2155 $calculatedVolume = 0;
2159 $volumeUnit =
$object->size_units * 3;
2162 if ($calculatedVolume > 0) {
2163 if ($volumeUnit < 50) {
2169 if ($totalVolume > 0) {
2170 if ($calculatedVolume) {
2171 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2175 if ($calculatedVolume) {
2184 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2189 print
'<div class="fichehalfright">';
2190 print
'<div class="underbanner clearboth"></div>';
2192 print
'<table class="border centpercent tableforfield">';
2196 print
'<table class="nobordernopadding centpercent"><tr><td>';
2197 print $langs->trans(
'SendingMethod');
2200 if ($action !=
'editshipping_method_id' && $permissiontoadd) {
2201 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>';
2203 print
'</tr></table>';
2205 if ($action ==
'editshipping_method_id') {
2206 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2207 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2208 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2209 $object->fetch_delivery_methods();
2210 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2212 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2214 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2217 if (
$object->shipping_method_id > 0) {
2219 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2220 print $langs->trans(
"SendingMethod".strtoupper($code));
2227 print
'<tr><td class="titlefieldmiddle">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2228 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2232 if (isModEnabled(
'incoterm')) {
2234 print
'<table class="nobordernopadding centpercent"><tr><td>';
2235 print $langs->trans(
'IncotermLabel');
2236 print
'<td><td class="right">';
2237 if ($permissiontoadd) {
2238 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2242 print
'</td></tr></table>';
2245 if ($action !=
'editincoterm') {
2246 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2248 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2254 $parameters = array();
2255 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2256 print $hookmanager->resPrint;
2263 print
'<div class="clearboth"></div>';
2268 if ($action ==
'editline') {
2269 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2270 <input type="hidden" name="token" value="' .
newToken().
'">
2271 <input type="hidden" name="action" value="updateline">
2272 <input type="hidden" name="mode" value="">
2273 <input type="hidden" name="id" value="' .
$object->id.
'">
2278 print
'<div class="div-table-responsive-no-min">';
2279 print
'<table class="noborder centpercent" id="tablelines" >';
2281 print
'<tr class="liste_titre">';
2284 print
'<td width="5" class="center linecolnum"> </td>';
2287 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2289 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2290 if ($origin && $origin_id > 0) {
2291 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2293 if ($action ==
'editline') {
2295 if (!isModEnabled(
'stock')) {
2298 if (empty(
$conf->productbatch->enabled)) {
2301 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2303 print $langs->trans(
"QtyToShip");
2305 print $langs->trans(
"QtyShipped");
2307 if (isModEnabled(
'stock')) {
2308 print
' - '.$langs->trans(
"WarehouseSource");
2310 if (isModEnabled(
'productbatch')) {
2311 print
' - '.$langs->trans(
"Batch");
2316 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2318 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2320 if (isModEnabled(
'stock')) {
2321 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2324 if (isModEnabled(
'productbatch')) {
2325 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2328 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2329 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2332 print
'<td class="linecoledit"></td>';
2333 print
'<td class="linecoldelete" width="10"></td>';
2338 $outputlangs = $langs;
2343 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2344 $newlang =
GETPOST(
'lang_id',
'aZ09');
2346 if (empty($newlang)) {
2347 $newlang =
$object->thirdparty->default_lang;
2349 if (!empty($newlang)) {
2351 $outputlangs->setDefaultLang($newlang);
2356 $alreadysent = array();
2357 if ($origin && $origin_id > 0) {
2358 $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";
2359 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2360 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2362 $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';
2363 $sql .=
', p.description as product_desc';
2364 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2365 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2366 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2368 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2369 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2370 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2371 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2372 $sql .=
" AND ed.fk_expedition = e.rowid";
2374 $sql .=
" ORDER BY obj.fk_product";
2376 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2377 $resql = $db->query($sql);
2379 $num = $db->num_rows($resql);
2383 $obj = $db->fetch_object($resql);
2386 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2387 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2388 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2389 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2400 for ($i = 0; $i < $num_prod; $i++) {
2401 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2402 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
2407 if (empty($reshook)) {
2408 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2409 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2413 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2417 if ($lines[$i]->fk_product > 0) {
2421 $prod->fetch($lines[$i]->fk_product);
2422 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2424 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2427 print
'<td class="linecoldescription">';
2430 $product_static->type = $lines[$i]->fk_product_type;
2431 $product_static->id = $lines[$i]->fk_product;
2432 $product_static->ref = $lines[$i]->ref;
2433 $product_static->status = $lines[$i]->product_tosell;
2434 $product_static->status_buy = $lines[$i]->product_tobuy;
2435 $product_static->status_batch = $lines[$i]->product_tobatch;
2437 $product_static->weight = $lines[$i]->weight;
2438 $product_static->weight_units = $lines[$i]->weight_units;
2439 $product_static->length = $lines[$i]->length;
2440 $product_static->length_units = $lines[$i]->length_units;
2441 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2442 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2443 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2444 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2445 $product_static->surface = $lines[$i]->surface;
2446 $product_static->surface_units = $lines[$i]->surface_units;
2447 $product_static->volume = $lines[$i]->volume;
2448 $product_static->volume_units = $lines[$i]->volume_units;
2450 $text = $product_static->getNomUrl(1);
2451 $text .=
' - '.$label;
2453 print $form->textwithtooltip($text, $description, 3, 0,
'', $i);
2454 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2460 print
'<td class="linecoldescription" >';
2462 $text =
img_object($langs->trans(
'Service'),
'service');
2464 $text =
img_object($langs->trans(
'Product'),
'product');
2467 if (!empty($lines[$i]->label)) {
2468 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2469 print $form->textwithtooltip($text, $lines[$i]->
description, 3, 0,
'', $i);
2484 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2487 if ($origin && $origin_id > 0) {
2488 print
'<td class="linecolqtyinothershipments center nowrap">';
2490 $qtyalreadysent = 0;
2491 foreach ($alreadysent as $key => $val) {
2492 if ($lines[$i]->fk_elementdet == $key) {
2494 foreach ($val as $shipmentline_id => $shipmentline_var) {
2495 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2501 $htmltooltip .=
'<br>';
2503 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2504 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2505 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2506 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2513 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2516 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2520 print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2524 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2526 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2527 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2528 print
'<!-- case edit 1 -->';
2530 foreach ($lines[$i]->detail_batch as $detail_batch) {
2533 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>';
2535 if ($lines[$i]->entrepot_id == 0) {
2537 $line->fetch($detail_batch->fk_expeditiondet);
2539 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2540 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>';
2546 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2548 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2550 } elseif (isModEnabled(
'stock')) {
2551 if ($lines[$i]->fk_product > 0) {
2552 if ($lines[$i]->entrepot_id > 0) {
2553 print
'<!-- case edit 2 -->';
2556 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>';
2558 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1, 0, array(),
'minwidth200').
'</td>';
2561 if (isModEnabled(
'productbatch')) {
2562 print
' - '.$langs->trans(
"NA");
2566 } elseif (count($lines[$i]->details_entrepot) > 1) {
2567 print
'<!-- case edit 3 -->';
2568 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2571 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>';
2573 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1, 0, array(),
'minwidth200').
'</td>';
2576 if (isModEnabled(
'productbatch')) {
2577 print
' - '.$langs->trans(
"NA");
2583 print
'<!-- case edit 4 -->';
2586 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2587 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2591 print
'<!-- case edit 5 -->';
2592 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2595 print
'<!-- case edit 6 -->';
2598 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>';
2605 } elseif (!isModEnabled(
'stock') && empty(
$conf->productbatch->enabled)) {
2606 print
'<!-- case edit 7 -->';
2609 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2617 print
'</table></td>';
2620 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2623 if (isModEnabled(
'stock')) {
2624 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2626 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2627 } elseif ($lines[$i]->entrepot_id > 0) {
2629 $entrepot->fetch($lines[$i]->entrepot_id);
2630 print $entrepot->getNomUrl(1);
2631 } elseif (count($lines[$i]->details_entrepot) > 1) {
2633 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2634 if ($detail_entrepot->entrepot_id > 0) {
2636 $entrepot->fetch($detail_entrepot->entrepot_id);
2637 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2640 print $form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2646 if (isModEnabled(
'productbatch')) {
2647 if (isset($lines[$i]->detail_batch)) {
2648 print
'<!-- Detail of lot -->';
2649 print
'<td class="linecolbatch">';
2650 if ($lines[$i]->product_tobatch) {
2652 foreach ($lines[$i]->detail_batch as $dbatch) {
2653 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2655 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2658 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2660 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2663 print $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2665 print $langs->trans(
"NA");
2669 print
'<td class="linecolbatch" ></td>';
2675 print
'<td class="center linecolweight">';
2677 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2684 print
'<td class="center linecolvolume">';
2686 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2695 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2696 print
'<td class="center" colspan="2" valign="middle">';
2697 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2698 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2702 print
'<td class="linecoledit center">';
2703 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2705 print
'<td class="linecoldelete" width="10">';
2706 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2710 if (!empty($rowExtrafieldsStart)) {
2711 print $rowExtrafieldsStart;
2712 print $rowExtrafieldsView;
2720 if (!empty($extrafields)) {
2722 if ($origin && $origin_id > 0) {
2725 if (isModEnabled(
'productbatch')) {
2728 if (isModEnabled(
'stock')) {
2733 $line->fetch_optionals();
2736 if ($action ==
'editline' && $line->id == $line_id) {
2737 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2739 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2747 if (empty($num_prod)) {
2748 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2766 if (($user->socid == 0) && ($action !=
'presend')) {
2767 print
'<div class="tabsAction">';
2769 $parameters = array();
2770 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2772 if (empty($reshook)) {
2774 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2775 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2778 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2784 if ($user->hasRight(
'expedition',
'creer')) {
2789 if ($user->hasRight(
'expedition',
'creer')) {
2795 if (empty($user->socid)) {
2797 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2798 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2800 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2807 if ($user->hasRight(
'facture',
'creer')) {
2809 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2817 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2822 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2824 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2832 if ($user->hasRight(
'expedition',
'creer')) {
2833 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2838 if ($user->hasRight(
'expedition',
'supprimer')) {
2851 if ($action !=
'presend' && $action !=
'editline') {
2852 print
'<div class="fichecenter"><div class="fichehalfleft">';
2855 $filedir =
$conf->expedition->dir_output.
"/sending/".$objectref;
2857 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2859 $genallowed = $user->hasRight(
'expedition',
'lire');
2860 $delallowed = $user->hasRight(
'expedition',
'creer');
2862 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2866 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'shipping'), 1);
2867 $linktoelem = $tmparray[
'linktoelem'];
2868 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2869 print $htmltoenteralink;
2871 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2877 print
'<br><!-- Link to sign -->';
2878 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2879 print showOnlineSignatureUrl(
'expedition',
$object->ref,
$object).
'<br>';
2882 print
'</div><div class="fichehalfright">';
2885 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2887 $somethingshown = $formactions->showactions(
$object,
'shipping', $socid, 1);
2889 print
'</div></div>';
2898 if (
GETPOST(
'modelselected')) {
2899 $action =
'presend';
2903 $modelmail =
'shipping_send';
2904 $defaulttopic =
'SendShippingRef';
2905 $diroutput =
$conf->expedition->dir_output.
'/sending';
2906 $trackid =
'shi'.$object->id;
2908 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
const STATUS_DRAFT
Draft status.
const STATUS_CLOSED
Closed status -> parcel was received by customer / end of process prev status : validated or shipment...
const STATUS_VALIDATED
Validated status -> parcel is ready to be sent prev status : draft next status : closed or shipment_i...
Class to manage lines of shipment.
CRUD class for batch number management within shipment.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage the table of subscription to notifications.
Class to manage order lines.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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'.
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.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
measuringUnitString($unitid, $measuring_style='', $unitscale='', $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.