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 $permissiontoedit = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
193 $permissiondellink = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
194 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande',
'receptionner')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande_advance',
'check')));
195 $permissiontodelete = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
197$permissiontoeditextra = $permissiontoadd;
198if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
200 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
207$shipping_method_id =
null;
218$parameters = array();
219$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
224if (empty($reshook)) {
225 $backurlforlist = DOL_URL_ROOT.
'/reception/list.php';
227 if (empty($backtopage) || ($cancel && empty($id))) {
228 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
229 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
230 $backtopage = $backurlforlist;
232 $backtopage = DOL_URL_ROOT.
'/reception/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
238 if (!empty($backtopageforcancel)) {
239 header(
"Location: ".$backtopageforcancel);
241 } elseif (!empty($backtopage)) {
242 header(
"Location: ".$backtopage);
256 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
258 include DOL_DOCUMENT_ROOT.
'/core/actions_lineupdown.inc.php';
261 if ($action ==
'reopen' && $permissiontoadd) {
269 if ($action ==
'modif' && $permissiontoadd) {
270 $result =
$object->setDraft($user);
274 $outputlangs = $langs;
277 $newlang =
GETPOST(
'lang_id',
'aZ09');
280 $newlang =
$object->thirdparty->default_lang;
282 if (!empty($newlang)) {
284 $outputlangs->setDefaultLang($newlang);
288 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
296 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm') && $permissiontoadd) {
300 if ($action ==
'setref_supplier' && $permissiontoadd) {
305 $result =
$object->setValueFrom(
'ref_supplier',
GETPOST(
'ref_supplier',
'alpha'),
'',
null,
'text',
'', $user,
'RECEPTION_MODIFY');
308 $action =
'editref_supplier';
310 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
315 if ($action ==
'update_extras' && $permissiontoeditextra) {
318 $attribute_name =
GETPOST(
'attribute',
'aZ09');
321 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
327 $result =
$object->updateExtraField($attribute_name,
'RECEPTION_MODIFY');
335 $action =
'edit_extras';
340 if ($action ==
'add' && $permissiontoadd) {
346 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")),
null,
'errors');
355 $object->origin_type = $origin;
356 $object->origin_id = $origin_id;
366 $object->date_delivery = $date_delivery;
367 $object->date_reception = $date_reception;
373 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
378 $ret = $extrafields->setOptionalsFromPost(
null, $object);
391 if ($origin && $origin_id > 0) {
395 $object->origin_type = $origin;
396 $object->origin_id = $origin_id;
407 $object->date_delivery = $date_delivery;
408 $object->date_reception = $date_reception;
414 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
416 if (
$object->origin ==
"supplierorder") {
417 $object->origin =
'order_supplier';
418 $object->origin_type =
'order_supplier';
419 $classname =
'CommandeFournisseur';
421 $classname = ucfirst(
$object->origin);
423 $objectsrc =
new $classname($db);
424 $objectsrc->fetch(
$object->origin_id);
426 $object->socid = $objectsrc->socid;
427 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
430 $batch_line = array();
431 $stockLine = array();
432 $array_options = array();
437 foreach ($_POST as $key => $value) {
440 if (strpos($key,
'qtyasked') !==
false) {
446 for ($i = 1; $i <= $num; $i++) {
458 if (
GETPOST($qty,
'alpha') > 0) {
463 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, (
string) $i);
468 for ($i = 1; $i <= $num; $i++) {
472 foreach ($objectsrc->lines as $linesrc) {
473 if ($linesrc->id == $lineId) {
474 $lineToTest = $linesrc;
478 if (empty($lineToTest)) {
482 $comment =
"comment".$i;
487 $cost_price =
"cost_price".$i;
506 if ($entrepot_id < 0) {
517 $ret =
$object->addline($entrepot_id,
GETPOSTINT($idl), (
float)
price2num(
GETPOST($qty),
'MS'), $array_options[$i],
GETPOST($comment), $eatbydate, $sellbydate,
GETPOST($batch),
GETPOSTFLOAT($cost_price,
'MU'));
529 $ret = $extrafields->setOptionalsFromPost(
null, $object);
543 $outputlangs = $langs;
546 $newlang =
GETPOST(
'lang_id',
'aZ09');
549 $newlang =
$object->thirdparty->default_lang;
551 if (!empty($newlang)) {
553 $outputlangs->setDefaultLang($newlang);
558 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
566 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"QtyToReceive").
'/'.$langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
572 header(
"Location: card.php?id=" .
$object->id);
579 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && $permissiontovalidate) {
582 $result =
$object->valid($user);
585 $langs->load(
"errors");
590 $outputlangs = $langs;
593 $newlang =
GETPOST(
'lang_id',
'aZ09');
596 $newlang =
$object->thirdparty->default_lang;
598 if (!empty($newlang)) {
600 $outputlangs->setDefaultLang($newlang);
605 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
611 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
612 $result =
$object->delete($user);
614 header(
"Location: ".DOL_URL_ROOT.
'/reception/index.php');
626 } elseif ($action ==
'setdate_livraison' && $permissiontoadd) {
630 $result =
$object->setDeliveryDate($user, $datedelivery);
634 } elseif ($action ==
'setdate_reception' && $user->hasRight(
'reception',
'creer')) {
638 $result =
$object->setReceptionDate($user, $datereception);
642 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $permissiontoadd) {
644 $result =
$object->deleteLine($user, $lineid);
649 $outputlangs = $langs;
652 $newlang =
GETPOST(
'lang_id',
'aZ09');
655 $newlang =
$object->thirdparty->default_lang;
657 if (!empty($newlang)) {
659 $outputlangs->setDefaultLang($newlang);
663 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
666 header(
'Location: ' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id);
671 } elseif (in_array($action, array(
'settracking_number',
'settracking_url',
'settrueWeight',
'settrueWidth',
'settrueHeight',
'settrueDepth',
'setshipping_method_id')) && $permissiontoadd) {
675 if ($action ==
'settracking_number') {
676 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
678 if ($action ==
'settracking_url') {
679 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
681 if ($action ==
'settrueWeight') {
685 if ($action ==
'settrueWidth') {
688 if ($action ==
'settrueHeight') {
692 if ($action ==
'settrueDepth') {
695 if ($action ==
'setshipping_method_id') {
699 if (
$object->update($user) >= 0) {
700 header(
"Location: card.php?id=" .
$object->id);
706 } elseif ($action ==
'builddoc' && $permissiontoread) {
715 $outputlangs = $langs;
718 $newlang =
GETPOST(
'lang_id',
'aZ09');
721 $newlang = $reception->thirdparty->default_lang;
723 if (!empty($newlang)) {
725 $outputlangs->setDefaultLang($newlang);
727 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
732 } elseif ($action ==
'remove_file' && $permissiontoadd) {
734 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
736 $upload_dir = $conf->reception->dir_output;
737 $file = $upload_dir.
'/'.
GETPOST(
'file');
744 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
745 $result =
$object->setBilled();
747 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
753 } elseif ($action ==
'classifyclosed' && $permissiontoadd) {
754 $result =
$object->setClosed();
756 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
762 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoread) {
767 $num_prod = count($lines);
768 for ($i = 0; $i < $num_prod; $i++) {
769 if ($lines[$i]->
id == $line_id) {
771 $line->id = $line_id;
772 if (!$error && $line->delete($user) < 0) {
776 unset($_POST[
"lineid"]);
780 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
785 } elseif ($action ==
'updateline' &&
GETPOST(
'save') && $permissiontoadd) {
790 if (!
$object->fetch($id) > 0) {
795 $qty =
GETPOST(
'qty',
'alpha');
797 $element_type =
'reception';
803 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
804 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
806 if (is_array($extralabelsline)) {
808 foreach ($extralabelsline as $key => $value) {
809 unset($_POST[
"options_" . $key]);
818 $result =
$object->updatelinefree(
GETPOSTINT(
'lineid'), (
float) $qty, $element_type, $fk_product,
GETPOSTINT(
'units'), $rang, $description, 0, $array_options);
823 $outputlangs = $langs;
826 $newlang =
GETPOST(
'lang_id',
'aZ09');
829 $newlang =
$object->thirdparty->default_lang;
831 if (!empty($newlang)) {
833 $outputlangs->setDefaultLang($newlang);
834 $outputlangs->load(
'products');
838 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
840 unset($_POST[
'qty']);
841 unset($_POST[
'units']);
846 } elseif ($origin && $origin_id > 0) {
854 $num_prod = count($lines);
855 for ($i = 0; $i < $num_prod; $i++) {
856 if ($lines[$i]->
id == $line_id) {
858 $line->fetch($line_id);
860 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
861 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
863 $line->fk_product = $lines[$i]->fk_product;
865 if ($lines[$i]->fk_product > 0) {
867 $stockLocation =
"entl".$line_id;
868 $qty =
"qtyl".$line_id;
869 $comment =
"comment".$line_id;
871 $line->id = $line_id;
872 $line->fk_entrepot =
GETPOSTINT($stockLocation);
874 $line->comment =
GETPOST($comment,
'alpha');
877 $batch =
"batch".$line_id;
878 $dlc =
"dlc".$line_id;
879 $dluo =
"dluo".$line_id;
880 $line->batch =
GETPOST($batch,
'alpha');
887 if ($line->update($user) < 0) {
892 $qty =
"qtyl".$line_id;
893 $line->id = $line_id;
895 $line->fk_entrepot = 0;
896 if ($line->update($user) < 0) {
905 unset($_POST[
"lineid"]);
910 $outputlangs = $langs;
913 $newlang =
GETPOST(
'lang_id',
'aZ09');
916 $newlang =
$object->thirdparty->default_lang;
918 if (!empty($newlang)) {
920 $outputlangs->setDefaultLang($newlang);
924 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
930 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
933 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
937 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
938 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
940 } elseif ($action ==
'addline' && !$origin &&
getDolGlobalString(
'RECEPTION_STANDALONE') && $permissiontoadd) {
941 $langs->load(
'errors');
943 $line_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
947 $element_type =
'reception';
953 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'aZ09');
954 if ($prod_entry_mode ==
'free') {
959 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")),
null,
'errors');
967 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
968 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
970 if (is_array($extralabelsline)) {
972 foreach ($extralabelsline as $key => $value) {
973 unset($_POST[
"options_".$key]);
977 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
978 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
983 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
987 setEventMessages($langs->trans(
'FieldCannotBeNegative', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
990 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($line_desc)) {
991 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
995 if (!$error &&
isModEnabled(
'variants') && $prod_entry_mode !=
'free') {
996 if ($combinations =
GETPOST(
'combinations',
'array')) {
1000 if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
1001 $idprod = $res->fk_product_child;
1002 $fk_product = $idprod;
1004 setEventMessages($langs->trans(
'ErrorProductCombinationNotFound'),
null,
'errors');
1010 if (!$error && ($qty >= 0) && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) {
1012 if (!empty($idprod) && $idprod > 0) {
1014 $prod->fetch($idprod);
1015 $desc = $prod->label;
1016 $description = $desc;
1019 $outputlangs = $langs;
1021 if (
GETPOST(
'lang_id',
'aZ09')) {
1022 $newlang =
GETPOST(
'lang_id',
'aZ09');
1024 if (empty($newlang)) {
1025 $newlang =
$object->thirdparty->default_lang;
1027 if (!empty($newlang)) {
1028 $outputlangs =
new Translate(
"", $conf);
1029 $outputlangs->setDefaultLang($newlang);
1032 $description = (!empty($prod->multilangs[$outputlangs->defaultlang][
"description"])) ? $prod->multilangs[$outputlangs->defaultlang][
"description"] : $prod->
description;
1034 $description = $prod->description;
1039 $description = $line_desc;
1043 if (!
getDolGlobalString(
'MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) {
1046 $outputlangs = $langs;
1048 if (
GETPOST(
'lang_id',
'alpha')) {
1049 $newlang =
GETPOST(
'lang_id',
'alpha');
1051 if (empty($newlang)) {
1052 $newlang =
$object->thirdparty->default_lang;
1054 if (!empty($newlang)) {
1055 $outputlangs =
new Translate(
"", $conf);
1056 $outputlangs->setDefaultLang($newlang);
1057 $outputlangs->load(
'products');
1059 if (!empty($prod->customcode)) {
1060 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
1062 if (!empty($prod->customcode) && !empty($prod->country_code)) {
1065 if (!empty($prod->country_code)) {
1066 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $outputlangs, 0);
1069 if (!empty($prod->customcode)) {
1070 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
1072 if (!empty($prod->customcode) && !empty($prod->country_code)) {
1075 if (!empty($prod->country_code)) {
1076 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $langs, 0);
1082 $type = $prod->type;
1083 $fk_unit = $prod->fk_unit;
1085 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1088 $fk_unit =
GETPOST(
'units',
'alpha');
1089 $description = $desc;
1090 $fk_elementdet =
'';
1096 $result =
$object->addlinefree((
float) $qty, $element_type, $idprod, $fk_unit, min($rank, count(
$object->lines) + 1), $description, $array_options);
1103 $outputlangs = $langs;
1104 $newlang =
GETPOST(
'lang_id',
'alpha');
1106 $newlang =
$object->thirdparty->default_lang;
1108 if (!empty($newlang)) {
1109 $outputlangs =
new Translate(
"", $conf);
1110 $outputlangs->setDefaultLang($newlang);
1112 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
1115 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
1122 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
1128 $triggersendname =
'RECEPTION_SENTBYMAIL';
1130 $mode =
'emailfromreception';
1131 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECEPTION_TO';
1132 $trackid =
'rec'.$object->id;
1133 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
1141$title =
$object->ref.
' - '.$langs->trans(
'Reception');
1142if ($action ==
'create') {
1143 $title = $langs->trans(
"NewReception");
1145llxHeader(
'', $title,
'Reception',
'', 0, 0,
'',
'',
'',
'mod-reception page-card');
1147$form =
new Form($db);
1154 $formproject =
null;
1157$product_static =
new Product($db);
1159$warehousestatic =
new Entrepot($db);
1161if ($action ==
'create' && $origin !=
'supplierorder' && !
getDolGlobalString(
'RECEPTION_STANDALONE')) {
1162 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
1164 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
1171if ($action ==
'create' && $permissiontoadd) {
1178 $res = $soc->fetch($socid);
1181 $note_private =
$object->getDefaultCreateValueFor(
'note_private');
1182 $note_public =
$object->getDefaultCreateValueFor(
'note_public');
1184 print
'<form name="crea_reception" action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST">';
1185 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
1186 print
'<input type="hidden" name="action" value="add">';
1187 print
'<input type="hidden" name="changecompany" value="0">';
1188 print
'<input type="hidden" name="originid" value="' .
$id .
'">';
1189 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
1193 print
'<table class="border centpercent">';
1198 print
'<td class="fieldrequired">' . $langs->trans(
'ThirdParty') .
'</td>';
1201 print $soc->getNomUrl(1);
1202 print
'<input type="hidden" name="socid" value="' . $soc->id .
'">';
1205 print
'<td class="valuefieldcreate">';
1206 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company(
'',
'socid',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth175 maxwidth500 widthcentpercentminusxx');
1210 $(document).ready(function() {
1211 $("#socid").change(function() {
1212 console.log("We have changed the company - Reload page");
1213 var socid = $(this).val();
1215 $("input[name=action]").val("create");
1216 $("input[name=changecompany]").val("1");
1217 $("form[name=crea_reception]").submit();
1222 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>';
1228 if (
isModEnabled(
'project') && is_object($formproject)) {
1230 if (empty($projectid) && !empty(
$object->fk_project)) {
1231 $projectid = (int)
$object->fk_project;
1233 $langs->load(
"projects");
1235 print
'<td>' . $langs->trans(
"Project") .
'</td><td colspan="2">';
1236 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1237 print $formproject->select_projects($soc->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 1, 0,
'widthcentpercentminusxx');
1238 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>';
1244 print
'<tr><td>'.$langs->trans(
"DateReception").
'</td>';
1245 print
'<td colspan="3">';
1246 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1247 $date_reception = ($date_reception ? $date_reception :
$object->date_reception);
1248 print $form->selectDate($date_reception ? $date_reception : -1,
'date_reception', 1, 1, 1);
1253 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1254 print
'<td colspan="3">';
1255 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1256 $date_delivery = ($date_delivery ? $date_delivery :
$object->delivery_date);
1257 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1263 print $langs->trans(
"Weight");
1264 print
'</td><td colspan="3">';
1265 print
img_picto(
'',
'fa-balance-scale',
'class="pictofixedwidth"');
1266 print
'<input name="weight" size="4" value="'.GETPOST(
'weight').
'"> ';
1267 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight", (
string)
GETPOSTINT(
'weight_units'), 0, 2);
1268 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1269 print $form->textwithpicto($text, $htmltext);
1274 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1275 print
' </td><td colspan="3">';
1276 print
img_picto(
'',
'fa-ruler',
'class="pictofixedwidth"');
1277 print
'<input name="sizeW" size="4" value="'.GETPOST(
'sizeW').
'">';
1278 print
' x <input name="sizeH" size="4" value="'.GETPOST(
'sizeH').
'">';
1279 print
' x <input name="sizeS" size="4" value="'.GETPOST(
'sizeS').
'">';
1281 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size", (
string)
GETPOSTINT(
'size_units'), 0, 2);
1282 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1283 print $form->textwithpicto($text, $htmltext);
1287 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
1288 print
'<td colspan="3">';
1289 $recept->fetch_delivery_methods();
1290 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1292 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1294 print
"</td></tr>\n";
1297 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1298 print
'<td colspan="3">';
1299 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1300 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1301 print
"</td></tr>\n";
1304 $extrafields->fetch_name_optionals_label(
$object->table_element);
1305 if (empty($reshook) && !empty($extrafields->attributes[
$object->table_element][
'label'])) {
1306 if (
$object->fetch_optionals() > 0) {
1307 $recept->array_options = array_merge($recept->array_options,
$object->array_options);
1309 print $recept->showOptionals($extrafields,
'create', $parameters);
1315 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"),
$object->label_incoterms, 1).
'</label></td>';
1316 print
'<td colspan="3" class="maxwidthonsmartphone">';
1317 print
img_picto(
'',
'incoterm',
'class="pictofixedwidth"');
1318 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1323 print
'<tr><td>'.$langs->trans(
'Model').
'</td>';
1324 print
'<td colspan="2">';
1325 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1326 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
1328 print $form->selectarray(
'model', $list,
getDolGlobalString(
'RECEPTION_ADDON_PDF'), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth200 widthcentpercentminusx', 1);
1334 print
'<td class="tdtop">';
1335 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext);
1337 print
'<td valign="top" colspan="2">';
1338 $doleditor =
new DolEditor(
'note_public', (
string) $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1339 print $doleditor->Create(1);
1342 if (!$user->socid) {
1344 print
'<td class="tdtop">';
1345 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext);
1347 print
'<td valign="top" colspan="2">';
1348 $doleditor =
new DolEditor(
'note_private', (
string) $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1349 print $doleditor->Create(1);
1357 print $form->buttonsSaveCancel(
"CreateDraft");
1360 } elseif ($origin) {
1361 if ($origin ==
'supplierorder') {
1362 $classname =
'CommandeFournisseur';
1364 $classname = ucfirst($origin);
1367 $objectsrc =
new $classname($db);
1368 if ($objectsrc->fetch($origin_id)) {
1370 $soc->fetch($objectsrc->socid);
1372 $author =
new User($db);
1373 $author->fetch($objectsrc->user_author_id);
1379 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1380 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1381 print
'<input type="hidden" name="action" value="add">';
1382 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
1383 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
1384 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
1385 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1387 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
1392 print
'<table class="border centpercent">';
1395 print
'<tr><td class="titlefieldcreate fieldrequired">';
1396 if ($origin ==
'supplierorder' &&
isModEnabled(
"supplier_order")) {
1397 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;
1400 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;
1407 if ($origin ==
'supplier_order') {
1408 print $langs->trans(
'SupplierOrder');
1410 print $langs->trans(
'RefSupplier');
1412 print
'</td><td colspan="3">';
1413 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
1418 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
1419 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
1423 if (
isModEnabled(
'project') && $formproject !==
null) {
1425 if (empty($projectid) && !empty($objectsrc->fk_project)) {
1426 $projectid = $objectsrc->fk_project;
1428 if ($origin ==
'project') {
1429 $projectid = ($origin_id ? $origin_id : 0);
1432 $langs->load(
"projects");
1434 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1435 print
img_picto(
'',
'project',
'class="paddingright"');
1436 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');
1437 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>';
1443 print
'<tr><td>'.$langs->trans(
"DateReception").
'</td>';
1444 print
'<td colspan="3">';
1445 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1446 $date_reception = ($date_reception ? $date_reception :
$object->date_reception);
1447 print $form->selectDate($date_reception ? $date_reception : -1,
'date_reception', 1, 1, 1);
1452 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
1453 print
'<td colspan="3">';
1454 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1455 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
1456 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
1461 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
1462 print
'<td colspan="3">';
1463 $doleditor =
new DolEditor(
'note_public', $objectsrc->note_public,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1464 print $doleditor->Create(1);
1468 if ($objectsrc->note_private && !$user->socid) {
1469 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
1470 print
'<td colspan="3">';
1471 $doleditor =
new DolEditor(
'note_private', $objectsrc->note_private,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1472 print $doleditor->Create(1);
1478 print $langs->trans(
"Weight");
1479 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight').
'"> ';
1480 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight", (
string)
GETPOSTINT(
'weight_units'), 0, 2);
1481 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1482 print $form->textwithpicto($text, $htmltext);
1486 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
1487 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth').
'">';
1488 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight').
'">';
1489 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth').
'">';
1491 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size", (
string)
GETPOSTINT(
'size_units'), 0, 2);
1492 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
1493 print $form->textwithpicto($text, $htmltext);
1497 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
1498 print
'<td colspan="3">';
1499 $recept->fetch_delivery_methods();
1500 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
1502 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1504 print
"</td></tr>\n";
1507 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
1508 print
'<td colspan="3">';
1509 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
1510 print
"</td></tr>\n";
1513 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
1514 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $recept, $action);
1515 print $hookmanager->resPrint;
1518 $extrafields->fetch_name_optionals_label(
$object->table_element);
1519 if (empty($reshook) && !empty($extrafields->attributes[
$object->table_element][
'label'])) {
1521 if ($objectsrc->fetch_optionals() > 0) {
1522 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
1524 print $recept->showOptionals($extrafields,
'create', $parameters);
1530 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
1531 print
'<td colspan="3" class="maxwidthonsmartphone">';
1532 print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
1537 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
1540 if (is_array($list) && count($list) > 1) {
1541 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
1542 print
'<td colspan="3">';
1544 print
"</td></tr>\n";
1558 $suffix2numAsked = array();
1559 $dispatchLines = array();
1561 foreach ($_POST as $key => $value) {
1566 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
1568 $paramSuffix = $reg[1] .
'_' . $reg[2];
1569 $suffix2numAsked[$paramSuffix] = $numAsked;
1572 $numline = $numAsked;
1574 $prod =
"product_" . $paramSuffix;
1575 $qty =
"qty_" . $paramSuffix;
1576 $ent =
"entrepot_" . $paramSuffix;
1577 $pu =
"pu_" . $paramSuffix;
1578 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
1583 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
1585 $paramSuffix = $reg[1] .
'_' . $reg[2];
1586 $suffix2numAsked[$paramSuffix] = $numAsked;
1590 $numline = $numAsked;
1592 $prod =
'product_batch_' . $paramSuffix;
1593 $qty =
'qty_' . $paramSuffix;
1594 $ent =
'entrepot_' . $paramSuffix;
1595 $pu =
'pu_' . $paramSuffix;
1596 $lot =
'lot_number_' . $paramSuffix;
1599 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
1600 $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));
1604 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1606 $paramSuffix = $reg[1];
1607 $suffix2numAsked[$paramSuffix] = $numAsked;
1611 $numline = $numAsked;
1613 $prod =
'productid'.$paramSuffix;
1614 $comment =
'comment'.$paramSuffix;
1615 $qty =
'qtyl'.$paramSuffix;
1616 $ent =
'entl'.$paramSuffix;
1617 $pu =
'pul'.$paramSuffix;
1618 $lot =
'batch'.$paramSuffix;
1621 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1622 $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' =>
GETPOST($lot));
1629 foreach ($suffix2numAsked as $suffix => $n) {
1630 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'receptiondet_batch',
'_' . $suffix,
'');
1633 print
'<script type="text/javascript">
1634 jQuery(document).ready(function() {
1635 jQuery("#autofill").click(function(event) {
1636 event.preventDefault();';
1638 while ($i <= $numAsked) {
1639 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1643 jQuery("#autoreset").click(function(event) {
1644 event.preventDefault();';
1646 while ($i <= $numAsked) {
1647 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1656 print
'<table class="noborder centpercent">';
1659 $objectsrc->loadReceptions();
1662 print
'<tr class="liste_titre">';
1663 print
'<td>'.$langs->trans(
"Description").
'</td>';
1664 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1665 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1666 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1667 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1669 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1672 print
' <br><center><a href="#" id="autofill"><span class="fas fa-fill pictofixedwidth" style=""></span> '.$langs->trans(
"Fill").
'</a>';
1673 print
' <a href="#" id="autoreset"><span class="fas fa-eraser pictofixedwidth" style=""></span>'.$langs->trans(
"Reset").
'</a></center><br>';
1677 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1680 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1682 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1685 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1694 $arrayofpurchaselinealreadyoutput = array();
1698 while ($indiceAsked <= $numAsked) {
1703 foreach ($objectsrc->lines as $supplierLine) {
1704 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1705 $line = $supplierLine;
1713 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1715 if (!empty($line->date_start)) {
1718 if (!empty($line->date_end)) {
1722 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1723 print
'<tr class="oddeven">'.
"\n";
1726 if ($line->fk_product > 0) {
1727 $product->fetch($line->fk_product);
1728 $product->load_stock(
'warehouseopen');
1733 print
'<a name="'.$line->id.
'"></a>';
1735 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1737 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1738 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1741 $product_static = $product;
1743 $text = $product_static->getNomUrl(1);
1744 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1746 print $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i);
1749 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1753 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1759 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1761 $text =
img_object($langs->trans(
'Service'),
'service');
1763 $text =
img_object($langs->trans(
'Product'),
'product');
1766 if (!empty($line->label)) {
1767 $text .=
' <strong>'.$line->label.
'</strong>';
1768 print $form->textwithtooltip($text, $line->desc, 3, 0,
'', (
string) $i);
1770 print $text.
' '.nl2br($line->desc);
1774 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1781 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1783 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1787 print
'<td class="center">';
1788 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1791 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1792 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->subprice.
'">';
1793 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1795 $qtyProdCom = $line->qty;
1798 print
'<td class="center">';
1799 $quantityDelivered = isset($objectsrc->receptions[$line->id]) ? $objectsrc->receptions[$line->id] : 0;
1800 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1801 print $quantityDelivered;
1803 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1808 $quantityToBeDelivered = 0;
1810 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1812 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1815 $warehouseObject =
null;
1818 print
'<!-- Case warehouse already known or product not a predefined product -->';
1819 if (array_key_exists($dispatchLines[$indiceAsked][
'ent'], $product->stock_warehouse)) {
1820 $stock = +$product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1822 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1823 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1826 print
'<td class="center">';
1829 $defaultqty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1831 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1832 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1834 print $langs->trans(
"NA");
1840 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.
price($cost_price).
'">';
1846 print
'<td class="left">';
1849 $ent =
"entl".$indiceAsked;
1850 $idl =
"idl".$indiceAsked;
1852 if ($line->fk_product > 0) {
1853 print
'<!-- Show warehouse selection -->';
1854 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1857 print $langs->trans(
"Service");
1863 if (!empty($product->status_batch)) {
1864 print
'<td><input name="batch'.$indiceAsked.
'" value="'.
dol_escape_htmltag($dispatchLines[$indiceAsked][
'lot']).
'"></td>';
1866 print
'<td class="nowraponall">';
1867 print $form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked, 0, 0, 1,
"");
1871 print
'<td class="nowraponall">';
1872 print $form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked, 0, 0, 1,
"");
1876 print
'<td colspan="3"></td>';
1881 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1887 if (!empty($extrafields)) {
1901 $srcLine->id = $line->id;
1902 $srcLine->fetch_optionals();
1904 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1905 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1907 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1909 print $recLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="oddeven"',
'colspan' => $colspan), (
string) $indiceAsked,
'',
'1');
1919 print $form->buttonsSaveCancel(
"Create");
1936 $num_prod = count($lines);
1940 print $langs->trans(
"NoRecordFound");
1947 $typeobject =
$object->origin;
1949 $origin_id =
$object->origin_id;
1956 $res =
$object->fetch_optionals();
1959 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1964 if ($action ==
'delete') {
1965 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception",
$object->ref),
'confirm_delete',
'', 0, 1);
1969 if ($action ==
'valid') {
1970 $objectref = substr(
$object->ref, 1, 4);
1971 if ($objectref ==
'PROV') {
1972 $numref =
$object->getNextNumRef($soc);
1974 $numref = (string)
$object->ref;
1977 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1979 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1981 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1985 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1986 $notify =
new Notify($db);
1988 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE',
$object->socid, $object);
1991 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1, 250);
1995 if ($action ==
'annuler') {
1996 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception",
$object->ref),
'confirm_cancel',
'', 0, 1);
1999 if (!$formconfirm) {
2000 $parameters = array(
'formConfirm' => $formconfirm);
2001 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
2002 if (empty($reshook)) {
2003 $formconfirm .= $hookmanager->resPrint;
2004 } elseif ($reshook > 0) {
2005 $formconfirm = $hookmanager->resPrint;
2015 $tmparray =
$object->getTotalWeightVolume();
2016 $totalWeight = $tmparray[
'weight'];
2017 $totalVolume = $tmparray[
'volume'];
2022 $objectsrc->fetch(
$object->origin_object->id);
2025 $objectsrc =
new Propal($db);
2026 $objectsrc->fetch(
$object->origin_object->id);
2028 if (($typeobject ==
'order_supplier' || $typeobject ==
'supplier_order' || $typeobject ==
'CommandeFournisseur') &&
$object->origin_object->id &&
isModEnabled(
"supplier_order")) {
2030 $objectsrc->fetch(
$object->origin_object->id);
2033 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
2034 $morehtmlref =
'<div class="refidno">';
2037 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'', 0, 1);
2038 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'',
null,
null,
'', 1);
2041 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
2043 if ($origin && $origin_id > 0) {
2045 $langs->load(
"projects");
2046 $morehtmlref .=
'<br>';
2048 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
2049 if ($action !=
'classify') {
2050 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
2052 $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');
2054 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
2056 $proj->fetch($objectsrc->fk_project);
2057 $morehtmlref .= $proj->getNomUrl(1);
2059 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
2067 $langs->load(
"projects");
2068 $morehtmlref .=
'<br>';
2069 if ($permissiontoadd) {
2070 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
2071 if ($action !=
'classify') {
2072 $morehtmlref .=
'<a class="editfielda" href="' . $_SERVER[
'PHP_SELF'] .
'?action=classify&token=' .
newToken() .
'&id=' .
$object->id .
'">' .
img_edit($langs->transnoentitiesnoconv(
'SetProject')) .
'</a> ';
2074 $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');
2076 if (!empty(
$object->fk_project)) {
2078 $proj->fetch(
$object->fk_project);
2079 $morehtmlref .= $proj->getNomUrl(1);
2081 $morehtmlref .=
'<span class="opacitymedium"> - ' .
dol_escape_htmltag($proj->title) .
'</span>';
2087 $morehtmlref .=
'</div>';
2089 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
2092 print
'<div class="fichecenter">';
2093 print
'<div class="fichehalfleft">';
2094 print
'<div class="underbanner clearboth"></div>';
2096 print
'<table class="border centpercent tableforfield">';
2101 print $langs->trans(
"RefOrder").
'</td>';
2102 print
'<td colspan="3">';
2103 print $objectsrc->getNomUrl(1,
'commande');
2109 print $langs->trans(
"RefProposal").
'</td>';
2110 print
'<td colspan="3">';
2111 print $objectsrc->getNomUrl(1,
'reception');
2115 if (($typeobject ==
'order_supplier' || $typeobject ==
'supplier_order' || $typeobject ==
'CommandeFournisseur') &&
$object->origin_object->id &&
isModEnabled(
"supplier_order")) {
2117 print $langs->trans(
"SupplierOrder").
'</td>';
2118 print
'<td colspan="3">';
2119 print $objectsrc->getNomUrl(1,
'reception');
2125 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
2126 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
2130 print
'<tr><td height="10">';
2131 print
'<table class="nobordernopadding centpercent"><tr><td>';
2132 print $langs->trans(
'DateReception');
2134 if ($action !=
'editdate_reception') {
2135 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>';
2137 print
'</tr></table>';
2139 if ($action ==
'editdate_reception') {
2140 print
'<form name="setdate_reception" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'" method="post">';
2141 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
2142 print
'<input type="hidden" name="action" value="setdate_reception">';
2143 print $form->selectDate(
$object->date_reception ?
$object->date_reception : -1,
'recep_', 1, 1, 0,
"setdate_reception", 1, 0);
2144 print
'<input type="submit" class="button button-edit smallpaddingimp" value="' . $langs->trans(
'Modify') .
'">';
2153 print
'<tr><td height="10">';
2154 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2155 print $langs->trans(
'DateDeliveryPlanned');
2158 if ($action !=
'editdate_livraison' && $permissiontoadd) {
2159 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>';
2161 print
'</tr></table>';
2162 print
'</td><td colspan="2">';
2163 if ($action ==
'editdate_livraison') {
2164 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2165 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2166 print
'<input type="hidden" name="action" value="setdate_livraison">';
2167 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
2168 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
2178 print $form->editfieldkey(
"Weight",
'trueWeight', (
string)
$object->trueWeight, $object, $user->hasRight(
'reception',
'creer'));
2179 print
'</td><td colspan="3">';
2181 if ($action ==
'edittrueWeight') {
2182 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2183 print
'<input name="action" value="settrueWeight" type="hidden">';
2184 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2185 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2186 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
2187 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", (
string)
$object->weight_units, 0, 2);
2188 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2189 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2193 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
2197 if ($totalWeight > 0) {
2198 if (!empty(
$object->trueWeight)) {
2199 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
2202 if (!empty(
$object->trueWeight)) {
2209 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', (
string)
$object->trueWidth, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2210 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth, $object, $user->hasRight(
'reception',
'creer'));
2211 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
2215 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', (
string)
$object->trueHeight, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2216 if ($action ==
'edittrueHeight') {
2217 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
2218 print
'<input name="action" value="settrueHeight" type="hidden">';
2219 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
2220 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2221 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
2222 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
2223 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
2224 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
2228 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
2234 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', (
string)
$object->trueDepth, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2235 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth, $object, $user->hasRight(
'reception',
'creer'));
2236 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
2241 print $langs->trans(
"Volume");
2243 print
'<td colspan="3">';
2244 $calculatedVolume = 0;
2248 $volumeUnit =
$object->size_units * 3;
2251 if ($calculatedVolume > 0) {
2252 if ($volumeUnit < 50) {
2258 if ($totalVolume > 0) {
2259 if ($calculatedVolume) {
2260 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
2264 if ($calculatedVolume) {
2274 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2279 print
'<div class="fichehalfright">';
2280 print
'<div class="underbanner clearboth"></div>';
2282 print
'<table class="border centpercent tableforfield">';
2285 print
'<tr><td height="10">';
2286 print
'<table class="nobordernopadding centpercent"><tr><td>';
2287 print $langs->trans(
'ReceptionMethod');
2290 if ($action !=
'editshipping_method_id' && $permissiontoadd) {
2291 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>';
2293 print
'</tr></table>';
2294 print
'</td><td colspan="2">';
2295 if ($action ==
'editshipping_method_id') {
2296 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
2297 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2298 print
'<input type="hidden" name="action" value="setshipping_method_id">';
2299 $object->fetch_delivery_methods();
2300 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
2302 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2304 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
2307 if (
$object->shipping_method_id > 0) {
2309 $code = $langs->getLabelFromKey($db, (
string)
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
2310 print $langs->trans(
"SendingMethod".strtoupper($code));
2317 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
2318 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url, $object, $user->hasRight(
'reception',
'creer'),
'safehtmlstring',
$object->tracking_number);
2324 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2325 print $langs->trans(
'IncotermLabel');
2326 print
'<td><td class="right">';
2327 if ($user->hasRight(
'reception',
'creer')) {
2328 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
2332 print
'</td></tr></table>';
2334 print
'<td colspan="3">';
2335 if ($action !=
'editincoterm') {
2336 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
2338 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
2348 print
'<div class="clearboth"></div>';
2354 if (!empty(
$object->table_element_line)) {
2356 $result =
$object->getLinesArray();
2358 print
' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">
2359 <input type="hidden" name="token" value="' .
newToken().
'">
2360 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
2361 <input type="hidden" name="mode" value="">
2362 <input type="hidden" name="page_y" value="">
2363 <input type="hidden" name="id" value="' .
$object->id.
'">
2366 if (!empty($conf->use_javascript_ajax) &&
$object->status == $object::STATUS_DRAFT) {
2367 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
2370 print
'<div class="div-table-responsive-no-min">';
2371 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
2372 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
2380 if (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines') {
2381 if ($action !=
'editline') {
2384 $parameters = array();
2385 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
2389 if (empty($reshook)) {
2395 if (!empty(
$object->lines) || (
$object->status == Reception::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
2404 if ($action ==
'editline') {
2405 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
2406 <input type="hidden" name="token" value="' .
newToken().
'">
2407 <input type="hidden" name="action" value="updateline">
2408 <input type="hidden" name="mode" value="">
2409 <input type="hidden" name="id" value="' .
$object->id.
'">';
2413 print
'<div class="div-table-responsive-no-min">';
2414 print
'<table id="tablelines" class="noborder centpercent">';
2416 print
'<tr class="liste_titre">';
2419 print
'<td width="5" class="center"> </td>';
2422 print
'<td>'.$langs->trans(
"Products").
'</td>';
2424 print
'<td>'.$langs->trans(
"Comment").
'</td>';
2426 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
2427 if ($origin && $origin_id > 0) {
2428 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
2432 if ($action ==
'editline') {
2436 if (empty($conf->productbatch->enabled)) {
2439 print
'<td class="center" colspan="'.$editColspan.
'">';
2441 print $langs->trans(
"QtyToReceive").
' - ';
2443 print $langs->trans(
"QtyReceived").
' - ';
2446 print $langs->trans(
"WarehouseTarget").
' - ';
2449 print $langs->trans(
"Batch");
2453 $statusreceived = $object::STATUS_CLOSED;
2455 $statusreceived = $object::STATUS_VALIDATED;
2458 $statusreceived = $object::STATUS_CLOSED;
2460 if (
$object->statut < $statusreceived) {
2461 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
2463 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
2466 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
2470 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
2473 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
2474 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
2477 print
'<td class="linecoledit"></td>';
2478 print
'<td class="linecoldelete" width="10"></td>';
2485 $outputlangs = $langs;
2489 if (
GETPOST(
'lang_id',
'aZ09')) {
2490 $newlang =
GETPOST(
'lang_id',
'aZ09');
2492 if (empty($newlang)) {
2493 $newlang =
$object->thirdparty->default_lang;
2495 if (!empty($newlang)) {
2496 $outputlangs =
new Translate(
"", $conf);
2497 $outputlangs->setDefaultLang($newlang);
2502 $alreadysent = array();
2506 if (empty($origin) || $origin ==
'order_supplier') {
2507 $origin =
'supplier_order';
2510 if ($origin_id > 0) {
2511 $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";
2512 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
2513 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
2514 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
2515 $sql .=
', p.description as product_desc';
2516 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as ed";
2517 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
2518 $sql .=
", ".MAIN_DB_PREFIX.(($origin ==
'supplier_order') ?
'commande_fournisseur' : $origin).
"det as obj";
2519 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
2520 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
2521 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
2522 $sql .=
" AND obj.rowid = ed.fk_elementdet";
2523 $sql .=
" AND ed.fk_reception = e.rowid";
2524 $sql .=
" AND ed.fk_reception !=".((int)
$object->id);
2525 $sql .=
" ORDER BY obj.fk_product";
2527 dol_syslog(
"get list of reception lines", LOG_DEBUG);
2528 $resql = $db->query($sql);
2530 $num = $db->num_rows($resql);
2534 $obj = $db->fetch_object($resql);
2537 $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);
2545 $arrayofpurchaselinealreadyoutput = array();
2549 for ($i = 0; $i < $num_prod; $i++) {
2550 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
2551 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
2555 print
'<td class="center">'.($i + 1).
'</td>';
2559 if ($lines[$i]->fk_product > 0) {
2563 $prod->fetch($lines[$i]->fk_product);
2564 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
2566 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
2569 print
'<td class="linecoldescription">';
2570 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2571 $text = $lines[$i]->product->getNomUrl(1);
2572 $text .=
' - '.$label;
2574 print $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i);
2575 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
2582 print
'<td class="linecoldescription">';
2583 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2585 $text =
img_object($langs->trans(
'Service'),
'service');
2587 $text =
img_object($langs->trans(
'Product'),
'product');
2590 if (!empty($lines[$i]->label)) {
2591 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
2592 print $form->textwithtooltip($text, $lines[$i]->
description, 3, 0,
'', (
string) $i);
2602 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2603 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
2605 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
2610 print
'<td class="center linecolqty">';
2611 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2612 print $lines[$i]->qty_asked;
2617 if ($origin && $origin_id > 0) {
2618 print
'<td class="center nowrap linecolqtyinotherreceptions">';
2620 $qtyalreadyreceived = 0;
2621 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
2622 foreach ($alreadysent as $key => $val) {
2623 if ($lines[$i]->fk_commandefourndet == $key) {
2625 foreach ($val as $receptionline_id => $receptionline_var) {
2626 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
2632 $htmltooltip .=
'<br>';
2634 $reception_static->fetch($receptionline_var[
'reception_id']);
2635 $htmltooltip .= $reception_static->getNomUrl(1,
'nolink', 0, 0, 1);
2636 $htmltooltip .=
' - '.$receptionline_var[
'qty'];
2638 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
2639 if (
isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
2640 $warehousestatic->fetch($receptionline_var[
'warehouse']);
2641 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
2643 $htmltooltip .=
' '.$form->textwithpicto(
'', $htmltext, 1);
2645 $qtyalreadyreceived += $receptionline_var[
'qty'];
2648 $htmltooltip = $langs->trans(
"QtyInOtherReceptions").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
2653 print $form->textwithpicto((
string) $qtyalreadyreceived, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
2657 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2659 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
2661 if ($lines[$i]->fk_product > 0) {
2662 print
'<!-- case edit 1 -->';
2665 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2667 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2669 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
2670 print
'<td class="nowraponall left"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
2672 print $langs->trans(
'SellByDate').
' : ';
2673 print $form->selectDate($lines[$i]->sellby,
'dlc'.$line_id, 0, 0, 1,
"").
'</br>';
2676 print $langs->trans(
'EatByDate').
' : ';
2677 print $form->selectDate($lines[$i]->eatby,
'dluo'.$line_id, 0, 0, 1,
"");
2683 print
'<!-- case edit 2 -->';
2686 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2694 print
'</table></td>';
2697 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
2701 if ($lines[$i]->fk_entrepot > 0) {
2703 $entrepot->fetch($lines[$i]->fk_entrepot);
2705 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
2706 print $entrepot->getNomUrl(1);
2715 if (isset($lines[$i]->batch)) {
2716 print
'<!-- Detail of lot -->';
2717 print
'<td class="linecolbatch nowrap">';
2718 $detail = $langs->trans(
"NA");
2719 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
2720 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
2722 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
2724 $detail = $productlot->getNomUrl(1);
2727 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
2729 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2732 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2734 $detail = $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2737 print $detail .
'</td>';
2745 print
'<td class="center linecolweight">';
2747 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2754 print
'<td class="center linecolvolume">';
2756 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2763 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2764 print
'<td class="center valignmiddle" colspan="2">';
2765 print
'<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2766 print
'<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2768 } elseif (
$object->statut == Reception::STATUS_DRAFT) {
2770 print
'<td class="linecoledit center">';
2771 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2773 print
'<td class="linecoldelete" width="10">';
2774 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2778 if (isset($rowExtrafieldsStart, $rowExtrafieldsView, $rowEnd)) {
2779 print $rowExtrafieldsStart;
2780 print $rowExtrafieldsView;
2786 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2789 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2790 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2800 $line->id = $lines[$i]->id;
2801 $line->fetch_optionals();
2803 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2804 print $line->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan),
'');
2806 print $line->showOptionals($extrafields,
'view', array(
'colspan' => $colspan),
'');
2828 if (($user->socid == 0) && ($action !=
'presend')) {
2829 print
'<div class="tabsAction">';
2831 $parameters = array();
2832 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2833 if (empty($reshook)) {
2834 if (
$object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2835 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer'))
2836 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate'))) {
2837 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2839 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2843 if (
$object->statut == Reception::STATUS_VALIDATED && $user->hasRight(
'reception',
'creer')) {
2844 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2849 if (
$object->statut == Reception::STATUS_CLOSED && $user->hasRight(
'reception',
'creer')) {
2850 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2854 if (empty($user->socid)) {
2856 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'reception',
'reception_advance',
'send')) {
2857 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2859 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2866 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
2868 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>';
2875 if (
$object->statut == Reception::STATUS_VALIDATED) {
2876 if ($user->hasRight(
'reception',
'creer') &&
$object->statut > 0) {
2878 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=classifybilled&token='.
newToken().
'">'.$langs->trans(
'ClassifyBilled').
'</a>';
2880 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=classifyclosed&token='.
newToken().
'">'.$langs->trans(
"Close").
'</a>';
2884 if ($user->hasRight(
'reception',
'supprimer')) {
2885 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2897 if ($action !=
'presend' && $action !=
'editline') {
2898 print
'<div class="fichecenter"><div class="fichehalfleft">';
2901 $filedir = $conf->reception->dir_output.
"/".$objectref;
2903 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2905 $genallowed = $user->hasRight(
'reception',
'lire');
2906 $delallowed = $user->hasRight(
'reception',
'creer');
2908 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2912 $somethingshown = $form->showLinkedObjectBlock($object,
'');
2914 print
'</div><div class="fichehalfright">';
2916 print
'</div></div>';
2920 $modelmail =
'reception_send';
2921 $defaulttopic =
'SendReceptionRef';
2922 $diroutput = $conf->reception->dir_output;
2923 $trackid =
'rec'.$object->id;
2925 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.