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' && $permissiontoadd) {
164 $result =
$object->setDraft($user, 0);
168 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
173 if ($action ==
'reopen' && $permissiontoadd) {
179 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
185 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm') && $permissiontoadd) {
189 if ($action ==
'setref_customer' && $permissiontoadd) {
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' && $permissiontoadd) {
207 $attribute_name =
GETPOST(
'attribute',
'restricthtml');
210 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
217 $result =
$object->updateExtraField($attribute_name,
'SHIPMENT_MODIFY');
225 $action =
'edit_extras';
230 if ($action ==
'add' && $permissiontoadd) {
238 $object->origin_id = $origin_id;
250 $classname = ucfirst(
$object->origin);
251 $objectsrc =
new $classname($db);
252 $objectsrc->fetch(
$object->origin_id);
254 $object->socid = $objectsrc->socid;
257 $object->date_delivery = $date_delivery;
258 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
264 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
266 $batch_line = array();
267 $stockLine = array();
268 $array_options = array();
270 $num = count($objectsrc->lines);
273 $product_batch_used = array();
275 for ($i = 0; $i < $num; $i++) {
282 $batch =
"batchl".$i.
"_0";
283 $stockLocation =
"ent1".$i.
"_0";
286 $is_batch_or_serial = 0;
287 if (!empty($objectsrc->lines[$i]->fk_product)) {
288 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
289 if ($resultFetch < 0) {
292 $is_batch_or_serial = $product->status_batch;
296 if (isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
297 if (GETPOSTISSET($batch)) {
300 while (GETPOSTISSET($batch)) {
303 $sub_qty[$j][
'id_batch'] =
GETPOSTINT($batch);
304 $subtotalqty += $sub_qty[$j][
'q'];
312 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)))) {
313 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
318 if ($is_batch_or_serial == 2 && $sub_qty[$j][
'q'] > 0) {
320 $product_batch_used[$j] = $sub_qty[$j][
'id_batch'];
324 $batch =
"batchl".$i.
"_".$j;
325 $qty =
"qtyl".$i.
'_'.$j;
328 $batch_line[$i][
'detail'] = $sub_qty;
329 $batch_line[$i][
'qty'] = $subtotalqty;
332 $totalqty += $subtotalqty;
339 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOSTINT($idl).
')',
null,
'errors');
343 } elseif (GETPOSTISSET($stockLocation)) {
346 while (GETPOSTISSET($stockLocation)) {
349 $stockLine[$i][$j][
'warehouse_id'] =
GETPOSTINT($stockLocation);
350 $stockLine[$i][$j][
'ix_l'] =
GETPOSTINT($idl);
356 $stockLocation =
"ent1".$i.
"_".$j;
357 $qty =
"qtyl".$i.
'_'.$j;
368 if (
getDolGlobalInt(
"MAIN_DONT_SHIP_MORE_THAN_ORDERED") && $subtotalqty > $objectsrc->lines[$i]->qty) {
369 setEventMessages($langs->trans(
"ErrorTooMuchShipped", $i + 1),
null,
'errors');
375 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
377 if (isset($extrafields->attributes[
$object->table_element_line][
'label']) && is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
379 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
380 unset($_POST[
"options_".$key]);
386 if (($totalqty > 0 ||
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) && !$error) {
387 for ($i = 0; $i < $num; $i++) {
390 if (!isset($batch_line[$i])) {
392 if (isset($stockLine[$i])) {
394 $nbstockline = count($stockLine[$i]);
395 for ($j = 0; $j < $nbstockline; $j++) {
396 if ($stockLine[$i][$j][
'qty'] > 0 || ($stockLine[$i][$j][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
397 $ret =
$object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
409 if ($entrepot_id < 0) {
412 if (!($objectsrc->lines[$i]->fk_product > 0)) {
425 if ($batch_line[$i][
'qty'] > 0 || ($batch_line[$i][
'qty'] == 0 &&
getDolGlobalString(
'SHIPMENT_GETS_ALL_ORDER_PRODUCTS'))) {
426 $ret =
$object->addline_batch($batch_line[$i], $array_options[$i]);
435 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
448 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
449 if (isModEnabled(
'stock')) {
450 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
452 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
458 header(
"Location: card.php?id=".
$object->id);
465 } elseif ($action ==
'create_delivery' &&
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'creer')) {
469 $result =
$object->create_delivery($user);
473 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&token='.
newToken().
'&id='.$result);
480 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && ((!
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 (in_array($action, array(
'settracking_number',
'settracking_url',
'settrueWeight',
'settrueWidth',
'settrueHeight',
'settrueDepth',
'setshipping_method_id')) && $user->hasRight(
'expedition',
'creer')) {
551 if ($action ==
'settracking_number') {
552 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
554 if ($action ==
'settracking_url') {
555 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
557 if ($action ==
'settrueWeight') {
561 if ($action ==
'settrueWidth') {
564 if ($action ==
'settrueHeight') {
568 if ($action ==
'settrueDepth') {
571 if ($action ==
'setshipping_method_id') {
576 if (
$object->update($user) >= 0) {
577 header(
"Location: card.php?id=".
$object->id);
584 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
586 $result =
$object->setBilled();
588 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
592 } elseif ($action ==
'classifyclosed' && $permissiontoadd) {
594 $result =
$object->setClosed();
596 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
600 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoadd) {
605 $line->fk_expedition =
$object->id;
607 $num_prod = count($lines);
608 for ($i = 0; $i < $num_prod; $i++) {
609 if ($lines[$i]->
id == $line_id) {
610 if (count($lines[$i]->details_entrepot) > 1) {
612 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
613 $line->id = $details_entrepot->line_id;
614 if (!$error && $line->delete($user) < 0) {
620 $line->id = $line_id;
621 if (!$error && $line->delete($user) < 0) {
626 unset($_POST[
"lineid"]);
630 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
635 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'save')) {
643 $num_prod = count($lines);
644 for ($i = 0; $i < $num_prod; $i++) {
645 if ($lines[$i]->
id == $line_id) {
646 $update_done =
false;
648 $line->fk_expedition =
$object->id;
651 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
653 if (is_array($extrafields->attributes[
$object->table_element_line][
'label'])) {
654 foreach ($extrafields->attributes[
$object->table_element_line][
'label'] as $key => $value) {
655 unset($_POST[
"options_".$key]);
658 $line->fk_product = $lines[$i]->fk_product;
659 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
661 foreach ($lines[$i]->detail_batch as $detail_batch) {
663 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
664 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
667 if (!empty($batch_id)) {
668 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
669 if ($lines[$i]->entrepot_id != 0) {
671 $line->entrepot_id = $lotStock->warehouseid;
675 if (empty($line->detail_batch)) {
676 $line->detail_batch =
new stdClass();
679 $line->detail_batch->fk_origin_stock = $batch_id;
680 $line->detail_batch->batch = $lotStock->batch;
681 $line->detail_batch->id = $detail_batch->id;
682 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
683 $line->detail_batch->qty = $batch_qty;
684 if ($line->update($user) < 0) {
695 unset($_POST[$batch]);
700 $batch =
"batchl".$line_id.
"_0";
701 $qty =
"qtyl".$line_id.
"_0";
705 if ($batch_qty > 0 && !empty($batch_id)) {
706 if ($lotStock->fetch($batch_id) > 0) {
708 if ($lines[$i]->entrepot_id > 0) {
710 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
711 $lineIdToAddLot = $line_id;
713 } elseif (count($lines[$i]->details_entrepot) > 1) {
715 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
716 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
717 $lineIdToAddLot = $detail_entrepot->line_id;
721 if ($lineIdToAddLot) {
723 if ($line->fetch($lineIdToAddLot) > 0) {
724 $line->detail_batch->fk_origin_stock = $batch_id;
725 $line->detail_batch->batch = $lotStock->batch;
726 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
727 $line->detail_batch->qty = $batch_qty;
728 if ($line->update($user) < 0) {
740 $line->origin_line_id = $lines[$i]->origin_line_id;
741 $line->entrepot_id = $lotStock->warehouseid;
743 $line->detail_batch[0]->fk_origin_stock = $batch_id;
744 $line->detail_batch[0]->batch = $lotStock->batch;
745 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
746 $line->detail_batch[0]->qty = $batch_qty;
747 if (
$object->create_line_batch($line, $line->array_options) < 0) {
760 if ($lines[$i]->fk_product > 0) {
762 if ($lines[$i]->entrepot_id == 0) {
764 $stockLocation =
"entl".$line_id;
765 $qty =
"qtyl".$line_id;
766 $line->id = $line_id;
767 $line->entrepot_id =
GETPOSTINT((
string) $stockLocation);
769 if ($line->update($user) < 0) {
773 unset($_POST[$stockLocation]);
775 } elseif ($lines[$i]->entrepot_id > 0) {
777 $stockLocation =
"entl".$line_id;
778 $qty =
"qtyl".$line_id;
779 $line->id = $line_id;
780 $line->entrepot_id =
GETPOSTINT($stockLocation);
782 if ($line->update($user) < 0) {
786 unset($_POST[$stockLocation]);
788 } elseif (count($lines[$i]->details_entrepot) > 1) {
790 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
792 $stockLocation =
"entl".$detail_entrepot->line_id;
793 $qty =
"qtyl".$detail_entrepot->line_id;
795 if (!empty($warehouse)) {
796 $line->id = $detail_entrepot->line_id;
797 $line->entrepot_id = $warehouse;
799 if ($line->update($user) < 0) {
806 unset($_POST[$stockLocation]);
810 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
811 $qty =
"qtyl".$line_id;
812 $line->id = $line_id;
814 $line->entrepot_id = 0;
815 if ($line->update($user) < 0) {
825 $qty =
"qtyl".$line_id;
826 $line->id = $line_id;
828 $line->entrepot_id = 0;
829 if ($line->update($user) < 0) {
839 if (empty($update_done)) {
840 $line->id = $lines[$i]->id;
841 $line->insertExtraFields();
846 unset($_POST[
"lineid"]);
851 $outputlangs = $langs;
854 $newlang =
GETPOST(
'lang_id',
'aZ09');
857 $newlang =
$object->thirdparty->default_lang;
859 if (!empty($newlang)) {
861 $outputlangs->setDefaultLang($newlang);
865 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
868 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
871 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
872 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
876 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
882 $triggersendname =
'SHIPPING_SENTBYMAIL';
884 $autocopy =
'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO';
885 $mode =
'emailfromshipment';
886 $trackid =
'shi'.$object->id;
887 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
895$title =
$object->ref.
' - '.$langs->trans(
"Shipment");
896if ($action ==
'create2') {
897 $title = $langs->trans(
"CreateShipment");
899$help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
901llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-expedition page-card');
907$form =
new Form($db);
910if (isModEnabled(
'project')) {
914$product_static =
new Product($db);
916$warehousestatic =
new Entrepot($db);
918if ($action ==
'create2') {
921 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
928if ($action ==
'create') {
938 $classname = ucfirst($origin);
941 if (
$object->fetch($origin_id)) {
945 $author =
new User($db);
946 $author->fetch(
$object->user_author_id);
948 if (isModEnabled(
'stock')) {
952 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
953 print
'<input type="hidden" name="token" value="'.newToken().
'">';
954 print
'<input type="hidden" name="action" value="add">';
955 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
956 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
958 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
963 print
'<table class="border centpercent">';
966 print
'<tr><td class="titlefieldcreate fieldrequired">';
967 if ($origin ==
'commande' && isModEnabled(
'order')) {
968 print $langs->trans(
"RefOrder");
970 if ($origin ==
'propal' && isModEnabled(
"propal")) {
971 print $langs->trans(
"RefProposal");
973 print
'</td><td colspan="3">';
980 if ($origin ==
'commande') {
981 print $langs->trans(
'RefCustomerOrder');
982 } elseif ($origin ==
'propal') {
983 print $langs->trans(
'RefCustomerOrder');
985 print $langs->trans(
'RefCustomer');
987 print
'</td><td colspan="3">';
988 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
993 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
994 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
998 if (isModEnabled(
'project')) {
1000 if (empty($projectid) && !empty(
$object->fk_project)) {
1001 $projectid =
$object->fk_project;
1003 if ($origin ==
'project') {
1004 $projectid = ($originid ? $originid : 0);
1007 $langs->load(
"projects");
1009 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1010 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1011 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
1012 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>';
1018 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1019 print
'<td colspan="3">';
1020 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1021 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1022 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1027 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1028 print
'<td colspan="3">';
1029 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1030 print $doleditor->Create(1);
1034 if (
$object->note_private && !$user->socid) {
1035 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1036 print
'<td colspan="3">';
1037 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1038 print $doleditor->Create(1);
1044 print $langs->trans(
"Weight");
1045 print
'</td><td colspan="3">';
1046 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1047 print
'<input name="weight" size="4" value="'.GETPOSTINT(
'weight').
'"> ';
1048 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
1049 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1050 print $form->textwithpicto($text, $htmltext);
1054 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1055 print
' </td><td colspan="3">';
1056 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1057 print
'<input name="sizeW" size="4" value="'.GETPOSTINT(
'sizeW').
'">';
1058 print
' x <input name="sizeH" size="4" value="'.GETPOSTINT(
'sizeH').
'">';
1059 print
' x <input name="sizeS" size="4" value="'.GETPOSTINT(
'sizeS').
'">';
1061 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
1062 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1063 print $form->textwithpicto($text, $htmltext);
1067 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1068 print
'<td colspan="3">';
1069 $expe->fetch_delivery_methods();
1070 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1071 print $form->selectarray(
"shipping_method_id", $expe->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1073 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1075 print
"</td></tr>\n";
1078 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1079 print
'<td colspan="3">';
1080 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1081 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1082 print
"</td></tr>\n";
1085 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1086 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $expe, $action);
1087 print $hookmanager->resPrint;
1089 if (empty($reshook)) {
1091 if (
$object->fetch_optionals() > 0) {
1092 $expe->array_options = array_merge($expe->array_options,
$object->array_options);
1094 print $expe->showOptionals($extrafields,
'edit', $parameters);
1099 if (isModEnabled(
'incoterm')) {
1101 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1102 print
'<td colspan="3" class="maxwidthonsmartphone">';
1103 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1104 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1109 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1111 if (is_countable($list) && count($list) > 1) {
1112 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1113 print
'<td colspan="3">';
1114 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1115 print $form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1116 print
"</td></tr>\n";
1126 $numAsked = count(
$object->lines);
1128 print
'<script type="text/javascript">'.
"\n";
1129 print
'jQuery(document).ready(function() {'.
"\n";
1130 print
'jQuery("#autofill").click(function() {';
1132 while ($i < $numAsked) {
1133 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1134 if (isModEnabled(
'productbatch')) {
1135 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1139 print
'return false; });'.
"\n";
1140 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1141 print
'return false; });'.
"\n";
1143 print
'</script>'.
"\n";
1147 print
'<table class="noborder centpercent">';
1153 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1156 print
'<tr class="liste_titre">';
1157 print
'<td>'.$langs->trans(
"Description").
'</td>';
1158 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1159 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1160 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1161 if (empty($conf->productbatch->enabled)) {
1162 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1167 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1169 if (isModEnabled(
'stock')) {
1170 if (empty($conf->productbatch->enabled)) {
1171 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1173 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1177 print
'<td class="left">'.$langs->trans(
'StockEntryDate').
'</td>';
1183 $warehousePicking = array();
1185 if ($warehouse_id > 0) {
1186 $warehousePicking[] = $warehouse_id;
1188 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1192 while ($indiceAsked < $numAsked) {
1195 $line =
$object->lines[$indiceAsked];
1197 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1198 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
1203 if (empty($reshook)) {
1205 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1208 if (!empty($line->date_start)) {
1211 if (!empty($line->date_end)) {
1215 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1216 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1219 if ($line->fk_product > 0) {
1220 $res = $product->fetch($line->fk_product);
1224 $product->load_stock(
'warehouseopen');
1228 print
'<a name="'.$line->id.
'"></a>';
1231 $product_static->type = $line->fk_product_type;
1232 $product_static->id = $line->fk_product;
1233 $product_static->ref = $line->ref;
1234 $product_static->status = $line->product_tosell;
1235 $product_static->status_buy = $line->product_tobuy;
1236 $product_static->status_batch = $line->product_tobatch;
1238 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1240 $text = $product_static->getNomUrl(1);
1241 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1244 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1247 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1250 if ($showdescinproductdesc) {
1251 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1258 $text =
img_object($langs->trans(
'Service'),
'service');
1260 $text =
img_object($langs->trans(
'Product'),
'product');
1263 if (!empty($line->label)) {
1264 $text .=
' <strong>'.$line->label.
'</strong>';
1265 print $form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1267 print $text.
' '.nl2br($line->desc);
1271 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1282 print
'<td class="center">'.$line->qty;
1283 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1284 print
''.$unit_order.
'</td>';
1285 $qtyProdCom = $line->qty;
1288 print
'<td class="center">';
1289 $quantityDelivered = isset(
$object->expeditions[$line->id]) ?
$object->expeditions[$line->id] :
'';
1290 print $quantityDelivered;
1291 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1292 print
''.$unit_order.
'</td>';
1295 $quantityAsked = $line->qty;
1297 $quantityToBeDelivered = 0;
1299 if (is_numeric($quantityDelivered)) {
1300 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1302 $quantityToBeDelivered = $quantityAsked;
1306 $warehouseObject =
null;
1307 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled(
'stock')) {
1308 print
'<!-- Case warehouse already known or product not a predefined product -->';
1310 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1312 $deliverableQty = $quantityToBeDelivered;
1314 $deliverableQty = min($quantityToBeDelivered, $stock);
1316 if ($deliverableQty < 0) {
1317 $deliverableQty = 0;
1319 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1321 print
'<td class="center">';
1324 $deliverableQty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1326 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1327 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.
'">';
1330 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1331 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1334 print $langs->trans(
"NA");
1339 if (isModEnabled(
'stock')) {
1340 print
'<td class="left">';
1343 $ent =
"entl".$indiceAsked;
1344 $idl =
"idl".$indiceAsked;
1346 if ($line->fk_product > 0) {
1347 print
'<!-- Show warehouse selection -->';
1353 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1355 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1357 if ($stock < $quantityToBeDelivered) {
1358 print
' '.img_warning($langs->trans(
"StockTooLow"));
1363 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span><input name="entl'.$indiceAsked.
'" id="entl'.$indiceAsked.
'" type="hidden" value="0">';
1374 $product->get_sousproduits_arbo();
1375 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1376 if (count($prods_arbo) > 0) {
1377 foreach ($prods_arbo as $key => $value) {
1380 if ($value[
'stock'] < $value[
'stock_alert']) {
1383 print
"<tr class=\"oddeven\"><td> ->
1384 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1385 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1386 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1396 print
'<td></td><td></td>';
1401 print
'<!-- Case product need lot -->';
1403 $staticwarehouse =
new Entrepot($db);
1404 if ($warehouse_id > 0) {
1405 $staticwarehouse->fetch($warehouse_id);
1411 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1412 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1416 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1417 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1418 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1420 $batchStock = + $dbatch->qty;
1421 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1424 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1425 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1427 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1428 $alreadyQtyBatchSetted[$line->fk_product] = array();
1431 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1432 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1435 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1438 if ($deliverableQty < 0) $deliverableQty = 0;
1440 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1441 if (GETPOSTISSET($inputName)) {
1442 $deliverableQty =
GETPOST($inputName,
'int');
1445 $tooltipClass = $tooltipTitle =
'';
1446 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1447 $tooltipClass =
' classfortooltip';
1448 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1450 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1452 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1454 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1455 print
'<td colspan="3" ></td><td class="center">';
1456 print
'<input class="qtyl '.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1459 print
'<!-- Show details of lot -->';
1460 print
'<td class="left">';
1462 print $staticwarehouse->getNomUrl(0).
' / ';
1464 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1467 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1469 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1472 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1474 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1478 $quantityToBeDelivered -= $deliverableQty;
1479 if ($quantityToBeDelivered < 0) {
1480 $quantityToBeDelivered = 0;
1485 print
'<td>'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1490 print
'<!-- Case there is no details of lot at all -->';
1491 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1492 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1495 print
'<td class="left">';
1496 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1506 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1507 print
'<!-- Case warehouse not already known and product does not need lot -->';
1508 print
'<td></td><td></td>';
1514 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1519 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1520 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1524 $tmpwarehouseObject =
new Entrepot($db);
1525 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1527 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1532 $tmpwarehouseObject->fetch($warehouse_id);
1533 if ($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1534 $stock = + $stock_warehouse->real;
1535 $deliverableQty = min($quantityToBeDelivered, $stock);
1536 $deliverableQty = max(0, $deliverableQty);
1538 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'>';
1539 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1541 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1542 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1544 if (!isset($alreadyQtySetted[$line->fk_product])) {
1545 $alreadyQtySetted[$line->fk_product] = array();
1548 $deliverableQty = min($quantityToBeDelivered, $stock);
1551 if ($deliverableQty < 0) {
1552 $deliverableQty = 0;
1555 $tooltipClass = $tooltipTitle =
'';
1556 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1557 $tooltipClass =
' classfortooltip';
1558 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1560 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = 0;
1563 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1565 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1566 if (GETPOSTISSET($inputName)) {
1570 print
'<input class="qtyl'.$tooltipClass.
' right" title="'.$tooltipTitle.
'" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1571 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1574 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1577 print $langs->trans(
"NA");
1582 if (isModEnabled(
'stock')) {
1583 print
'<td class="left">';
1585 print $tmpwarehouseObject->getNomUrl(0).
' ';
1587 print
'<!-- Show details of stock -->';
1588 print
'('.$stock.
')';
1590 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1594 $quantityToBeDelivered -= $deliverableQty;
1595 if ($quantityToBeDelivered < 0) {
1596 $quantityToBeDelivered = 0;
1607 $product->get_sousproduits_arbo();
1608 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1609 if (count($prods_arbo) > 0) {
1610 foreach ($prods_arbo as $key => $value) {
1613 if ($value[
'stock'] < $value[
'stock_alert']) {
1616 print
'<tr class"oddeven"><td>';
1617 print
" ->
1618 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1619 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1620 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1629 print
'<!-- Case warehouse not already known and product need lot -->';
1630 print
'<td></td><td></td>';
1637 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1639 $tmpwarehouseObject =
new Entrepot($db);
1644 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1645 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1646 $nbofsuggested += count($stock_warehouse->detail_batch);
1650 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1652 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1657 $tmpwarehouseObject->fetch($warehouse_id);
1658 if (($stock_warehouse->real > 0 || !empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) && (count($stock_warehouse->detail_batch))) {
1659 foreach ($stock_warehouse->detail_batch as $dbatch) {
1660 $batchStock = + $dbatch->qty;
1661 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1662 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1664 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1665 $alreadyQtyBatchSetted[$line->fk_product] = array();
1668 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1669 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1672 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1675 if ($deliverableQty < 0) {
1676 $deliverableQty = 0;
1679 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1680 if (GETPOSTISSET($inputName)) {
1684 $tooltipClass = $tooltipTitle =
'';
1685 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1686 $tooltipClass =
' classfortooltip';
1687 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1689 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = 0 ;
1691 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1693 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ?
'oddeven' :
'').
'><td colspan="3"></td><td class="center">';
1694 print
'<input class="qtyl right '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1697 print
'<td class="left">';
1699 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1701 print
'<!-- Show details of lot -->';
1702 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1705 print $langs->trans(
"Batch").
': ';
1706 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1708 print $productlotObject->getNomUrl(1);
1710 print $langs->trans(
"TableLotIncompleteRunRepairWithParamStandardEqualConfirmed");
1713 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1716 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1718 print
' ('.$dbatch->qty.
')';
1719 $quantityToBeDelivered -= $deliverableQty;
1720 if ($quantityToBeDelivered < 0) {
1721 $quantityToBeDelivered = 0;
1727 print
'<td class="left">'.dol_print_date($dbatch->context[
'stock_entry_date'],
'day').
'</td>';
1735 $warehouse_selected_id =
GETPOSTINT(
'entrepot_id');
1737 print
'<!-- line not shown yet, we show it -->';
1738 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1742 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1743 $disabled =
'disabled="disabled"';
1745 if ($warehouse_selected_id <= 0) {
1746 $disabled =
'disabled="disabled"';
1748 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1750 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1754 if (isModEnabled(
'productbatch') && $product->hasbatch()) {
1755 $disabled =
'disabled="disabled"';
1757 if ($warehouse_selected_id <= 0) {
1758 $disabled =
'disabled="disabled"';
1760 print
'<input class="qtyl right" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$quantityToBeDelivered.
'"'.($disabled ?
' '.$disabled :
'').
'> ';
1762 print
'<input name="ent1' . $indiceAsked .
'_' . $subj .
'" type="hidden" value="' . $warehouse_selected_id .
'">';
1765 print $langs->trans(
"NA");
1769 print
'<td class="left">';
1771 if ($warehouse_selected_id > 0) {
1772 $warehouseObject =
new Entrepot($db);
1773 $warehouseObject->fetch($warehouse_selected_id);
1774 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1776 if ($line->fk_product) {
1777 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1783 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
1795 if (!empty($extrafields)) {
1801 $srcLine->id = $line->id;
1802 $srcLine->fetch_optionals();
1804 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1806 print $expLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="drag drop oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1817 print $form->buttonsSaveCancel(
"Create");
1834 $num_prod = count($lines);
1837 $typeobject =
$object->origin;
1839 $origin_id =
$object->origin_id;
1847 $res =
$object->fetch_optionals();
1855 if ($action ==
'delete') {
1856 $formquestion = array();
1858 $formquestion = array(
1860 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1861 'name' =>
'alsoUpdateStock',
1862 'type' =>
'checkbox',
1867 $formconfirm = $form->formconfirm(
1868 $_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
1869 $langs->trans(
'DeleteSending'),
1870 $langs->trans(
"ConfirmDeleteSending",
$object->ref),
1879 if ($action ==
'valid') {
1880 $objectref = substr(
$object->ref, 1, 4);
1881 if ($objectref ==
'PROV') {
1882 $numref =
$object->getNextNumRef($soc);
1887 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1889 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1891 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1894 if (isModEnabled(
'notification')) {
1895 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1896 $notify =
new Notify($db);
1898 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE',
$object->socid,
$object);
1901 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1, 250);
1904 if ($action ==
'cancel') {
1905 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending",
$object->ref),
'confirm_cancel',
'', 0, 1);
1909 $parameters = array(
'formConfirm' => $formconfirm);
1910 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1911 if (empty($reshook)) {
1912 $formconfirm .= $hookmanager->resPrint;
1913 } elseif ($reshook > 0) {
1914 $formconfirm = $hookmanager->resPrint;
1922 $tmparray =
$object->getTotalWeightVolume();
1923 $totalWeight = $tmparray[
'weight'];
1924 $totalVolume = $tmparray[
'volume'];
1926 if (!empty($typeobject) && $typeobject ===
'commande' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
'order')) {
1928 $objectsrc->fetch(
$object->origin_object->id);
1930 if (!empty($typeobject) && $typeobject ===
'propal' && is_object(
$object->origin_object) &&
$object->origin_object->id && isModEnabled(
"propal")) {
1931 $objectsrc =
new Propal($db);
1932 $objectsrc->fetch(
$object->origin_object->id);
1936 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1937 $morehtmlref =
'<div class="refidno">';
1939 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
$object, $user->hasRight(
'expedition',
'creer'),
'string',
'', 0, 1);
1940 $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);
1942 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1944 if (isModEnabled(
'project')) {
1945 $langs->load(
"projects");
1946 $morehtmlref .=
'<br>';
1948 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1949 if ($action !=
'classify') {
1950 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1952 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1954 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1956 $proj->fetch($objectsrc->fk_project);
1957 $morehtmlref .= $proj->getNomUrl(1);
1959 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1964 $morehtmlref .=
'</div>';
1967 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1970 print
'<div class="fichecenter">';
1971 print
'<div class="fichehalfleft">';
1972 print
'<div class="underbanner clearboth"></div>';
1974 print
'<table class="border tableforfield centpercent">';
1977 if (!empty($typeobject) && $typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
1979 print $langs->trans(
"RefOrder").
'</td>';
1980 print
'<td colspan="3">';
1981 print $objectsrc->getNomUrl(1,
'commande');
1985 if (!empty($typeobject) && $typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1987 print $langs->trans(
"RefProposal").
'</td>';
1988 print
'<td colspan="3">';
1989 print $objectsrc->getNomUrl(1,
'expedition');
1995 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1996 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour").
"</td>\n";
2000 print
'<tr><td height="10">';
2001 print
'<table class="nobordernopadding centpercent"><tr><td>';
2002 print $langs->trans(
'DateDeliveryPlanned');
2005 if ($action !=
'editdate_livraison') {
2006 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>';
2008 print
'</tr></table>';
2009 print
'</td><td colspan="2">';
2010 if ($action ==
'editdate_livraison') {
2011 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2012 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2013 print
'<input type="hidden" name="action" value="setdate_livraison">';
2014 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2015 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2025 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'expedition',
'creer'));
2026 print
'</td><td colspan="3">';
2028 if ($action ==
'edittrueWeight') {
2029 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2030 print
'<input name="action" value="settrueWeight" type="hidden">';
2031 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2032 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2033 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50 valignmiddle">';
2034 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2,
'maxwidth125 valignmiddle');
2035 print
' <input class="button smallpaddingimp valignmiddle" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2036 print
' <input class="button button-cancel smallpaddingimp valignmiddle" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2040 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2044 if ($totalWeight > 0) {
2045 if (!empty(
$object->trueWeight)) {
2046 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2048 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');
2049 if (!empty(
$object->trueWeight)) {
2056 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2057 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'expedition',
'creer'));
2058 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2062 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2063 if ($action ==
'edittrueHeight') {
2064 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2065 print
'<input name="action" value="settrueHeight" type="hidden">';
2066 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2067 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2068 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
2069 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2070 print
' <input class="button smallpaddingimp" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2071 print
' <input class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2075 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2081 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2082 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'expedition',
'creer'));
2083 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2088 print $langs->trans(
"Volume");
2090 print
'<td colspan="3">';
2091 $calculatedVolume = 0;
2095 $volumeUnit =
$object->size_units * 3;
2098 if ($calculatedVolume > 0) {
2099 if ($volumeUnit < 50) {
2105 if ($totalVolume > 0) {
2106 if ($calculatedVolume) {
2107 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2111 if ($calculatedVolume) {
2120 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2125 print
'<div class="fichehalfright">';
2126 print
'<div class="underbanner clearboth"></div>';
2128 print
'<table class="border centpercent tableforfield">';
2131 print
'<tr><td height="10">';
2132 print
'<table class="nobordernopadding centpercent"><tr><td>';
2133 print $langs->trans(
'SendingMethod');
2136 if ($action !=
'editshipping_method_id') {
2137 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>';
2139 print
'</tr></table>';
2140 print
'</td><td colspan="2">';
2141 if ($action ==
'editshipping_method_id') {
2142 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2143 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2144 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2145 $object->fetch_delivery_methods();
2146 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2148 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2150 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
2153 if (
$object->shipping_method_id > 0) {
2155 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2156 print $langs->trans(
"SendingMethod".strtoupper($code));
2163 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'expedition',
'creer')).
'</td><td colspan="3">';
2164 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'expedition',
'creer'),
'safehtmlstring',
$object->tracking_number);
2168 if (isModEnabled(
'incoterm')) {
2170 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2171 print $langs->trans(
'IncotermLabel');
2172 print
'<td><td class="right">';
2173 if ($user->hasRight(
'expedition',
'creer')) {
2174 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2178 print
'</td></tr></table>';
2180 print
'<td colspan="3">';
2181 if ($action !=
'editincoterm') {
2182 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2184 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2190 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2191 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2192 print $hookmanager->resPrint;
2199 print
'<div class="clearboth"></div>';
2204 if ($action ==
'editline') {
2205 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2206 <input type="hidden" name="token" value="' .
newToken().
'">
2207 <input type="hidden" name="action" value="updateline">
2208 <input type="hidden" name="mode" value="">
2209 <input type="hidden" name="id" value="' .
$object->id.
'">
2214 print
'<div class="div-table-responsive-no-min">';
2215 print
'<table class="noborder" width="100%" id="tablelines" >';
2217 print
'<tr class="liste_titre">';
2220 print
'<td width="5" class="center linecolnum"> </td>';
2223 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2225 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2226 if ($origin && $origin_id > 0) {
2227 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2229 if ($action ==
'editline') {
2231 if (!isModEnabled(
'stock')) {
2234 if (empty($conf->productbatch->enabled)) {
2237 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2239 print $langs->trans(
"QtyToShip").
' - ';
2241 print $langs->trans(
"QtyShipped").
' - ';
2243 if (isModEnabled(
'stock')) {
2244 print $langs->trans(
"WarehouseSource").
' - ';
2246 if (isModEnabled(
'productbatch')) {
2247 print $langs->trans(
"Batch");
2252 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2254 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2256 if (isModEnabled(
'stock')) {
2257 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2260 if (isModEnabled(
'productbatch')) {
2261 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2264 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2265 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2268 print
'<td class="linecoledit"></td>';
2269 print
'<td class="linecoldelete" width="10"></td>';
2274 $outputlangs = $langs;
2279 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2280 $newlang =
GETPOST(
'lang_id',
'aZ09');
2282 if (empty($newlang)) {
2283 $newlang =
$object->thirdparty->default_lang;
2285 if (!empty($newlang)) {
2286 $outputlangs =
new Translate(
"", $conf);
2287 $outputlangs->setDefaultLang($newlang);
2292 $alreadysent = array();
2293 if ($origin && $origin_id > 0) {
2294 $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";
2295 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot";
2296 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2298 $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';
2299 $sql .=
', p.description as product_desc';
2300 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2301 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2302 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2304 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2305 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2306 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2307 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2308 $sql .=
" AND ed.fk_expedition = e.rowid";
2310 $sql .=
" ORDER BY obj.fk_product";
2312 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2313 $resql = $db->query($sql);
2315 $num = $db->num_rows($resql);
2319 $obj = $db->fetch_object($resql);
2322 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2323 'shipment_ref' => $obj->shipment_ref,
'shipment_id' => $obj->shipment_id,
'warehouse' => $obj->fk_entrepot,
'qty_shipped' => $obj->qty_shipped,
2324 'product_tosell' => $obj->product_tosell,
'product_tobuy' => $obj->product_tobuy,
'product_tobatch' => $obj->product_tobatch,
2325 'date_valid' => $db->jdate($obj->date_valid),
'date_delivery' => $db->jdate($obj->date_delivery));
2336 for ($i = 0; $i < $num_prod; $i++) {
2337 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2338 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters,
$object, $action);
2343 if (empty($reshook)) {
2344 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2345 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2349 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2353 if ($lines[$i]->fk_product > 0) {
2357 $prod->fetch($lines[$i]->fk_product);
2358 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2360 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2363 print
'<td class="linecoldescription">';
2366 $product_static->type = $lines[$i]->fk_product_type;
2367 $product_static->id = $lines[$i]->fk_product;
2368 $product_static->ref = $lines[$i]->ref;
2369 $product_static->status = $lines[$i]->product_tosell;
2370 $product_static->status_buy = $lines[$i]->product_tobuy;
2371 $product_static->status_batch = $lines[$i]->product_tobatch;
2373 $product_static->weight = $lines[$i]->weight;
2374 $product_static->weight_units = $lines[$i]->weight_units;
2375 $product_static->length = $lines[$i]->length;
2376 $product_static->length_units = $lines[$i]->length_units;
2377 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2378 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2379 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2380 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2381 $product_static->surface = $lines[$i]->surface;
2382 $product_static->surface_units = $lines[$i]->surface_units;
2383 $product_static->volume = $lines[$i]->volume;
2384 $product_static->volume_units = $lines[$i]->volume_units;
2386 $text = $product_static->getNomUrl(1);
2387 $text .=
' - '.$label;
2389 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
2390 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2396 print
'<td class="linecoldescription" >';
2398 $text =
img_object($langs->trans(
'Service'),
'service');
2400 $text =
img_object($langs->trans(
'Product'),
'product');
2403 if (!empty($lines[$i]->label)) {
2404 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2405 print $form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2420 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2423 if ($origin && $origin_id > 0) {
2424 print
'<td class="linecolqtyinothershipments center nowrap">';
2426 $qtyalreadysent = 0;
2427 foreach ($alreadysent as $key => $val) {
2428 if ($lines[$i]->fk_elementdet == $key) {
2430 foreach ($val as $shipmentline_id => $shipmentline_var) {
2431 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2437 $htmltooltip .=
'<br>';
2439 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2440 $htmltooltip .= $shipment_static->getNomUrl(1,
'', 0, 0, 1);
2441 $htmltooltip .=
' - '.$shipmentline_var[
'qty_shipped'];
2442 $htmltooltip .=
' - '.$langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2449 $qtyalreadysent += $shipmentline_var[
'qty_shipped'];
2452 $htmltooltip = $langs->trans(
"QtyInOtherShipments").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2456 print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2460 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2462 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2463 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2464 print
'<!-- case edit 1 -->';
2466 foreach ($lines[$i]->detail_batch as $detail_batch) {
2469 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>';
2471 if ($lines[$i]->entrepot_id == 0) {
2473 $line->fetch($detail_batch->fk_expeditiondet);
2475 $entrepot_id = !empty($detail_batch->entrepot_id) ? $detail_batch->entrepot_id : $lines[$i]->entrepot_id;
2476 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>';
2482 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2484 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2486 } elseif (isModEnabled(
'stock')) {
2487 if ($lines[$i]->fk_product > 0) {
2488 if ($lines[$i]->entrepot_id > 0) {
2489 print
'<!-- case edit 2 -->';
2492 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>';
2494 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2496 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2498 } elseif (count($lines[$i]->details_entrepot) > 1) {
2499 print
'<!-- case edit 3 -->';
2500 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2503 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>';
2505 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2507 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2511 print
'<!-- case edit 4 -->';
2514 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2515 print
'<td><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
2519 print
'<!-- case edit 5 -->';
2520 print
'<tr><td colspan="3">'.$langs->trans(
"ErrorStockIsNotEnough").
'</td></tr>';
2523 print
'<!-- case edit 6 -->';
2526 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>';
2533 } elseif (!isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2534 print
'<!-- case edit 7 -->';
2537 print
'<td><input class="qtyl right" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2545 print
'</table></td>';
2548 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2551 if (isModEnabled(
'stock')) {
2552 print
'<td class="linecolwarehousesource tdoverflowmax200">';
2554 print
'<span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
2555 } elseif ($lines[$i]->entrepot_id > 0) {
2557 $entrepot->fetch($lines[$i]->entrepot_id);
2558 print $entrepot->getNomUrl(1);
2559 } elseif (count($lines[$i]->details_entrepot) > 1) {
2561 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2562 if ($detail_entrepot->entrepot_id > 0) {
2564 $entrepot->fetch($detail_entrepot->entrepot_id);
2565 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->label, $detail_entrepot->qty_shipped).
'<br>';
2568 print $form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2574 if (isModEnabled(
'productbatch')) {
2575 if (isset($lines[$i]->detail_batch)) {
2576 print
'<!-- Detail of lot -->';
2577 print
'<td class="linecolbatch">';
2578 if ($lines[$i]->product_tobatch) {
2580 foreach ($lines[$i]->detail_batch as $dbatch) {
2581 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2583 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2586 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2588 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2591 print $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2593 print $langs->trans(
"NA");
2597 print
'<td class="linecolbatch" ></td>';
2603 print
'<td class="center linecolweight">';
2605 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2612 print
'<td class="center linecolvolume">';
2614 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2623 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2624 print
'<td class="center" colspan="2" valign="middle">';
2625 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2626 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2630 print
'<td class="linecoledit center">';
2631 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2633 print
'<td class="linecoldelete" width="10">';
2634 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2638 if (!empty($rowExtrafieldsStart)) {
2639 print $rowExtrafieldsStart;
2640 print $rowExtrafieldsView;
2648 if (!empty($extrafields)) {
2650 if ($origin && $origin_id > 0) {
2653 if (isModEnabled(
'productbatch')) {
2656 if (isModEnabled(
'stock')) {
2661 $line->fetch_optionals();
2664 if ($action ==
'editline' && $line->id == $line_id) {
2665 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2667 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2675 if (empty($num_prod)) {
2676 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"NoLineGoOnTabToAddSome", $langs->transnoentitiesnoconv(
"ShipmentDistribution")).
'</span></td></tr>';
2694 if (($user->socid == 0) && ($action !=
'presend')) {
2695 print
'<div class="tabsAction">';
2697 $parameters = array();
2698 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2700 if (empty($reshook)) {
2702 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'creer'))
2703 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'expedition',
'shipping_advance',
'validate'))) {
2706 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2712 if ($user->hasRight(
'expedition',
'creer')) {
2717 if ($user->hasRight(
'expedition',
'creer')) {
2723 if (empty($user->socid)) {
2725 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'expedition',
'shipping_advance',
'send')) {
2726 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2728 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2735 if ($user->hasRight(
'facture',
'creer')) {
2737 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid,
'');
2745 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.
$object->id,
'');
2750 if ($user->hasRight(
'expedition',
'creer') &&
$object->status > 0) {
2752 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyBilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=classifybilled&token='.
newToken().
'&id='.
$object->id,
'');
2760 if ($user->hasRight(
'expedition',
'creer')) {
2761 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.
$object->id.
'&mode=init#formmailbeforetitle',
'');
2766 if ($user->hasRight(
'expedition',
'supprimer')) {
2779 if ($action !=
'presend' && $action !=
'editline') {
2780 print
'<div class="fichecenter"><div class="fichehalfleft">';
2783 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2785 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2787 $genallowed = $user->hasRight(
'expedition',
'lire');
2788 $delallowed = $user->hasRight(
'expedition',
'creer');
2790 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2794 $linktoelem = $form->showLinkToObjectBlock(
$object,
null, array(
'shipping'));
2795 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2801 print
'<br><!-- Link to sign -->';
2802 require_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
2803 print showOnlineSignatureUrl(
'expedition',
$object->ref,
$object).
'<br>';
2806 print
'</div><div class="fichehalfright">';
2809 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2811 $somethingshown = $formactions->showactions(
$object,
'shipping', $socid, 1);
2813 print
'</div></div>';
2822 if (
GETPOST(
'modelselected')) {
2823 $action =
'presend';
2827 $modelmail =
'shipping_send';
2828 $defaulttopic =
'SendShippingRef';
2829 $diroutput = $conf->expedition->dir_output.
'/sending';
2830 $trackid =
'shi'.$object->id;
2832 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.