39 require
'../main.inc.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
66 $langs->loadLangs(array(
"sendings",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal'));
69 $langs->load(
'incoterm');
72 $langs->load(
'productbatch');
75 $origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'expedition';
78 if (empty($origin_id)) {
79 $origin_id =
GETPOST(
'origin_id',
'int');
81 if (empty($origin_id)) {
82 $origin_id =
GETPOST(
'object_id',
'int');
85 $line_id =
GETPOST(
'lineid',
'int') ?
GETPOST(
'lineid',
'int') :
'';
86 $facid =
GETPOST(
'facid',
'int');
88 $action =
GETPOST(
'action',
'alpha');
89 $confirm =
GETPOST(
'confirm',
'alpha');
90 $cancel =
GETPOST(
'cancel',
'alpha');
93 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
94 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
95 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
102 $extrafields->fetch_name_optionals_label($object->table_element);
103 $extrafields->fetch_name_optionals_label($object->table_element_line);
104 $extrafields->fetch_name_optionals_label($objectorder->table_element_line);
107 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
110 $hookmanager->initHooks(array(
'expeditioncard',
'globalcard'));
112 $date_delivery =
dol_mktime(
GETPOST(
'date_deliveryhour',
'int'),
GETPOST(
'date_deliverymin',
'int'), 0,
GETPOST(
'date_deliverymonth',
'int'),
GETPOST(
'date_deliveryday',
'int'),
GETPOST(
'date_deliveryyear',
'int'));
114 if ($id > 0 || !empty($ref)) {
115 $object->fetch($id, $ref);
116 $object->fetch_thirdparty();
122 $socid = $user->socid;
127 $permissiondellink = $user->rights->expedition->delivery->creer;
128 $permissiontoadd = $user->rights->expedition->creer;
136 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
141 if (empty($reshook)) {
143 if ($origin && $origin_id > 0) {
144 if ($origin ==
'commande') {
145 header(
"Location: ".DOL_URL_ROOT.
'/expedition/shipment.php?id='.((
int) $origin_id));
154 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
157 $upload_dir = $conf->expedition->dir_output.
'/sending';
158 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
161 if ($action ==
'reopen' && $user->rights->expedition->creer) {
163 $result = $object->reOpen();
167 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm')) {
168 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
171 if ($action ==
'setref_customer') {
172 $result = $object->fetch($id);
177 $result = $object->setValueFrom(
'ref_customer',
GETPOST(
'ref_customer',
'alpha'),
'',
null,
'text',
'', $user,
'SHIPMENT_MODIFY');
180 $action =
'editref_customer';
182 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
187 if ($action ==
'update_extras') {
191 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
198 $result = $object->insertExtraFields(
'SHIPMENT_MODIFY');
206 $action =
'edit_extras';
211 if ($action ==
'add' && $user->rights->expedition->creer) {
216 $object->note =
GETPOST(
'note',
'alpha');
217 $object->origin = $origin;
218 $object->origin_id = $origin_id;
219 $object->fk_project =
GETPOST(
'projectid',
'int');
220 $object->weight =
GETPOST(
'weight',
'int') ==
'' ?
"NULL" :
GETPOST(
'weight',
'int');
221 $object->sizeH =
GETPOST(
'sizeH',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeH',
'int');
222 $object->sizeW =
GETPOST(
'sizeW',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeW',
'int');
223 $object->sizeS =
GETPOST(
'sizeS',
'int') ==
'' ?
"NULL" :
GETPOST(
'sizeS',
'int');
224 $object->size_units =
GETPOST(
'size_units',
'int');
225 $object->weight_units =
GETPOST(
'weight_units',
'int');
230 $classname = ucfirst($object->origin);
231 $objectsrc =
new $classname($db);
232 $objectsrc->fetch($object->origin_id);
234 $object->socid = $objectsrc->socid;
235 $object->ref_customer =
GETPOST(
'ref_customer',
'alpha');
236 $object->model_pdf =
GETPOST(
'model');
237 $object->date_delivery = $date_delivery;
238 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
239 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
240 $object->tracking_number =
GETPOST(
'tracking_number',
'alpha');
241 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
242 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
243 $object->fk_incoterms =
GETPOST(
'incoterm_id',
'int');
244 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
246 $batch_line = array();
247 $stockLine = array();
248 $array_options = array();
250 $num = count($objectsrc->lines);
253 for ($i = 0; $i < $num; $i++) {
260 $batch =
"batchl".$i.
"_0";
261 $stockLocation =
"ent1".$i.
"_0";
264 $is_batch_or_serial=0;
265 if (!empty($objectsrc->lines[$i]->fk_product)) {
266 $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product,
'',
'',
'', 1, 1, 1);
267 if ($resultFetch < 0) {
270 $is_batch_or_serial = $product->status_batch;
274 if (
isModEnabled(
'productbatch') && $objectsrc->lines[$i]->product_tobatch) {
281 $sub_qty[$j][
'id_batch'] =
GETPOST($batch,
'int');
282 $subtotalqty += $sub_qty[$j][
'q'];
290 if ($is_batch_or_serial==2 && $sub_qty[$j][
'q']>1) {
291 setEventMessages($langs->trans(
"TooManyQtyForSerialNumber", $product->ref,
''),
null,
'errors');
296 $batch =
"batchl".$i.
"_".$j;
297 $qty =
"qtyl".$i.
'_'.$j;
300 $batch_line[$i][
'detail'] = $sub_qty;
301 $batch_line[$i][
'qty'] = $subtotalqty;
302 $batch_line[$i][
'ix_l'] =
GETPOST($idl,
'int');
304 $totalqty += $subtotalqty;
311 setEventMessages($langs->trans(
"StockIsRequiredToChooseWhichLotToUse").
' ('.$langs->trans(
"Line").
' '.
GETPOST($idl,
'int').
')',
null,
'errors');
321 $stockLine[$i][$j][
'warehouse_id'] =
GETPOST($stockLocation,
'int');
322 $stockLine[$i][$j][
'ix_l'] =
GETPOST($idl,
'int');
327 $stockLocation =
"ent1".$i.
"_".$j;
328 $qty =
"qtyl".$i.
'_'.$j;
332 if (
GETPOST($qty,
'int') > 0) {
338 $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
340 if (is_array($extrafields->attributes[$object->table_element_line][
'label'])) {
342 foreach ($extrafields->attributes[$object->table_element_line][
'label'] as $key => $value) {
343 unset($_POST[
"options_".$key]);
349 if ($totalqty > 0 && !$error) {
350 for ($i = 0; $i < $num; $i++) {
352 if (!isset($batch_line[$i])) {
354 if (isset($stockLine[$i])) {
356 $nbstockline = count($stockLine[$i]);
357 for ($j = 0; $j < $nbstockline; $j++) {
358 if ($stockLine[$i][$j][
'qty'] > 0) {
359 $ret = $object->addline($stockLine[$i][$j][
'warehouse_id'], $stockLine[$i][$j][
'ix_l'], $stockLine[$i][$j][
'qty'], $array_options[$i]);
367 if (
GETPOST($qty,
'int') > 0 || (
GETPOST($qty,
'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
370 $entrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') :
GETPOST(
'entrepot_id',
'int');
371 if ($entrepot_id < 0) {
374 if (!($objectsrc->lines[$i]->fk_product > 0)) {
378 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
GETPOST($qty,
'int'), $array_options[$i]);
387 if ($batch_line[$i][
'qty'] > 0) {
388 $ret = $object->addline_batch($batch_line[$i], $array_options[$i]);
397 $ret = $extrafields->setOptionalsFromPost(
null, $object);
403 $ret = $object->create($user);
410 $labelfieldmissing = $langs->transnoentitiesnoconv(
"QtyToShip");
412 $labelfieldmissing .=
'/'.$langs->transnoentitiesnoconv(
"Warehouse");
414 setEventMessages($langs->trans(
"ErrorFieldRequired", $labelfieldmissing),
null,
'errors');
420 header(
"Location: card.php?id=".$object->id);
424 $_GET[
"commande_id"] =
GETPOST(
'commande_id',
'int');
427 } elseif ($action ==
'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) {
431 $result = $object->create_delivery($user);
435 header(
"Location: ".DOL_URL_ROOT.
'/delivery/card.php?action=create_delivery&id='.$result);
442 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' &&
443 ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer))
444 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate)))
446 $object->fetch_thirdparty();
448 $result = $object->valid($user);
454 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
455 $outputlangs = $langs;
458 $newlang =
GETPOST(
'lang_id',
'aZ09');
461 $newlang = $object->thirdparty->default_lang;
463 if (!empty($newlang)) {
465 $outputlangs->setDefaultLang($newlang);
467 $model = $object->model_pdf;
468 $ret = $object->fetch($id);
470 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
476 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && $user->rights->expedition->supprimer) {
477 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
478 $result = $object->cancel(0, $also_update_stock);
480 $result = $object->setStatut(-1);
484 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->expedition->supprimer) {
485 $also_update_stock = (
GETPOST(
'alsoUpdateStock',
'alpha') ? 1 : 0);
486 $result = $object->delete(0, $also_update_stock);
488 header(
"Location: ".DOL_URL_ROOT.
'/expedition/index.php');
502 } elseif ($action ==
'setdate_livraison' && !empty($user->rights->expedition->creer)) {
503 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
506 $result = $object->setDeliveryDate($user, $datedelivery);
510 } elseif (($action ==
'settracking_number'
511 || $action ==
'settracking_url'
512 || $action ==
'settrueWeight'
513 || $action ==
'settrueWidth'
514 || $action ==
'settrueHeight'
515 || $action ==
'settrueDepth'
516 || $action ==
'setshipping_method_id')
517 && $user->rights->expedition->creer
522 if ($action ==
'settracking_number') {
523 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
525 if ($action ==
'settracking_url') {
526 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'int'));
528 if ($action ==
'settrueWeight') {
529 $object->trueWeight = trim(
GETPOST(
'trueWeight',
'int'));
530 $object->weight_units =
GETPOST(
'weight_units',
'int');
532 if ($action ==
'settrueWidth') {
533 $object->trueWidth = trim(
GETPOST(
'trueWidth',
'int'));
535 if ($action ==
'settrueHeight') {
536 $object->trueHeight = trim(
GETPOST(
'trueHeight',
'int'));
537 $object->size_units =
GETPOST(
'size_units',
'int');
539 if ($action ==
'settrueDepth') {
540 $object->trueDepth = trim(
GETPOST(
'trueDepth',
'int'));
542 if ($action ==
'setshipping_method_id') {
543 $object->shipping_method_id = trim(
GETPOST(
'shipping_method_id',
'int'));
547 if ($object->update($user) >= 0) {
548 header(
"Location: card.php?id=".$object->id);
555 } elseif ($action ==
'classifybilled') {
557 $result = $object->setBilled();
559 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
563 } elseif ($action ==
'classifyclosed') {
565 $result = $object->setClosed();
567 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
571 } elseif ($action ==
'deleteline' && !empty($line_id)) {
574 $lines = $object->lines;
576 $line->fk_expedition = $object->id;
578 $num_prod = count($lines);
579 for ($i = 0; $i < $num_prod; $i++) {
580 if ($lines[$i]->
id == $line_id) {
581 if (count($lines[$i]->details_entrepot) > 1) {
583 foreach ($lines[$i]->details_entrepot as $details_entrepot) {
584 $line->id = $details_entrepot->line_id;
585 if (!$error && $line->delete($user) < 0) {
591 $line->id = $line_id;
592 if (!$error && $line->delete($user) < 0) {
597 unset($_POST[
"lineid"]);
601 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
606 } elseif ($action ==
'updateline' && $user->rights->expedition->creer &&
GETPOST(
'save')) {
613 $lines = $object->lines;
614 $num_prod = count($lines);
615 for ($i = 0; $i < $num_prod; $i++) {
616 if ($lines[$i]->
id == $line_id) {
618 $line->fk_expedition = $object->id;
621 $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
623 if (is_array($extrafields->attributes[$object->table_element_line][
'label'])) {
624 foreach ($extrafields->attributes[$object->table_element_line][
'label'] as $key => $value) {
625 unset($_POST[
"options_".$key]);
628 $line->fk_product = $lines[$i]->fk_product;
629 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
631 foreach ($lines[$i]->detail_batch as $detail_batch) {
633 $batch =
"batchl".$detail_batch->fk_expeditiondet.
"_".$detail_batch->fk_origin_stock;
634 $qty =
"qtyl".$detail_batch->fk_expeditiondet.
'_'.$detail_batch->id;
635 $batch_id =
GETPOST($batch,
'int');
636 $batch_qty =
GETPOST($qty,
'int');
637 if (!empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->qty)) {
638 if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) {
639 if ($lines[$i]->entrepot_id != 0) {
641 $line->entrepot_id = $lotStock->warehouseid;
645 if (empty($line->detail_batch)) {
646 $line->detail_batch =
new stdClass();
649 $line->detail_batch->fk_origin_stock = $batch_id;
650 $line->detail_batch->batch = $lotStock->batch;
651 $line->detail_batch->id = $detail_batch->id;
652 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
653 $line->detail_batch->qty = $batch_qty;
654 if ($line->update($user) < 0) {
663 unset($_POST[$batch]);
668 $batch =
"batchl".$line_id.
"_0";
669 $qty =
"qtyl".$line_id.
"_0";
670 $batch_id =
GETPOST($batch,
'int');
671 $batch_qty =
GETPOST($qty,
'int');
673 if ($batch_qty > 0 && !empty($batch_id)) {
674 if ($lotStock->fetch($batch_id) > 0) {
676 if ($lines[$i]->entrepot_id > 0) {
678 if ($lines[$i]->entrepot_id == $lotStock->warehouseid) {
679 $lineIdToAddLot = $line_id;
681 } elseif (count($lines[$i]->details_entrepot) > 1) {
683 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
684 if ($detail_entrepot->entrepot_id == $lotStock->warehouseid) {
685 $lineIdToAddLot = $detail_entrepot->line_id;
689 if ($lineIdToAddLot) {
691 if ($line->fetch($lineIdToAddLot) > 0) {
692 $line->detail_batch->fk_origin_stock = $batch_id;
693 $line->detail_batch->batch = $lotStock->batch;
694 $line->detail_batch->entrepot_id = $lotStock->warehouseid;
695 $line->detail_batch->qty = $batch_qty;
696 if ($line->update($user) < 0) {
706 $line->origin_line_id = $lines[$i]->origin_line_id;
707 $line->entrepot_id = $lotStock->warehouseid;
709 $line->detail_batch[0]->fk_origin_stock = $batch_id;
710 $line->detail_batch[0]->batch = $lotStock->batch;
711 $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
712 $line->detail_batch[0]->qty = $batch_qty;
713 if ($object->create_line_batch($line, $line->array_options) < 0) {
724 if ($lines[$i]->fk_product > 0) {
726 if ($lines[$i]->entrepot_id > 0) {
728 $stockLocation =
"entl".$line_id;
729 $qty =
"qtyl".$line_id;
730 $line->id = $line_id;
731 $line->entrepot_id =
GETPOST($stockLocation,
'int');
732 $line->qty =
GETPOST($qty,
'int');
733 if ($line->update($user) < 0) {
737 unset($_POST[$stockLocation]);
739 } elseif (count($lines[$i]->details_entrepot) > 1) {
741 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
743 $stockLocation =
"entl".$detail_entrepot->line_id;
744 $qty =
"qtyl".$detail_entrepot->line_id;
745 $warehouse =
GETPOST($stockLocation,
'int');
746 if (!empty($warehouse)) {
747 $line->id = $detail_entrepot->line_id;
748 $line->entrepot_id = $warehouse;
749 $line->qty =
GETPOST($qty,
'int');
750 if ($line->update($user) < 0) {
755 unset($_POST[$stockLocation]);
759 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
760 $qty =
"qtyl".$line_id;
761 $line->id = $line_id;
762 $line->qty =
GETPOST($qty,
'int');
763 $line->entrepot_id = 0;
764 if ($line->update($user) < 0) {
772 $qty =
"qtyl".$line_id;
773 $line->id = $line_id;
774 $line->qty =
GETPOST($qty,
'int');
775 $line->entrepot_id = 0;
776 if ($line->update($user) < 0) {
786 unset($_POST[
"lineid"]);
789 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
791 $outputlangs = $langs;
794 $newlang =
GETPOST(
'lang_id',
'aZ09');
797 $newlang = $object->thirdparty->default_lang;
799 if (!empty($newlang)) {
801 $outputlangs->setDefaultLang($newlang);
804 $ret = $object->fetch($object->id);
805 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
808 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
811 } elseif ($action ==
'updateline' && $user->rights->expedition->creer &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
812 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
816 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
822 $triggersendname =
'SHIPPING_SENTBYMAIL';
824 $mode =
'emailfromshipment';
825 $trackid =
'shi'.$object->id;
826 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
834 $title = $langs->trans(
"Shipment");
835 if ($action ==
'create2') {
836 $title = $langs->trans(
"CreateShipment");
838 $help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
842 if (empty($action)) {
853 $product_static =
new Product($db);
855 $warehousestatic =
new Entrepot($db);
857 if ($action ==
'create2') {
860 print
'<br>'.$langs->trans(
"ShipmentCreationIsDoneFromOrder");
861 $action =
''; $id =
''; $ref =
'';
865 if ($action ==
'create') {
875 $classname = ucfirst($origin);
877 $object =
new $classname($db);
878 if ($object->fetch($origin_id)) {
880 $soc->fetch($object->socid);
882 $author =
new User($db);
883 $author->fetch($object->user_author_id);
889 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
890 print
'<input type="hidden" name="token" value="'.newToken().
'">';
891 print
'<input type="hidden" name="action" value="add">';
892 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
893 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
894 if (
GETPOST(
'entrepot_id',
'int')) {
895 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
900 print
'<table class="border centpercent">';
903 print
'<tr><td class="titlefieldcreate fieldrequired">';
904 if ($origin ==
'commande' &&
isModEnabled(
'commande')) {
905 print $langs->trans(
"RefOrder");
908 print $langs->trans(
"RefProposal");
910 print
'</td><td colspan="3">';
911 print $object->getNomUrl(1);
917 if ($origin ==
'commande') {
918 print $langs->trans(
'RefCustomerOrder');
919 } elseif ($origin ==
'propal') {
920 print $langs->trans(
'RefCustomerOrder');
922 print $langs->trans(
'RefCustomer');
924 print
'</td><td colspan="3">';
925 print
'<input type="text" name="ref_customer" value="'.$object->ref_client.
'" />';
930 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
931 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
936 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
937 if (empty($projectid) && !empty($object->fk_project)) {
938 $projectid = $object->fk_project;
940 if ($origin ==
'project') {
941 $projectid = ($originid ? $originid : 0);
944 $langs->load(
"projects");
946 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
948 $numprojet = $formproject->select_projects($soc->id, $projectid,
'projectid', 0);
949 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>';
955 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
956 print
'<td colspan="3">';
957 $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
958 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
963 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
964 print
'<td colspan="3">';
965 $doleditor =
new DolEditor(
'note_public', $object->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
966 print $doleditor->Create(1);
970 if ($object->note_private && !$user->socid) {
971 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
972 print
'<td colspan="3">';
973 $doleditor =
new DolEditor(
'note_private', $object->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
974 print $doleditor->Create(1);
980 print $langs->trans(
"Weight");
981 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
982 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
983 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
984 print
$form->textwithpicto($text, $htmltext);
988 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
989 print
' </td><td colspan="3"><input name="sizeW" size="4" value="'.GETPOST(
'sizeW',
'int').
'">';
990 print
' x <input name="sizeH" size="4" value="'.GETPOST(
'sizeH',
'int').
'">';
991 print
' x <input name="sizeS" size="4" value="'.GETPOST(
'sizeS',
'int').
'">';
993 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
994 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
995 print
$form->textwithpicto($text, $htmltext);
999 print
"<tr><td>".$langs->trans(
"DeliveryMethod").
"</td>";
1000 print
'<td colspan="3">';
1001 $expe->fetch_delivery_methods();
1002 print
$form->selectarray(
"shipping_method_id", $expe->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
1004 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1006 print
"</td></tr>\n";
1009 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1010 print
'<td colspan="3">';
1011 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1012 print
"</td></tr>\n";
1015 $parameters = array(
'objectsrc' => isset($objectsrc) ? $objectsrc :
'',
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1016 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $expe, $action);
1017 print $hookmanager->resPrint;
1019 if (empty($reshook)) {
1021 if ($object->fetch_optionals() > 0) {
1022 $expe->array_options = array_merge($expe->array_options, $object->array_options);
1024 print $expe->showOptionals($extrafields,
'edit',
$parameters);
1031 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $object->label_incoterms, 1).
'</label></td>';
1032 print
'<td colspan="3" class="maxwidthonsmartphone">';
1033 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''));
1038 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
1040 if (count($list) > 1) {
1041 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1042 print
'<td colspan="3">';
1043 print
$form->selectarray(
'model', $list, $conf->global->EXPEDITION_ADDON_PDF);
1044 print
"</td></tr>\n";
1054 $numAsked = count($object->lines);
1056 print
'<script type="text/javascript">'.
"\n";
1057 print
'jQuery(document).ready(function() {'.
"\n";
1058 print
'jQuery("#autofill").click(function() {';
1060 while ($i < $numAsked) {
1061 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1063 print
'jQuery("#qtyl'.$i.
'_'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1067 print
'return false; });'.
"\n";
1068 print
'jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0);'.
"\n";
1069 print
'return false; });'.
"\n";
1071 print
'</script>'.
"\n";
1075 print
'<table class="noborder centpercent">';
1078 $object->loadExpeditions();
1081 $alreadyQtyBatchSetted = $alreadyQtySetted = array();
1084 print
'<tr class="liste_titre">';
1085 print
'<td>'.$langs->trans(
"Description").
'</td>';
1086 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1087 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
1088 print
'<td class="center">'.$langs->trans(
"QtyToShip");
1089 if (empty($conf->productbatch->enabled)) {
1090 print
'<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Autofill"),
'autofill',
'class="paddingrightonly"').
'</a>';
1095 print
'<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans(
"Reset"),
'eraser').
'</span>';
1098 if (empty($conf->productbatch->enabled)) {
1099 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1101 print
'<td class="left">'.$langs->trans(
"Warehouse").
' / '.$langs->trans(
"Batch").
' ('.$langs->trans(
"Stock").
')</td>';
1107 $warehouse_id =
GETPOST(
'entrepot_id',
'int');
1108 $warehousePicking = array();
1110 if ($warehouse_id > 0) {
1111 $warehousePicking[] = $warehouse_id;
1113 $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking);
1117 while ($indiceAsked < $numAsked) {
1120 $line = $object->lines[$indiceAsked];
1122 $parameters = array(
'i' => $indiceAsked,
'line' => $line,
'num' => $numAsked);
1123 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters, $object, $action);
1128 if (empty($reshook)) {
1130 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1133 if (!empty($line->date_start)) {
1136 if (!empty($line->date_end)) {
1140 print
'<!-- line for order line '.$line->id.
' -->'.
"\n";
1141 print
'<tr class="oddeven" id="row-'.$line->id.
'">'.
"\n";
1144 if ($line->fk_product > 0) {
1145 $res = $product->fetch($line->fk_product);
1149 $product->load_stock(
'warehouseopen');
1153 print
'<a name="'.$line->id.
'"></a>';
1156 $product_static->type = $line->fk_product_type;
1157 $product_static->id = $line->fk_product;
1158 $product_static->ref = $line->ref;
1159 $product_static->status = $line->product_tosell;
1160 $product_static->status_buy = $line->product_tobuy;
1161 $product_static->status_batch = $line->product_tobatch;
1163 $showdescinproductdesc =
getDolGlobalString(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
1165 $text = $product_static->getNomUrl(1);
1166 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1169 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1172 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1175 if ($showdescinproductdesc) {
1176 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1183 $text =
img_object($langs->trans(
'Service'),
'service');
1185 $text =
img_object($langs->trans(
'Product'),
'product');
1188 if (!empty($line->label)) {
1189 $text .=
' <strong>'.$line->label.
'</strong>';
1190 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1192 print $text.
' '.nl2br($line->desc);
1196 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1202 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1207 print
'<td class="center">'.$line->qty;
1208 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1209 print
''.$unit_order.
'</td>';
1210 $qtyProdCom = $line->qty;
1213 print
'<td class="center">';
1214 $quantityDelivered = isset($object->expeditions[$line->id]) ? $object->expeditions[$line->id] :
'';
1215 print $quantityDelivered;
1216 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1217 print
''.$unit_order.
'</td>';
1220 $quantityAsked = $line->qty;
1221 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1222 $quantityToBeDelivered = 0;
1224 if (is_numeric($quantityDelivered)) {
1225 $quantityToBeDelivered = $quantityAsked - $quantityDelivered;
1227 $quantityToBeDelivered = $quantityAsked;
1231 $warehouseObject =
null;
1232 if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !
isModEnabled(
'stock')) {
1233 print
'<!-- Case warehouse already known or product not a predefined product -->';
1235 $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0);
1236 $deliverableQty = min($quantityToBeDelivered, $stock);
1237 if ($deliverableQty < 0) {
1238 $deliverableQty = 0;
1240 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1242 print
'<td class="center">';
1243 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1244 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1245 $deliverableQty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1247 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1248 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.
'">';
1250 if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
1251 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1252 print
'<input name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1255 print $langs->trans(
"NA");
1261 print
'<td class="left">';
1262 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1264 $ent =
"entl".$indiceAsked;
1265 $idl =
"idl".$indiceAsked;
1266 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1267 if ($line->fk_product > 0) {
1268 print
'<!-- Show warehouse selection -->';
1271 if (empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) {
1274 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 1, 0, $line->fk_product,
'', 1, 0, array(),
'minwidth200',
'', 1, $stockMin,
'stock DESC, e.ref');
1276 if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) {
1278 if ($stock < $quantityToBeDelivered) {
1279 print
' '.img_warning($langs->trans(
"StockTooLow"));
1284 print $langs->trans(
"Service");
1292 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
1293 $product->get_sousproduits_arbo();
1294 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1295 if (count($prods_arbo) > 0) {
1296 foreach ($prods_arbo as $key => $value) {
1299 if ($value[
'stock'] < $value[
'stock_alert']) {
1302 print
"<tr class=\"oddeven\"><td> ->
1303 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1304 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1305 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td></tr>";
1311 print
'<td></td><td></td></tr>';
1312 print
'<!-- Case product need lot -->';
1314 $staticwarehouse =
new Entrepot($db);
1315 if ($warehouse_id > 0) {
1316 $staticwarehouse->fetch($warehouse_id);
1322 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1323 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1327 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1328 if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) {
1329 foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) {
1331 $batchStock = + $dbatch->qty;
1332 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1333 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] :
'').
'>';
1334 print
'<td colspan="3" ></td><td class="center">';
1335 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1338 print
'<!-- Show details of lot -->';
1339 print
'<td class="left">';
1341 print $staticwarehouse->getNomUrl(0).
' / ';
1343 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1346 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
1347 if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) {
1348 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1350 if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) {
1351 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1353 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
1357 $quantityToBeDelivered -= $deliverableQty;
1358 if ($quantityToBeDelivered < 0) {
1359 $quantityToBeDelivered = 0;
1365 print
'<!-- Case there is no details of lot at all -->';
1366 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1367 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0" disabled="disabled"> ';
1370 print
'<td class="left">';
1371 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $staticwarehouse->label);
1377 if (empty($conf->productbatch->enabled) || !$product->hasbatch()) {
1378 print
'<!-- Case warehouse not already known and product does not need lot -->';
1379 print
'<td></td><td></td></tr>'.
"\n";
1381 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1386 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1387 if ($stock_warehouse->real > 0) {
1391 $tmpwarehouseObject =
new Entrepot($db);
1392 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1393 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1398 $tmpwarehouseObject->fetch($warehouse_id);
1399 if ($stock_warehouse->real > 0) {
1400 $stock = + $stock_warehouse->real;
1401 $deliverableQty = min($quantityToBeDelivered, $stock);
1402 $deliverableQty = max(0, $deliverableQty);
1404 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] :
'').
'>';
1405 print
'<td colspan="3" ></td><td class="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.
') -->';
1406 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1407 if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1408 $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]);
1410 if (!isset($alreadyQtySetted[$line->fk_product])) {
1411 $alreadyQtySetted[$line->fk_product] = array();
1414 $deliverableQty = min($quantityToBeDelivered, $stock);
1417 if ($deliverableQty < 0) $deliverableQty = 0;
1420 if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) {
1421 $tooltip =
' class="classfortooltip" title="'.$langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)].
'" ';
1424 $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)];
1426 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1428 $deliverableQty =
GETPOST($inputName,
'int');
1431 print
'<input '.$tooltip.
' class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1432 print
'<input name="ent1'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$warehouse_id.
'">';
1434 if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
1435 print
'<input name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'" type="hidden" value="0">';
1438 print $langs->trans(
"NA");
1444 print
'<td class="left">';
1445 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1446 print $tmpwarehouseObject->getNomUrl(0).
' ';
1448 print
'<!-- Show details of stock -->';
1449 print
'('.$stock.
')';
1451 print $langs->trans(
"Service");
1455 $quantityToBeDelivered -= $deliverableQty;
1456 if ($quantityToBeDelivered < 0) {
1457 $quantityToBeDelivered = 0;
1464 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
1465 $product->get_sousproduits_arbo();
1466 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
1467 if (count($prods_arbo) > 0) {
1468 foreach ($prods_arbo as $key => $value) {
1471 if ($value[
'stock'] < $value[
'stock_alert']) {
1474 print
'<tr class"oddeven"><td>';
1475 print
" ->
1476 <a href=\"".DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
"\">".$value[
'fullpath'].
"
1477 </a> (".$value[
'nb'].
")</td><td class=\"center\"> ".$value[
'nb_total'].
"</td><td> </td><td> </td>
1478 <td class=\"center\">".$value[
'stock'].
" ".$img.
"</td>";
1484 print
'<!-- Case warehouse not already known and product need lot -->';
1485 print
'<td></td><td></td></tr>';
1488 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1490 $tmpwarehouseObject =
new Entrepot($db);
1495 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1496 if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
1497 $nbofsuggested+=count($stock_warehouse->detail_batch);
1501 foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) {
1502 if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) {
1507 $tmpwarehouseObject->fetch($warehouse_id);
1508 if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
1509 foreach ($stock_warehouse->detail_batch as $dbatch) {
1510 $batchStock = + $dbatch->qty;
1511 if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1512 $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]);
1514 if (!isset($alreadyQtyBatchSetted[$line->fk_product])) {
1515 $alreadyQtyBatchSetted[$line->fk_product] = array();
1518 if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) {
1519 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array();
1522 $deliverableQty = min($quantityToBeDelivered, $batchStock);
1525 if ($deliverableQty < 0) $deliverableQty = 0;
1527 $inputName =
'qtyl'.$indiceAsked.
'_'.$subj;
1529 $deliverableQty =
GETPOST($inputName,
'int');
1532 $tooltipClass = $tooltipTitle =
'';
1533 if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) {
1534 $tooltipClass =
' classfortooltip';
1535 $tooltipTitle = $langs->trans(
'StockQuantitiesAlreadyAllocatedOnPreviousLines').
' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1537 $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
1539 print
'<!-- subj='.$subj.
'/'.$nbofsuggested.
' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] :
'').
'><td colspan="3"></td><td class="center">';
1540 print
'<input class="qtyl '.$tooltipClass.
'" title="'.$tooltipTitle.
'" name="'.$inputName.
'" id="'.$inputName.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1543 print
'<td class="left">';
1545 print $tmpwarehouseObject->getNomUrl(0).
' / ';
1547 print
'<!-- Show details of lot -->';
1548 print
'<input name="batchl'.$indiceAsked.
'_'.$subj.
'" type="hidden" value="'.$dbatch->id.
'">';
1551 print $langs->trans(
"Batch").
': ';
1552 $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
1554 print $productlotObject->getNomUrl(1);
1556 print
'TableLotIncompleteRunRepairWithParamStandardEqualConfirmed';
1558 if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) {
1559 print
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
1561 if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) {
1562 print
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
1564 print
' ('.$dbatch->qty.
')';
1565 $quantityToBeDelivered -= $deliverableQty;
1566 if ($quantityToBeDelivered < 0) {
1567 $quantityToBeDelivered = 0;
1577 $warehouse_selected_id =
GETPOST(
'entrepot_id',
'int');
1579 print
'<!-- line not shown yet, we show it -->';
1580 print
'<tr class="oddeven"><td colspan="3"></td><td class="center">';
1582 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1584 if (
isModEnabled(
'productbatch') && $product->hasbatch()) {
1585 $disabled =
'disabled="disabled"';
1587 if ($warehouse_selected_id <= 0) {
1588 $disabled =
'disabled="disabled"';
1590 print
'<input class="qtyl" name="qtyl'.$indiceAsked.
'_'.$subj.
'" id="qtyl'.$indiceAsked.
'_'.$subj.
'" type="text" size="4" value="0"'.($disabled ?
' '.$disabled :
'').
'> ';
1592 print $langs->trans(
"NA");
1596 print
'<td class="left">';
1597 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1598 if ($warehouse_selected_id > 0) {
1599 $warehouseObject =
new Entrepot($db);
1600 $warehouseObject->fetch($warehouse_selected_id);
1601 print
img_warning().
' '.$langs->trans(
"NoProductToShipFoundIntoStock", $warehouseObject->label);
1603 if ($line->fk_product) {
1604 print
img_warning().
' '.$langs->trans(
"StockTooLow");
1610 print $langs->trans(
"Service");
1619 if (!empty($extrafields)) {
1625 $srcLine->id = $line->id;
1626 $srcLine->fetch_optionals();
1628 $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
1630 print $expLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="drag drop oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1641 print
$form->buttonsSaveCancel(
"Create");
1650 } elseif ($object->id > 0) {
1656 $lines = $object->lines;
1658 $num_prod = count($lines);
1660 if (!empty($object->origin) && $object->origin_id > 0) {
1661 $typeobject = $object->origin;
1662 $origin = $object->origin;
1663 $origin_id = $object->origin_id;
1664 $object->fetch_origin();
1668 $soc->fetch($object->socid);
1670 $res = $object->fetch_optionals();
1673 print
dol_get_fiche_head($head,
'shipping', $langs->trans(
"Shipment"), -1, $object->picto);
1678 if ($action ==
'delete') {
1679 $formquestion = array();
1681 $formquestion = array(
1683 'label' => $langs->trans(
'ShipmentIncrementStockOnDelete'),
1684 'name' =>
'alsoUpdateStock',
1685 'type' =>
'checkbox',
1691 $_SERVER[
'PHP_SELF'].
'?id='.$object->id,
1692 $langs->trans(
'DeleteSending'),
1693 $langs->trans(
"ConfirmDeleteSending", $object->ref),
1702 if ($action ==
'valid') {
1703 $objectref = substr($object->ref, 1, 4);
1704 if ($objectref ==
'PROV') {
1705 $numref = $object->getNextNumRef($soc);
1707 $numref = $object->ref;
1710 $text = $langs->trans(
"ConfirmValidateSending", $numref);
1713 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1714 $notify =
new Notify($db);
1716 $text .= $notify->confirmMessage(
'SHIPPING_VALIDATE', $object->socid, $object);
1719 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateSending'), $text,
'confirm_valid',
'', 0, 1);
1722 if ($action ==
'cancel') {
1723 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelSending'), $langs->trans(
"ConfirmCancelSending", $object->ref),
'confirm_cancel',
'', 0, 1);
1728 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1729 if (empty($reshook)) {
1731 } elseif ($reshook > 0) {
1740 $tmparray = $object->getTotalWeightVolume();
1741 $totalWeight = $tmparray[
'weight'];
1742 $totalVolume = $tmparray[
'volume'];
1745 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1747 $objectsrc->fetch($object->$typeobject->id);
1749 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1750 $objectsrc =
new Propal($db);
1751 $objectsrc->fetch($object->$typeobject->id);
1755 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1756 $morehtmlref =
'<div class="refidno">';
1758 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', 0, 1);
1759 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer,
'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ?
':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE :
''),
'',
null,
null,
'', 1);
1761 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1764 $langs->load(
"projects");
1765 $morehtmlref .=
'<br>';
1767 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1768 if ($action !=
'classify') {
1769 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1771 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, ($action ==
'classify' ? 1 : 0), 0, 1,
'');
1773 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1775 $proj->fetch($objectsrc->fk_project);
1776 $morehtmlref .= $proj->getNomUrl(1);
1778 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1783 $morehtmlref .=
'</div>';
1786 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1789 print
'<div class="fichecenter">';
1790 print
'<div class="fichehalfleft">';
1791 print
'<div class="underbanner clearboth"></div>';
1793 print
'<table class="border tableforfield" width="100%">';
1796 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1798 print $langs->trans(
"RefOrder").
'</td>';
1799 print
'<td colspan="3">';
1800 print $objectsrc->getNomUrl(1,
'commande');
1804 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1806 print $langs->trans(
"RefProposal").
'</td>';
1807 print
'<td colspan="3">';
1808 print $objectsrc->getNomUrl(1,
'expedition');
1814 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1815 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour").
"</td>\n";
1819 print
'<tr><td height="10">';
1820 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1821 print $langs->trans(
'DateDeliveryPlanned');
1824 if ($action !=
'editdate_livraison') {
1825 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>';
1827 print
'</tr></table>';
1828 print
'</td><td colspan="2">';
1829 if ($action ==
'editdate_livraison') {
1830 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1831 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1832 print
'<input type="hidden" name="action" value="setdate_livraison">';
1833 print
$form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1834 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1837 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1844 print
$form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->expedition->creer);
1845 print
'</td><td colspan="3">';
1847 if ($action ==
'edittrueWeight') {
1848 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1849 print
'<input name="action" value="settrueWeight" type="hidden">';
1850 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1851 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1852 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text" class="width50">';
1853 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2);
1854 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1855 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1858 print $object->trueWeight;
1859 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1863 if ($totalWeight > 0) {
1864 if (!empty($object->trueWeight)) {
1865 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1867 print
showDimensionInBestUnit($totalWeight, 0,
"weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT :
'no');
1868 if (!empty($object->trueWeight)) {
1875 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1876 print
$form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
1877 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1881 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1882 if ($action ==
'edittrueHeight') {
1883 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1884 print
'<input name="action" value="settrueHeight" type="hidden">';
1885 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1886 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1887 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text" class="width50">';
1888 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1889 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1890 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1893 print $object->trueHeight;
1894 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1900 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1901 print
$form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
1902 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1907 print $langs->trans(
"Volume");
1909 print
'<td colspan="3">';
1910 $calculatedVolume = 0;
1912 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1913 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1914 $volumeUnit = $object->size_units * 3;
1917 if ($calculatedVolume > 0) {
1918 if ($volumeUnit < 50) {
1919 print
showDimensionInBestUnit($calculatedVolume, $volumeUnit,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
1924 if ($totalVolume > 0) {
1925 if ($calculatedVolume) {
1926 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1928 print
showDimensionInBestUnit($totalVolume, 0,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
1930 if ($calculatedVolume) {
1939 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1944 print
'<div class="fichehalfright">';
1945 print
'<div class="underbanner clearboth"></div>';
1947 print
'<table class="border centpercent tableforfield">';
1950 print
'<tr><td height="10">';
1951 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1952 print $langs->trans(
'SendingMethod');
1955 if ($action !=
'editshipping_method_id') {
1956 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>';
1958 print
'</tr></table>';
1959 print
'</td><td colspan="2">';
1960 if ($action ==
'editshipping_method_id') {
1961 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1962 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1963 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1964 $object->fetch_delivery_methods();
1965 print
$form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1967 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1969 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1972 if ($object->shipping_method_id > 0) {
1974 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1975 print $langs->trans(
"SendingMethod".strtoupper($code));
1982 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).
'</td><td colspan="3">';
1983 print
$form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer,
'safehtmlstring', $object->tracking_number);
1989 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1990 print $langs->trans(
'IncotermLabel');
1991 print
'<td><td class="right">';
1992 if ($user->rights->expedition->creer) {
1993 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
1997 print
'</td></tr></table>';
1999 print
'<td colspan="3">';
2000 if ($action !=
'editincoterm') {
2001 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
2003 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
2009 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
2010 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
2011 print $hookmanager->resPrint;
2018 print
'<div class="clearboth"></div>';
2023 if ($action ==
'editline') {
2024 print
' <form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
2025 <input type="hidden" name="token" value="' .
newToken().
'">
2026 <input type="hidden" name="action" value="updateline">
2027 <input type="hidden" name="mode" value="">
2028 <input type="hidden" name="id" value="' . $object->id.
'">
2033 print
'<div class="div-table-responsive-no-min">';
2034 print
'<table class="noborder" width="100%" id="tablelines" >';
2036 print
'<tr class="liste_titre">';
2038 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
2039 print
'<td width="5" class="center linecolnum"> </td>';
2042 print
'<td class="linecoldescription" >'.$langs->trans(
"Products").
'</td>';
2044 print
'<td class="center linecolqty">'.$langs->trans(
"QtyOrdered").
'</td>';
2045 if ($origin && $origin_id > 0) {
2046 print
'<td class="center linecolqtyinothershipments">'.$langs->trans(
"QtyInOtherShipments").
'</td>';
2048 if ($action ==
'editline') {
2053 if (empty($conf->productbatch->enabled)) {
2056 print
'<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.
'">';
2057 if ($object->statut <= 1) {
2058 print $langs->trans(
"QtyToShip").
' - ';
2060 print $langs->trans(
"QtyShipped").
' - ';
2063 print $langs->trans(
"WarehouseSource").
' - ';
2066 print $langs->trans(
"Batch");
2070 if ($object->statut <= 1) {
2071 print
'<td class="center linecolqtytoship">'.$langs->trans(
"QtyToShip").
'</td>';
2073 print
'<td class="center linecolqtyshipped">'.$langs->trans(
"QtyShipped").
'</td>';
2076 print
'<td class="left linecolwarehousesource">'.$langs->trans(
"WarehouseSource").
'</td>';
2080 print
'<td class="left linecolbatch">'.$langs->trans(
"Batch").
'</td>';
2083 print
'<td class="center linecolweight">'.$langs->trans(
"CalculatedWeight").
'</td>';
2084 print
'<td class="center linecolvolume">'.$langs->trans(
"CalculatedVolume").
'</td>';
2086 if ($object->statut == 0) {
2087 print
'<td class="linecoledit"></td>';
2088 print
'<td class="linecoldelete" width="10"></td>';
2093 $outputlangs = $langs;
2095 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
2096 $object->fetch_thirdparty();
2098 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
2099 $newlang =
GETPOST(
'lang_id',
'aZ09');
2101 if (empty($newlang)) {
2102 $newlang = $object->thirdparty->default_lang;
2104 if (!empty($newlang)) {
2105 $outputlangs =
new Translate(
"", $conf);
2106 $outputlangs->setDefaultLang($newlang);
2111 $alreadysent = array();
2112 if ($origin && $origin_id > 0) {
2113 $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";
2114 $sql .=
", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot";
2115 $sql .=
", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
2117 $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';
2118 $sql .=
', p.description as product_desc';
2119 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
2120 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
2121 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
2123 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2124 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
2125 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
2126 $sql .=
" AND obj.rowid = ed.fk_origin_line";
2127 $sql .=
" AND ed.fk_expedition = e.rowid";
2129 $sql .=
" ORDER BY obj.fk_product";
2131 dol_syslog(
"expedition/card.php get list of shipment lines", LOG_DEBUG);
2132 $resql = $db->query($sql);
2134 $num = $db->num_rows(
$resql);
2138 $obj = $db->fetch_object(
$resql);
2141 $alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
2142 'shipment_ref'=>$obj->shipment_ref,
'shipment_id'=>$obj->shipment_id,
'warehouse'=>$obj->fk_entrepot,
'qty_shipped'=>$obj->qty_shipped,
2143 'product_tosell'=>$obj->product_tosell,
'product_tobuy'=>$obj->product_tobuy,
'product_tobatch'=>$obj->product_tobatch,
2144 'date_valid'=>$db->jdate($obj->date_valid),
'date_delivery'=>$db->jdate($obj->date_delivery));
2155 for ($i = 0; $i < $num_prod; $i++) {
2156 $parameters = array(
'i' => $i,
'line' => $lines[$i],
'line_id' => $line_id,
'num' => $num_prod,
'alreadysent' => $alreadysent,
'editColspan' => !empty($editColspan) ? $editColspan : 0,
'outputlangs' => $outputlangs);
2157 $reshook = $hookmanager->executeHooks(
'printObjectLine',
$parameters, $object, $action);
2162 if (empty($reshook)) {
2163 print
'<!-- origin line id = '.$lines[$i]->origin_line_id.
' -->';
2164 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'" >';
2167 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
2168 print
'<td class="center linecolnum">'.($i + 1).
'</td>';
2172 if ($lines[$i]->fk_product > 0) {
2174 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
2176 $prod->fetch($lines[$i]->fk_product);
2177 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product_label;
2179 $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label);
2182 print
'<td class="linecoldescription">';
2185 $product_static->type = $lines[$i]->fk_product_type;
2186 $product_static->id = $lines[$i]->fk_product;
2187 $product_static->ref = $lines[$i]->ref;
2188 $product_static->status = $lines[$i]->product_tosell;
2189 $product_static->status_buy = $lines[$i]->product_tobuy;
2190 $product_static->status_batch = $lines[$i]->product_tobatch;
2192 $product_static->weight = $lines[$i]->weight;
2193 $product_static->weight_units = $lines[$i]->weight_units;
2194 $product_static->length = $lines[$i]->length;
2195 $product_static->length_units = $lines[$i]->length_units;
2196 $product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
2197 $product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
2198 $product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
2199 $product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
2200 $product_static->surface = $lines[$i]->surface;
2201 $product_static->surface_units = $lines[$i]->surface_units;
2202 $product_static->volume = $lines[$i]->volume;
2203 $product_static->volume_units = $lines[$i]->volume_units;
2205 $text = $product_static->getNomUrl(1);
2206 $text .=
' - '.$label;
2208 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
2209 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start :
'', !empty($lines[$i]->date_end) ? $lines[$i]->date_end :
'');
2215 print
'<td class="linecoldescription" >';
2217 $text =
img_object($langs->trans(
'Service'),
'service');
2219 $text =
img_object($langs->trans(
'Product'),
'product');
2222 if (!empty($lines[$i]->label)) {
2223 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2224 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
2234 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
2239 print
'<td class="center linecolqty">'.$lines[$i]->qty_asked.
' '.$unit_order.
'</td>';
2242 if ($origin && $origin_id > 0) {
2243 print
'<td class="linecolqtyinothershipments center nowrap">';
2244 foreach ($alreadysent as $key => $val) {
2245 if ($lines[$i]->fk_origin_line == $key) {
2247 foreach ($val as $shipmentline_id => $shipmentline_var) {
2248 if ($shipmentline_var[
'shipment_id'] == $lines[$i]->fk_expedition) {
2256 $shipment_static->fetch($shipmentline_var[
'shipment_id']);
2257 print $shipment_static->getNomUrl(1);
2258 print
' - '.$shipmentline_var[
'qty_shipped'];
2259 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($shipmentline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($shipmentline_var[
'date_valid'],
'dayhour'));
2260 if (
isModEnabled(
'stock') && $shipmentline_var[
'warehouse'] > 0) {
2261 $warehousestatic->fetch($shipmentline_var[
'warehouse']);
2262 $htmltext .=
'<br>'.$langs->trans(
"FromLocation").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
2264 print
' '.$form->textwithpicto(
'', $htmltext, 1);
2271 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2273 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding centpercent">';
2274 if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) {
2275 print
'<!-- case edit 1 -->';
2277 foreach ($lines[$i]->detail_batch as $detail_batch) {
2280 print
'<td><input class="qtyl" 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>';
2282 if ($lines[$i]->entrepot_id == 0) {
2284 $line->fetch($detail_batch->fk_expeditiondet);
2286 $entrepot_id = !empty($detail_batch->entrepot_id)?$detail_batch->entrepot_id:$lines[$i]->entrepot_id;
2287 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>';
2293 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'_0" id="qtyl'.$line_id.
'_0" type="text" size="4" value="0"></td>';
2295 print
'<td>'.$formproduct->selectLotStock(
'',
'batchl'.$line_id.
'_0',
'', 1, 0, $lines[$i]->fk_product).
'</td>';
2298 if ($lines[$i]->fk_product > 0) {
2299 if ($lines[$i]->entrepot_id > 0) {
2300 print
'<!-- case edit 2 -->';
2303 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2305 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2307 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2309 } elseif (count($lines[$i]->details_entrepot) > 1) {
2310 print
'<!-- case edit 3 -->';
2311 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2314 print
'<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.
'" id="qtyl'.$detail_entrepot->line_id.
'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.
'">'.$unit_order.
'</td>';
2316 print
'<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id,
'entl'.$detail_entrepot->line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2318 print
'<td> - '.$langs->trans(
"NA").
'</td>';
2322 print
'<!-- case edit 4 -->';
2323 print
'<tr><td colspan="3">'.$langs->trans(
"NotEnoughStock").
'</td></tr>';
2326 print
'<!-- case edit 5 -->';
2329 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'">'.$unit_order.
'</td>';
2336 } elseif (!
isModEnabled(
'stock') && empty($conf->productbatch->enabled)) {
2337 print
'<!-- case edit 6 -->';
2340 print
'<td><input class="qtyl" name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty_shipped.
'"></td>';
2348 print
'</table></td>';
2351 print
'<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.
' '.$unit_order.
'</td>';
2355 print
'<td class="linecolwarehousesource left">';
2356 if ($lines[$i]->entrepot_id > 0) {
2358 $entrepot->fetch($lines[$i]->entrepot_id);
2359 print $entrepot->getNomUrl(1);
2360 } elseif (count($lines[$i]->details_entrepot) > 1) {
2362 foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
2363 if ($detail_entrepot->entrepot_id > 0) {
2365 $entrepot->fetch($detail_entrepot->entrepot_id);
2366 $detail .= $langs->trans(
"DetailWarehouseFormat", $entrepot->libelle, $detail_entrepot->qty_shipped).
'<br>';
2369 print
$form->textwithtooltip(
img_picto(
'',
'object_stock').
' '.$langs->trans(
"DetailWarehouseNumber"), $detail);
2376 if (isset($lines[$i]->detail_batch)) {
2377 print
'<!-- Detail of lot -->';
2378 print
'<td class="linecolbatch">';
2379 if ($lines[$i]->product_tobatch) {
2381 foreach ($lines[$i]->detail_batch as $dbatch) {
2382 $detail .= $langs->trans(
"Batch").
': '.$dbatch->batch;
2383 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
2384 $detail .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($dbatch->sellby,
"day");
2386 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2387 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($dbatch->eatby,
"day");
2389 $detail .=
' - '.$langs->trans(
"Qty").
': '.$dbatch->qty;
2392 print
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2394 print $langs->trans(
"NA");
2398 print
'<td class="linecolbatch" ></td>';
2404 print
'<td class="center linecolweight">';
2406 print $lines[$i]->weight * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"weight", $lines[$i]->weight_units);
2413 print
'<td class="center linecolvolume">';
2415 print $lines[$i]->volume * $lines[$i]->qty_shipped.
' '.
measuringUnitString(0,
"volume", $lines[$i]->volume_units);
2424 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2425 print
'<td class="center" colspan="2" valign="middle">';
2426 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2427 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2431 print
'<td class="linecoledit center">';
2432 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2434 print
'<td class="linecoldelete" width="10">';
2435 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2439 if (!empty($rowExtrafieldsStart)) {
2440 print $rowExtrafieldsStart;
2441 print $rowExtrafieldsView;
2449 if (!empty($extrafields)) {
2451 if ($origin && $origin_id > 0) {
2462 $line->fetch_optionals();
2465 if ($action ==
'editline' && $line->id == $line_id) {
2466 print $lines[$i]->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2468 print $lines[$i]->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked :
'',
'', 0,
'card');
2484 $object->fetchObjectLinked($object->id, $object->element);
2491 if (($user->socid == 0) && ($action !=
'presend')) {
2492 print
'<div class="tabsAction">';
2495 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
2497 if (empty($reshook)) {
2499 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->creer))
2500 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->shipping_advance->validate))) {
2501 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
"PHP_SELF"].
'?action=valid&token='.
newToken().
'&id='.$object->id,
'');
2503 print
dolGetButtonAction($langs->trans(
'NotAllowed'), $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2510 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
2511 print
dolGetButtonAction(
'', $langs->trans(
'ClassifyUnbilled'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
2513 print
dolGetButtonAction(
'', $langs->trans(
'ReOpen'),
'default', $_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.$object->id,
'');
2518 if (empty($user->socid)) {
2519 if ($object->statut > 0) {
2520 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) {
2521 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?action=presend&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
2523 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false);
2530 if ($user->rights->facture->creer) {
2533 print
dolGetButtonAction(
'', $langs->trans(
'CreateBill'),
'default', DOL_URL_ROOT.
'/compta/facture/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid,
'');
2540 print
dolGetButtonAction(
'', $langs->trans(
'CreateDeliveryOrder'),
'default', $_SERVER[
"PHP_SELF"].
'?action=create_delivery&token='.
newToken().
'&id='.$object->id,
'');
2544 if ($user->rights->expedition->creer && $object->statut > 0 && !$object->billed) {
2545 $label =
"Close"; $paramaction =
'classifyclosed';
2547 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
2548 $label =
"ClassifyBilled";
2549 $paramaction =
'classifybilled';
2551 print
dolGetButtonAction(
'', $langs->trans($label),
'default', $_SERVER[
"PHP_SELF"].
'?action='. $paramaction .
'&token='.
newToken().
'&id='.$object->id,
'');
2557 if ($user->rights->expedition->supprimer) {
2558 print
dolGetButtonAction(
'', $langs->trans(
'Cancel'),
'danger', $_SERVER[
"PHP_SELF"].
'?action=cancel&token='.
newToken().
'&id='.$object->id.
'&mode=init#formmailbeforetitle',
'');
2563 if ($user->rights->expedition->supprimer) {
2564 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'');
2576 if ($action !=
'presend' && $action !=
'editline') {
2577 print
'<div class="fichecenter"><div class="fichehalfleft">';
2580 $filedir = $conf->expedition->dir_output.
"/sending/".$objectref;
2582 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2584 $genallowed = $user->rights->expedition->lire;
2585 $delallowed = $user->rights->expedition->creer;
2587 print $formfile->showdocuments(
'expedition', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2591 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'shipping'));
2592 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
2595 print
'</div><div class="fichehalfright">';
2598 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2600 $somethingshown =
$formactions->showactions($object,
'shipping', $socid, 1);
2602 print
'</div></div>';
2611 if (
GETPOST(
'modelselected')) {
2612 $action =
'presend';
2616 $modelmail =
'shipping_send';
2617 $defaulttopic = $langs->trans(
'SendShippingRef');
2618 $diroutput = $conf->expedition->dir_output.
'/sending';
2619 $trackid =
'shi'.$object->id;
2621 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif($action=='specimen') elseif($action=='setmodel') elseif($action=='del') elseif($action=='setdoc') $formactions
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage shipments.
const STATUS_DRAFT
Draft status.
const STATUS_CLOSED
Closed status.
const STATUS_VALIDATED
Validated status.
Classe to manage lines of shipment.
CRUD class for batch number management within shipment.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation models.
Class to manage 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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
print_date_range($date_start, $date_end, $format='', $outputlangs='')
Format output for start and end date.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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...
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.