39require
'../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
50if (isModEnabled(
"product") || isModEnabled(
"service")) {
51 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
53if (isModEnabled(
"propal")) {
54 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
58if (isModEnabled(
'productbatch')) {
59 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
61if (isModEnabled(
'project')) {
62 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
66$langs->loadLangs(array(
"receptions",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'sendings'));
68if (isModEnabled(
'incoterm')) {
69 $langs->load(
'incoterm');
71if (isModEnabled(
'productbatch')) {
72 $langs->load(
'productbatch');
75$origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'reception';
78if (empty($origin_id)) {
81if (empty($origin_id)) {
84if (empty($origin_id)) {
91$action =
GETPOST(
'action',
'alpha');
96$confirm =
GETPOST(
'confirm',
'alpha');
97$cancel =
GETPOST(
'cancel',
'alpha');
98$backtopage =
GETPOST(
'backtopage',
'alpha');
99$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
111$extrafields->fetch_name_optionals_label(
$object->table_element);
112$extrafields->fetch_name_optionals_label(
$object->table_element_line);
113$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
116include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
119$hookmanager->initHooks(array(
'receptioncard',
'globalcard'));
123if ($id > 0 || !empty($ref)) {
136 if (($origin ==
'order_supplier' || $origin ==
'supplier_order') && is_object(
$object->origin_object) && isModEnabled(
"supplier_order")) {
137 $origin_id =
$object->origin_object->id;
138 $objectsrc =
$object->origin_object;
145 $socid = $user->socid;
149if (isModEnabled(
"reception") || $origin ==
'reception' || empty($origin)) {
153 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
154 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
155 } elseif (!$user->hasRight($origin,
'lire') && !$user->hasRight($origin,
'read')) {
160if (isModEnabled(
"reception")) {
161 $permissiontoread = $user->hasRight(
'reception',
'lire');
162 $permissiontoadd = $user->hasRight(
'reception',
'creer');
163 $permissiondellink = $user->hasRight(
'reception',
'creer');
164 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate')));
165 $permissiontodelete = $user->hasRight(
'reception',
'supprimer');
167 $permissiontoread = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
168 $permissiontoadd = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
169 $permissiondellink = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
170 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande',
'receptionner')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande_advance',
'check')));
171 $permissiontodelete = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
181$parameters = array();
182$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
187if (empty($reshook)) {
203 if (!empty($backtopageforcancel)) {
204 header(
"Location: ".$backtopageforcancel);
206 } elseif (!empty($backtopage)) {
207 header(
"Location: ".$backtopage);
214 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
217 if ($action ==
'reopen' && $permissiontoadd) {
222 if ($action ==
'modif' && $permissiontoadd) {
223 $result =
$object->setDraft($user);
227 $outputlangs = $langs;
230 $newlang =
GETPOST(
'lang_id',
'aZ09');
233 $newlang =
$object->thirdparty->default_lang;
235 if (!empty($newlang)) {
237 $outputlangs->setDefaultLang($newlang);
241 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
249 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm') && $permissiontoadd) {
253 if ($action ==
'setref_supplier' && $permissiontoadd) {
258 $result =
$object->setValueFrom(
'ref_supplier',
GETPOST(
'ref_supplier',
'alpha'),
'',
null,
'text',
'', $user,
'RECEPTION_MODIFY');
261 $action =
'editref_supplier';
263 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
268 if ($action ==
'update_extras' && $permissiontoadd) {
272 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
279 $result =
$object->insertExtraFields(
'RECEPTION_MODIFY');
287 $action =
'edit_extras';
292 if ($action ==
'add' && $permissiontoadd) {
300 $object->origin_id = $origin_id;
312 if (
$object->origin ==
"supplierorder") {
313 $object->origin =
'order_supplier';
314 $classname =
'CommandeFournisseur';
316 $classname = ucfirst(
$object->origin);
318 $objectsrc =
new $classname($db);
319 $objectsrc->fetch(
$object->origin_id);
321 $object->socid = $objectsrc->socid;
324 $object->date_delivery = $date_delivery;
325 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
331 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
333 $batch_line = array();
334 $stockLine = array();
335 $array_options = array();
340 foreach ($_POST as $key => $value) {
343 if (strpos($key,
'qtyasked') !==
false) {
349 for ($i = 1; $i <= $num; $i++) {
361 if (
GETPOST($qty,
'alpha') > 0) {
366 $array_options[$i] = $extrafields->getOptionalsFromPost(
$object->table_element_line, $i);
371 for ($i = 1; $i <= $num; $i++) {
375 foreach ($objectsrc->lines as $linesrc) {
376 if ($linesrc->id == $lineId) {
377 $lineToTest = $linesrc;
381 if (empty($lineToTest)) {
385 $comment =
"comment".$i;
390 $cost_price =
"cost_price".$i;
409 if ($entrepot_id < 0) {
416 $eatby =
GETPOST($eatby,
'alpha');
417 $sellby =
GETPOST($sellby,
'alpha');
418 $eatbydate = str_replace(
'/',
'-', $eatby);
419 $sellbydate = str_replace(
'/',
'-', $sellby);
422 $ret =
$object->addline($entrepot_id,
GETPOSTINT($idl),
price2num(
GETPOST($qty),
'MS'), $array_options[$i],
GETPOST($comment), strtotime($eatbydate), strtotime($sellbydate),
GETPOST($batch),
GETPOSTFLOAT($cost_price,
'MU'));
434 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
448 $outputlangs = $langs;
451 $newlang =
GETPOST(
'lang_id',
'aZ09');
454 $newlang =
$object->thirdparty->default_lang;
456 if (!empty($newlang)) {
458 $outputlangs->setDefaultLang($newlang);
463 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
471 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"QtyToReceive").
'/'.$langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
477 header(
"Location: card.php?id=".
$object->id);
484 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && $permissiontovalidate) {
487 $result =
$object->valid($user);
490 $langs->load(
"errors");
495 $outputlangs = $langs;
498 $newlang =
GETPOST(
'lang_id',
'aZ09');
501 $newlang =
$object->thirdparty->default_lang;
503 if (!empty($newlang)) {
505 $outputlangs->setDefaultLang($newlang);
510 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
516 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
517 $result =
$object->delete($user);
519 header(
"Location: ".DOL_URL_ROOT.
'/reception/index.php');
531 } elseif ($action ==
'setdate_livraison' && $permissiontoadd) {
535 $result =
$object->setDeliveryDate($user, $datedelivery);
539 } elseif (($action ==
'settracking_number' || $action ==
'settracking_url'
540 || $action ==
'settrueWeight'
541 || $action ==
'settrueWidth'
542 || $action ==
'settrueHeight'
543 || $action ==
'settrueDepth'
544 || $action ==
'setshipping_method_id') && $permissiontoadd) {
548 if ($action ==
'settracking_number') {
549 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
551 if ($action ==
'settracking_url') {
552 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'restricthtml'));
554 if ($action ==
'settrueWeight') {
558 if ($action ==
'settrueWidth') {
561 if ($action ==
'settrueHeight') {
565 if ($action ==
'settrueDepth') {
568 if ($action ==
'setshipping_method_id') {
573 if (
$object->update($user) >= 0) {
574 header(
"Location: card.php?id=".
$object->id);
581 } elseif ($action ==
'builddoc' && $permissiontoread) {
590 $outputlangs = $langs;
593 $newlang =
GETPOST(
'lang_id',
'aZ09');
596 $newlang = $reception->thirdparty->default_lang;
598 if (!empty($newlang)) {
600 $outputlangs->setDefaultLang($newlang);
602 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
607 } elseif ($action ==
'remove_file' && $permissiontoadd) {
609 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
611 $upload_dir = $conf->reception->dir_output;
612 $file = $upload_dir.
'/'.
GETPOST(
'file');
619 } elseif ($action ==
'classifybilled' && $permissiontoadd) {
620 $result =
$object->setBilled();
622 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
628 } elseif ($action ==
'classifyclosed' && $permissiontoread) {
629 $result =
$object->setClosed();
631 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
637 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoread) {
642 $num_prod = count($lines);
643 for ($i = 0; $i < $num_prod; $i++) {
644 if ($lines[$i]->
id == $line_id) {
646 $line->id = $line_id;
647 if (!$error && $line->delete($user) < 0) {
651 unset($_POST[
"lineid"]);
655 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
660 } elseif ($action ==
'updateline' &&
GETPOST(
'save') && $permissiontoadd) {
668 $num_prod = count($lines);
669 for ($i = 0; $i < $num_prod; $i++) {
670 if ($lines[$i]->
id == $line_id) {
672 $line->fetch($line_id);
674 $extrafields->fetch_name_optionals_label(
$object->table_element_line);
675 $line->array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
678 $line->fk_product = $lines[$i]->fk_product;
681 if ($lines[$i]->fk_product > 0) {
683 $stockLocation =
"entl".$line_id;
684 $qty =
"qtyl".$line_id;
685 $comment =
"comment".$line_id;
688 $line->id = $line_id;
689 $line->fk_entrepot =
GETPOSTINT($stockLocation);
691 $line->comment =
GETPOST($comment,
'alpha');
693 if (isModEnabled(
'productbatch')) {
694 $batch =
"batch".$line_id;
695 $dlc =
"dlc".$line_id;
696 $dluo =
"dluo".$line_id;
698 $eatby =
GETPOST($dluo,
'alpha');
699 $eatbydate = str_replace(
'/',
'-', $eatby);
701 $sellby =
GETPOST($dlc,
'alpha');
702 $sellbydate = str_replace(
'/',
'-', $sellby);
703 $line->batch =
GETPOST($batch,
'alpha');
704 $line->eatby = strtotime($eatbydate);
705 $line->sellby = strtotime($sellbydate);
708 if ($line->update($user) < 0) {
713 $qty =
"qtyl".$line_id;
714 $line->id = $line_id;
716 $line->fk_entrepot = 0;
717 if ($line->update($user) < 0) {
726 unset($_POST[
"lineid"]);
731 $outputlangs = $langs;
734 $newlang =
GETPOST(
'lang_id',
'aZ09');
737 $newlang =
$object->thirdparty->default_lang;
739 if (!empty($newlang)) {
741 $outputlangs->setDefaultLang($newlang);
745 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
748 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
751 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
752 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
756 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
762 $triggersendname =
'RECEPTION_SENTBYMAIL';
764 $mode =
'emailfromreception';
765 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECEPTION_TO';
766 $trackid =
'rec'.$object->id;
767 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
775$title =
$object->ref.
' - '.$langs->trans(
'Reception');
777llxHeader(
'', $title,
'Reception',
'', 0, 0,
'',
'',
'',
'mod-reception page-card');
779$form =
new Form($db);
782if (isModEnabled(
'project')) {
786$product_static =
new Product($db);
788$warehousestatic =
new Entrepot($db);
790if ($action ==
'create2') {
791 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
793 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
800if ($action ==
'create') {
809 if ($origin ==
'supplierorder') {
810 $classname =
'CommandeFournisseur';
812 $classname = ucfirst($origin);
815 $objectsrc =
new $classname($db);
816 if ($objectsrc->fetch($origin_id)) {
818 $soc->fetch($objectsrc->socid);
820 $author =
new User($db);
821 $author->fetch($objectsrc->user_author_id);
823 if (isModEnabled(
'stock')) {
827 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
828 print
'<input type="hidden" name="token" value="'.newToken().
'">';
829 print
'<input type="hidden" name="action" value="add">';
830 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
831 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
832 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
833 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
835 print
'<input type="hidden" name="entrepot_id" value="'.GETPOSTINT(
'entrepot_id').
'">';
840 print
'<table class="border centpercent">';
843 print
'<tr><td class="titlefieldcreate fieldrequired">';
844 if ($origin ==
'supplierorder' && isModEnabled(
"supplier_order")) {
845 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;
847 if ($origin ==
'propal' && isModEnabled(
"propal")) {
848 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;
855 if ($origin ==
'supplier_order') {
856 print $langs->trans(
'SupplierOrder');
858 print $langs->trans(
'RefSupplier');
860 print
'</td><td colspan="3">';
861 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
866 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
867 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
871 if (isModEnabled(
'project')) {
873 if (empty($projectid) && !empty($objectsrc->fk_project)) {
874 $projectid = $objectsrc->fk_project;
876 if ($origin ==
'project') {
877 $projectid = ($originid ? $originid : 0);
880 $langs->load(
"projects");
882 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
883 print
img_picto(
'',
'project',
'class="paddingright"');
884 print $formproject->select_projects((!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $soc->id : -1), $projectid,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
885 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>';
891 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
892 print
'<td colspan="3">';
893 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
894 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
899 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
900 print
'<td colspan="3">';
901 $doleditor =
new DolEditor(
'note_public', $objectsrc->note_public,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
902 print $doleditor->Create(1);
906 if ($objectsrc->note_private && !$user->socid) {
907 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
908 print
'<td colspan="3">';
909 $doleditor =
new DolEditor(
'note_private', $objectsrc->note_private,
'', 60,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
910 print $doleditor->Create(1);
916 print $langs->trans(
"Weight");
917 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOSTINT(
'weight').
'"> ';
918 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOSTINT(
'weight_units'), 0, 2);
919 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
920 print $form->textwithpicto($text, $htmltext);
924 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
925 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOSTINT(
'trueWidth').
'">';
926 print
' x <input name="trueHeight" size="4" value="'.GETPOSTINT(
'trueHeight').
'">';
927 print
' x <input name="trueDepth" size="4" value="'.GETPOSTINT(
'trueDepth').
'">';
929 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOSTINT(
'size_units'), 0, 2);
930 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
931 print $form->textwithpicto($text, $htmltext);
935 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
936 print
'<td colspan="3">';
937 $recept->fetch_delivery_methods();
938 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOSTINT(
'shipping_method_id'), 1, 0, 0,
"", 1);
940 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
942 print
"</td></tr>\n";
945 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
946 print
'<td colspan="3">';
947 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
948 print
"</td></tr>\n";
951 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid' => $socid);
952 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $recept, $action);
953 print $hookmanager->resPrint;
956 $extrafields->fetch_name_optionals_label(
$object->table_element);
957 if (empty($reshook) && !empty($extrafields->attributes[
$object->table_element][
'label'])) {
959 if ($objectsrc->fetch_optionals() > 0) {
960 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
962 print $recept->showOptionals($extrafields,
'create', $parameters);
966 if (isModEnabled(
'incoterm')) {
968 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
969 print
'<td colspan="3" class="maxwidthonsmartphone">';
970 print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
975 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
978 if (is_countable($list) && count($list) > 1) {
979 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
980 print
'<td colspan="3">';
982 print
"</td></tr>\n";
996 $suffix2numAsked = array();
997 $dispatchLines = array();
999 foreach ($_POST as $key => $value) {
1004 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
1006 $paramSuffix = $reg[1] .
'_' . $reg[2];
1007 $suffix2numAsked[$paramSuffix] = $numAsked;
1010 $numline = $numAsked;
1012 $prod =
"product_" . $paramSuffix;
1013 $qty =
"qty_" . $paramSuffix;
1014 $ent =
"entrepot_" . $paramSuffix;
1015 $pu =
"pu_" . $paramSuffix;
1016 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
1021 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
1023 $paramSuffix = $reg[1] .
'_' . $reg[2];
1024 $suffix2numAsked[$paramSuffix] = $numAsked;
1028 $numline = $numAsked;
1030 $prod =
'product_batch_' . $paramSuffix;
1031 $qty =
'qty_' . $paramSuffix;
1032 $ent =
'entrepot_' . $paramSuffix;
1033 $pu =
'pu_' . $paramSuffix;
1034 $lot =
'lot_number_' . $paramSuffix;
1037 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
1038 $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));
1042 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1044 $paramSuffix = $reg[1];
1045 $suffix2numAsked[$paramSuffix] = $numAsked;
1049 $numline = $numAsked;
1051 $prod =
'productid'.$paramSuffix;
1052 $comment =
'comment'.$paramSuffix;
1053 $qty =
'qtyl'.$paramSuffix;
1054 $ent =
'entl'.$paramSuffix;
1055 $pu =
'pul'.$paramSuffix;
1056 $lot =
'batch'.$paramSuffix;
1059 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1060 $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));
1067 foreach ($suffix2numAsked as $suffix => $n) {
1068 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'receptiondet_batch',
'_' . $suffix,
'');
1071 print
'<script type="text/javascript">
1072 jQuery(document).ready(function() {
1073 jQuery("#autofill").click(function(event) {
1074 event.preventDefault();';
1076 while ($i <= $numAsked) {
1077 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1081 jQuery("#autoreset").click(function(event) {
1082 event.preventDefault();';
1084 while ($i <= $numAsked) {
1085 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1094 print
'<table class="noborder centpercent">';
1097 $objectsrc->loadReceptions();
1100 print
'<tr class="liste_titre">';
1101 print
'<td>'.$langs->trans(
"Description").
'</td>';
1102 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1103 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1104 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1105 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1107 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1109 if (!isModEnabled(
'productbatch')) {
1110 print
' <br><center><a href="#" id="autofill"><span class="fas fa-fill pictofixedwidth" style=""></span> '.$langs->trans(
"Fill").
'</a>';
1111 print
' <a href="#" id="autoreset"><span class="fas fa-eraser pictofixedwidth" style=""></span>'.$langs->trans(
"Reset").
'</a></center><br>';
1114 if (isModEnabled(
'stock')) {
1115 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1117 if (isModEnabled(
'productbatch')) {
1118 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1120 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1123 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1132 $arrayofpurchaselinealreadyoutput = array();
1136 while ($indiceAsked <= $numAsked) {
1140 foreach ($objectsrc->lines as $supplierLine) {
1141 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1142 $line = $supplierLine;
1148 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1151 if (!empty($line->date_start)) {
1154 if (!empty($line->date_end)) {
1158 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1159 print
'<tr class="oddeven">'.
"\n";
1162 if ($line->fk_product > 0) {
1163 $product->fetch($line->fk_product);
1164 $product->load_stock(
'warehouseopen');
1169 print
'<a name="'.$line->id.
'"></a>';
1171 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1173 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1174 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1177 $product_static = $product;
1179 $text = $product_static->getNomUrl(1);
1180 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1182 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1185 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1189 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1195 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1197 $text =
img_object($langs->trans(
'Service'),
'service');
1199 $text =
img_object($langs->trans(
'Product'),
'product');
1202 if (!empty($line->label)) {
1203 $text .=
' <strong>'.$line->label.
'</strong>';
1204 print $form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1206 print $text.
' '.nl2br($line->desc);
1210 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1217 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1219 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1223 print
'<td class="center">';
1224 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1227 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1228 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->pu_ht.
'">';
1229 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1231 $qtyProdCom = $line->qty;
1234 print
'<td class="center">';
1235 $quantityDelivered = $objectsrc->receptions[$line->id];
1236 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1237 print $quantityDelivered;
1239 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1244 $quantityToBeDelivered = 0;
1246 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1248 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1251 $warehouseObject =
null;
1252 if (isModEnabled(
'stock')) {
1254 print
'<!-- Case warehouse already known or product not a predefined product -->';
1255 if (array_key_exists($dispatchLines[$indiceAsked][
'ent'], $product->stock_warehouse)) {
1256 $stock = +$product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1258 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1259 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1262 print
'<td class="center">';
1265 $defaultqty =
GETPOSTINT(
'qtyl'.$indiceAsked);
1267 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1268 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1270 print $langs->trans(
"NA");
1276 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.$cost_price.
'">';
1281 if (isModEnabled(
'stock')) {
1282 print
'<td class="left">';
1285 $ent =
"entl".$indiceAsked;
1286 $idl =
"idl".$indiceAsked;
1288 if ($line->fk_product > 0) {
1289 print
'<!-- Show warehouse selection -->';
1290 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1293 print $langs->trans(
"Service");
1298 if (isModEnabled(
'productbatch')) {
1299 if (!empty($product->status_batch)) {
1300 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1302 print
'<td class="nowraponall">';
1303 print $form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked, 0, 0, 1,
"");
1307 print
'<td class="nowraponall">';
1308 print $form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked, 0, 0, 1,
"");
1312 print
'<td colspan="3"></td>';
1317 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1323 if (!empty($extrafields)) {
1325 if (isModEnabled(
'productbatch')) {
1337 $srcLine->id = $line->id;
1338 $srcLine->fetch_optionals();
1340 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1341 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1343 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1345 print $recLine->showOptionals($extrafields,
'edit', array(
'style' =>
'class="oddeven"',
'colspan' => $colspan), $indiceAsked,
'', 1);
1355 print $form->buttonsSaveCancel(
"Create");
1364} elseif ($id || $ref) {
1372 $num_prod = count($lines);
1376 print $langs->trans(
"NoRecordFound");
1382 $object->origin =
'CommandeFournisseur';
1383 $typeobject =
$object->origin;
1385 $origin_id =
$object->origin_id;
1392 $res =
$object->fetch_optionals();
1395 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1400 if ($action ==
'delete') {
1401 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception",
$object->ref),
'confirm_delete',
'', 0, 1);
1405 if ($action ==
'valid') {
1406 $objectref = substr(
$object->ref, 1, 4);
1407 if ($objectref ==
'PROV') {
1408 $numref =
$object->getNextNumRef($soc);
1413 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1415 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1417 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1420 if (isModEnabled(
'notification')) {
1421 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1422 $notify =
new Notify($db);
1424 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE',
$object->socid,
$object);
1427 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1, 250);
1431 if ($action ==
'annuler') {
1432 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception",
$object->ref),
'confirm_cancel',
'', 0, 1);
1435 if (!$formconfirm) {
1436 $parameters = array(
'formConfirm' => $formconfirm);
1437 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
1438 if (empty($reshook)) {
1439 $formconfirm .= $hookmanager->resPrint;
1440 } elseif ($reshook > 0) {
1441 $formconfirm = $hookmanager->resPrint;
1451 $tmparray =
$object->getTotalWeightVolume();
1452 $totalWeight = $tmparray[
'weight'];
1453 $totalVolume = $tmparray[
'volume'];
1456 if ($typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
1458 $objectsrc->fetch(
$object->origin_object->id);
1460 if ($typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1461 $objectsrc =
new Propal($db);
1462 $objectsrc->fetch(
$object->origin_object->id);
1464 if ($typeobject ==
'CommandeFournisseur' &&
$object->origin_object->id && isModEnabled(
"supplier_order")) {
1466 $objectsrc->fetch(
$object->origin_object->id);
1469 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1470 $morehtmlref =
'<div class="refidno">';
1473 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier,
$object, $user->hasRight(
'reception',
'creer'),
'string',
'', 0, 1);
1474 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier,
$object, $user->hasRight(
'reception',
'creer'),
'string',
'',
null,
null,
'', 1);
1477 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1479 if (isModEnabled(
'project')) {
1480 $langs->load(
"projects");
1481 $morehtmlref .=
'<br>';
1483 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1484 if ($action !=
'classify' && $permissiontoadd) {
1485 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1487 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ?
$object->socid : -1),
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1489 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1491 $proj->fetch($objectsrc->fk_project);
1492 $morehtmlref .= $proj->getNomUrl(1);
1494 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1499 $morehtmlref .=
'</div>';
1501 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1504 print
'<div class="fichecenter">';
1505 print
'<div class="fichehalfleft">';
1506 print
'<div class="underbanner clearboth"></div>';
1508 print
'<table class="border centpercent tableforfield">';
1511 if ($typeobject ==
'commande' &&
$object->origin_object->id && isModEnabled(
'order')) {
1513 print $langs->trans(
"RefOrder").
'</td>';
1514 print
'<td colspan="3">';
1515 print $objectsrc->getNomUrl(1,
'commande');
1519 if ($typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1521 print $langs->trans(
"RefProposal").
'</td>';
1522 print
'<td colspan="3">';
1523 print $objectsrc->getNomUrl(1,
'reception');
1527 if ($typeobject ==
'CommandeFournisseur' &&
$object->origin_object->id && isModEnabled(
"propal")) {
1529 print $langs->trans(
"SupplierOrder").
'</td>';
1530 print
'<td colspan="3">';
1531 print $objectsrc->getNomUrl(1,
'reception');
1537 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1538 print
'<td colspan="3">'.dol_print_date(
$object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
1542 print
'<tr><td height="10">';
1543 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1544 print $langs->trans(
'DateDeliveryPlanned');
1547 if ($action !=
'editdate_livraison' && $permissiontoadd) {
1548 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>';
1550 print
'</tr></table>';
1551 print
'</td><td colspan="2">';
1552 if ($action ==
'editdate_livraison') {
1553 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1554 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1555 print
'<input type="hidden" name="action" value="setdate_livraison">';
1556 print $form->selectDate(
$object->date_delivery ?
$object->date_delivery : -1,
'liv_', 1, 1, 0,
"setdate_livraison", 1, 0);
1557 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1567 print $form->editfieldkey(
"Weight",
'trueWeight',
$object->trueWeight,
$object, $user->hasRight(
'reception',
'creer'));
1568 print
'</td><td colspan="3">';
1570 if ($action ==
'edittrueWeight') {
1571 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1572 print
'<input name="action" value="settrueWeight" type="hidden">';
1573 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1574 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1575 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
1576 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
$object->weight_units, 0, 2);
1577 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1578 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1582 print (
$object->trueWeight &&
$object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight",
$object->weight_units) :
'';
1586 if ($totalWeight > 0) {
1587 if (!empty(
$object->trueWeight)) {
1588 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1591 if (!empty(
$object->trueWeight)) {
1598 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1599 print $form->editfieldval(
"Width",
'trueWidth',
$object->trueWidth,
$object, $user->hasRight(
'reception',
'creer'));
1600 print (
$object->trueWidth &&
$object->width_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->width_units) :
'';
1604 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight',
$object->trueHeight,
$object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1605 if ($action ==
'edittrueHeight') {
1606 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1607 print
'<input name="action" value="settrueHeight" type="hidden">';
1608 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1609 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1610 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
1611 print $formproduct->selectMeasuringUnits(
"size_units",
"size",
$object->size_units, 0, 2);
1612 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1613 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1617 print (
$object->trueHeight &&
$object->height_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->height_units) :
'';
1623 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1624 print $form->editfieldval(
"Depth",
'trueDepth',
$object->trueDepth,
$object, $user->hasRight(
'reception',
'creer'));
1625 print (
$object->trueDepth &&
$object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size",
$object->depth_units) :
'';
1630 print $langs->trans(
"Volume");
1632 print
'<td colspan="3">';
1633 $calculatedVolume = 0;
1637 $volumeUnit =
$object->size_units * 3;
1640 if ($calculatedVolume > 0) {
1641 if ($volumeUnit < 50) {
1647 if ($totalVolume > 0) {
1648 if ($calculatedVolume) {
1649 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1653 if ($calculatedVolume) {
1663 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1668 print
'<div class="fichehalfright">';
1669 print
'<div class="underbanner clearboth"></div>';
1671 print
'<table class="border centpercent tableforfield">';
1674 print
'<tr><td height="10">';
1675 print
'<table class="nobordernopadding centpercent"><tr><td>';
1676 print $langs->trans(
'ReceptionMethod');
1679 if ($action !=
'editshipping_method_id' && $permissiontoadd) {
1680 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>';
1682 print
'</tr></table>';
1683 print
'</td><td colspan="2">';
1684 if ($action ==
'editshipping_method_id') {
1685 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
1686 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1687 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1688 $object->fetch_delivery_methods();
1689 print $form->selectarray(
"shipping_method_id",
$object->meths,
$object->shipping_method_id, 1, 0, 0,
"", 1);
1691 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1693 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1696 if (
$object->shipping_method_id > 0) {
1698 $code = $langs->getLabelFromKey($db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1699 print $langs->trans(
"SendingMethod".strtoupper($code));
1706 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number',
$object->tracking_number,
$object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1707 print $form->editfieldval(
"TrackingNumber",
'tracking_number',
$object->tracking_url,
$object, $user->hasRight(
'reception',
'creer'),
'safehtmlstring',
$object->tracking_number);
1711 if (isModEnabled(
'incoterm')) {
1713 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1714 print $langs->trans(
'IncotermLabel');
1715 print
'<td><td class="right">';
1716 if ($user->hasRight(
'reception',
'creer')) {
1717 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
1721 print
'</td></tr></table>';
1723 print
'<td colspan="3">';
1724 if ($action !=
'editincoterm') {
1725 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
1727 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
1737 print
'<div class="clearboth"></div>';
1741 if ($action ==
'editline') {
1742 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$line_id.
'" method="POST">
1743 <input type="hidden" name="token" value="' .
newToken().
'">
1744 <input type="hidden" name="action" value="updateline">
1745 <input type="hidden" name="mode" value="">
1746 <input type="hidden" name="id" value="' .
$object->id.
'">';
1750 print
'<div class="div-table-responsive-no-min">';
1751 print
'<table id="tablelines" class="noborder centpercent">';
1753 print
'<tr class="liste_titre">';
1756 print
'<td width="5" class="center"> </td>';
1759 print
'<td>'.$langs->trans(
"Products").
'</td>';
1761 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1763 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1764 if ($origin && $origin_id > 0) {
1765 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
1767 if ($action ==
'editline') {
1769 if (!isModEnabled(
'stock')) {
1772 if (empty($conf->productbatch->enabled)) {
1775 print
'<td class="center" colspan="'.$editColspan.
'">';
1777 print $langs->trans(
"QtyToReceive").
' - ';
1779 print $langs->trans(
"QtyReceived").
' - ';
1781 if (isModEnabled(
'stock')) {
1782 print $langs->trans(
"WarehouseTarget").
' - ';
1784 if (isModEnabled(
'productbatch')) {
1785 print $langs->trans(
"Batch");
1789 $statusreceived = $object::STATUS_CLOSED;
1791 $statusreceived = $object::STATUS_VALIDATED;
1794 $statusreceived = $object::STATUS_CLOSED;
1796 if (
$object->statut < $statusreceived) {
1797 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
1799 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1801 if (isModEnabled(
'stock')) {
1802 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
1805 if (isModEnabled(
'productbatch')) {
1806 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
1809 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
1810 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
1813 print
'<td class="linecoledit"></td>';
1814 print
'<td class="linecoldelete" width="10"></td>';
1823 $outputlangs = $langs;
1825 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1826 $newlang =
GETPOST(
'lang_id',
'aZ09');
1828 if (empty($newlang)) {
1829 $newlang =
$object->thirdparty->default_lang;
1831 if (!empty($newlang)) {
1832 $outputlangs =
new Translate(
"", $conf);
1833 $outputlangs->setDefaultLang($newlang);
1838 $alreadysent = array();
1840 $origin =
'commande_fournisseur';
1842 if ($origin && $origin_id > 0) {
1843 $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";
1844 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
1845 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
1847 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
1848 $sql .=
', p.description as product_desc';
1849 $sql .=
" FROM ".MAIN_DB_PREFIX.
"receptiondet_batch as ed";
1850 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
1851 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
1853 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
1854 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
1855 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
1856 $sql .=
" AND obj.rowid = ed.fk_elementdet";
1857 $sql .=
" AND ed.fk_reception = e.rowid";
1858 $sql .=
" AND ed.fk_reception !=".((int)
$object->id);
1860 $sql .=
" ORDER BY obj.fk_product";
1862 dol_syslog(
"get list of reception lines", LOG_DEBUG);
1863 $resql = $db->query($sql);
1865 $num = $db->num_rows($resql);
1869 $obj = $db->fetch_object($resql);
1872 $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);
1880 $arrayofpurchaselinealreadyoutput = array();
1884 for ($i = 0; $i < $num_prod; $i++) {
1885 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
1886 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
1890 print
'<td class="center">'.($i + 1).
'</td>';
1894 if ($lines[$i]->fk_product > 0) {
1898 $prod->fetch($lines[$i]->fk_product);
1899 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
1901 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
1904 print
'<td class="linecoldescription">';
1905 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1906 $text = $lines[$i]->product->getNomUrl(1);
1907 $text .=
' - '.$label;
1909 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1910 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
1912 print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ?
'<br>'.dol_htmlentitiesbr($lines[$i]->
description) :
'';
1917 print
'<td class="linecoldescription">';
1918 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1920 $text =
img_object($langs->trans(
'Service'),
'service');
1922 $text =
img_object($langs->trans(
'Product'),
'product');
1925 if (!empty($lines[$i]->label)) {
1926 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
1927 print $form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
1937 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1938 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
1940 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
1945 print
'<td class="center linecolqty">';
1946 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1947 print $lines[$i]->qty_asked;
1952 if ($origin && $origin_id > 0) {
1953 print
'<td class="center nowrap linecolqtyinotherreceptions">';
1955 $qtyalreadyreceived = 0;
1956 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1957 foreach ($alreadysent as $key => $val) {
1958 if ($lines[$i]->fk_commandefourndet == $key) {
1960 foreach ($val as $receptionline_id => $receptionline_var) {
1961 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
1967 $htmltooltip .=
'<br>';
1969 $reception_static->fetch($receptionline_var[
'reception_id']);
1970 $htmltooltip .= $reception_static->getNomUrl(1, 0, 0, 0, 1);
1971 $htmltooltip .=
' - '.$receptionline_var[
'qty'];
1973 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
1974 if (isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
1975 $warehousestatic->fetch($receptionline_var[
'warehouse']);
1976 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
1978 $htmltooltip .=
' '.$form->textwithpicto(
'', $htmltext, 1);
1980 $qtyalreadyreceived += $receptionline_var[
'qty'];
1983 $htmltooltip = $langs->trans(
"QtyInOtherReceptions").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
1988 print $form->textwithpicto($qtyalreadyreceived, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
1992 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1994 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
1995 if (isModEnabled(
'stock')) {
1996 if ($lines[$i]->fk_product > 0) {
1997 print
'<!-- case edit 1 -->';
2000 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2002 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
2004 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
2005 print
'<td class="nowraponall left"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
2007 print $langs->trans(
'SellByDate').
' : ';
2008 print $form->selectDate($lines[$i]->sellby,
'dlc'.$line_id, 0, 0, 1,
"").
'</br>';
2011 print $langs->trans(
'EatByDate').
' : ';
2012 print $form->selectDate($lines[$i]->eatby,
'dluo'.$line_id, 0, 0, 1,
"");
2018 print
'<!-- case edit 2 -->';
2021 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2029 print
'</table></td>';
2032 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
2035 if (isModEnabled(
'stock')) {
2036 if ($lines[$i]->fk_entrepot > 0) {
2038 $entrepot->fetch($lines[$i]->fk_entrepot);
2040 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
2041 print $entrepot->getNomUrl(1);
2049 if (isModEnabled(
'productbatch')) {
2050 if (isset($lines[$i]->batch)) {
2051 print
'<!-- Detail of lot -->';
2052 print
'<td class="linecolbatch nowrap">';
2053 $detail = $langs->trans(
"NA");
2054 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
2055 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
2057 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
2059 $detail = $productlot->getNomUrl(1);
2062 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
2064 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2067 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2069 $detail = $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2072 print $detail .
'</td>';
2080 print
'<td class="center linecolweight">';
2082 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2089 print
'<td class="center linecolvolume">';
2091 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2098 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2099 print
'<td class="center valignmiddle" colspan="2">';
2100 print
'<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2101 print
'<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2103 } elseif (
$object->statut == Reception::STATUS_DRAFT) {
2105 print
'<td class="linecoledit center">';
2106 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2108 print
'<td class="linecoldelete" width="10">';
2109 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2113 if (!empty($rowExtrafieldsStart)) {
2114 print $rowExtrafieldsStart;
2115 print $rowExtrafieldsView;
2121 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2124 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2125 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2127 if (isModEnabled(
'stock')) {
2130 if (isModEnabled(
'productbatch')) {
2135 $line->id = $lines[$i]->id;
2136 $line->fetch_optionals();
2138 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2139 print $line->showOptionals($extrafields,
'edit', array(
'colspan' => $colspan),
'');
2141 print $line->showOptionals($extrafields,
'view', array(
'colspan' => $colspan),
'');
2163 if (($user->socid == 0) && ($action !=
'presend')) {
2164 print
'<div class="tabsAction">';
2166 $parameters = array();
2167 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2168 if (empty($reshook)) {
2169 if (
$object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2170 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer'))
2171 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate'))) {
2172 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2174 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2178 if (
$object->statut == Reception::STATUS_VALIDATED && $user->hasRight(
'reception',
'creer')) {
2179 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2184 if (
$object->statut == Reception::STATUS_CLOSED && $user->hasRight(
'reception',
'creer')) {
2185 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2189 if (empty($user->socid)) {
2191 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'reception',
'reception_advance',
'send')) {
2192 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2194 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2200 if (isModEnabled(
"supplier_invoice") && (
$object->statut == Reception::STATUS_VALIDATED ||
$object->statut == Reception::STATUS_CLOSED)) {
2201 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
2203 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>';
2210 if (
$object->statut == Reception::STATUS_VALIDATED) {
2211 if ($user->hasRight(
'reception',
'creer') &&
$object->statut > 0) {
2213 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=classifybilled&token='.
newToken().
'">'.$langs->trans(
'ClassifyBilled').
'</a>';
2215 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=classifyclosed&token='.
newToken().
'">'.$langs->trans(
"Close").
'</a>';
2219 if ($user->hasRight(
'reception',
'supprimer')) {
2220 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2232 if ($action !=
'presend' && $action !=
'editline') {
2233 print
'<div class="fichecenter"><div class="fichehalfleft">';
2236 $filedir = $conf->reception->dir_output.
"/".$objectref;
2238 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2240 $genallowed = $user->hasRight(
'reception',
'lire');
2241 $delallowed = $user->hasRight(
'reception',
'creer');
2243 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2247 $somethingshown = $form->showLinkedObjectBlock(
$object,
'');
2249 print
'</div><div class="fichehalfright">';
2251 print
'</div></div>';
2255 $modelmail =
'shipping_send';
2256 $defaulttopic =
'SendReceptionRef';
2257 $diroutput = $conf->reception->dir_output;
2258 $trackid =
'rec'.$object->id;
2260 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage 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 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 third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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($unit, $measuring_style='', $scale='', $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.