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';
67$langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'productbatch'));
69if (isModEnabled(
'incoterm')) {
70 $langs->load(
'incoterm');
72if (isModEnabled(
'productbatch')) {
73 $langs->load(
'productbatch');
76$origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'expedition';
79if (empty($origin_id)) {
82if (empty($origin_id)) {
89$action =
GETPOST(
'action',
'alpha');
90$confirm =
GETPOST(
'confirm',
'alpha');
91$cancel =
GETPOST(
'cancel',
'alpha');
103$extrafields->fetch_name_optionals_label(
$object->table_element);
104$extrafields->fetch_name_optionals_label(
$object->table_element_line);
105$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
108include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
111$hookmanager->initHooks(array(
'expeditioncard',
'globalcard'));
115if ($id > 0 || !empty($ref)) {
123 $socid = $user->socid;
128$permissiondellink = $user->hasRight(
'expedition',
'delivery',
'creer');
129$permissiontoadd = $user->hasRight(
'expedition',
'creer');
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
142if (empty($reshook)) {
144 if ($origin && $origin_id > 0) {
145 if ($origin ==
'commande') {
146 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
155 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
158 $upload_dir = $conf->expedition->dir_output.
'/sending';
159 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
162 if ($action ==
'setdraft' && $user->hasRight(
'expedition',
'creer')) {
164 $result =
$object->setDraft($user, 0);
168 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
173 if ($action ==
'reopen' && $user->hasRight(
'expedition',
'creer')) {
179 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
185 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm')) {
189 if ($action ==
'setref_customer') {
195 $result =
$object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
198 $action =
'editref_customer';
200 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
205 if ($action ==
'update_extras' && $user->hasRight(
'expedition',
'creer')) {
209 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
216 $result =
$object->insertExtraFields(
'SHIPMENT_MODIFY');
224 $action =
'edit_extras';
229 if ($action ==
'add' && $user->hasRight(
'expedition',
'creer')) {
237 $object->origin_id = $origin_id;
249 $classname = ucfirst(
$object->origin);
250 $objectsrc =
new $classname($db);
251 $objectsrc->fetch(
$object->origin_id);
253 $object->socid = $objectsrc->socid;
256 $object->date_delivery = $date_delivery;
257 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
263 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
265 $batch_line = array();
266 $stockLine = array();
267 $array_options = array();
269 $num = count($objectsrc->lines);
272 $product_batch_used = array();
274 for ($i = 0; $i < $num; $i++) {
281 $batch =
"batchl".$i.
"_0";
282 $stockLocation =
"ent1".$i.
"_0";
285 $is_batch_or_serial = 0;
286 if (!empty($objectsrc->lines[$i]->fk_product)) {
287 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
288 if ($resultFetch < 0) {
291 $is_batch_or_serial = $product->status_batch;
295 if (isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
296 if (GETPOSTISSET($batch)) {
299 while (GETPOSTISSET($batch)) {
302 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
303 $subtotalqty += $sub_qty[$j][
'q'];
311 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)))) {
312 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
317 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 0) {
319 $product_batch_used[$j] = $sub_qty[$j][
'id_batch'];
323 $batch =
"batchl".$i.
"_".$j;
324 $qty =
"qtyl".$i.
'_'.$j;
327 $batch_line[$i][
'detail'] = $sub_qty;
328 $batch_line[$i][
'qty'] = $subtotalqty;
331 $totalqty += $subtotalqty;
338 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
342 } elseif (GETPOSTISSET($stockLocation)) {
345 while (GETPOSTISSET($stockLocation)) {
348 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
349 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
355 $stockLocation =
"ent1".$i.
"_".$j;
356 $qty =
"qtyl".$i.
'_'.$j;
367 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
368 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
374 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
376 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
378 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
379 unset($_POST[
"options_".$key]);
385 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
386 for ($i = 0; $i < $num; $i++) {
389 if (!isset($batch_line[$i])) {
391 if (isset($stockLine[$i])) {
393 $nbstockline = count($stockLine[$i]);
394 for ($j = 0; $j < $nbstockline; $j++) {
395 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
396 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
408 if ($entrepot_id < 0) {
411 if (!($objectsrc->lines[$i]->fk_product > 0)) {
424 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
425 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
434 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
447 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
448 if (isModEnabled(
'stock')) {
449 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
451 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
457 header(
"Location: card.php?id=".
$object->id);
464 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
468 $result =
$object->create_delivery($user);
472 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&token='.
newToken().
'&id='.$result);
479 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' &&
480 ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
481 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate')))
485 $result =
$object->valid($user);
492 $outputlangs = $langs;
495 $newlang =
GETPOST(
'lang_id',
'aZ09');
498 $newlang =
$object->thirdparty->default_lang;
500 if (!empty($newlang)) {
502 $outputlangs->setDefaultLang($newlang);
507 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
513 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
514 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
515 $result =
$object->cancel(0, $also_update_stock);
517 $result =
$object->setStatut(-1);
521 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
522 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
523 $result =
$object->delete($user, 0, $also_update_stock);
525 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
539 } elseif ($action ==
'setdate_livraison' && $user->hasRight(
'expedition',
'creer')) {
543 $result =
$object->setDeliveryDate($user, $datedelivery);
547 } elseif (($action ==
'settracking_number'
548 || $action ==
'settracking_url'
549 || $action ==
'settrueWeight'
550 || $action ==
'settrueWidth'
551 || $action ==
'settrueHeight'
552 || $action ==
'settrueDepth'
553 || $action ==
'setshipping_method_id')
554 && $user->hasRight(
'expedition',
'creer')
559 if ($action ==
'settracking_number') {
560 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
562 if ($action ==
'settracking_url') {
563 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
565 if ($action ==
'settrueWeight') {
569 if ($action ==
'settrueWidth') {
572 if ($action ==
'settrueHeight') {
576 if ($action ==
'settrueDepth') {
579 if ($action ==
'setshipping_method_id') {
584 if (
$object->update($user) >= 0) {
585 header(
"Location: card.php?id=".
$object->id);
592 } elseif ($action ==
'classifybilled') {
594 $result =
$object->setBilled();
596 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
600 } elseif ($action ==
'classifyclosed') {
602 $result =
$object->setClosed();
604 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
608 } elseif ($action ==
'deleteline' && !empty($line_id)) {
613 $line->fk_expedition =
$object->id;
615 $num_prod = count($lines);
616 for ($i = 0; $i < $num_prod; $i++) {
617 if ($lines[$i]->
id == $line_id) {
618 if (count($lines[$i]->details_entrepot) > 1) {
620 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
621 $line->id = $details_entrepot->line_id;
622 if (!$error && $line->delete($user) < 0) {
628 $line->id = $line_id;
629 if (!$error && $line->delete($user) < 0) {
634 unset($_POST[
"lineid"]);
638 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
643 } elseif ($action ==
'updateline' && $user->hasRight(
'expedition',
'creer') &&
GETPOST(
'save')) {
651 $num_prod = count($lines);
652 for ($i = 0; $i < $num_prod; $i++) {
653 if ($lines[$i]->
id == $line_id) {
654 $update_done =
false;
656 $line->fk_expedition =
$object->id;
659 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
661 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
662 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
663 unset($_POST[
"options_".$key]);
666 $line->fk_product = $lines[$i]->fk_product;
667 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
669 foreach ($lines[$i]->detail_batch as $detail_batch) {
671 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
672 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
675 if (!empty($batch_id)) {
676 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
677 if ($lines[$i]->entrepot_id != 0) {
679 $line->entrepot_id = $lotStock->warehouseid;
683 if (empty($line->detail_batch)) {
684 $line->detail_batch =
new stdClass();
687 $line->detail_batch->fk_origin_stock = $batch_id;
688 $line->detail_batch->batch = $lotStock->batch;
689 $line->detail_batch->id = $detail_batch->id;
690 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
691 $line->detail_batch->qty = $batch_qty;
692 if ($line->update($user) < 0) {
703 unset($_POST[$batch]);
708 $batch =
"batchl".$line_id.
"_0";
709 $qty =
"qtyl".$line_id.
"_0";
713 if ($batch_qty > 0 && !empty($batch_id)) {
714 if ($lotStock->fetch($batch_id) > 0) {
716 if ($lines[$i]->entrepot_id > 0) {
718 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
719 $lineIdToAddLot = $line_id;
721 } elseif (count($lines[$i]->details_entrepot) > 1) {
723 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
724 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
725 $lineIdToAddLot = $detail_entrepot->line_id;
729 if ($lineIdToAddLot) {
731 if ($line->fetch($lineIdToAddLot) > 0) {
732 $line->detail_batch->fk_origin_stock = $batch_id;
733 $line->detail_batch->batch = $lotStock->batch;
734 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
735 $line->detail_batch->qty = $batch_qty;
736 if ($line->update($user) < 0) {
748 $line->origin_line_id = $lines[$i]->origin_line_id;
749 $line->entrepot_id = $lotStock->warehouseid;
751 $line->detail_batch[0]->fk_origin_stock = $batch_id;
752 $line->detail_batch[0]->batch = $lotStock->batch;
753 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
754 $line->detail_batch[0]->qty = $batch_qty;
755 if (
$object->create_line_batch($line, $line->array_options) < 0) {
768 if ($lines[$i]->fk_product > 0) {
770 if ($lines[$i]->entrepot_id == 0) {
773 $qty =
"qtyl".$line_id;
774 $line->id = $line_id;
775 $line->entrepot_id =
GETPOSTINT($stockLocation);
777 if ($line->update($user) < 0) {
781 unset($_POST[$stockLocation]);
783 } elseif ($lines[$i]->entrepot_id > 0) {
785 $stockLocation =
"entl".$line_id;
786 $qty =
"qtyl".$line_id;
787 $line->id = $line_id;
788 $line->entrepot_id =
GETPOSTINT($stockLocation);
790 if ($line->update($user) < 0) {
794 unset($_POST[$stockLocation]);
796 } elseif (count($lines[$i]->details_entrepot) > 1) {
798 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
800 $stockLocation =
"entl".$detail_entrepot->line_id;
801 $qty =
"qtyl".$detail_entrepot->line_id;
803 if (!empty($warehouse)) {
804 $line->id = $detail_entrepot->line_id;
805 $line->entrepot_id = $warehouse;
807 if ($line->update($user) < 0) {
814 unset($_POST[$stockLocation]);
818 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
819 $qty =
"qtyl".$line_id;
820 $line->id = $line_id;
822 $line->entrepot_id = 0;
823 if ($line->update($user) < 0) {
833 $qty =
"qtyl".$line_id;
834 $line->id = $line_id;
836 $line->entrepot_id = 0;
837 if ($line->update($user) < 0) {
847 if (empty($update_done)) {
848 $line->id = $lines[$i]->id;
849 $line->insertExtraFields();
854 unset($_POST[
"lineid"]);
859 $outputlangs = $langs;
862 $newlang =
GETPOST(
'lang_id',
'aZ09');
865 $newlang =
$object->thirdparty->default_lang;
867 if (!empty($newlang)) {
869 $outputlangs->setDefaultLang($newlang);
873 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
876 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
879 } elseif ($action ==
'updateline' && $user->hasRight(
'expedition',
'creer') &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
880 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
884 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
890 $triggersendname =
'SHIPPING_SENTBYMAIL';
892 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
893 $mode =
'emailfromshipment';
894 $trackid =
'shi'.$object->id;
895 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
903$title =
$object->ref.
' - '.$langs->trans(
"Shipment");
904if ($action ==
'create2') {
905 $title = $langs->trans(
"CreateShipment");
907$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
915$form =
new Form($db);
918if (isModEnabled(
'project')) {
922$product_static =
new Product($db);
924$warehousestatic =
new Entrepot($db);
926if ($action ==
'create2') {
929 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
936if ($action ==
'create') {
946 $classname = ucfirst($origin);
949 if (
$object->fetch($origin_id)) {
953 $author =
new User($db);
954 $author->fetch(
$object->user_author_id);
956 if (isModEnabled(
'stock')) {
960 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
961 print
'<input type="hidden" name="token" value="'.newToken().
'">';
962 print
'<input type="hidden" name="action" value="add">';
963 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
964 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
966 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
971 print
'<table class="border centpercent">';
974 print
'<tr><td class="titlefieldcreate fieldrequired">';
975 if ($origin ==
'commande' && isModEnabled(
'order')) {
976 print $langs->trans(
"RefOrder");
978 if ($origin ==
'propal' && isModEnabled(
"propal")) {
979 print $langs->trans(
"RefProposal");
981 print
'</td><td colspan="3">';
988 if ($origin ==
'commande') {
989 print $langs->trans(
'RefCustomerOrder');
990 } elseif ($origin ==
'propal') {
991 print $langs->trans(
'RefCustomerOrder');
993 print $langs->trans(
'RefCustomer');
995 print
'</td><td colspan="3">';
996 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
1001 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
1002 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
1006 if (isModEnabled(
'project')) {
1008 if (empty($projectid) && !empty(
$object->fk_project)) {
1009 $projectid =
$object->fk_project;
1011 if ($origin ==
'project') {
1012 $projectid = ($originid ? $originid : 0);
1015 $langs->load(
"projects");
1017 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1018 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1019 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
1020 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>';
1026 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1027 print
'<td colspan="3">';
1028 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1029 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1030 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1035 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1036 print
'<td colspan="3">';
1037 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1038 print $doleditor->Create(1);
1042 if (
$object->note_private && !$user->socid) {
1043 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1044 print
'<td colspan="3">';
1045 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1046 print $doleditor->Create(1);
1052 print $langs->trans(
"Weight");
1053 print
'</td><td colspan="3">';
1054 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1055 print
'<input name="weight" size="4" value="'.GETPOSTINT(
'weight').
'"> ';
1056 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
1057 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1058 print $form->textwithpicto($text, $htmltext);
1062 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1063 print
' </td><td colspan="3">';
1064 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1065 print
'<input name="sizeW" size="4" value="'.GETPOSTINT(
'sizeW').
'">';
1066 print
' x <input name="sizeH" size="4" value="'.GETPOSTINT(
'sizeH').
'">';
1067 print
' x <input name="sizeS" size="4" value="'.GETPOSTINT(
'sizeS').
'">';
1069 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
1070 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1071 print $form->textwithpicto($text, $htmltext);
1075 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1076 print
'<td colspan="3">';
1077 $expe->fetch_delivery_methods();
1078 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1079 print $form->selectarray(
"shipping_method_id", $expe->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1081 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1083 print
"</td></tr>\n";
1086 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1087 print
'<td colspan="3">';
1088 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1089 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1090 print
"</td></tr>\n";
1093 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1094 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $expe, $action);
1095 print $hookmanager->resPrint;
1097 if (empty($reshook)) {
1099 if (
$object->fetch_optionals() > 0) {
1100 $expe->array_options = array_merge($expe->array_options,
$object->array_options);
1102 print $expe->showOptionals($extrafields,
'edit', $parameters);
1107 if (isModEnabled(
'incoterm')) {
1109 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1110 print
'<td colspan="3" class="maxwidthonsmartphone">';
1111 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1112 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1117 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1119 if (is_countable($list) && count($list) > 1) {
1120 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1121 print
'<td colspan="3">';
1122 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1123 print $form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1124 print
"</td></tr>\n";
1134 $numAsked = count(
$object->lines);
1136 print
'<script type="text/javascript">'.
"\n";
1137 print
'jQuery(document).ready(function() {'.
"\n";
1138 print
'jQuery("#autofill").click(function() {';
1140 while ($i < $numAsked) {
1141 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1142 if (isModEnabled(
'productbatch')) {
1143 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1147 print
'return false; });'.
"\n";
1148 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1149 print
'return false; });'.
"\n";
1151 print
'</script>'.
"\n";
1155 print
'<table class="noborder centpercent">';
1161 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1164 print
'<tr class="liste_titre">';
1165 print
'<td>'.$langs->trans(
"Description").
'</td>';
1166 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1167 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1168 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1169 if (empty($conf->productbatch->enabled)) {
1170 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1175 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1177 if (isModEnabled(
'stock')) {
1178 if (empty($conf->productbatch->enabled)) {
1179 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1181 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1185 print
'<td class="left">'.$langs->trans(
'StockEntryDate').
'</td>';
1191 $warehousePicking = array();
1193 if ($warehouse_id > 0) {
1194 $warehousePicking[] = $warehouse_id;
1196 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1200 while ($indiceAsked < $numAsked) {
1203 $line =
$object->lines[$indiceAsked];
1205 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1206 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
1211 if (empty($reshook)) {
1213 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1216 if (!empty($line->date_start)) {
1219 if (!empty($line->date_end)) {
1223 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1224 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1227 if ($line->fk_product > 0) {
1228 $res = $product->fetch($line->fk_product);
1232 $product->load_stock(
'warehouseopen');
1236 print
'<a name="'.$line->id.
'"></a>';
1239 $product_static->type = $line->fk_product_type;
1240 $product_static->id = $line->fk_product;
1241 $product_static->ref = $line->ref;
1242 $product_static->status = $line->product_tosell;
1243 $product_static->status_buy = $line->product_tobuy;
1244 $product_static->status_batch = $line->product_tobatch;
1246 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1248 $text = $product_static->getNomUrl(1);
1249 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1252 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1255 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1258 if ($showdescinproductdesc) {
1259 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1266 $text =
img_object($langs->trans(
'Service'),
'service');
1268 $text =
img_object($langs->trans(
'Product'),
'product');
1271 if (!empty($line->label)) {
1272 $text .=
' <strong>'.$line->label.
'</strong>';
1273 print $form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1275 print $text.
' '.nl2br($line->desc);
1279 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1290 print
'<td class="center">'.$line->qty;
1291 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1292 print
''.$unit_order.
'</td>';
1293 $qtyProdCom = $line->qty;
1296 print
'<td class="center">';
1297 $quantityDelivered = isset(
$object->expeditions[$line->id]) ?
$object->expeditions[$line->id] :
'';
1298 print $quantityDelivered;
1299 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1300 print
''.$unit_order.
'</td>';
1303 $quantityAsked = $line->qty;
1305 $quantityToBeDelivered = 0;
1307 if (is_numeric($quantityDelivered)) {
1308 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1310 $quantityToBeDelivered = $quantityAsked;
1314 $warehouseObject =
null;
1315 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled(
'stock')) {
1316 print
'<!-- Case warehouse already known or product not a predefined product -->';
1318 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1320 $deliverableQty = $quantityToBeDelivered;
1322 $deliverableQty = min($quantityToBeDelivered, $stock);
1324 if ($deliverableQty < 0) {
1325 $deliverableQty = 0;
1327 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1329 print
'<td class="center">';
1332 $deliverableQty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1334 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1335 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.
'">';
1338 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1339 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1342 print $langs->trans(
"NA");
1347 if (isModEnabled(
'stock')) {
1348 print
'<td class="left">';
1351 $ent =
"entl".$indiceAsked;
1352 $idl =
"idl".$indiceAsked;
1354 if ($line->fk_product > 0) {
1355 print
'<!-- Show warehouse selection -->';
1361 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1363 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1365 if ($stock < $quantityToBeDelivered) {
1366 print
' '.img_warning($langs->trans(
"StockTooLow"));
1371 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span><input name="entl'.$indiceAsked.
'" id="entl'.$indiceAsked.
'" type="hidden" value="0">';
1382 $product->get_sousproduits_arbo();
1383 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1384 if (count($prods_arbo) > 0) {
1385 foreach ($prods_arbo as $key => $value) {
1388 if ($value[
'stock'] < $value[
'stock_alert']) {
1391 print
"<tr class=\"oddeven\"><td> ->
1392 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1393 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1394 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1404 print
'<td></td><td></td>';
1409 print
'<!-- Case product need lot -->';
1411 $staticwarehouse =
new Entrepot($db);
1412 if ($warehouse_id > 0) {
1413 $staticwarehouse->fetch($warehouse_id);
1419 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1420 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1424 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1425 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1426 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1428 $batchStock = + $dbatch->qty;
1429 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1432 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1433 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1435 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1436 $alreadyQtyBatchSetted[$line->fk_product] = array();
1439 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1440 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1443 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1446 if ($deliverableQty < 0) $deliverableQty = 0;
1448 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1449 if (GETPOSTISSET($inputName)) {
1450 $deliverableQty =
GETPOST($inputName,
'int');
1453 $tooltipClass = $tooltipTitle =
'';
1454 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1455 $tooltipClass =
' classfortooltip';
1456 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1458 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1460 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1462 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1463 print
'<td colspan="3" ></td><td class="center">';
1464 print
'<input class="qtyl '.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1467 print
'<!-- Show details of lot -->';
1468 print
'<td class="left">';
1470 print $staticwarehouse->getNomUrl(0).
' / ';
1472 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1475 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1477 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1480 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1482 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1486 $quantityToBeDelivered -= $deliverableQty;
1487 if ($quantityToBeDelivered < 0) {
1488 $quantityToBeDelivered = 0;
1493 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1498 print
'<!-- Case there is no details of lot at all -->';
1499 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1500 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1503 print
'<td class="left">';
1504 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1514 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1515 print
'<!-- Case warehouse not already known and product does not need lot -->';
1516 print
'<td></td><td></td>';
1522 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1527 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1528 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1532 $tmpwarehouseObject =
new Entrepot($db);
1533 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1535 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1540 $tmpwarehouseObject->fetch($warehouse_id);
1541 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1542 $stock = + $stock_warehouse->real;
1543 $deliverableQty = min($quantityToBeDelivered, $stock);
1544 $deliverableQty = max(0, $deliverableQty);
1546 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1547 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1549 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1550 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1552 if (!isset($alreadyQtySetted[$line->fk_product])) {
1553 $alreadyQtySetted[$line->fk_product] = array();
1556 $deliverableQty = min($quantityToBeDelivered, $stock);
1559 if ($deliverableQty < 0) {
1560 $deliverableQty = 0;
1563 $tooltipClass = $tooltipTitle =
'';
1564 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1565 $tooltipClass =
' classfortooltip';
1566 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1568 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1571 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1573 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1574 if (GETPOSTISSET($inputName)) {
1578 print
'<input class="qtyl'.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1579 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1582 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1585 print $langs->trans(
"NA");
1590 if (isModEnabled(
'stock')) {
1591 print
'<td class="left">';
1593 print $tmpwarehouseObject->getNomUrl(0).
' ';
1595 print
'<!-- Show details of stock -->';
1596 print
'('.$stock.
')';
1598 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1602 $quantityToBeDelivered -= $deliverableQty;
1603 if ($quantityToBeDelivered < 0) {
1604 $quantityToBeDelivered = 0;
1615 $product->get_sousproduits_arbo();
1616 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1617 if (count($prods_arbo) > 0) {
1618 foreach ($prods_arbo as $key => $value) {
1621 if ($value[
'stock'] < $value[
'stock_alert']) {
1624 print
'<tr class"oddeven"><td>';
1625 print
" ->
1626 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1627 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1628 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1637 print
'<!-- Case warehouse not already known and product need lot -->';
1638 print
'<td></td><td></td>';
1645 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1647 $tmpwarehouseObject =
new Entrepot($db);
1652 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1653 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1654 $nbofsuggested += count($stock_warehouse->detail_batch);
1658 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1660 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1665 $tmpwarehouseObject->fetch($warehouse_id);
1666 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1667 foreach ($stock_warehouse->detail_batch as $dbatch) {
1668 $batchStock = + $dbatch->qty;
1669 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1670 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1672 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1673 $alreadyQtyBatchSetted[$line->fk_product] = array();
1676 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1677 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1680 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1683 if ($deliverableQty < 0) {
1684 $deliverableQty = 0;
1687 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1688 if (GETPOSTISSET($inputName)) {
1692 $tooltipClass = $tooltipTitle =
'';
1693 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1694 $tooltipClass =
' classfortooltip';
1695 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1697 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1699 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1701 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1702 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1705 print
'<td class="left">';
1707 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1709 print
'<!-- Show details of lot -->';
1710 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1713 print $langs->trans(
"Batch").
': ';
1714 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1716 print $productlotObject->getNomUrl(1);
1718 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1721 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1724 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1726 print
' ('.$dbatch->qty.
')';
1727 $quantityToBeDelivered -= $deliverableQty;
1728 if ($quantityToBeDelivered < 0) {
1729 $quantityToBeDelivered = 0;
1735 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1743 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1745 print
'<!-- line not shown yet, we show it -->';
1746 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1750 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1751 $disabled =
'disabled="disabled"';
1753 if ($warehouse_selected_id <= 0) {
1754 $disabled =
'disabled="disabled"';
1756 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1758 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1761 print $langs->trans(
"NA");
1765 print
'<td class="left">';
1767 if ($warehouse_selected_id > 0) {
1768 $warehouseObject =
new Entrepot($db);
1769 $warehouseObject->fetch($warehouse_selected_id);
1770 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1772 if ($line->fk_product) {
1773 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1779 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1791 if (!empty($extrafields)) {
1797 $srcLine->id = $line->id;
1798 $srcLine->fetch_optionals();
1800 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1802 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1813 print $form->buttonsSaveCancel(
"Create");
1830 $num_prod = count($lines);
1833 $typeobject =
$object->origin;
1835 $origin_id =
$object->origin_id;
1843 $res =
$object->fetch_optionals();
1851 if ($action ==
'delete') {
1852 $formquestion = array();
1854 $formquestion = array(
1856 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1857 'name' =>
'alsoUpdateStock',
1858 'type' =>
'checkbox',
1863 $formconfirm = $form->formconfirm(
1864 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1865 $langs->trans(
'DeleteSending'),
1866 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1875 if ($action ==
'valid') {
1876 $objectref = substr(
$object->ref, 1, 4);
1877 if ($objectref ==
'PROV') {
1878 $numref =
$object->getNextNumRef($soc);
1883 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1885 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1887 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1890 if (isModEnabled(
'notification')) {
1891 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1892 $notify =
new Notify($db);
1894 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1897 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1900 if ($action ==
'cancel') {
1901 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1905 $parameters = array(
'formConfirm' => $formconfirm);
1906 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1907 if (empty($reshook)) {
1908 $formconfirm .= $hookmanager->resPrint;
1909 } elseif ($reshook > 0) {
1910 $formconfirm = $hookmanager->resPrint;
1918 $tmparray =
$object->getTotalWeightVolume();
1919 $totalWeight = $tmparray[
'weight'];
1920 $totalVolume = $tmparray[
'volume'];
1922 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
'order')) {
1924 $objectsrc->fetch(
$object->origin_object->id);
1926 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
"propal")) {
1927 $objectsrc =
new Propal($db);
1928 $objectsrc->fetch(
$object->origin_object->id);
1932 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1933 $morehtmlref =
'<div class="refidno">';
1935 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1936 $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);
1938 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1940 if (isModEnabled(
'project')) {
1941 $langs->load(
"projects");
1942 $morehtmlref .=
'<br>';
1944 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1945 if ($action !=
'classify') {
1946 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1948 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1950 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1952 $proj->fetch($objectsrc->fk_project);
1953 $morehtmlref .= $proj->getNomUrl(1);
1955 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1960 $morehtmlref .=
'</div>';
1963 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1966 print
'<div class="fichecenter">';
1967 print
'<div class="fichehalfleft">';
1968 print
'<div class="underbanner clearboth"></div>';
1970 print
'<table class="border tableforfield centpercent">';
1973 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
1975 print $langs->trans(
"RefOrder").
'</td>';
1976 print
'<td colspan="3">';
1977 print $objectsrc->getNomUrl(1,
'commande');
1981 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1983 print $langs->trans(
"RefProposal").
'</td>';
1984 print
'<td colspan="3">';
1985 print $objectsrc->getNomUrl(1,
'expedition');
1991 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1992 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
1996 print
'<tr><td height="10">';
1997 print
'<table class="nobordernopadding centpercent"><tr><td>';
1998 print $langs->trans(
'DateDeliveryPlanned');
2001 if ($action !=
'editdate_livraison') {
2002 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>';
2004 print
'</tr></table>';
2005 print
'</td><td colspan="2">';
2006 if ($action ==
'editdate_livraison') {
2007 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2008 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2009 print
'<input type="hidden" name="action" value="setdate_livraison">';
2010 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2011 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2021 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
2022 print
'</td><td colspan="3">';
2024 if ($action ==
'edittrueWeight') {
2025 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2026 print
'<input name="action" value="settrueWeight" type="hidden">';
2027 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2028 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2029 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
2030 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
2031 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2032 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2036 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2040 if ($totalWeight > 0) {
2041 if (!empty(
$object->trueWeight)) {
2042 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2044 print
showDimensionInBestUnit($totalWeight, 0,
"weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT :
'no');
2045 if (!empty(
$object->trueWeight)) {
2052 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2053 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2054 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2058 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2059 if ($action ==
'edittrueHeight') {
2060 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2061 print
'<input name="action" value="settrueHeight" type="hidden">';
2062 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2063 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2064 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2065 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2066 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2067 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2071 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2077 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2078 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2079 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2084 print $langs->trans(
"Volume");
2086 print
'<td colspan="3">';
2087 $calculatedVolume = 0;
2091 $volumeUnit =
$object->size_units * 3;
2094 if ($calculatedVolume > 0) {
2095 if ($volumeUnit < 50) {
2096 print
showDimensionInBestUnit($calculatedVolume, $volumeUnit,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
2101 if ($totalVolume > 0) {
2102 if ($calculatedVolume) {
2103 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2105 print
showDimensionInBestUnit($totalVolume, 0,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
2107 if ($calculatedVolume) {
2116 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2121 print
'<div class="fichehalfright">';
2122 print
'<div class="underbanner clearboth"></div>';
2124 print
'<table class="border centpercent tableforfield">';
2127 print
'<tr><td height="10">';
2128 print
'<table class="nobordernopadding centpercent"><tr><td>';
2129 print $langs->trans(
'SendingMethod');
2132 if ($action !=
'editshipping_method_id') {
2133 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>';
2135 print
'</tr></table>';
2136 print
'</td><td colspan="2">';
2137 if ($action ==
'editshipping_method_id') {
2138 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2139 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2140 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2141 $object->fetch_delivery_methods();
2142 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2144 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2146 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2149 if (
$object->shipping_method_id > 0) {
2151 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2152 print $langs->trans(
"SendingMethod".strtoupper($code));
2159 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2160 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2164 if (isModEnabled(
'incoterm')) {
2166 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2167 print $langs->trans(
'IncotermLabel');
2168 print
'<td><td class="right">';
2169 if ($user->hasRight(
'expedition',
'creer')) {
2170 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2174 print
'</td></tr></table>';
2176 print
'<td colspan="3">';
2177 if ($action !=
'editincoterm') {
2178 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2180 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2186 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2187 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2188 print $hookmanager->resPrint;
2195 print
'<div class="clearboth"></div>';
2200 if ($action ==
'editline') {
2201 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2202 <input type="hidden" name="token" value="' .
newToken().
'">
2203 <input type="hidden" name="action" value="updateline">
2204 <input type="hidden" name="mode" value="">
2205 <input type="hidden" name="id" value="' .
$object->id.
'">
2210 print
'<div class="div-table-responsive-no-min">';
2211 print
'<table class="noborder" width="100%" id="tablelines" >';
2213 print
'<tr class="liste_titre">';
2216 print
'<td width="5" class="center linecolnum"> </td>';
2219 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2221 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2222 if ($origin && $origin_id > 0) {
2223 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2225 if ($action ==
'editline') {
2227 if (!isModEnabled(
'stock')) {
2230 if (empty($conf->productbatch->enabled)) {
2233 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2235 print $langs->trans(
"QtyToShip").
' - ';
2237 print $langs->trans(
"QtyShipped").
' - ';
2239 if (isModEnabled(
'stock')) {
2240 print $langs->trans(
"WarehouseSource").
' - ';
2242 if (isModEnabled(
'productbatch')) {
2243 print $langs->trans(
"Batch");
2248 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2250 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2252 if (isModEnabled(
'stock')) {
2253 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2256 if (isModEnabled(
'productbatch')) {
2257 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2260 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2261 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2264 print
'<td class="linecoledit"></td>';
2265 print
'<td class="linecoldelete" width="10"></td>';
2270 $outputlangs = $langs;
2275 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2276 $newlang =
GETPOST(
'lang_id',
'aZ09');
2278 if (empty($newlang)) {
2279 $newlang =
$object->thirdparty->default_lang;
2281 if (!empty($newlang)) {
2282 $outputlangs =
new Translate(
"", $conf);
2283 $outputlangs->setDefaultLang($newlang);
2288 $alreadysent = array();
2289 if ($origin && $origin_id > 0) {
2290 $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";
2291 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2292 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2294 $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';
2295 $sql .=
', p.description as product_desc';
2296 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2297 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2298 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2300 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2301 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2302 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2303 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2304 $sql .=
" AND ed.fk_expedition = e.rowid";
2306 $sql .=
" ORDER BY obj.fk_product";
2308 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2309 $resql = $db->query($sql);
2311 $num = $db->num_rows($resql);
2315 $obj = $db->fetch_object($resql);
2318 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2319 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2320 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2321 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2332 for ($i = 0; $i < $num_prod; $i++) {
2333 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2334 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
2339 if (empty($reshook)) {
2340 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2341 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2345 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2349 if ($lines[$i]->fk_product > 0) {
2353 $prod->fetch($lines[$i]->fk_product);
2354 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2356 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2359 print
'<td class="linecoldescription">';
2362 $product_static->type = $lines[$i]->fk_product_type;
2363 $product_static->id = $lines[$i]->fk_product;
2364 $product_static->ref = $lines[$i]->ref;
2365 $product_static->status = $lines[$i]->product_tosell;
2366 $product_static->status_buy = $lines[$i]->product_tobuy;
2367 $product_static->status_batch = $lines[$i]->product_tobatch;
2369 $product_static->weight = $lines[$i]->weight;
2370 $product_static->weight_units = $lines[$i]->weight_units;
2371 $product_static->length = $lines[$i]->length;
2372 $product_static->length_units = $lines[$i]->length_units;
2373 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2374 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2375 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2376 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2377 $product_static->surface = $lines[$i]->surface;
2378 $product_static->surface_units = $lines[$i]->surface_units;
2379 $product_static->volume = $lines[$i]->volume;
2380 $product_static->volume_units = $lines[$i]->volume_units;
2382 $text = $product_static->getNomUrl(1);
2383 $text .=
' - '.$label;
2385 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
2386 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2392 print
'<td class="linecoldescription" >';
2394 $text =
img_object($langs->trans(
'Service'),
'service');
2396 $text =
img_object($langs->trans(
'Product'),
'product');
2399 if (!empty($lines[$i]->label)) {
2400 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2401 print $form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2416 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2419 if ($origin && $origin_id > 0) {
2420 print
'<td class="linecolqtyinothershipments center nowrap">';
2422 $qtyalreadysent = 0;
2423 foreach ($alreadysent as $key => $val) {
2424 if ($lines[$i]->fk_elementdet == $key) {
2426 foreach ($val as $shipmentline_id => $shipmentline_var) {
2427 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2433 $htmltooltip .=
'<br>';
2435 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2436 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2437 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2438 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2445 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2448 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2452 print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2456 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2458 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2459 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2460 print
'<!-- case edit 1 -->';
2462 foreach ($lines[$i]->detail_batch as $detail_batch) {
2465 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>';
2467 if ($lines[$i]->entrepot_id == 0) {
2469 $line->fetch($detail_batch->fk_expeditiondet);
2471 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2472 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>';
2478 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2480 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2482 } elseif (isModEnabled(
'stock')) {
2483 if ($lines[$i]->fk_product > 0) {
2484 if ($lines[$i]->entrepot_id > 0) {
2485 print
'<!-- case edit 2 -->';
2488 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>';
2490 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2492 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2494 } elseif (count($lines[$i]->details_entrepot) > 1) {
2495 print
'<!-- case edit 3 -->';
2496 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2499 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>';
2501 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2503 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2507 print
'<!-- case edit 4 -->';
2510 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2511 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2515 print
'<!-- case edit 5 -->';
2516 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2519 print
'<!-- case edit 6 -->';
2522 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>';
2529 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2530 print
'<!-- case edit 7 -->';
2533 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2541 print
'</table></td>';
2544 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2547 if (isModEnabled(
'stock')) {
2548 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2550 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2551 } elseif ($lines[$i]->entrepot_id > 0) {
2553 $entrepot->fetch($lines[$i]->entrepot_id);
2554 print $entrepot->getNomUrl(1);
2555 } elseif (count($lines[$i]->details_entrepot) > 1) {
2557 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2558 if ($detail_entrepot->entrepot_id > 0) {
2560 $entrepot->fetch($detail_entrepot->entrepot_id);
2561 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2564 print $form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2570 if (isModEnabled(
'productbatch')) {
2571 if (isset($lines[$i]->detail_batch)) {
2572 print
'<!-- Detail of lot -->';
2573 print
'<td class="linecolbatch">';
2574 if ($lines[$i]->product_tobatch) {
2576 foreach ($lines[$i]->detail_batch as $dbatch) {
2577 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2579 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2582 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2584 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2587 print $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2589 print $langs->trans(
"NA");
2593 print
'<td class="linecolbatch" ></td>';
2599 print
'<td class="center linecolweight">';
2601 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2608 print
'<td class="center linecolvolume">';
2610 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2619 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2620 print
'<td class="center" colspan="2" valign="middle">';
2621 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2622 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2626 print
'<td class="linecoledit center">';
2627 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2629 print
'<td class="linecoldelete" width="10">';
2630 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2634 if (!empty($rowExtrafieldsStart)) {
2635 print $rowExtrafieldsStart;
2636 print $rowExtrafieldsView;
2644 if (!empty($extrafields)) {
2646 if ($origin && $origin_id > 0) {
2649 if (isModEnabled(
'productbatch')) {
2652 if (isModEnabled(
'stock')) {
2657 $line->fetch_optionals();
2660 if ($action ==
'editline' && $line->id == $line_id) {
2661 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2663 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2671 if (empty($num_prod)) {
2672 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2690 if (($user->socid == 0) && ($action !=
'presend')) {
2691 print
'<div class="tabsAction">';
2693 $parameters = array();
2694 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2696 if (empty($reshook)) {
2698 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2699 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2702 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2708 if ($user->hasRight(
'expedition',
'creer')) {
2713 if ($user->hasRight(
'expedition',
'creer')) {
2719 if (empty($user->socid)) {
2721 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2722 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2724 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2731 if ($user->hasRight(
'facture',
'creer')) {
2733 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2741 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2746 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2748 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2756 if ($user->hasRight(
'expedition',
'creer')) {
2757 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2762 if ($user->hasRight(
'expedition',
'supprimer')) {
2775 if ($action !=
'presend' && $action !=
'editline') {
2776 print
'<div class="fichecenter"><div class="fichehalfleft">';
2779 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2781 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2783 $genallowed = $user->hasRight(
'expedition',
'lire');
2784 $delallowed = $user->hasRight(
'expedition',
'creer');
2786 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2790 $linktoelem = $form->showLinkToObjectBlock(
$object,
null, array(
'shipping'));
2791 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2797 print
'<br><!-- Link to sign -->';
2798 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2799 print showOnlineSignatureUrl(
'expedition',
$object->ref,
$object).
'<br>';
2802 print
'</div><div class="fichehalfright">';
2805 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2807 $somethingshown = $formactions->showactions(
$object,
'shipping', $socid, 1);
2809 print
'</div></div>';
2818 if (
GETPOST(
'modelselected')) {
2819 $action =
'presend';
2823 $modelmail =
'shipping_send';
2824 $defaulttopic =
'SendShippingRef';
2825 $diroutput = $conf->expedition->dir_output.
'/sending';
2826 $trackid =
'shi'.$object->id;
2828 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage shipments.
const STATUS_DRAFT
Draft status.
const STATUS_CLOSED
Closed status -> 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 models.
Class to manage the table of subscription to notifications.
Class to manage order lines.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Manage record for batch number management.
Class with list of lots and properties.
Class to manage projects.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.
measuringUnitString($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
shipping_prepare_head($object)
Prepare array with list of tabs.