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;
264 $classname = ucfirst(
$object->origin);
265 $objectsrc =
new $classname($db);
266 '@phan-var-force Facture|Commande $objectsrc';
267 $objectsrc->fetch(
$object->origin_id);
269 $object->socid = $objectsrc->socid;
272 $object->date_delivery = $date_delivery;
273 $object->date_shipping = $date_shipping;
274 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
280 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
282 $batch_line = array();
283 $stockLine = array();
284 $array_options = array();
286 $num = count($objectsrc->lines);
289 $product_batch_used = array();
291 for ($i = 0; $i < $num; $i++) {
298 $batch =
"batchl".$i.
"_0";
299 $stockLocation =
"ent1".$i.
"_0";
302 $is_batch_or_serial = 0;
303 if (!empty($objectsrc->lines[$i]->fk_product)) {
304 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
305 if ($resultFetch < 0) {
308 $is_batch_or_serial = $product->status_batch;
312 if (isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
313 if (GETPOSTISSET($batch)) {
316 while (GETPOSTISSET($batch)) {
319 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
320 $subtotalqty += $sub_qty[$j][
'q'];
328 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)))) {
329 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
334 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 0) {
336 $product_batch_used[$j] = $sub_qty[$j][
'id_batch'];
340 $batch =
"batchl".$i.
"_".$j;
341 $qty =
"qtyl".$i.
'_'.$j;
344 $batch_line[$i][
'detail'] = $sub_qty;
345 $batch_line[$i][
'qty'] = $subtotalqty;
348 $totalqty += $subtotalqty;
355 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
359 } elseif (GETPOSTISSET($stockLocation)) {
362 while (GETPOSTISSET($stockLocation)) {
365 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
366 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
372 $stockLocation =
"ent1".$i.
"_".$j;
373 $qty =
"qtyl".$i.
'_'.$j;
384 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
385 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
391 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
393 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
395 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
396 unset($_POST[
"options_".$key]);
402 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
403 for ($i = 0; $i < $num; $i++) {
406 if (!isset($batch_line[$i])) {
408 if (isset($stockLine[$i])) {
410 $nbstockline = count($stockLine[$i]);
411 for ($j = 0; $j < $nbstockline; $j++) {
412 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
413 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
425 if ($entrepot_id < 0) {
428 if (!($objectsrc->lines[$i]->fk_product > 0)) {
441 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
442 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
451 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
464 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
465 if (isModEnabled(
'stock')) {
466 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
468 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
474 header(
"Location: card.php?id=".
$object->id);
481 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
485 $result =
$object->create_delivery($user);
489 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&token='.
newToken().
'&id='.$result);
496 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
497 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate')))
501 $result =
$object->valid($user);
508 $outputlangs = $langs;
511 $newlang =
GETPOST(
'lang_id',
'aZ09');
514 $newlang =
$object->thirdparty->default_lang;
516 if (!empty($newlang)) {
518 $outputlangs->setDefaultLang($newlang);
523 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
529 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
530 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
531 $result =
$object->cancel(0, $also_update_stock);
533 $result =
$object->setStatut(-1);
537 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
538 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
539 $result =
$object->delete($user, 0, $also_update_stock);
541 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
555 } elseif ($action ==
'setdate_livraison' && $user->hasRight(
'expedition',
'creer')) {
559 $result =
$object->setDeliveryDate($user, $datedelivery);
563 } elseif ($action ==
'setdate_shipping' && $user->hasRight(
'expedition',
'creer')) {
567 $result =
$object->setShippingDate($user, $dateshipping);
571 } elseif (in_array($action, array(
'settracking_number',
'settracking_url',
'settrueWeight',
'settrueWidth',
'settrueHeight',
'settrueDepth',
'setshipping_method_id')) && $user->hasRight(
'expedition',
'creer')) {
575 if ($action ==
'settracking_number') {
576 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
578 if ($action ==
'settracking_url') {
579 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
581 if ($action ==
'settrueWeight') {
585 if ($action ==
'settrueWidth') {
588 if ($action ==
'settrueHeight') {
592 if ($action ==
'settrueDepth') {
595 if ($action ==
'setshipping_method_id') {
600 if (
$object->update($user) >= 0) {
601 header(
"Location: card.php?id=".
$object->id);
608 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
610 $result =
$object->setBilled();
612 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
616 } elseif ($action ==
'classifyclosed' && $permissiontoadd) {
618 $result =
$object->setClosed();
620 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
624 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoadd) {
629 $line->fk_expedition =
$object->id;
631 $num_prod = count($lines);
632 for ($i = 0; $i < $num_prod; $i++) {
633 if ($lines[$i]->
id == $line_id) {
634 if (count($lines[$i]->details_entrepot) > 1) {
636 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
637 $line->id = $details_entrepot->line_id;
638 if (!$error && $line->delete($user) < 0) {
644 $line->id = $line_id;
645 if (!$error && $line->delete($user) < 0) {
650 unset($_POST[
"lineid"]);
654 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
659 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save')) {
667 $num_prod = count($lines);
668 for ($i = 0; $i < $num_prod; $i++) {
669 if ($lines[$i]->
id == $line_id) {
670 $update_done =
false;
672 $line->fk_expedition =
$object->id;
675 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
677 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
678 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
679 unset($_POST[
"options_".$key]);
682 $line->fk_product = $lines[$i]->fk_product;
683 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
685 foreach ($lines[$i]->detail_batch as $detail_batch) {
687 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
688 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
691 if (!empty($batch_id)) {
692 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
693 if ($lines[$i]->entrepot_id != 0) {
695 $line->entrepot_id = $lotStock->warehouseid;
699 if (empty($line->detail_batch)) {
700 $line->detail_batch =
new stdClass();
703 $line->detail_batch->fk_origin_stock = $batch_id;
704 $line->detail_batch->batch = $lotStock->batch;
705 $line->detail_batch->id = $detail_batch->id;
706 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
707 $line->detail_batch->qty = $batch_qty;
708 if ($line->update($user) < 0) {
719 unset($_POST[$batch]);
724 $batch =
"batchl".$line_id.
"_0";
725 $qty =
"qtyl".$line_id.
"_0";
729 if ($batch_qty > 0 && !empty($batch_id)) {
730 if ($lotStock->fetch($batch_id) > 0) {
732 if ($lines[$i]->entrepot_id > 0) {
734 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
735 $lineIdToAddLot = $line_id;
737 } elseif (count($lines[$i]->details_entrepot) > 1) {
739 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
740 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
741 $lineIdToAddLot = $detail_entrepot->line_id;
745 if ($lineIdToAddLot) {
747 if ($line->fetch($lineIdToAddLot) > 0) {
748 $line->detail_batch->fk_origin_stock = $batch_id;
749 $line->detail_batch->batch = $lotStock->batch;
750 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
751 $line->detail_batch->qty = $batch_qty;
752 if ($line->update($user) < 0) {
764 $line->origin_line_id = $lines[$i]->origin_line_id;
765 $line->entrepot_id = $lotStock->warehouseid;
767 $line->detail_batch[0]->fk_origin_stock = $batch_id;
768 $line->detail_batch[0]->batch = $lotStock->batch;
769 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
770 $line->detail_batch[0]->qty = $batch_qty;
771 if (
$object->create_line_batch($line, $line->array_options) < 0) {
784 if ($lines[$i]->fk_product > 0) {
786 if ($lines[$i]->entrepot_id == 0) {
788 $stockLocation =
"entl".$line_id;
789 $qty =
"qtyl".$line_id;
790 $line->id = $line_id;
791 $line->entrepot_id =
GETPOSTINT((
string) $stockLocation);
793 if ($line->update($user) < 0) {
797 unset($_POST[$stockLocation]);
799 } elseif ($lines[$i]->entrepot_id > 0) {
801 $stockLocation =
"entl".$line_id;
802 $qty =
"qtyl".$line_id;
803 $line->id = $line_id;
804 $line->entrepot_id =
GETPOSTINT($stockLocation);
806 if ($line->update($user) < 0) {
810 unset($_POST[$stockLocation]);
812 } elseif (count($lines[$i]->details_entrepot) > 1) {
814 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
816 $stockLocation =
"entl".$detail_entrepot->line_id;
817 $qty =
"qtyl".$detail_entrepot->line_id;
819 if (!empty($warehouse)) {
820 $line->id = $detail_entrepot->line_id;
821 $line->entrepot_id = $warehouse;
823 if ($line->update($user) < 0) {
830 unset($_POST[$stockLocation]);
834 } elseif (!isModEnabled(
'stock') && empty(
$conf->productbatch->enabled)) {
835 $qty =
"qtyl".$line_id;
836 $line->id = $line_id;
838 $line->entrepot_id = 0;
839 if ($line->update($user) < 0) {
849 $qty =
"qtyl".$line_id;
850 $line->id = $line_id;
852 $line->entrepot_id = 0;
853 if ($line->update($user) < 0) {
863 if (empty($update_done)) {
864 $line->id = $lines[$i]->id;
865 $line->insertExtraFields();
870 unset($_POST[
"lineid"]);
875 $outputlangs = $langs;
878 $newlang =
GETPOST(
'lang_id',
'aZ09');
881 $newlang =
$object->thirdparty->default_lang;
883 if (!empty($newlang)) {
885 $outputlangs->setDefaultLang($newlang);
889 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
892 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
895 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
896 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
900 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
906 $triggersendname =
'SHIPPING_SENTBYMAIL';
908 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
909 $mode =
'emailfromshipment';
910 $trackid =
'shi'.$object->id;
911 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
919$title =
$object->ref.
' - '.$langs->trans(
"Shipment");
920if ($action ==
'create2') {
921 $title = $langs->trans(
"CreateShipment");
923$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
925llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-expedition page-card');
931$form =
new Form($db);
934if (isModEnabled(
'project')) {
940$product_static =
new Product($db);
942$warehousestatic =
new Entrepot($db);
944if ($action ==
'create2') {
947 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
954if ($action ==
'create') {
964 $classname = ucfirst($origin);
967 '@phan-var-force Commande|Facture $object';
968 if (
$object->fetch($origin_id)) {
972 $author =
new User($db);
973 $author->fetch(
$object->user_author_id);
975 if (isModEnabled(
'stock')) {
979 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
980 print
'<input type="hidden" name="token" value="'.newToken().
'">';
981 print
'<input type="hidden" name="action" value="add">';
982 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
983 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
985 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
990 print
'<table class="border centpercent">';
993 print
'<tr><td class="titlefieldcreate fieldrequired">';
994 if ($origin ==
'commande' && isModEnabled(
'order')) {
995 print $langs->trans(
"RefOrder");
997 if ($origin ==
'propal' && isModEnabled(
"propal")) {
998 print $langs->trans(
"RefProposal");
1000 print
'</td><td colspan="3">';
1007 if ($origin ==
'commande') {
1008 print $langs->trans(
'RefCustomerOrder');
1009 } elseif ($origin ==
'propal') {
1010 print $langs->trans(
'RefCustomerOrder');
1012 print $langs->trans(
'RefCustomer');
1014 print
'</td><td colspan="3">';
1015 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
1020 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
1021 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
1025 if (isModEnabled(
'project') && is_object($formproject)) {
1027 if (empty($projectid) && !empty(
$object->fk_project)) {
1028 $projectid =
$object->fk_project;
1030 if ($origin ==
'project') {
1031 $projectid = ($originid ? $originid : 0);
1034 $langs->load(
"projects");
1036 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1037 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1038 print $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'widthcentpercentminusxx');
1039 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>';
1045 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1046 print
'<td colspan="3">';
1047 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1048 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1049 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1054 print
'<tr><td>'.$langs->trans(
"DateShipping").
'</td>';
1055 print
'<td colspan="3">';
1056 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1057 $date_shipping = ($date_shipping ? $date_shipping :
$object->date_shipping);
1058 print $form->selectDate($date_shipping ? $date_shipping : -1,
'date_shipping', 1, 1, 1);
1063 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1064 print
'<td colspan="3">';
1065 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1066 print $doleditor->Create(1);
1070 if (
$object->note_private && !$user->socid) {
1071 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1072 print
'<td colspan="3">';
1073 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1074 print $doleditor->Create(1);
1080 print $langs->trans(
"Weight");
1081 print
'</td><td colspan="3">';
1082 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1083 print
'<input name="weight" size="4" value="'.GETPOSTINT(
'weight').
'"> ';
1084 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
1085 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1086 print $form->textwithpicto($text, $htmltext);
1090 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1091 print
' </td><td colspan="3">';
1092 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1093 print
'<input name="sizeW" size="4" value="'.GETPOSTINT(
'sizeW').
'">';
1094 print
' x <input name="sizeH" size="4" value="'.GETPOSTINT(
'sizeH').
'">';
1095 print
' x <input name="sizeS" size="4" value="'.GETPOSTINT(
'sizeS').
'">';
1097 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
1098 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1099 print $form->textwithpicto($text, $htmltext);
1103 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1104 print
'<td colspan="3">';
1105 $expe->fetch_delivery_methods();
1106 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1107 print $form->selectarray(
"shipping_method_id", $expe->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1, 0, 0,
'',
'widthcentpercentminusxx');
1109 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1111 print
"</td></tr>\n";
1114 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1115 print
'<td colspan="3">';
1116 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1117 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1118 print
"</td></tr>\n";
1121 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1122 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $expe, $action);
1123 print $hookmanager->resPrint;
1125 if (empty($reshook)) {
1127 if (
$object->fetch_optionals() > 0) {
1128 $expe->array_options = array_merge($expe->array_options,
$object->array_options);
1130 print $expe->showOptionals($extrafields,
'edit', $parameters);
1135 if (isModEnabled(
'incoterm')) {
1137 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1138 print
'<td colspan="3" class="maxwidthonsmartphone">';
1139 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1140 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1145 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1147 if (is_countable($list) && count($list) > 1) {
1148 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1149 print
'<td colspan="3">';
1150 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1151 print $form->selectarray(
'model', $list,
getDolGlobalString(
'EXPEDITION_ADDON_PDF'), 0, 0, 0,
'', 0, 0, 0,
'',
'widthcentpercentminusx');
1152 print
"</td></tr>\n";
1162 $numAsked = count(
$object->lines);
1164 print
'<script type="text/javascript">'.
"\n";
1165 print
'jQuery(document).ready(function() {'.
"\n";
1166 print
'jQuery("#autofill").click(function() {';
1168 while ($i < $numAsked) {
1169 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1170 if (isModEnabled(
'productbatch')) {
1171 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1175 print
'return false; });'.
"\n";
1176 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1177 print
'return false; });'.
"\n";
1179 print
'</script>'.
"\n";
1183 print
'<div class="div-table-responsive-no-min">';
1184 print
'<table class="noborder centpercent">';
1190 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1193 print
'<tr class="liste_titre">';
1194 print
'<td>'.$langs->trans(
"Description").
'</td>';
1195 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1196 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1197 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1198 if (empty(
$conf->productbatch->enabled)) {
1199 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1204 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1206 if (isModEnabled(
'stock')) {
1207 if (empty(
$conf->productbatch->enabled)) {
1208 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1210 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1214 print
'<td class="left">'.$langs->trans(
'StockEntryDate').
'</td>';
1220 $warehousePicking = array();
1222 if ($warehouse_id > 0) {
1223 $warehousePicking[] = $warehouse_id;
1225 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1229 while ($indiceAsked < $numAsked) {
1232 $line =
$object->lines[$indiceAsked];
1234 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1235 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
1240 if (empty($reshook)) {
1242 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1245 if (!empty($line->date_start)) {
1248 if (!empty($line->date_end)) {
1252 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1253 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1256 if ($line->fk_product > 0) {
1257 $res = $product->fetch($line->fk_product);
1261 $product->load_stock(
'warehouseopen');
1265 print
'<a name="'.$line->id.
'"></a>';
1268 $product_static->type = $line->fk_product_type;
1269 $product_static->id = $line->fk_product;
1270 $product_static->ref = $line->ref;
1271 $product_static->status = $line->product_tosell;
1272 $product_static->status_buy = $line->product_tobuy;
1273 $product_static->status_batch = $line->product_tobatch;
1275 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1277 $text = $product_static->getNomUrl(1);
1278 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1281 print $form->textwithtooltip($text, $description, 3, 0,
'', $i);
1284 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1287 if ($showdescinproductdesc) {
1288 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1295 $text =
img_object($langs->trans(
'Service'),
'service');
1297 $text =
img_object($langs->trans(
'Product'),
'product');
1300 if (!empty($line->label)) {
1301 $text .=
' <strong>'.$line->label.
'</strong>';
1302 print $form->textwithtooltip($text, $line->desc, 3, 0,
'', $i);
1304 print $text.
' '.nl2br($line->desc);
1308 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1319 print
'<td class="center">'.$line->qty;
1320 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1321 print
''.$unit_order.
'</td>';
1322 $qtyProdCom = $line->qty;
1325 print
'<td class="center">';
1326 $quantityDelivered = isset(
$object->expeditions[$line->id]) ?
$object->expeditions[$line->id] :
'';
1327 print $quantityDelivered;
1328 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1329 print
''.$unit_order.
'</td>';
1332 $quantityAsked = $line->qty;
1334 $quantityToBeDelivered = 0;
1336 if (is_numeric($quantityDelivered)) {
1337 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1339 $quantityToBeDelivered = $quantityAsked;
1343 $warehouseObject =
null;
1344 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled(
'stock')) {
1345 print
'<!-- Case warehouse already known or product not a predefined product -->';
1347 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1349 $deliverableQty = $quantityToBeDelivered;
1351 $deliverableQty = min($quantityToBeDelivered, $stock);
1353 if ($deliverableQty < 0) {
1354 $deliverableQty = 0;
1356 if (empty(
$conf->productbatch->enabled) || !$product->hasbatch()) {
1358 print
'<td class="center">';
1361 $deliverableQty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1363 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1364 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.
'">';
1367 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1368 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1371 print $langs->trans(
"NA");
1376 if (isModEnabled(
'stock')) {
1377 print
'<td class="left">';
1380 $ent =
"entl".$indiceAsked;
1381 $idl =
"idl".$indiceAsked;
1383 if ($line->fk_product > 0) {
1384 print
'<!-- Show warehouse selection -->';
1390 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200', array(), 1, $stockMin,
'stock DESC, e.ref');
1392 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1394 if ($stock < $quantityToBeDelivered) {
1395 print
' '.img_warning($langs->trans(
"StockTooLow"));
1400 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span><input name="entl'.$indiceAsked.
'" id="entl'.$indiceAsked.
'" type="hidden" value="0">';
1411 $product->get_sousproduits_arbo();
1412 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1413 if (count($prods_arbo) > 0) {
1414 foreach ($prods_arbo as $key => $value) {
1417 if ($value[
'stock'] < $value[
'stock_alert']) {
1420 print
"<tr class=\"oddeven\"><td> ->
1421 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1422 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1423 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1433 print
'<td></td><td></td>';
1438 print
'<!-- Case product need lot -->';
1440 $staticwarehouse =
new Entrepot($db);
1441 if ($warehouse_id > 0) {
1442 $staticwarehouse->fetch($warehouse_id);
1448 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1449 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1453 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1454 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1455 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1457 $batchStock = + $dbatch->qty;
1458 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1461 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1462 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1464 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1465 $alreadyQtyBatchSetted[$line->fk_product] = array();
1468 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1469 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1472 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1475 if ($deliverableQty < 0) {
1476 $deliverableQty = 0;
1479 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1480 if (GETPOSTISSET($inputName)) {
1481 $deliverableQty =
GETPOST($inputName,
'int');
1484 $tooltipClass = $tooltipTitle =
'';
1485 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1486 $tooltipClass =
' classfortooltip';
1487 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1489 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1491 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1493 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1494 print
'<td colspan="3" ></td><td class="center">';
1495 print
'<input class="qtyl '.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1498 print
'<!-- Show details of lot -->';
1499 print
'<td class="left">';
1501 print $staticwarehouse->getNomUrl(0).
' / ';
1503 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1506 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1508 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1511 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1513 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1517 $quantityToBeDelivered -= $deliverableQty;
1518 if ($quantityToBeDelivered < 0) {
1519 $quantityToBeDelivered = 0;
1524 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1529 print
'<!-- Case there is no details of lot at all -->';
1530 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1531 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1534 print
'<td class="left">';
1535 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1545 if (empty(
$conf->productbatch->enabled) || !$product->hasbatch()) {
1546 print
'<!-- Case warehouse not already known and product does not need lot -->';
1547 print
'<td></td><td></td>';
1553 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1558 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1559 if ($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1563 $tmpwarehouseObject =
new Entrepot($db);
1564 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1566 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1571 $tmpwarehouseObject->fetch($warehouse_id);
1572 if ($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1573 $stock = + $stock_warehouse->real;
1574 $deliverableQty = min($quantityToBeDelivered, $stock);
1575 $deliverableQty = max(0, $deliverableQty);
1577 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1578 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1580 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1581 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1583 if (!isset($alreadyQtySetted[$line->fk_product])) {
1584 $alreadyQtySetted[$line->fk_product] = array();
1587 $deliverableQty = min($quantityToBeDelivered, $stock);
1590 if ($deliverableQty < 0) {
1591 $deliverableQty = 0;
1594 $tooltipClass = $tooltipTitle =
'';
1595 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1596 $tooltipClass =
' classfortooltip';
1597 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1599 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1602 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1604 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1605 if (GETPOSTISSET($inputName)) {
1609 print
'<input class="qtyl'.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1610 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1613 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1616 print $langs->trans(
"NA");
1621 if (isModEnabled(
'stock')) {
1622 print
'<td class="left">';
1624 print $tmpwarehouseObject->getNomUrl(0).
' ';
1626 print
'<!-- Show details of stock -->';
1627 print
'('.$stock.
')';
1629 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1633 $quantityToBeDelivered -= $deliverableQty;
1634 if ($quantityToBeDelivered < 0) {
1635 $quantityToBeDelivered = 0;
1646 $product->get_sousproduits_arbo();
1647 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1648 if (count($prods_arbo) > 0) {
1649 foreach ($prods_arbo as $key => $value) {
1652 if ($value[
'stock'] < $value[
'stock_alert']) {
1655 print
'<tr class"oddeven"><td>';
1656 print
" ->
1657 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1658 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1659 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1668 print
'<!-- Case warehouse not already known and product need lot -->';
1669 print
'<td></td><td></td>';
1676 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1678 $tmpwarehouseObject =
new Entrepot($db);
1683 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1684 if (($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1685 $nbofsuggested += count($stock_warehouse->detail_batch);
1689 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1691 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1696 $tmpwarehouseObject->fetch($warehouse_id);
1697 if (($stock_warehouse->real > 0 || !empty(
$conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1698 foreach ($stock_warehouse->detail_batch as $dbatch) {
1699 $batchStock = + $dbatch->qty;
1700 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1701 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1703 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1704 $alreadyQtyBatchSetted[$line->fk_product] = array();
1707 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1708 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1711 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1714 if ($deliverableQty < 0) {
1715 $deliverableQty = 0;
1718 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1719 if (GETPOSTISSET($inputName)) {
1723 $tooltipClass = $tooltipTitle =
'';
1724 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1725 $tooltipClass =
' classfortooltip';
1726 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1728 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1730 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1732 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1733 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1736 print
'<td class="left">';
1738 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1740 print
'<!-- Show details of lot -->';
1741 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1744 print $langs->trans(
"Batch").
': ';
1745 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1747 print $productlotObject->getNomUrl(1);
1749 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1752 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1755 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1757 print
' ('.$dbatch->qty.
')';
1758 $quantityToBeDelivered -= $deliverableQty;
1759 if ($quantityToBeDelivered < 0) {
1760 $quantityToBeDelivered = 0;
1766 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1774 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1776 print
'<!-- line not shown yet, we show it -->';
1777 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1781 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1782 $disabled =
'disabled="disabled"';
1784 if ($warehouse_selected_id <= 0) {
1785 $disabled =
'disabled="disabled"';
1787 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1789 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1793 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1794 $disabled =
'disabled="disabled"';
1796 if ($warehouse_selected_id <= 0) {
1797 $disabled =
'disabled="disabled"';
1799 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$quantityToBeDelivered.
'"'.($disabled ?
' '.$disabled :
'').
'> ';
1801 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1804 print $langs->trans(
"NA");
1808 print
'<td class="left">';
1810 if ($warehouse_selected_id > 0) {
1811 $warehouseObject =
new Entrepot($db);
1812 $warehouseObject->fetch($warehouse_selected_id);
1813 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1815 if ($line->fk_product) {
1816 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1822 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1834 if (!empty($extrafields)) {
1840 $srcLine->id = $line->id;
1841 $srcLine->fetch_optionals();
1843 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1845 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1857 print $form->buttonsSaveCancel(
"Create");
1867 '@phan-var-force Expedition $object';
1873 $num_prod = count($lines);
1876 $typeobject =
$object->origin;
1878 $origin_id =
$object->origin_id;
1886 $res =
$object->fetch_optionals();
1894 if ($action ==
'delete') {
1895 $formquestion = array();
1897 $formquestion = array(
1899 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1900 'name' =>
'alsoUpdateStock',
1901 'type' =>
'checkbox',
1906 $formconfirm = $form->formconfirm(
1907 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1908 $langs->trans(
'DeleteSending'),
1909 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1918 if ($action ==
'valid') {
1919 $objectref = substr(
$object->ref, 1, 4);
1920 if ($objectref ==
'PROV') {
1921 $numref =
$object->getNextNumRef($soc);
1926 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1928 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1930 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1933 if (isModEnabled(
'notification')) {
1934 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1935 $notify =
new Notify($db);
1937 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1940 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1943 if ($action ==
'cancel') {
1944 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1948 $parameters = array(
'formConfirm' => $formconfirm);
1949 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1950 if (empty($reshook)) {
1951 $formconfirm .= $hookmanager->resPrint;
1952 } elseif ($reshook > 0) {
1953 $formconfirm = $hookmanager->resPrint;
1961 $tmparray =
$object->getTotalWeightVolume();
1962 $totalWeight = $tmparray[
'weight'];
1963 $totalVolume = $tmparray[
'volume'];
1965 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
'order')) {
1967 $objectsrc->fetch(
$object->origin_object->id);
1969 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
"propal")) {
1970 $objectsrc =
new Propal($db);
1971 $objectsrc->fetch(
$object->origin_object->id);
1975 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1976 $morehtmlref =
'<div class="refidno">';
1978 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1979 $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);
1981 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1983 if (isModEnabled(
'project')) {
1984 $langs->load(
"projects");
1985 $morehtmlref .=
'<br>';
1987 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1988 if ($action !=
'classify') {
1989 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1991 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1993 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1995 $proj->fetch($objectsrc->fk_project);
1996 $morehtmlref .= $proj->getNomUrl(1);
1998 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
2003 $morehtmlref .=
'</div>';
2006 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
2009 print
'<div class="fichecenter">';
2010 print
'<div class="fichehalfleft">';
2011 print
'<div class="underbanner clearboth"></div>';
2013 print
'<table class="border tableforfield centpercent">';
2016 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
2018 print $langs->trans(
"RefOrder").
'</td>';
2020 print $objectsrc->getNomUrl(1,
'commande');
2024 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
2026 print $langs->trans(
"RefProposal").
'</td>';
2028 print $objectsrc->getNomUrl(1,
'expedition');
2034 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"DateCreation").
'</td>';
2035 print
'<td>'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
2039 print
'<tr><td height="10">';
2040 print
'<table class="nobordernopadding centpercent"><tr><td>';
2041 print $langs->trans(
'DateDeliveryPlanned');
2043 if ($action !=
'editdate_livraison') {
2044 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>';
2046 print
'</tr></table>';
2048 if ($action ==
'editdate_livraison') {
2049 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2050 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2051 print
'<input type="hidden" name="action" value="setdate_livraison">';
2052 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2053 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2062 print
'<tr><td height="10">';
2063 print
'<table class="nobordernopadding centpercent"><tr><td>';
2064 print $langs->trans(
'DateShipping');
2066 if ($action !=
'editdate_shipping') {
2067 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>';
2069 print
'</tr></table>';
2071 if ($action ==
'editdate_shipping') {
2072 print
'<form name="setdate_shipping" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2073 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2074 print
'<input type="hidden" name="action" value="setdate_shipping">';
2075 print $form->selectDate(
$object->date_shipping ?
$object->date_shipping : -1,
'ship_', 1, 1, 0,
"setdate_shipping", 1, 0);
2076 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2086 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
2089 if ($action ==
'edittrueWeight') {
2090 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2091 print
'<input name="action" value="settrueWeight" type="hidden">';
2092 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2093 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2094 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
2095 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
2096 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2097 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2101 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2105 if ($totalWeight > 0) {
2106 if (!empty(
$object->trueWeight)) {
2107 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2110 if (!empty(
$object->trueWeight)) {
2117 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2118 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2119 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2123 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2124 if ($action ==
'edittrueHeight') {
2125 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2126 print
'<input name="action" value="settrueHeight" type="hidden">';
2127 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2128 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2129 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2130 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2131 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2132 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2136 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2142 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2143 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2144 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2149 print $langs->trans(
"Volume");
2152 $calculatedVolume = 0;
2156 $volumeUnit =
$object->size_units * 3;
2159 if ($calculatedVolume > 0) {
2160 if ($volumeUnit < 50) {
2166 if ($totalVolume > 0) {
2167 if ($calculatedVolume) {
2168 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2172 if ($calculatedVolume) {
2181 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2186 print
'<div class="fichehalfright">';
2187 print
'<div class="underbanner clearboth"></div>';
2189 print
'<table class="border centpercent tableforfield">';
2193 print
'<table class="nobordernopadding centpercent"><tr><td>';
2194 print $langs->trans(
'SendingMethod');
2197 if ($action !=
'editshipping_method_id' && $permissiontoadd) {
2198 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>';
2200 print
'</tr></table>';
2202 if ($action ==
'editshipping_method_id') {
2203 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2204 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2205 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2206 $object->fetch_delivery_methods();
2207 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2209 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2211 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2214 if (
$object->shipping_method_id > 0) {
2216 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2217 print $langs->trans(
"SendingMethod".strtoupper($code));
2224 print
'<tr><td class="titlefieldmiddle">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td>';
2225 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2229 if (isModEnabled(
'incoterm')) {
2231 print
'<table class="nobordernopadding centpercent"><tr><td>';
2232 print $langs->trans(
'IncotermLabel');
2233 print
'<td><td class="right">';
2234 if ($permissiontoadd) {
2235 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2239 print
'</td></tr></table>';
2242 if ($action !=
'editincoterm') {
2243 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2245 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2251 $parameters = array();
2252 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2253 print $hookmanager->resPrint;
2260 print
'<div class="clearboth"></div>';
2265 if ($action ==
'editline') {
2266 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2267 <input type="hidden" name="token" value="' .
newToken().
'">
2268 <input type="hidden" name="action" value="updateline">
2269 <input type="hidden" name="mode" value="">
2270 <input type="hidden" name="id" value="' .
$object->id.
'">
2275 print
'<div class="div-table-responsive-no-min">';
2276 print
'<table class="noborder centpercent" id="tablelines" >';
2278 print
'<tr class="liste_titre">';
2281 print
'<td width="5" class="center linecolnum"> </td>';
2284 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2286 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2287 if ($origin && $origin_id > 0) {
2288 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2290 if ($action ==
'editline') {
2292 if (!isModEnabled(
'stock')) {
2295 if (empty(
$conf->productbatch->enabled)) {
2298 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2300 print $langs->trans(
"QtyToShip");
2302 print $langs->trans(
"QtyShipped");
2304 if (isModEnabled(
'stock')) {
2305 print
' - '.$langs->trans(
"WarehouseSource");
2307 if (isModEnabled(
'productbatch')) {
2308 print
' - '.$langs->trans(
"Batch");
2313 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2315 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2317 if (isModEnabled(
'stock')) {
2318 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2321 if (isModEnabled(
'productbatch')) {
2322 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2325 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2326 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2329 print
'<td class="linecoledit"></td>';
2330 print
'<td class="linecoldelete" width="10"></td>';
2335 $outputlangs = $langs;
2340 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2341 $newlang =
GETPOST(
'lang_id',
'aZ09');
2343 if (empty($newlang)) {
2344 $newlang =
$object->thirdparty->default_lang;
2346 if (!empty($newlang)) {
2348 $outputlangs->setDefaultLang($newlang);
2353 $alreadysent = array();
2354 if ($origin && $origin_id > 0) {
2355 $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";
2356 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2357 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2359 $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';
2360 $sql .=
', p.description as product_desc';
2361 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2362 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2363 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2365 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2366 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2367 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2368 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2369 $sql .=
" AND ed.fk_expedition = e.rowid";
2371 $sql .=
" ORDER BY obj.fk_product";
2373 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2374 $resql = $db->query($sql);
2376 $num = $db->num_rows($resql);
2380 $obj = $db->fetch_object($resql);
2383 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2384 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2385 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2386 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2397 for ($i = 0; $i < $num_prod; $i++) {
2398 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2399 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
2404 if (empty($reshook)) {
2405 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2406 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2410 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2414 if ($lines[$i]->fk_product > 0) {
2418 $prod->fetch($lines[$i]->fk_product);
2419 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2421 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2424 print
'<td class="linecoldescription">';
2427 $product_static->type = $lines[$i]->fk_product_type;
2428 $product_static->id = $lines[$i]->fk_product;
2429 $product_static->ref = $lines[$i]->ref;
2430 $product_static->status = $lines[$i]->product_tosell;
2431 $product_static->status_buy = $lines[$i]->product_tobuy;
2432 $product_static->status_batch = $lines[$i]->product_tobatch;
2434 $product_static->weight = $lines[$i]->weight;
2435 $product_static->weight_units = $lines[$i]->weight_units;
2436 $product_static->length = $lines[$i]->length;
2437 $product_static->length_units = $lines[$i]->length_units;
2438 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2439 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2440 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2441 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2442 $product_static->surface = $lines[$i]->surface;
2443 $product_static->surface_units = $lines[$i]->surface_units;
2444 $product_static->volume = $lines[$i]->volume;
2445 $product_static->volume_units = $lines[$i]->volume_units;
2447 $text = $product_static->getNomUrl(1);
2448 $text .=
' - '.$label;
2450 print $form->textwithtooltip($text, $description, 3, 0,
'', $i);
2451 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2457 print
'<td class="linecoldescription" >';
2459 $text =
img_object($langs->trans(
'Service'),
'service');
2461 $text =
img_object($langs->trans(
'Product'),
'product');
2464 if (!empty($lines[$i]->label)) {
2465 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2466 print $form->textwithtooltip($text, $lines[$i]->
description, 3, 0,
'', $i);
2481 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2484 if ($origin && $origin_id > 0) {
2485 print
'<td class="linecolqtyinothershipments center nowrap">';
2487 $qtyalreadysent = 0;
2488 foreach ($alreadysent as $key => $val) {
2489 if ($lines[$i]->fk_elementdet == $key) {
2491 foreach ($val as $shipmentline_id => $shipmentline_var) {
2492 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2498 $htmltooltip .=
'<br>';
2500 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2501 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2502 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2503 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2510 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2513 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2517 print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2521 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2523 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2524 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2525 print
'<!-- case edit 1 -->';
2527 foreach ($lines[$i]->detail_batch as $detail_batch) {
2530 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>';
2532 if ($lines[$i]->entrepot_id == 0) {
2534 $line->fetch($detail_batch->fk_expeditiondet);
2536 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2537 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>';
2543 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2545 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2547 } elseif (isModEnabled(
'stock')) {
2548 if ($lines[$i]->fk_product > 0) {
2549 if ($lines[$i]->entrepot_id > 0) {
2550 print
'<!-- case edit 2 -->';
2553 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>';
2555 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1, 0, array(),
'minwidth200').
'</td>';
2558 if (isModEnabled(
'productbatch')) {
2559 print
' - '.$langs->trans(
"NA");
2563 } elseif (count($lines[$i]->details_entrepot) > 1) {
2564 print
'<!-- case edit 3 -->';
2565 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2568 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>';
2570 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1, 0, array(),
'minwidth200').
'</td>';
2573 if (isModEnabled(
'productbatch')) {
2574 print
' - '.$langs->trans(
"NA");
2580 print
'<!-- case edit 4 -->';
2583 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2584 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2588 print
'<!-- case edit 5 -->';
2589 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2592 print
'<!-- case edit 6 -->';
2595 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>';
2602 } elseif (!isModEnabled(
'stock') && empty(
$conf->productbatch->enabled)) {
2603 print
'<!-- case edit 7 -->';
2606 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2614 print
'</table></td>';
2617 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2620 if (isModEnabled(
'stock')) {
2621 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2623 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2624 } elseif ($lines[$i]->entrepot_id > 0) {
2626 $entrepot->fetch($lines[$i]->entrepot_id);
2627 print $entrepot->getNomUrl(1);
2628 } elseif (count($lines[$i]->details_entrepot) > 1) {
2630 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2631 if ($detail_entrepot->entrepot_id > 0) {
2633 $entrepot->fetch($detail_entrepot->entrepot_id);
2634 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2637 print $form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2643 if (isModEnabled(
'productbatch')) {
2644 if (isset($lines[$i]->detail_batch)) {
2645 print
'<!-- Detail of lot -->';
2646 print
'<td class="linecolbatch">';
2647 if ($lines[$i]->product_tobatch) {
2649 foreach ($lines[$i]->detail_batch as $dbatch) {
2650 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2652 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2655 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2657 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2660 print $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2662 print $langs->trans(
"NA");
2666 print
'<td class="linecolbatch" ></td>';
2672 print
'<td class="center linecolweight">';
2674 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2681 print
'<td class="center linecolvolume">';
2683 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2692 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2693 print
'<td class="center" colspan="2" valign="middle">';
2694 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2695 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2699 print
'<td class="linecoledit center">';
2700 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2702 print
'<td class="linecoldelete" width="10">';
2703 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2707 if (!empty($rowExtrafieldsStart)) {
2708 print $rowExtrafieldsStart;
2709 print $rowExtrafieldsView;
2717 if (!empty($extrafields)) {
2719 if ($origin && $origin_id > 0) {
2722 if (isModEnabled(
'productbatch')) {
2725 if (isModEnabled(
'stock')) {
2730 $line->fetch_optionals();
2733 if ($action ==
'editline' && $line->id == $line_id) {
2734 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2736 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2744 if (empty($num_prod)) {
2745 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2763 if (($user->socid == 0) && ($action !=
'presend')) {
2764 print
'<div class="tabsAction">';
2766 $parameters = array();
2767 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2769 if (empty($reshook)) {
2771 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2772 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2775 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2781 if ($user->hasRight(
'expedition',
'creer')) {
2786 if ($user->hasRight(
'expedition',
'creer')) {
2792 if (empty($user->socid)) {
2794 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2795 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2797 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2804 if ($user->hasRight(
'facture',
'creer')) {
2806 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2814 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2819 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2821 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2829 if ($user->hasRight(
'expedition',
'creer')) {
2830 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2835 if ($user->hasRight(
'expedition',
'supprimer')) {
2848 if ($action !=
'presend' && $action !=
'editline') {
2849 print
'<div class="fichecenter"><div class="fichehalfleft">';
2852 $filedir =
$conf->expedition->dir_output.
"/sending/".$objectref;
2854 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2856 $genallowed = $user->hasRight(
'expedition',
'lire');
2857 $delallowed = $user->hasRight(
'expedition',
'creer');
2859 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2863 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'shipping'), 1);
2864 $linktoelem = $tmparray[
'linktoelem'];
2865 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2866 print $htmltoenteralink;
2868 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2874 print
'<br><!-- Link to sign -->';
2875 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2876 print showOnlineSignatureUrl(
'expedition',
$object->ref,
$object).
'<br>';
2879 print
'</div><div class="fichehalfright">';
2882 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2884 $somethingshown = $formactions->showactions(
$object,
'shipping', $socid, 1);
2886 print
'</div></div>';
2895 if (
GETPOST(
'modelselected')) {
2896 $action =
'presend';
2900 $modelmail =
'shipping_send';
2901 $defaulttopic =
'SendShippingRef';
2902 $diroutput =
$conf->expedition->dir_output.
'/sending';
2903 $trackid =
'shi'.$object->id;
2905 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.