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');
140$parameters = array();
141$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
146if (empty($reshook)) {
148 if ($origin && $origin_id > 0) {
149 if ($origin ==
'commande') {
150 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
159 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
162 $upload_dir = $conf->expedition->dir_output.
'/sending';
163 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
166 if ($action ==
'setdraft' && $permissiontoadd) {
168 $result =
$object->setDraft($user, 0);
172 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
177 if ($action ==
'reopen' && $permissiontoadd) {
183 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
189 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm') && $permissiontoadd) {
193 if ($action ==
'setref_customer' && $permissiontoadd) {
199 $result =
$object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
202 $action =
'editref_customer';
204 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
209 if ($action ==
'update_extras' && $permissiontoadd) {
211 $attribute_name =
GETPOST(
'attribute',
'restricthtml');
214 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
221 $result =
$object->updateExtraField($attribute_name,
'SHIPMENT_MODIFY');
229 $action =
'edit_extras';
234 if ($action ==
'add' && $permissiontoadd) {
242 $object->origin_id = $origin_id;
254 $classname = ucfirst(
$object->origin);
255 $objectsrc =
new $classname($db);
256 '@phan-var-force Facture|Commande $objectsrc';
257 $objectsrc->fetch(
$object->origin_id);
259 $object->socid = $objectsrc->socid;
262 $object->date_delivery = $date_delivery;
263 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
269 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
271 $batch_line = array();
272 $stockLine = array();
273 $array_options = array();
275 $num = count($objectsrc->lines);
278 $product_batch_used = array();
280 for ($i = 0; $i < $num; $i++) {
287 $batch =
"batchl".$i.
"_0";
288 $stockLocation =
"ent1".$i.
"_0";
291 $is_batch_or_serial = 0;
292 if (!empty($objectsrc->lines[$i]->fk_product)) {
293 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
294 if ($resultFetch < 0) {
297 $is_batch_or_serial = $product->status_batch;
301 if (isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
302 if (GETPOSTISSET($batch)) {
305 while (GETPOSTISSET($batch)) {
308 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
309 $subtotalqty += $sub_qty[$j][
'q'];
317 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)))) {
318 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
323 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 0) {
325 $product_batch_used[$j] = $sub_qty[$j][
'id_batch'];
329 $batch =
"batchl".$i.
"_".$j;
330 $qty =
"qtyl".$i.
'_'.$j;
333 $batch_line[$i][
'detail'] = $sub_qty;
334 $batch_line[$i][
'qty'] = $subtotalqty;
337 $totalqty += $subtotalqty;
344 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
348 } elseif (GETPOSTISSET($stockLocation)) {
351 while (GETPOSTISSET($stockLocation)) {
354 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
355 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
361 $stockLocation =
"ent1".$i.
"_".$j;
362 $qty =
"qtyl".$i.
'_'.$j;
373 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
374 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
380 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
382 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
384 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
385 unset($_POST[
"options_".$key]);
391 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
392 for ($i = 0; $i < $num; $i++) {
395 if (!isset($batch_line[$i])) {
397 if (isset($stockLine[$i])) {
399 $nbstockline = count($stockLine[$i]);
400 for ($j = 0; $j < $nbstockline; $j++) {
401 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
402 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
414 if ($entrepot_id < 0) {
417 if (!($objectsrc->lines[$i]->fk_product > 0)) {
430 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
431 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
440 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
453 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
454 if (isModEnabled(
'stock')) {
455 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
457 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
463 header(
"Location: card.php?id=".
$object->id);
470 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
474 $result =
$object->create_delivery($user);
478 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&token='.
newToken().
'&id='.$result);
485 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
486 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate')))
490 $result =
$object->valid($user);
497 $outputlangs = $langs;
500 $newlang =
GETPOST(
'lang_id',
'aZ09');
503 $newlang =
$object->thirdparty->default_lang;
505 if (!empty($newlang)) {
507 $outputlangs->setDefaultLang($newlang);
512 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
518 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
519 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
520 $result =
$object->cancel(0, $also_update_stock);
522 $result =
$object->setStatut(-1);
526 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'expedition',
'supprimer')) {
527 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
528 $result =
$object->delete($user, 0, $also_update_stock);
530 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
544 } elseif ($action ==
'setdate_livraison' && $user->hasRight(
'expedition',
'creer')) {
548 $result =
$object->setDeliveryDate($user, $datedelivery);
552 } elseif (in_array($action, array(
'settracking_number',
'settracking_url',
'settrueWeight',
'settrueWidth',
'settrueHeight',
'settrueDepth',
'setshipping_method_id')) && $user->hasRight(
'expedition',
'creer')) {
556 if ($action ==
'settracking_number') {
557 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
559 if ($action ==
'settracking_url') {
560 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
562 if ($action ==
'settrueWeight') {
566 if ($action ==
'settrueWidth') {
569 if ($action ==
'settrueHeight') {
573 if ($action ==
'settrueDepth') {
576 if ($action ==
'setshipping_method_id') {
581 if (
$object->update($user) >= 0) {
582 header(
"Location: card.php?id=".
$object->id);
589 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
591 $result =
$object->setBilled();
593 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
597 } elseif ($action ==
'classifyclosed' && $permissiontoadd) {
599 $result =
$object->setClosed();
601 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
605 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoadd) {
610 $line->fk_expedition =
$object->id;
612 $num_prod = count($lines);
613 for ($i = 0; $i < $num_prod; $i++) {
614 if ($lines[$i]->
id == $line_id) {
615 if (count($lines[$i]->details_entrepot) > 1) {
617 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
618 $line->id = $details_entrepot->line_id;
619 if (!$error && $line->delete($user) < 0) {
625 $line->id = $line_id;
626 if (!$error && $line->delete($user) < 0) {
631 unset($_POST[
"lineid"]);
635 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
640 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save')) {
648 $num_prod = count($lines);
649 for ($i = 0; $i < $num_prod; $i++) {
650 if ($lines[$i]->
id == $line_id) {
651 $update_done =
false;
653 $line->fk_expedition =
$object->id;
656 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
658 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
659 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
660 unset($_POST[
"options_".$key]);
663 $line->fk_product = $lines[$i]->fk_product;
664 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
666 foreach ($lines[$i]->detail_batch as $detail_batch) {
668 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
669 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
672 if (!empty($batch_id)) {
673 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
674 if ($lines[$i]->entrepot_id != 0) {
676 $line->entrepot_id = $lotStock->warehouseid;
680 if (empty($line->detail_batch)) {
681 $line->detail_batch =
new stdClass();
684 $line->detail_batch->fk_origin_stock = $batch_id;
685 $line->detail_batch->batch = $lotStock->batch;
686 $line->detail_batch->id = $detail_batch->id;
687 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
688 $line->detail_batch->qty = $batch_qty;
689 if ($line->update($user) < 0) {
700 unset($_POST[$batch]);
705 $batch =
"batchl".$line_id.
"_0";
706 $qty =
"qtyl".$line_id.
"_0";
710 if ($batch_qty > 0 && !empty($batch_id)) {
711 if ($lotStock->fetch($batch_id) > 0) {
713 if ($lines[$i]->entrepot_id > 0) {
715 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
716 $lineIdToAddLot = $line_id;
718 } elseif (count($lines[$i]->details_entrepot) > 1) {
720 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
721 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
722 $lineIdToAddLot = $detail_entrepot->line_id;
726 if ($lineIdToAddLot) {
728 if ($line->fetch($lineIdToAddLot) > 0) {
729 $line->detail_batch->fk_origin_stock = $batch_id;
730 $line->detail_batch->batch = $lotStock->batch;
731 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
732 $line->detail_batch->qty = $batch_qty;
733 if ($line->update($user) < 0) {
745 $line->origin_line_id = $lines[$i]->origin_line_id;
746 $line->entrepot_id = $lotStock->warehouseid;
748 $line->detail_batch[0]->fk_origin_stock = $batch_id;
749 $line->detail_batch[0]->batch = $lotStock->batch;
750 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
751 $line->detail_batch[0]->qty = $batch_qty;
752 if (
$object->create_line_batch($line, $line->array_options) < 0) {
765 if ($lines[$i]->fk_product > 0) {
767 if ($lines[$i]->entrepot_id == 0) {
769 $stockLocation =
"entl".$line_id;
770 $qty =
"qtyl".$line_id;
771 $line->id = $line_id;
772 $line->entrepot_id =
GETPOSTINT((
string) $stockLocation);
774 if ($line->update($user) < 0) {
778 unset($_POST[$stockLocation]);
780 } elseif ($lines[$i]->entrepot_id > 0) {
782 $stockLocation =
"entl".$line_id;
783 $qty =
"qtyl".$line_id;
784 $line->id = $line_id;
785 $line->entrepot_id =
GETPOSTINT($stockLocation);
787 if ($line->update($user) < 0) {
791 unset($_POST[$stockLocation]);
793 } elseif (count($lines[$i]->details_entrepot) > 1) {
795 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
797 $stockLocation =
"entl".$detail_entrepot->line_id;
798 $qty =
"qtyl".$detail_entrepot->line_id;
800 if (!empty($warehouse)) {
801 $line->id = $detail_entrepot->line_id;
802 $line->entrepot_id = $warehouse;
804 if ($line->update($user) < 0) {
811 unset($_POST[$stockLocation]);
815 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
816 $qty =
"qtyl".$line_id;
817 $line->id = $line_id;
819 $line->entrepot_id = 0;
820 if ($line->update($user) < 0) {
830 $qty =
"qtyl".$line_id;
831 $line->id = $line_id;
833 $line->entrepot_id = 0;
834 if ($line->update($user) < 0) {
844 if (empty($update_done)) {
845 $line->id = $lines[$i]->id;
846 $line->insertExtraFields();
851 unset($_POST[
"lineid"]);
856 $outputlangs = $langs;
859 $newlang =
GETPOST(
'lang_id',
'aZ09');
862 $newlang =
$object->thirdparty->default_lang;
864 if (!empty($newlang)) {
866 $outputlangs->setDefaultLang($newlang);
870 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
873 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
876 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
877 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
881 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
887 $triggersendname =
'SHIPPING_SENTBYMAIL';
889 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
890 $mode =
'emailfromshipment';
891 $trackid =
'shi'.$object->id;
892 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
900$title =
$object->ref.
' - '.$langs->trans(
"Shipment");
901if ($action ==
'create2') {
902 $title = $langs->trans(
"CreateShipment");
904$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
906llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-expedition page-card');
912$form =
new Form($db);
915if (isModEnabled(
'project')) {
921$product_static =
new Product($db);
923$warehousestatic =
new Entrepot($db);
925if ($action ==
'create2') {
928 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
935if ($action ==
'create') {
945 $classname = ucfirst($origin);
948 '@phan-var-force Commande|Facture $object';
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') && is_object($formproject)) {
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',
false,
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',
false,
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, 0,
'', $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, 0,
'', $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', array(), 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) {
1447 $deliverableQty = 0;
1450 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1451 if (GETPOSTISSET($inputName)) {
1452 $deliverableQty =
GETPOST($inputName,
'int');
1455 $tooltipClass = $tooltipTitle =
'';
1456 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1457 $tooltipClass =
' classfortooltip';
1458 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1460 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1462 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1464 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1465 print
'<td colspan="3" ></td><td class="center">';
1466 print
'<input class="qtyl '.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1469 print
'<!-- Show details of lot -->';
1470 print
'<td class="left">';
1472 print $staticwarehouse->getNomUrl(0).
' / ';
1474 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1477 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1479 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1482 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1484 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1488 $quantityToBeDelivered -= $deliverableQty;
1489 if ($quantityToBeDelivered < 0) {
1490 $quantityToBeDelivered = 0;
1495 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1500 print
'<!-- Case there is no details of lot at all -->';
1501 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1502 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1505 print
'<td class="left">';
1506 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1516 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1517 print
'<!-- Case warehouse not already known and product does not need lot -->';
1518 print
'<td></td><td></td>';
1524 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1529 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1530 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1534 $tmpwarehouseObject =
new Entrepot($db);
1535 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1537 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1542 $tmpwarehouseObject->fetch($warehouse_id);
1543 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1544 $stock = + $stock_warehouse->real;
1545 $deliverableQty = min($quantityToBeDelivered, $stock);
1546 $deliverableQty = max(0, $deliverableQty);
1548 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1549 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1551 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1552 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1554 if (!isset($alreadyQtySetted[$line->fk_product])) {
1555 $alreadyQtySetted[$line->fk_product] = array();
1558 $deliverableQty = min($quantityToBeDelivered, $stock);
1561 if ($deliverableQty < 0) {
1562 $deliverableQty = 0;
1565 $tooltipClass = $tooltipTitle =
'';
1566 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1567 $tooltipClass =
' classfortooltip';
1568 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1570 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1573 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1575 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1576 if (GETPOSTISSET($inputName)) {
1580 print
'<input class="qtyl'.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1581 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1584 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1587 print $langs->trans(
"NA");
1592 if (isModEnabled(
'stock')) {
1593 print
'<td class="left">';
1595 print $tmpwarehouseObject->getNomUrl(0).
' ';
1597 print
'<!-- Show details of stock -->';
1598 print
'('.$stock.
')';
1600 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1604 $quantityToBeDelivered -= $deliverableQty;
1605 if ($quantityToBeDelivered < 0) {
1606 $quantityToBeDelivered = 0;
1617 $product->get_sousproduits_arbo();
1618 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1619 if (count($prods_arbo) > 0) {
1620 foreach ($prods_arbo as $key => $value) {
1623 if ($value[
'stock'] < $value[
'stock_alert']) {
1626 print
'<tr class"oddeven"><td>';
1627 print
" ->
1628 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1629 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1630 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1639 print
'<!-- Case warehouse not already known and product need lot -->';
1640 print
'<td></td><td></td>';
1647 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1649 $tmpwarehouseObject =
new Entrepot($db);
1654 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1655 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1656 $nbofsuggested += count($stock_warehouse->detail_batch);
1660 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1662 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1667 $tmpwarehouseObject->fetch($warehouse_id);
1668 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1669 foreach ($stock_warehouse->detail_batch as $dbatch) {
1670 $batchStock = + $dbatch->qty;
1671 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1672 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1674 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1675 $alreadyQtyBatchSetted[$line->fk_product] = array();
1678 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1679 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1682 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1685 if ($deliverableQty < 0) {
1686 $deliverableQty = 0;
1689 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1690 if (GETPOSTISSET($inputName)) {
1694 $tooltipClass = $tooltipTitle =
'';
1695 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1696 $tooltipClass =
' classfortooltip';
1697 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1699 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1701 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1703 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1704 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1707 print
'<td class="left">';
1709 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1711 print
'<!-- Show details of lot -->';
1712 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1715 print $langs->trans(
"Batch").
': ';
1716 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1718 print $productlotObject->getNomUrl(1);
1720 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1723 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1726 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1728 print
' ('.$dbatch->qty.
')';
1729 $quantityToBeDelivered -= $deliverableQty;
1730 if ($quantityToBeDelivered < 0) {
1731 $quantityToBeDelivered = 0;
1737 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1745 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1747 print
'<!-- line not shown yet, we show it -->';
1748 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1752 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1753 $disabled =
'disabled="disabled"';
1755 if ($warehouse_selected_id <= 0) {
1756 $disabled =
'disabled="disabled"';
1758 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1760 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1764 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1765 $disabled =
'disabled="disabled"';
1767 if ($warehouse_selected_id <= 0) {
1768 $disabled =
'disabled="disabled"';
1770 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$quantityToBeDelivered.
'"'.($disabled ?
' '.$disabled :
'').
'> ';
1772 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1775 print $langs->trans(
"NA");
1779 print
'<td class="left">';
1781 if ($warehouse_selected_id > 0) {
1782 $warehouseObject =
new Entrepot($db);
1783 $warehouseObject->fetch($warehouse_selected_id);
1784 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1786 if ($line->fk_product) {
1787 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1793 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1805 if (!empty($extrafields)) {
1811 $srcLine->id = $line->id;
1812 $srcLine->fetch_optionals();
1814 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1816 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1827 print $form->buttonsSaveCancel(
"Create");
1837 '@phan-var-force Expedition $object';
1845 $num_prod = count($lines);
1848 $typeobject =
$object->origin;
1850 $origin_id =
$object->origin_id;
1858 $res =
$object->fetch_optionals();
1866 if ($action ==
'delete') {
1867 $formquestion = array();
1869 $formquestion = array(
1871 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1872 'name' =>
'alsoUpdateStock',
1873 'type' =>
'checkbox',
1878 $formconfirm = $form->formconfirm(
1879 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1880 $langs->trans(
'DeleteSending'),
1881 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1890 if ($action ==
'valid') {
1891 $objectref = substr(
$object->ref, 1, 4);
1892 if ($objectref ==
'PROV') {
1893 $numref =
$object->getNextNumRef($soc);
1898 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1900 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1902 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1905 if (isModEnabled(
'notification')) {
1906 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1907 $notify =
new Notify($db);
1909 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1912 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1915 if ($action ==
'cancel') {
1916 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1920 $parameters = array(
'formConfirm' => $formconfirm);
1921 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1922 if (empty($reshook)) {
1923 $formconfirm .= $hookmanager->resPrint;
1924 } elseif ($reshook > 0) {
1925 $formconfirm = $hookmanager->resPrint;
1933 $tmparray =
$object->getTotalWeightVolume();
1934 $totalWeight = $tmparray[
'weight'];
1935 $totalVolume = $tmparray[
'volume'];
1937 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
'order')) {
1939 $objectsrc->fetch(
$object->origin_object->id);
1941 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
"propal")) {
1942 $objectsrc =
new Propal($db);
1943 $objectsrc->fetch(
$object->origin_object->id);
1947 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1948 $morehtmlref =
'<div class="refidno">';
1950 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1951 $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);
1953 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1955 if (isModEnabled(
'project')) {
1956 $langs->load(
"projects");
1957 $morehtmlref .=
'<br>';
1959 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1960 if ($action !=
'classify') {
1961 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1963 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1965 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1967 $proj->fetch($objectsrc->fk_project);
1968 $morehtmlref .= $proj->getNomUrl(1);
1970 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1975 $morehtmlref .=
'</div>';
1978 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1981 print
'<div class="fichecenter">';
1982 print
'<div class="fichehalfleft">';
1983 print
'<div class="underbanner clearboth"></div>';
1985 print
'<table class="border tableforfield centpercent">';
1988 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
1990 print $langs->trans(
"RefOrder").
'</td>';
1991 print
'<td colspan="3">';
1992 print $objectsrc->getNomUrl(1,
'commande');
1996 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1998 print $langs->trans(
"RefProposal").
'</td>';
1999 print
'<td colspan="3">';
2000 print $objectsrc->getNomUrl(1,
'expedition');
2006 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
2007 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
2011 print
'<tr><td height="10">';
2012 print
'<table class="nobordernopadding centpercent"><tr><td>';
2013 print $langs->trans(
'DateDeliveryPlanned');
2016 if ($action !=
'editdate_livraison') {
2017 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>';
2019 print
'</tr></table>';
2020 print
'</td><td colspan="2">';
2021 if ($action ==
'editdate_livraison') {
2022 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2023 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2024 print
'<input type="hidden" name="action" value="setdate_livraison">';
2025 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2026 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2036 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
2037 print
'</td><td colspan="3">';
2039 if ($action ==
'edittrueWeight') {
2040 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2041 print
'<input name="action" value="settrueWeight" type="hidden">';
2042 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2043 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2044 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
2045 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
2046 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2047 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2051 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2055 if ($totalWeight > 0) {
2056 if (!empty(
$object->trueWeight)) {
2057 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2059 print
showDimensionInBestUnit($totalWeight, 0,
"weight", $langs,
getDolGlobalInt(
'MAIN_WEIGHT_DEFAULT_ROUND', -1), isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT :
'no');
2060 if (!empty(
$object->trueWeight)) {
2067 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2068 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2069 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2073 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2074 if ($action ==
'edittrueHeight') {
2075 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2076 print
'<input name="action" value="settrueHeight" type="hidden">';
2077 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2078 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2079 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2080 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2081 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2082 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2086 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2092 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2093 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2094 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2099 print $langs->trans(
"Volume");
2101 print
'<td colspan="3">';
2102 $calculatedVolume = 0;
2106 $volumeUnit =
$object->size_units * 3;
2109 if ($calculatedVolume > 0) {
2110 if ($volumeUnit < 50) {
2116 if ($totalVolume > 0) {
2117 if ($calculatedVolume) {
2118 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2122 if ($calculatedVolume) {
2131 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2136 print
'<div class="fichehalfright">';
2137 print
'<div class="underbanner clearboth"></div>';
2139 print
'<table class="border centpercent tableforfield">';
2142 print
'<tr><td height="10">';
2143 print
'<table class="nobordernopadding centpercent"><tr><td>';
2144 print $langs->trans(
'SendingMethod');
2147 if ($action !=
'editshipping_method_id') {
2148 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>';
2150 print
'</tr></table>';
2151 print
'</td><td colspan="2">';
2152 if ($action ==
'editshipping_method_id') {
2153 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2154 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2155 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2156 $object->fetch_delivery_methods();
2157 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2159 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2161 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2164 if (
$object->shipping_method_id > 0) {
2166 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2167 print $langs->trans(
"SendingMethod".strtoupper($code));
2174 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2175 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2179 if (isModEnabled(
'incoterm')) {
2181 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2182 print $langs->trans(
'IncotermLabel');
2183 print
'<td><td class="right">';
2184 if ($user->hasRight(
'expedition',
'creer')) {
2185 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2189 print
'</td></tr></table>';
2191 print
'<td colspan="3">';
2192 if ($action !=
'editincoterm') {
2193 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2195 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2201 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2202 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2203 print $hookmanager->resPrint;
2210 print
'<div class="clearboth"></div>';
2215 if ($action ==
'editline') {
2216 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2217 <input type="hidden" name="token" value="' .
newToken().
'">
2218 <input type="hidden" name="action" value="updateline">
2219 <input type="hidden" name="mode" value="">
2220 <input type="hidden" name="id" value="' .
$object->id.
'">
2225 print
'<div class="div-table-responsive-no-min">';
2226 print
'<table class="noborder" width="100%" id="tablelines" >';
2228 print
'<tr class="liste_titre">';
2231 print
'<td width="5" class="center linecolnum"> </td>';
2234 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2236 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2237 if ($origin && $origin_id > 0) {
2238 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2240 if ($action ==
'editline') {
2242 if (!isModEnabled(
'stock')) {
2245 if (empty($conf->productbatch->enabled)) {
2248 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2250 print $langs->trans(
"QtyToShip").
' - ';
2252 print $langs->trans(
"QtyShipped").
' - ';
2254 if (isModEnabled(
'stock')) {
2255 print $langs->trans(
"WarehouseSource").
' - ';
2257 if (isModEnabled(
'productbatch')) {
2258 print $langs->trans(
"Batch");
2263 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2265 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2267 if (isModEnabled(
'stock')) {
2268 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2271 if (isModEnabled(
'productbatch')) {
2272 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2275 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2276 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2279 print
'<td class="linecoledit"></td>';
2280 print
'<td class="linecoldelete" width="10"></td>';
2285 $outputlangs = $langs;
2290 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2291 $newlang =
GETPOST(
'lang_id',
'aZ09');
2293 if (empty($newlang)) {
2294 $newlang =
$object->thirdparty->default_lang;
2296 if (!empty($newlang)) {
2297 $outputlangs =
new Translate(
"", $conf);
2298 $outputlangs->setDefaultLang($newlang);
2303 $alreadysent = array();
2304 if ($origin && $origin_id > 0) {
2305 $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";
2306 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2307 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2309 $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';
2310 $sql .=
', p.description as product_desc';
2311 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2312 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2313 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2315 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2316 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2317 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2318 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2319 $sql .=
" AND ed.fk_expedition = e.rowid";
2321 $sql .=
" ORDER BY obj.fk_product";
2323 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2324 $resql = $db->query($sql);
2326 $num = $db->num_rows($resql);
2330 $obj = $db->fetch_object($resql);
2333 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2334 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2335 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2336 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2347 for ($i = 0; $i < $num_prod; $i++) {
2348 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2349 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
2354 if (empty($reshook)) {
2355 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2356 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2360 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2364 if ($lines[$i]->fk_product > 0) {
2368 $prod->fetch($lines[$i]->fk_product);
2369 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2371 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2374 print
'<td class="linecoldescription">';
2377 $product_static->type = $lines[$i]->fk_product_type;
2378 $product_static->id = $lines[$i]->fk_product;
2379 $product_static->ref = $lines[$i]->ref;
2380 $product_static->status = $lines[$i]->product_tosell;
2381 $product_static->status_buy = $lines[$i]->product_tobuy;
2382 $product_static->status_batch = $lines[$i]->product_tobatch;
2384 $product_static->weight = $lines[$i]->weight;
2385 $product_static->weight_units = $lines[$i]->weight_units;
2386 $product_static->length = $lines[$i]->length;
2387 $product_static->length_units = $lines[$i]->length_units;
2388 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2389 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2390 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2391 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2392 $product_static->surface = $lines[$i]->surface;
2393 $product_static->surface_units = $lines[$i]->surface_units;
2394 $product_static->volume = $lines[$i]->volume;
2395 $product_static->volume_units = $lines[$i]->volume_units;
2397 $text = $product_static->getNomUrl(1);
2398 $text .=
' - '.$label;
2400 print $form->textwithtooltip($text, $description, 3, 0,
'', $i);
2401 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2407 print
'<td class="linecoldescription" >';
2409 $text =
img_object($langs->trans(
'Service'),
'service');
2411 $text =
img_object($langs->trans(
'Product'),
'product');
2414 if (!empty($lines[$i]->label)) {
2415 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2416 print $form->textwithtooltip($text, $lines[$i]->
description, 3, 0,
'', $i);
2431 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2434 if ($origin && $origin_id > 0) {
2435 print
'<td class="linecolqtyinothershipments center nowrap">';
2437 $qtyalreadysent = 0;
2438 foreach ($alreadysent as $key => $val) {
2439 if ($lines[$i]->fk_elementdet == $key) {
2441 foreach ($val as $shipmentline_id => $shipmentline_var) {
2442 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2448 $htmltooltip .=
'<br>';
2450 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2451 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2452 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2453 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2460 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2463 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2467 print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2471 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2473 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2474 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2475 print
'<!-- case edit 1 -->';
2477 foreach ($lines[$i]->detail_batch as $detail_batch) {
2480 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>';
2482 if ($lines[$i]->entrepot_id == 0) {
2484 $line->fetch($detail_batch->fk_expeditiondet);
2486 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2487 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>';
2493 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2495 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2497 } elseif (isModEnabled(
'stock')) {
2498 if ($lines[$i]->fk_product > 0) {
2499 if ($lines[$i]->entrepot_id > 0) {
2500 print
'<!-- case edit 2 -->';
2503 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>';
2505 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2507 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2509 } elseif (count($lines[$i]->details_entrepot) > 1) {
2510 print
'<!-- case edit 3 -->';
2511 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2514 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>';
2516 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2518 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2522 print
'<!-- case edit 4 -->';
2525 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2526 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2530 print
'<!-- case edit 5 -->';
2531 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2534 print
'<!-- case edit 6 -->';
2537 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>';
2544 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2545 print
'<!-- case edit 7 -->';
2548 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2556 print
'</table></td>';
2559 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2562 if (isModEnabled(
'stock')) {
2563 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2565 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2566 } elseif ($lines[$i]->entrepot_id > 0) {
2568 $entrepot->fetch($lines[$i]->entrepot_id);
2569 print $entrepot->getNomUrl(1);
2570 } elseif (count($lines[$i]->details_entrepot) > 1) {
2572 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2573 if ($detail_entrepot->entrepot_id > 0) {
2575 $entrepot->fetch($detail_entrepot->entrepot_id);
2576 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2579 print $form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2585 if (isModEnabled(
'productbatch')) {
2586 if (isset($lines[$i]->detail_batch)) {
2587 print
'<!-- Detail of lot -->';
2588 print
'<td class="linecolbatch">';
2589 if ($lines[$i]->product_tobatch) {
2591 foreach ($lines[$i]->detail_batch as $dbatch) {
2592 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2594 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2597 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2599 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2602 print $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2604 print $langs->trans(
"NA");
2608 print
'<td class="linecolbatch" ></td>';
2614 print
'<td class="center linecolweight">';
2616 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2623 print
'<td class="center linecolvolume">';
2625 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2634 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2635 print
'<td class="center" colspan="2" valign="middle">';
2636 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2637 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2641 print
'<td class="linecoledit center">';
2642 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2644 print
'<td class="linecoldelete" width="10">';
2645 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2649 if (!empty($rowExtrafieldsStart)) {
2650 print $rowExtrafieldsStart;
2651 print $rowExtrafieldsView;
2659 if (!empty($extrafields)) {
2661 if ($origin && $origin_id > 0) {
2664 if (isModEnabled(
'productbatch')) {
2667 if (isModEnabled(
'stock')) {
2672 $line->fetch_optionals();
2675 if ($action ==
'editline' && $line->id == $line_id) {
2676 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2678 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2686 if (empty($num_prod)) {
2687 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2705 if (($user->socid == 0) && ($action !=
'presend')) {
2706 print
'<div class="tabsAction">';
2708 $parameters = array();
2709 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2711 if (empty($reshook)) {
2713 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2714 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2717 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2723 if ($user->hasRight(
'expedition',
'creer')) {
2728 if ($user->hasRight(
'expedition',
'creer')) {
2734 if (empty($user->socid)) {
2736 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2737 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2739 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2746 if ($user->hasRight(
'facture',
'creer')) {
2748 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2756 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2761 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2763 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2771 if ($user->hasRight(
'expedition',
'creer')) {
2772 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2777 if ($user->hasRight(
'expedition',
'supprimer')) {
2790 if ($action !=
'presend' && $action !=
'editline') {
2791 print
'<div class="fichecenter"><div class="fichehalfleft">';
2794 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2796 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2798 $genallowed = $user->hasRight(
'expedition',
'lire');
2799 $delallowed = $user->hasRight(
'expedition',
'creer');
2801 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2805 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(
'shipping'), 1);
2806 $linktoelem = $tmparray[
'linktoelem'];
2807 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2808 print $htmltoenteralink;
2810 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2816 print
'<br><!-- Link to sign -->';
2817 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2818 print showOnlineSignatureUrl(
'expedition',
$object->ref,
$object).
'<br>';
2821 print
'</div><div class="fichehalfright">';
2824 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2826 $somethingshown = $formactions->showactions(
$object,
'shipping', $socid, 1);
2828 print
'</div></div>';
2837 if (
GETPOST(
'modelselected')) {
2838 $action =
'presend';
2842 $modelmail =
'shipping_send';
2843 $defaulttopic =
'SendShippingRef';
2844 $diroutput = $conf->expedition->dir_output.
'/sending';
2845 $trackid =
'shi'.$object->id;
2847 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($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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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 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.
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.