40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.orderline.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
65 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
66 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
77$langs->loadLangs(array(
"receptions",
"companies",
"bills",
'orders',
'stocks',
'other',
'propal',
'sendings'));
80 $langs->load(
'incoterm');
83 $langs->load(
'productbatch');
86$origin =
GETPOST(
'origin',
'alpha');
89if (empty($origin_id) && !empty($origin)) {
92if (empty($origin_id) && !empty($origin)) {
95if (empty($origin_id) && !empty($origin)) {
102$action =
GETPOST(
'action',
'alpha');
107$confirm =
GETPOST(
'confirm',
'alpha');
108$cancel =
GETPOST(
'cancel',
'alpha');
109$backtopage =
GETPOST(
'backtopage',
'alpha');
110$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
116$cancel =
GETPOST(
'cancel',
'alpha');
119$backtopage =
GETPOST(
'backtopage',
'alpha');
130$extrafields->fetch_name_optionals_label(
$object->table_element);
131$extrafields->fetch_name_optionals_label(
$object->table_element_line);
132$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
135include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
147 if (empty($origin)) {
148 if (!empty(
$object->origin_type)) {
149 $origin =
$object->origin_type;
154 if (empty($origin_id)) {
155 $origin_id =
$object->origin_id;
160$hookmanager->initHooks(array(
'receptioncard',
'globalcard'));
167 $socid = $user->socid;
171if (
isModEnabled(
"reception") || $origin ==
'reception' || empty($origin)) {
175 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
176 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
177 } elseif (!$user->hasRight($origin,
'lire') && !$user->hasRight($origin,
'read')) {
183 $permissiontoread = $user->hasRight(
'reception',
'lire');
184 $permissiontoadd = $user->hasRight(
'reception',
'creer');
185 $permissiontoedit = $user->hasRight(
'reception',
'creer');
186 $permissiondellink = $user->hasRight(
'reception',
'creer');
187 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate')));
188 $permissiontodelete = $user->hasRight(
'reception',
'supprimer');
190 $permissiontoread = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
191 $permissiontoadd = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
192 $permissiondellink = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
193 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande',
'receptionner')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande_advance',
'check')));
194 $permissiontodelete = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
196$permissiontoeditextra = $permissiontoadd;
197if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
199 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
206$shipping_method_id =
null;
217$parameters = array();
218$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
223if (empty($reshook)) {
224 $backurlforlist = DOL_URL_ROOT.
'/reception/list.php';
226 if (empty($backtopage) || ($cancel && empty($id))) {
227 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
228 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
229 $backtopage = $backurlforlist;
231 $backtopage = DOL_URL_ROOT.
'/reception/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
237 if (!empty($backtopageforcancel)) {
238 header(
"Location: ".$backtopageforcancel);
240 } elseif (!empty($backtopage)) {
241 header(
"Location: ".$backtopage);
255 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
258 if ($action ==
'reopen' && $permissiontoadd) {
266 if ($action ==
'modif' && $permissiontoadd) {
267 $result =
$object->setDraft($user);
271 $outputlangs = $langs;
274 $newlang =
GETPOST(
'lang_id',
'aZ09');
277 $newlang =
$object->thirdparty->default_lang;
279 if (!empty($newlang)) {
281 $outputlangs->setDefaultLang($newlang);
285 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
293 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm') && $permissiontoadd) {
297 if ($action ==
'setref_supplier' && $permissiontoadd) {
302 $result =
$object->setValueFrom(
'ref_supplier',
GETPOST(
'ref_supplier',
'alpha'),
'',
null,
'text',
'', $user,
'RECEPTION_MODIFY');
305 $action =
'editref_supplier';
307 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
312 if ($action ==
'update_extras' && $permissiontoeditextra) {
315 $attribute_name =
GETPOST(
'attribute',
'aZ09');
318 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
324 $result =
$object->updateExtraField($attribute_name,
'RECEPTION_MODIFY');
332 $action =
'edit_extras';
337 if ($action ==
'add' && $permissiontoadd) {
343 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")),
null,
'errors');
352 $object->origin_type = $origin;
353 $object->origin_id = $origin_id;
363 $object->date_delivery = $date_delivery;
364 $object->date_reception = $date_reception;
370 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
375 $ret = $extrafields->setOptionalsFromPost(
null, $object);
388 if ($origin && $origin_id > 0) {
392 $object->origin_type = $origin;
393 $object->origin_id = $origin_id;
404 $object->date_delivery = $date_delivery;
405 $object->date_reception = $date_reception;
411 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
413 if (
$object->origin ==
"supplierorder") {
414 $object->origin =
'order_supplier';
415 $object->origin_type =
'order_supplier';
416 $classname =
'CommandeFournisseur';
418 $classname = ucfirst(
$object->origin);
420 $objectsrc =
new $classname($db);
421 $objectsrc->fetch(
$object->origin_id);
423 $object->socid = $objectsrc->socid;
424 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
427 $batch_line = array();
428 $stockLine = array();
429 $array_options = array();
434 foreach ($_POST as $key => $value) {
437 if (strpos($key,
'qtyasked') !==
false) {
443 for ($i = 1; $i <= $num; $i++) {
455 if (
GETPOST($qty,
'alpha') > 0) {
460 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, (
string) $i);
465 for ($i = 1; $i <= $num; $i++) {
469 foreach ($objectsrc->lines as $linesrc) {
470 if ($linesrc->id == $lineId) {
471 $lineToTest = $linesrc;
475 if (empty($lineToTest)) {
479 $comment =
"comment".$i;
484 $cost_price =
"cost_price".$i;
503 if ($entrepot_id < 0) {
510 $eatby =
GETPOST($eatby,
'alpha');
511 $sellby =
GETPOST($sellby,
'alpha');
512 $eatbydate = str_replace(
'/',
'-', $eatby);
513 $sellbydate = str_replace(
'/',
'-', $sellby);
516 $ret =
$object->addline($entrepot_id,
GETPOSTINT($idl), (
float)
price2num(
GETPOST($qty),
'MS'), $array_options[$i],
GETPOST($comment), strtotime($eatbydate), strtotime($sellbydate),
GETPOST($batch),
GETPOSTFLOAT($cost_price,
'MU'));
528 $ret = $extrafields->setOptionalsFromPost(
null, $object);
542 $outputlangs = $langs;
545 $newlang =
GETPOST(
'lang_id',
'aZ09');
548 $newlang =
$object->thirdparty->default_lang;
550 if (!empty($newlang)) {
552 $outputlangs->setDefaultLang($newlang);
557 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
565 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"QtyToReceive").
'/'.$langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
571 header(
"Location: card.php?id=" .
$object->id);
578 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && $permissiontovalidate) {
581 $result =
$object->valid($user);
584 $langs->load(
"errors");
589 $outputlangs = $langs;
592 $newlang =
GETPOST(
'lang_id',
'aZ09');
595 $newlang =
$object->thirdparty->default_lang;
597 if (!empty($newlang)) {
599 $outputlangs->setDefaultLang($newlang);
604 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
610 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
611 $result =
$object->delete($user);
613 header(
"Location: ".DOL_URL_ROOT.
'/reception/index.php');
625 } elseif ($action ==
'setdate_livraison' && $permissiontoadd) {
629 $result =
$object->setDeliveryDate($user, $datedelivery);
633 } elseif ($action ==
'setdate_reception' && $user->hasRight(
'reception',
'creer')) {
637 $result =
$object->setReceptionDate($user, $datereception);
641 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
643 $result =
$object->deleteLine($user, $lineid);
648 $outputlangs = $langs;
651 $newlang =
GETPOST(
'lang_id',
'aZ09');
654 $newlang =
$object->thirdparty->default_lang;
656 if (!empty($newlang)) {
658 $outputlangs->setDefaultLang($newlang);
662 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
665 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
670 } elseif (in_array($action, array(
'settracking_number',
'settracking_url',
'settrueWeight',
'settrueWidth',
'settrueHeight',
'settrueDepth',
'setshipping_method_id')) && $permissiontoadd) {
674 if ($action ==
'settracking_number') {
675 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
677 if ($action ==
'settracking_url') {
678 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
680 if ($action ==
'settrueWeight') {
684 if ($action ==
'settrueWidth') {
687 if ($action ==
'settrueHeight') {
691 if ($action ==
'settrueDepth') {
694 if ($action ==
'setshipping_method_id') {
698 if (
$object->update($user) >= 0) {
699 header(
"Location: card.php?id=" .
$object->id);
705 } elseif ($action ==
'builddoc' && $permissiontoread) {
714 $outputlangs = $langs;
717 $newlang =
GETPOST(
'lang_id',
'aZ09');
720 $newlang = $reception->thirdparty->default_lang;
722 if (!empty($newlang)) {
724 $outputlangs->setDefaultLang($newlang);
726 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
731 } elseif ($action ==
'remove_file' && $permissiontoadd) {
733 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
735 $upload_dir = $conf->reception->dir_output;
736 $file = $upload_dir.
'/'.
GETPOST(
'file');
743 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
744 $result =
$object->setBilled();
746 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
752 } elseif ($action ==
'classifyclosed' && $permissiontoread) {
753 $result =
$object->setClosed();
755 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
761 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoread) {
766 $num_prod = count($lines);
767 for ($i = 0; $i < $num_prod; $i++) {
768 if ($lines[$i]->
id == $line_id) {
770 $line->id = $line_id;
771 if (!$error && $line->delete($user) < 0) {
775 unset($_POST[
"lineid"]);
779 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
784 } elseif ($action ==
'updateline' &&
GETPOST(
'save') && $permissiontoadd) {
789 if (!
$object->fetch($id) > 0) {
794 $qty =
GETPOST(
'qty',
'alpha');
796 $element_type =
'reception';
802 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
803 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
805 if (is_array($extralabelsline)) {
807 foreach ($extralabelsline as $key => $value) {
808 unset($_POST[
"options_" . $key]);
817 $result =
$object->updatelinefree(
GETPOSTINT(
'lineid'), (
float) $qty, $element_type, $fk_product,
GETPOSTINT(
'units'), $rang, $description, 0, $array_options);
822 $outputlangs = $langs;
825 $newlang =
GETPOST(
'lang_id',
'aZ09');
828 $newlang =
$object->thirdparty->default_lang;
830 if (!empty($newlang)) {
832 $outputlangs->setDefaultLang($newlang);
833 $outputlangs->load(
'products');
837 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
839 unset($_POST[
'qty']);
840 unset($_POST[
'units']);
845 } elseif ($origin && $origin_id > 0) {
853 $num_prod = count($lines);
854 for ($i = 0; $i < $num_prod; $i++) {
855 if ($lines[$i]->
id == $line_id) {
857 $line->fetch($line_id);
859 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
860 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
862 $line->fk_product = $lines[$i]->fk_product;
864 if ($lines[$i]->fk_product > 0) {
866 $stockLocation =
"entl".$line_id;
867 $qty =
"qtyl".$line_id;
868 $comment =
"comment".$line_id;
870 $line->id = $line_id;
871 $line->fk_entrepot =
GETPOSTINT($stockLocation);
873 $line->comment =
GETPOST($comment,
'alpha');
876 $batch =
"batch".$line_id;
877 $dlc =
"dlc".$line_id;
878 $dluo =
"dluo".$line_id;
880 $eatby =
GETPOST($dluo,
'alpha');
881 $eatbydate = str_replace(
'/',
'-', $eatby);
883 $sellby =
GETPOST($dlc,
'alpha');
884 $sellbydate = str_replace(
'/',
'-', $sellby);
885 $line->batch =
GETPOST($batch,
'alpha');
886 $line->eatby = strtotime($eatbydate);
887 $line->sellby = strtotime($sellbydate);
890 if ($line->update($user) < 0) {
895 $qty =
"qtyl".$line_id;
896 $line->id = $line_id;
898 $line->fk_entrepot = 0;
899 if ($line->update($user) < 0) {
908 unset($_POST[
"lineid"]);
913 $outputlangs = $langs;
916 $newlang =
GETPOST(
'lang_id',
'aZ09');
919 $newlang =
$object->thirdparty->default_lang;
921 if (!empty($newlang)) {
923 $outputlangs->setDefaultLang($newlang);
927 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
933 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
936 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
940 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
941 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
943 } elseif ($action ==
'addline' && !$origin &&
getDolGlobalString(
'RECEPTION_STANDALONE') && $permissiontoadd) {
944 $langs->load(
'errors');
946 $line_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
950 $element_type =
'reception';
956 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'aZ09');
957 if ($prod_entry_mode ==
'free') {
962 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")),
null,
'errors');
970 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
971 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
973 if (is_array($extralabelsline)) {
975 foreach ($extralabelsline as $key => $value) {
976 unset($_POST[
"options_".$key]);
980 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
981 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
986 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
990 setEventMessages($langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
993 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($line_desc)) {
994 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
998 if (!$error &&
isModEnabled(
'variants') && $prod_entry_mode !=
'free') {
999 if ($combinations =
GETPOST(
'combinations',
'array')) {
1003 if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
1004 $idprod = $res->fk_product_child;
1005 $fk_product = $idprod;
1007 setEventMessages($langs->trans(
'ErrorProductCombinationNotFound'),
null,
'errors');
1013 if (!$error && ($qty >= 0) && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) {
1015 if (!empty($idprod) && $idprod > 0) {
1017 $prod->fetch($idprod);
1018 $desc = $prod->label;
1019 $description = $desc;
1022 $outputlangs = $langs;
1024 if (
GETPOST(
'lang_id',
'aZ09')) {
1025 $newlang =
GETPOST(
'lang_id',
'aZ09');
1027 if (empty($newlang)) {
1028 $newlang =
$object->thirdparty->default_lang;
1030 if (!empty($newlang)) {
1031 $outputlangs =
new Translate(
"", $conf);
1032 $outputlangs->setDefaultLang($newlang);
1035 $description = (!empty($prod->multilangs[$outputlangs->defaultlang][
"description"])) ? $prod->multilangs[$outputlangs->defaultlang][
"description"] : $prod->
description;
1037 $description = $prod->description;
1042 $description = $line_desc;
1046 if (!
getDolGlobalString(
'MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) {
1049 $outputlangs = $langs;
1051 if (
GETPOST(
'lang_id',
'alpha')) {
1052 $newlang =
GETPOST(
'lang_id',
'alpha');
1054 if (empty($newlang)) {
1055 $newlang =
$object->thirdparty->default_lang;
1057 if (!empty($newlang)) {
1058 $outputlangs =
new Translate(
"", $conf);
1059 $outputlangs->setDefaultLang($newlang);
1060 $outputlangs->load(
'products');
1062 if (!empty($prod->customcode)) {
1063 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
1065 if (!empty($prod->customcode) && !empty($prod->country_code)) {
1068 if (!empty($prod->country_code)) {
1069 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $outputlangs, 0);
1072 if (!empty($prod->customcode)) {
1073 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
1075 if (!empty($prod->customcode) && !empty($prod->country_code)) {
1078 if (!empty($prod->country_code)) {
1079 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $langs, 0);
1085 $type = $prod->type;
1086 $fk_unit = $prod->fk_unit;
1088 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1091 $fk_unit =
GETPOST(
'units',
'alpha');
1092 $description = $desc;
1093 $fk_elementdet =
'';
1099 $result =
$object->addlinefree((
float) $qty, $element_type, $idprod, $fk_unit, min($rank, count(
$object->lines) + 1), $description, $array_options);
1106 $outputlangs = $langs;
1107 $newlang =
GETPOST(
'lang_id',
'alpha');
1109 $newlang =
$object->thirdparty->default_lang;
1111 if (!empty($newlang)) {
1112 $outputlangs =
new Translate(
"", $conf);
1113 $outputlangs->setDefaultLang($newlang);
1115 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
1118 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
1125 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
1131 $triggersendname =
'RECEPTION_SENTBYMAIL';
1133 $mode =
'emailfromreception';
1134 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECEPTION_TO';
1135 $trackid =
'rec'.$object->id;
1136 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
1144$title =
$object->ref.
' - '.$langs->trans(
'Reception');
1145if ($action ==
'create') {
1146 $title = $langs->trans(
"NewReception");
1148llxHeader(
'', $title,
'Reception',
'', 0, 0,
'',
'',
'',
'mod-reception page-card');
1150$form =
new Form($db);
1157 $formproject =
null;
1160$product_static =
new Product($db);
1162$warehousestatic =
new Entrepot($db);
1164if ($action ==
'create' && $origin !=
'supplierorder' && !
getDolGlobalString(
'RECEPTION_STANDALONE')) {
1165 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
1167 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
1174if ($action ==
'create' && $permissiontoadd) {
1181 $res = $soc->fetch($socid);
1184 $note_private =
$object->getDefaultCreateValueFor(
'note_private');
1185 $note_public =
$object->getDefaultCreateValueFor(
'note_public');
1187 print
'<form name="crea_reception" action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST">';
1188 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
1189 print
'<input type="hidden" name="action" value="add">';
1190 print
'<input type="hidden" name="changecompany" value="0">';
1191 print
'<input type="hidden" name="originid" value="' .
$id .
'">';
1192 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
1196 print
'<table class="border centpercent">';
1201 print
'<td class="fieldrequired">' . $langs->trans(
'ThirdParty') .
'</td>';
1204 print $soc->getNomUrl(1);
1205 print
'<input type="hidden" name="socid" value="' . $soc->id .
'">';
1208 print
'<td class="valuefieldcreate">';
1209 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth175 maxwidth500 widthcentpercentminusxx');
1213 $(document).ready(function() {
1214 $("#socid").change(function() {
1215 console.log("We have changed the company - Reload page");
1216 var socid = $(this).val();
1218 $("input[name=action]").val("create");
1219 $("input[name=changecompany]").val("1");
1220 $("form[name=crea_reception]").submit();
1225 print
' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
1231 if (
isModEnabled(
'project') && is_object($formproject)) {
1233 if (empty($projectid) && !empty(
$object->fk_project)) {
1234 $projectid = (int)
$object->fk_project;
1236 $langs->load(
"projects");
1238 print
'<td>' . $langs->trans(
"Project") .
'</td><td colspan="2">';
1239 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1240 print $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'widthcentpercentminusxx');
1241 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>';
1247 print
'<tr><td>'.$langs->trans(
"DateReception").
'</td>';
1248 print
'<td colspan="3">';
1249 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1250 $date_reception = ($date_reception ? $date_reception :
$object->date_reception);
1251 print $form->selectDate($date_reception ? $date_reception : -1,
'date_reception', 1, 1, 1);
1256 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1257 print
'<td colspan="3">';
1258 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1259 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1260 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1266 print $langs->trans(
"Weight");
1267 print
'</td><td colspan="3">';
1268 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1269 print
'<input name="weight" size="4" value="'.GETPOST(
'weight').
'"> ';
1270 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight", (
string)
GETPOSTINT(
'weight_units'), 0, 2);
1271 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1272 print $form->textwithpicto($text, $htmltext);
1277 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1278 print
' </td><td colspan="3">';
1279 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1280 print
'<input name="sizeW" size="4" value="'.GETPOST(
'sizeW').
'">';
1281 print
' x <input name="sizeH" size="4" value="'.GETPOST(
'sizeH').
'">';
1282 print
' x <input name="sizeS" size="4" value="'.GETPOST(
'sizeS').
'">';
1284 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size", (
string)
GETPOSTINT(
'size_units'), 0, 2);
1285 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1286 print $form->textwithpicto($text, $htmltext);
1290 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
1291 print
'<td colspan="3">';
1292 $recept->fetch_delivery_methods();
1293 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1295 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1297 print
"</td></tr>\n";
1300 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1301 print
'<td colspan="3">';
1302 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1303 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1304 print
"</td></tr>\n";
1307 $extrafields->fetch_name_optionals_label(
$object->table_element);
1308 if (empty($reshook) && !empty($extrafields->attributes[
$object->table_element][
'label'])) {
1310 if ($objectsrc->fetch_optionals() > 0) {
1311 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
1313 print $recept->showOptionals($extrafields,
'create', $parameters);
1319 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1320 print
'<td colspan="3" class="maxwidthonsmartphone">';
1321 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1322 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1327 print
'<tr><td>'.$langs->trans(
'Model').
'</td>';
1328 print
'<td colspan="2">';
1329 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1330 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
1332 print $form->selectarray(
'model', $list,
getDolGlobalString(
'RECEPTION_ADDON_PDF'), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth200 widthcentpercentminusx', 1);
1338 print
'<td class="tdtop">';
1339 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext);
1341 print
'<td valign="top" colspan="2">';
1342 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1343 print $doleditor->Create(1);
1346 if (!$user->socid) {
1348 print
'<td class="tdtop">';
1349 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext);
1351 print
'<td valign="top" colspan="2">';
1352 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1353 print $doleditor->Create(1);
1361 print $form->buttonsSaveCancel(
"CreateDraft");
1364 } elseif ($origin) {
1365 if ($origin ==
'supplierorder') {
1366 $classname =
'CommandeFournisseur';
1368 $classname = ucfirst($origin);
1371 $objectsrc =
new $classname($db);
1372 if ($objectsrc->fetch($origin_id)) {
1374 $soc->fetch($objectsrc->socid);
1376 $author =
new User($db);
1377 $author->fetch($objectsrc->user_author_id);
1383 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1384 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1385 print
'<input type="hidden" name="action" value="add">';
1386 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
1387 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
1388 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
1389 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1391 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
1396 print
'<table class="border centpercent">';
1399 print
'<tr><td class="titlefieldcreate fieldrequired">';
1400 if ($origin ==
'supplierorder' &&
isModEnabled(
"supplier_order")) {
1401 print $langs->trans(
"RefOrder").
'</td><td colspan="3"><a href="'.DOL_URL_ROOT.
'/fourn/commande/card.php?id='.$objectsrc->id.
'">'.
img_object($langs->trans(
"ShowOrder"),
'order').
' '.$objectsrc->ref;
1404 print $langs->trans(
"RefProposal").
'</td><td colspan="3"><a href="'.DOL_URL_ROOT.
'/comm/card.php?id='.$objectsrc->id.
'">'.
img_object($langs->trans(
"ShowProposal"),
'propal').
' '.$objectsrc->ref;
1411 if ($origin ==
'supplier_order') {
1412 print $langs->trans(
'SupplierOrder');
1414 print $langs->trans(
'RefSupplier');
1416 print
'</td><td colspan="3">';
1417 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
1422 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
1423 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
1427 if (
isModEnabled(
'project') && $formproject !==
null) {
1429 if (empty($projectid) && !empty($objectsrc->fk_project)) {
1430 $projectid = $objectsrc->fk_project;
1432 if ($origin ==
'project') {
1433 $projectid = ($origin_id ? $origin_id : 0);
1436 $langs->load(
"projects");
1438 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1439 print
img_picto(
'',
'project',
'class="paddingright"');
1440 print $formproject->select_projects((!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $soc->id : -1), (string) $projectid,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
1441 print
' <a 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" title="'.$langs->trans(
"AddProject").
'"></span></a>';
1447 print
'<tr><td>'.$langs->trans(
"DateReception").
'</td>';
1448 print
'<td colspan="3">';
1449 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1450 $date_reception = ($date_reception ? $date_reception :
$object->date_reception);
1451 print $form->selectDate($date_reception ? $date_reception : -1,
'date_reception', 1, 1, 1);
1456 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1457 print
'<td colspan="3">';
1458 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1459 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
1460 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1465 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1466 print
'<td colspan="3">';
1467 $doleditor =
new DolEditor(
'note_public', $objectsrc->note_public,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1468 print $doleditor->Create(1);
1472 if ($objectsrc->note_private && !$user->socid) {
1473 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1474 print
'<td colspan="3">';
1475 $doleditor =
new DolEditor(
'note_private', $objectsrc->note_private,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1476 print $doleditor->Create(1);
1482 print $langs->trans(
"Weight");
1483 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight').
'"> ';
1484 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight", (
string)
GETPOSTINT(
'weight_units'), 0, 2);
1485 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1486 print $form->textwithpicto($text, $htmltext);
1490 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1491 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth').
'">';
1492 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight').
'">';
1493 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth').
'">';
1495 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size", (
string)
GETPOSTINT(
'size_units'), 0, 2);
1496 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1497 print $form->textwithpicto($text, $htmltext);
1501 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
1502 print
'<td colspan="3">';
1503 $recept->fetch_delivery_methods();
1504 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1506 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1508 print
"</td></tr>\n";
1511 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1512 print
'<td colspan="3">';
1513 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1514 print
"</td></tr>\n";
1517 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1518 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $recept, $action);
1519 print $hookmanager->resPrint;
1522 $extrafields->fetch_name_optionals_label(
$object->table_element);
1523 if (empty($reshook) && !empty($extrafields->attributes[
$object->table_element][
'label'])) {
1525 if ($objectsrc->fetch_optionals() > 0) {
1526 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
1528 print $recept->showOptionals($extrafields,
'create', $parameters);
1534 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
1535 print
'<td colspan="3" class="maxwidthonsmartphone">';
1536 print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
1541 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
1544 if (is_array($list) && count($list) > 1) {
1545 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1546 print
'<td colspan="3">';
1548 print
"</td></tr>\n";
1562 $suffix2numAsked = array();
1563 $dispatchLines = array();
1565 foreach ($_POST as $key => $value) {
1570 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
1572 $paramSuffix = $reg[1] .
'_' . $reg[2];
1573 $suffix2numAsked[$paramSuffix] = $numAsked;
1576 $numline = $numAsked;
1578 $prod =
"product_" . $paramSuffix;
1579 $qty =
"qty_" . $paramSuffix;
1580 $ent =
"entrepot_" . $paramSuffix;
1581 $pu =
"pu_" . $paramSuffix;
1582 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
1587 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
1589 $paramSuffix = $reg[1] .
'_' . $reg[2];
1590 $suffix2numAsked[$paramSuffix] = $numAsked;
1594 $numline = $numAsked;
1596 $prod =
'product_batch_' . $paramSuffix;
1597 $qty =
'qty_' . $paramSuffix;
1598 $ent =
'entrepot_' . $paramSuffix;
1599 $pu =
'pu_' . $paramSuffix;
1600 $lot =
'lot_number_' . $paramSuffix;
1603 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
1604 $dispatchLines[$numAsked] = array(
'paramSuffix' => $paramSuffix,
'prod' =>
GETPOSTINT($prod),
'qty' =>
price2num(
GETPOST($qty),
'MS'),
'ent' =>
GETPOSTINT($ent),
'pu' =>
price2num(
GETPOST($pu),
'MU'),
'comment' =>
GETPOST(
'comment'),
'fk_commandefourndet' =>
GETPOSTINT($fk_commandefourndet),
'DLC' => $dDLC,
'DLUO' => $dDLUO,
'lot' =>
GETPOST($lot));
1608 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1610 $paramSuffix = $reg[1];
1611 $suffix2numAsked[$paramSuffix] = $numAsked;
1615 $numline = $numAsked;
1617 $prod =
'productid'.$paramSuffix;
1618 $comment =
'comment'.$paramSuffix;
1619 $qty =
'qtyl'.$paramSuffix;
1620 $ent =
'entl'.$paramSuffix;
1621 $pu =
'pul'.$paramSuffix;
1622 $lot =
'batch'.$paramSuffix;
1625 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1626 $dispatchLines[$numAsked] = array(
'prod' =>
GETPOSTINT($prod),
'qty' =>
price2num(
GETPOST($qty),
'MS'),
'ent' =>
GETPOSTINT($ent),
'pu' =>
price2num(
GETPOST($pu),
'MU'),
'comment' =>
GETPOST($comment),
'fk_commandefourndet' =>
GETPOSTINT($fk_commandefourndet),
'DLC' => $dDLC,
'DLUO' => $dDLUO,
'lot' =>
GETPOSTINT($lot));
1633 foreach ($suffix2numAsked as $suffix => $n) {
1634 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'receptiondet_batch',
'_' . $suffix,
'');
1637 print
'<script type="text/javascript">
1638 jQuery(document).ready(function() {
1639 jQuery("#autofill").click(function(event) {
1640 event.preventDefault();';
1642 while ($i <= $numAsked) {
1643 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1647 jQuery("#autoreset").click(function(event) {
1648 event.preventDefault();';
1650 while ($i <= $numAsked) {
1651 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1660 print
'<table class="noborder centpercent">';
1663 $objectsrc->loadReceptions();
1666 print
'<tr class="liste_titre">';
1667 print
'<td>'.$langs->trans(
"Description").
'</td>';
1668 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1669 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1670 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1671 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1673 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1676 print
' <br><center><a href="#" id="autofill"><span class="fas fa-fill pictofixedwidth" style=""></span> '.$langs->trans(
"Fill").
'</a>';
1677 print
' <a href="#" id="autoreset"><span class="fas fa-eraser pictofixedwidth" style=""></span>'.$langs->trans(
"Reset").
'</a></center><br>';
1681 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1684 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1686 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1689 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1698 $arrayofpurchaselinealreadyoutput = array();
1702 while ($indiceAsked <= $numAsked) {
1707 foreach ($objectsrc->lines as $supplierLine) {
1708 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1709 $line = $supplierLine;
1717 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1719 if (!empty($line->date_start)) {
1722 if (!empty($line->date_end)) {
1726 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1727 print
'<tr class="oddeven">'.
"\n";
1730 if ($line->fk_product > 0) {
1731 $product->fetch($line->fk_product);
1732 $product->load_stock(
'warehouseopen');
1737 print
'<a name="'.$line->id.
'"></a>';
1739 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1741 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1742 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1745 $product_static = $product;
1747 $text = $product_static->getNomUrl(1);
1748 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1750 print $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i);
1753 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1757 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1763 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1765 $text =
img_object($langs->trans(
'Service'),
'service');
1767 $text =
img_object($langs->trans(
'Product'),
'product');
1770 if (!empty($line->label)) {
1771 $text .=
' <strong>'.$line->label.
'</strong>';
1772 print $form->textwithtooltip($text, $line->desc, 3, 0,
'', (
string) $i);
1774 print $text.
' '.nl2br($line->desc);
1778 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1785 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1787 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1791 print
'<td class="center">';
1792 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1795 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1796 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->subprice.
'">';
1797 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1799 $qtyProdCom = $line->qty;
1802 print
'<td class="center">';
1803 $quantityDelivered = isset($objectsrc->receptions[$line->id]) ? $objectsrc->receptions[$line->id] : 0;
1804 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1805 print $quantityDelivered;
1807 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1812 $quantityToBeDelivered = 0;
1814 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1816 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1819 $warehouseObject =
null;
1822 print
'<!-- Case warehouse already known or product not a predefined product -->';
1823 if (array_key_exists($dispatchLines[$indiceAsked][
'ent'], $product->stock_warehouse)) {
1824 $stock = +$product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1826 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1827 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1830 print
'<td class="center">';
1833 $defaultqty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1835 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1836 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1838 print $langs->trans(
"NA");
1844 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.
price($cost_price).
'">';
1850 print
'<td class="left">';
1853 $ent =
"entl".$indiceAsked;
1854 $idl =
"idl".$indiceAsked;
1856 if ($line->fk_product > 0) {
1857 print
'<!-- Show warehouse selection -->';
1858 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1861 print $langs->trans(
"Service");
1867 if (!empty($product->status_batch)) {
1868 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1870 print
'<td class="nowraponall">';
1871 print $form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked, 0, 0, 1,
"");
1875 print
'<td class="nowraponall">';
1876 print $form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked, 0, 0, 1,
"");
1880 print
'<td colspan="3"></td>';
1885 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1891 if (!empty($extrafields)) {
1905 $srcLine->id = $line->id;
1906 $srcLine->fetch_optionals();
1908 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1909 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1911 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1913 print $recLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="oddeven"',
'colspan' => $colspan), (
string) $indiceAsked,
'',
'1');
1923 print $form->buttonsSaveCancel(
"Create");
1940 $num_prod = count($lines);
1944 print $langs->trans(
"NoRecordFound");
1951 $typeobject =
$object->origin;
1953 $origin_id =
$object->origin_id;
1960 $res =
$object->fetch_optionals();
1963 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1968 if ($action ==
'delete') {
1969 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception",
$object->ref),
'confirm_delete',
'', 0, 1);
1973 if ($action ==
'valid') {
1974 $objectref = substr(
$object->ref, 1, 4);
1975 if ($objectref ==
'PROV') {
1976 $numref =
$object->getNextNumRef($soc);
1978 $numref = (string)
$object->ref;
1981 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1983 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1985 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1989 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1990 $notify =
new Notify($db);
1992 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE',
$object->socid, $object);
1995 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1, 250);
1999 if ($action ==
'annuler') {
2000 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception",
$object->ref),
'confirm_cancel',
'', 0, 1);
2003 if (!$formconfirm) {
2004 $parameters = array(
'formConfirm' => $formconfirm);
2005 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
2006 if (empty($reshook)) {
2007 $formconfirm .= $hookmanager->resPrint;
2008 } elseif ($reshook > 0) {
2009 $formconfirm = $hookmanager->resPrint;
2019 $tmparray =
$object->getTotalWeightVolume();
2020 $totalWeight = $tmparray[
'weight'];
2021 $totalVolume = $tmparray[
'volume'];
2026 $objectsrc->fetch(
$object->origin_object->id);
2029 $objectsrc =
new Propal($db);
2030 $objectsrc->fetch(
$object->origin_object->id);
2032 if (($typeobject ==
'supplier_order' || $typeobject ==
'CommandeFournisseur') &&
$object->origin_object->id &&
isModEnabled(
"supplier_order")) {
2034 $objectsrc->fetch(
$object->origin_object->id);
2037 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
2038 $morehtmlref =
'<div class="refidno">';
2041 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'', 0, 1);
2042 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'',
null,
null,
'', 1);
2045 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
2047 if ($origin && $origin_id > 0) {
2049 $langs->load(
"projects");
2050 $morehtmlref .=
'<br>';
2052 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
2053 if ($action !=
'classify') {
2054 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
2056 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $objectsrc->socid, (
string) $objectsrc->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
2058 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
2060 $proj->fetch($objectsrc->fk_project);
2061 $morehtmlref .= $proj->getNomUrl(1);
2063 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
2071 $langs->load(
"projects");
2072 $morehtmlref .=
'<br>';
2073 if ($permissiontoadd) {
2074 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
2075 if ($action !=
'classify') {
2076 $morehtmlref .=
'<a class="editfielda" href="' . $_SERVER[
'PHP_SELF'] .
'?action=classify&token=' .
newToken() .
'&id=' .
$object->id .
'">' .
img_edit($langs->transnoentitiesnoconv(
'SetProject')) .
'</a> ';
2078 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
2080 if (!empty(
$object->fk_project)) {
2082 $proj->fetch(
$object->fk_project);
2083 $morehtmlref .= $proj->getNomUrl(1);
2085 $morehtmlref .=
'<span class="opacitymedium"> - ' .
dol_escape_htmltag($proj->title) .
'</span>';
2091 $morehtmlref .=
'</div>';
2093 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
2096 print
'<div class="fichecenter">';
2097 print
'<div class="fichehalfleft">';
2098 print
'<div class="underbanner clearboth"></div>';
2100 print
'<table class="border centpercent tableforfield">';
2105 print $langs->trans(
"RefOrder").
'</td>';
2106 print
'<td colspan="3">';
2107 print $objectsrc->getNomUrl(1,
'commande');
2113 print $langs->trans(
"RefProposal").
'</td>';
2114 print
'<td colspan="3">';
2115 print $objectsrc->getNomUrl(1,
'reception');
2119 if (($typeobject ==
'supplier_order' || $typeobject ==
'CommandeFournisseur') &&
$object->origin_object->id &&
isModEnabled(
"propal")) {
2121 print $langs->trans(
"SupplierOrder").
'</td>';
2122 print
'<td colspan="3">';
2123 print $objectsrc->getNomUrl(1,
'reception');
2129 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
2130 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
2134 print
'<tr><td height="10">';
2135 print
'<table class="nobordernopadding centpercent"><tr><td>';
2136 print $langs->trans(
'DateReception');
2138 if ($action !=
'editdate_reception') {
2139 print
'<td class="right"><a class="editfielda" href="' . $_SERVER[
"PHP_SELF"] .
'?action=editdate_reception&token=' .
newToken() .
'&id=' .
$object->id .
'">' .
img_edit($langs->trans(
'SetReceptionDate'), 1) .
'</a></td>';
2141 print
'</tr></table>';
2143 if ($action ==
'editdate_reception') {
2144 print
'<form name="setdate_reception" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'" method="post">';
2145 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
2146 print
'<input type="hidden" name="action" value="setdate_reception">';
2147 print $form->selectDate(
$object->date_reception ?
$object->date_reception : -1,
'recep_', 1, 1, 0,
"setdate_reception", 1, 0);
2148 print
'<input type="submit" class="button button-edit smallpaddingimp" value="' . $langs->trans(
'Modify') .
'">';
2157 print
'<tr><td height="10">';
2158 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2159 print $langs->trans(
'DateDeliveryPlanned');
2162 if ($action !=
'editdate_livraison' && $permissiontoadd) {
2163 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>';
2165 print
'</tr></table>';
2166 print
'</td><td colspan="2">';
2167 if ($action ==
'editdate_livraison') {
2168 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2169 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2170 print
'<input type="hidden" name="action" value="setdate_livraison">';
2171 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2172 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
2182 print $form->editfieldkey(
"Weight",
'trueWeight', (
string)
$object->trueWeight, $object, $user->hasRight(
'reception',
'creer'));
2183 print
'</td><td colspan="3">';
2185 if ($action ==
'edittrueWeight') {
2186 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2187 print
'<input name="action" value="settrueWeight" type="hidden">';
2188 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2189 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2190 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
2191 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", (
string)
$object->weight_units, 0, 2);
2192 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2193 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2197 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2201 if ($totalWeight > 0) {
2202 if (!empty(
$object->trueWeight)) {
2203 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2206 if (!empty(
$object->trueWeight)) {
2213 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', (
string)
$object->trueWidth, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2214 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth, $object, $user->hasRight(
'reception',
'creer'));
2215 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2219 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', (
string)
$object->trueHeight, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2220 if ($action ==
'edittrueHeight') {
2221 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2222 print
'<input name="action" value="settrueHeight" type="hidden">';
2223 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2224 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2225 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
2226 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2227 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2228 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2232 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2238 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', (
string)
$object->trueDepth, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2239 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth, $object, $user->hasRight(
'reception',
'creer'));
2240 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2245 print $langs->trans(
"Volume");
2247 print
'<td colspan="3">';
2248 $calculatedVolume = 0;
2252 $volumeUnit =
$object->size_units * 3;
2255 if ($calculatedVolume > 0) {
2256 if ($volumeUnit < 50) {
2262 if ($totalVolume > 0) {
2263 if ($calculatedVolume) {
2264 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2268 if ($calculatedVolume) {
2278 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2283 print
'<div class="fichehalfright">';
2284 print
'<div class="underbanner clearboth"></div>';
2286 print
'<table class="border centpercent tableforfield">';
2289 print
'<tr><td height="10">';
2290 print
'<table class="nobordernopadding centpercent"><tr><td>';
2291 print $langs->trans(
'ReceptionMethod');
2294 if ($action !=
'editshipping_method_id' && $permissiontoadd) {
2295 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editshipping_method_id&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetReceptionMethod'), 1).
'</a></td>';
2297 print
'</tr></table>';
2298 print
'</td><td colspan="2">';
2299 if ($action ==
'editshipping_method_id') {
2300 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2301 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2302 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2303 $object->fetch_delivery_methods();
2304 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2306 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2308 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
2311 if (
$object->shipping_method_id > 0) {
2313 $code = $langs->getLabelFromKey($db, (
string)
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2314 print $langs->trans(
"SendingMethod".strtoupper($code));
2321 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2322 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url, $object, $user->hasRight(
'reception',
'creer'),
'safehtmlstring',
$object->tracking_number);
2328 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2329 print $langs->trans(
'IncotermLabel');
2330 print
'<td><td class="right">';
2331 if ($user->hasRight(
'reception',
'creer')) {
2332 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2336 print
'</td></tr></table>';
2338 print
'<td colspan="3">';
2339 if ($action !=
'editincoterm') {
2340 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2342 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2352 print
'<div class="clearboth"></div>';
2358 if (!empty(
$object->table_element_line)) {
2360 $result =
$object->getLinesArray();
2362 print
' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">
2363 <input type="hidden" name="token" value="' .
newToken().
'">
2364 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
2365 <input type="hidden" name="mode" value="">
2366 <input type="hidden" name="page_y" value="">
2367 <input type="hidden" name="id" value="' .
$object->id.
'">
2370 if (!empty($conf->use_javascript_ajax) &&
$object->status == $object::STATUS_DRAFT) {
2371 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
2374 print
'<div class="div-table-responsive-no-min">';
2375 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
2376 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
2384 if (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines') {
2385 if ($action !=
'editline') {
2388 $parameters = array();
2389 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
2393 if (empty($reshook)) {
2399 if (!empty(
$object->lines) || (
$object->status == Reception::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
2408 if ($action ==
'editline') {
2409 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2410 <input type="hidden" name="token" value="' .
newToken().
'">
2411 <input type="hidden" name="action" value="updateline">
2412 <input type="hidden" name="mode" value="">
2413 <input type="hidden" name="id" value="' .
$object->id.
'">';
2417 print
'<div class="div-table-responsive-no-min">';
2418 print
'<table id="tablelines" class="noborder centpercent">';
2420 print
'<tr class="liste_titre">';
2423 print
'<td width="5" class="center"> </td>';
2426 print
'<td>'.$langs->trans(
"Products").
'</td>';
2428 print
'<td>'.$langs->trans(
"Comment").
'</td>';
2430 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
2431 if ($origin && $origin_id > 0) {
2432 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
2436 if ($action ==
'editline') {
2440 if (empty($conf->productbatch->enabled)) {
2443 print
'<td class="center" colspan="'.$editColspan.
'">';
2445 print $langs->trans(
"QtyToReceive").
' - ';
2447 print $langs->trans(
"QtyReceived").
' - ';
2450 print $langs->trans(
"WarehouseTarget").
' - ';
2453 print $langs->trans(
"Batch");
2457 $statusreceived = $object::STATUS_CLOSED;
2459 $statusreceived = $object::STATUS_VALIDATED;
2462 $statusreceived = $object::STATUS_CLOSED;
2464 if (
$object->statut < $statusreceived) {
2465 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
2467 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
2470 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
2474 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
2477 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
2478 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
2481 print
'<td class="linecoledit"></td>';
2482 print
'<td class="linecoldelete" width="10"></td>';
2489 $outputlangs = $langs;
2493 if (
GETPOST(
'lang_id',
'aZ09')) {
2494 $newlang =
GETPOST(
'lang_id',
'aZ09');
2496 if (empty($newlang)) {
2497 $newlang =
$object->thirdparty->default_lang;
2499 if (!empty($newlang)) {
2500 $outputlangs =
new Translate(
"", $conf);
2501 $outputlangs->setDefaultLang($newlang);
2506 $alreadysent = array();
2508 if (empty($origin)) {
2509 $origin =
'supplier_order';
2512 if ($origin_id > 0) {
2513 $sql =
"SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
2514 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
2515 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
2516 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
2517 $sql .=
', p.description as product_desc';
2518 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as ed";
2519 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
2520 $sql .=
", ".MAIN_DB_PREFIX.(($origin ==
'supplier_order') ?
'commande_fournisseur' : $origin).
"det as obj";
2521 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2522 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
2523 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
2524 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2525 $sql .=
" AND ed.fk_reception = e.rowid";
2526 $sql .=
" AND ed.fk_reception !=".((int)
$object->id);
2527 $sql .=
" ORDER BY obj.fk_product";
2529 dol_syslog(
"get list of reception lines", LOG_DEBUG);
2530 $resql = $db->query($sql);
2532 $num = $db->num_rows($resql);
2536 $obj = $db->fetch_object($resql);
2539 $alreadysent[$obj->rowid][$obj->receptionline_id] = array(
'reception_ref' => $obj->reception_ref,
'reception_id' => $obj->reception_id,
'warehouse' => $obj->fk_entrepot,
'qty' => $obj->qty,
'date_valid' => $obj->date_valid,
'date_delivery' => $obj->date_delivery);
2547 $arrayofpurchaselinealreadyoutput = array();
2551 for ($i = 0; $i < $num_prod; $i++) {
2552 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
2553 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
2557 print
'<td class="center">'.($i + 1).
'</td>';
2561 if ($lines[$i]->fk_product > 0) {
2565 $prod->fetch($lines[$i]->fk_product);
2566 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
2568 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
2571 print
'<td class="linecoldescription">';
2572 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2573 $text = $lines[$i]->product->getNomUrl(1);
2574 $text .=
' - '.$label;
2576 print $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i);
2577 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
2584 print
'<td class="linecoldescription">';
2585 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2587 $text =
img_object($langs->trans(
'Service'),
'service');
2589 $text =
img_object($langs->trans(
'Product'),
'product');
2592 if (!empty($lines[$i]->label)) {
2593 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2594 print $form->textwithtooltip($text, $lines[$i]->
description, 3, 0,
'', (
string) $i);
2604 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2605 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
2607 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
2612 print
'<td class="center linecolqty">';
2613 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2614 print $lines[$i]->qty_asked;
2619 if ($origin && $origin_id > 0) {
2620 print
'<td class="center nowrap linecolqtyinotherreceptions">';
2622 $qtyalreadyreceived = 0;
2623 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2624 foreach ($alreadysent as $key => $val) {
2625 if ($lines[$i]->fk_commandefourndet == $key) {
2627 foreach ($val as $receptionline_id => $receptionline_var) {
2628 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
2634 $htmltooltip .=
'<br>';
2636 $reception_static->fetch($receptionline_var[
'reception_id']);
2637 $htmltooltip .= $reception_static->getNomUrl(1,
'nolink', 0, 0, 1);
2638 $htmltooltip .=
' - '.$receptionline_var[
'qty'];
2640 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
2641 if (
isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
2642 $warehousestatic->fetch($receptionline_var[
'warehouse']);
2643 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
2645 $htmltooltip .=
' '.$form->textwithpicto(
'', $htmltext, 1);
2647 $qtyalreadyreceived += $receptionline_var[
'qty'];
2650 $htmltooltip = $langs->trans(
"QtyInOtherReceptions").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2655 print $form->textwithpicto((
string) $qtyalreadyreceived, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2659 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2661 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
2663 if ($lines[$i]->fk_product > 0) {
2664 print
'<!-- case edit 1 -->';
2667 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2669 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2671 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
2672 print
'<td class="nowraponall left"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
2674 print $langs->trans(
'SellByDate').
' : ';
2675 print $form->selectDate($lines[$i]->sellby,
'dlc'.$line_id, 0, 0, 1,
"").
'</br>';
2678 print $langs->trans(
'EatByDate').
' : ';
2679 print $form->selectDate($lines[$i]->eatby,
'dluo'.$line_id, 0, 0, 1,
"");
2685 print
'<!-- case edit 2 -->';
2688 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2696 print
'</table></td>';
2699 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
2703 if ($lines[$i]->fk_entrepot > 0) {
2705 $entrepot->fetch($lines[$i]->fk_entrepot);
2707 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
2708 print $entrepot->getNomUrl(1);
2717 if (isset($lines[$i]->batch)) {
2718 print
'<!-- Detail of lot -->';
2719 print
'<td class="linecolbatch nowrap">';
2720 $detail = $langs->trans(
"NA");
2721 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
2722 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
2724 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
2726 $detail = $productlot->getNomUrl(1);
2729 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
2731 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2734 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2736 $detail = $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2739 print $detail .
'</td>';
2747 print
'<td class="center linecolweight">';
2749 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2756 print
'<td class="center linecolvolume">';
2758 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2765 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2766 print
'<td class="center valignmiddle" colspan="2">';
2767 print
'<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2768 print
'<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2770 } elseif (
$object->statut == Reception::STATUS_DRAFT) {
2772 print
'<td class="linecoledit center">';
2773 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2775 print
'<td class="linecoldelete" width="10">';
2776 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2780 if (isset($rowExtrafieldsStart, $rowExtrafieldsView, $rowEnd)) {
2781 print $rowExtrafieldsStart;
2782 print $rowExtrafieldsView;
2788 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2791 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2792 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2802 $line->id = $lines[$i]->id;
2803 $line->fetch_optionals();
2805 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2806 print $line->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan),
'');
2808 print $line->showOptionals($extrafields,
'view', array(
'colspan' => $colspan),
'');
2830 if (($user->socid == 0) && ($action !=
'presend')) {
2831 print
'<div class="tabsAction">';
2833 $parameters = array();
2834 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2835 if (empty($reshook)) {
2836 if (
$object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2837 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer'))
2838 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate'))) {
2839 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2841 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2845 if (
$object->statut == Reception::STATUS_VALIDATED && $user->hasRight(
'reception',
'creer')) {
2846 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2851 if (
$object->statut == Reception::STATUS_CLOSED && $user->hasRight(
'reception',
'creer')) {
2852 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2856 if (empty($user->socid)) {
2858 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'reception',
'reception_advance',
'send')) {
2859 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2861 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2868 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
2870 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?action=create&origin='.
$object->element.
'&originid='.
$object->id.
'&socid='.
$object->socid.
'">'.$langs->trans(
"CreateBill").
'</a>';
2877 if (
$object->statut == Reception::STATUS_VALIDATED) {
2878 if ($user->hasRight(
'reception',
'creer') &&
$object->statut > 0) {
2880 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=classifybilled&token='.
newToken().
'">'.$langs->trans(
'ClassifyBilled').
'</a>';
2882 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=classifyclosed&token='.
newToken().
'">'.$langs->trans(
"Close").
'</a>';
2886 if ($user->hasRight(
'reception',
'supprimer')) {
2887 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2899 if ($action !=
'presend' && $action !=
'editline') {
2900 print
'<div class="fichecenter"><div class="fichehalfleft">';
2903 $filedir = $conf->reception->dir_output.
"/".$objectref;
2905 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2907 $genallowed = $user->hasRight(
'reception',
'lire');
2908 $delallowed = $user->hasRight(
'reception',
'creer');
2910 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2914 $somethingshown = $form->showLinkedObjectBlock($object,
'');
2916 print
'</div><div class="fichehalfright">';
2918 print
'</div></div>';
2922 $modelmail =
'reception_send';
2923 $defaulttopic =
'SendReceptionRef';
2924 $diroutput = $conf->reception->dir_output;
2925 $trackid =
'rec'.$object->id;
2927 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage table ReceptionLineBatch.
Class to manage predefined suppliers products.
Class to manage line orders.
Class to manage customers orders.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage the table of subscription to notifications.
Class ProductCombination Used to represent the relation between a product and one of its variants.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class with list of lots and properties.
Class to manage projects.
Class to manage proposals.
Class to manage receptions.
Class to manage table commandefournisseurdispatch.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
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_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
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.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
reception_prepare_head(Reception $object)
Prepare array with list of tabs.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.