37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
48if (isModEnabled(
"product") || isModEnabled(
"service")) {
49 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
51if (isModEnabled(
"propal")) {
52 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
56if (isModEnabled(
'productbatch')) {
57 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
59if (isModEnabled(
'project')) {
60 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
64$langs->loadLangs(array(
"receptions",
"companies",
"bills",
'deliveries',
'orders',
'stocks',
'other',
'propal',
'sendings'));
66if (isModEnabled(
'incoterm')) {
67 $langs->load(
'incoterm');
69if (isModEnabled(
'productbatch')) {
70 $langs->load(
'productbatch');
73$origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'reception';
76if (empty($origin_id)) {
77 $origin_id =
GETPOST(
'origin_id',
'int');
79if (empty($origin_id)) {
80 $origin_id =
GETPOST(
'object_id',
'int');
82if (empty($origin_id)) {
83 $origin_id =
GETPOST(
'originid',
'int');
86$line_id =
GETPOST(
'lineid',
'int') ?
GETPOST(
'lineid',
'int') :
'';
87$facid =
GETPOST(
'facid',
'int');
89$action =
GETPOST(
'action',
'alpha');
94$confirm =
GETPOST(
'confirm',
'alpha');
95$cancel =
GETPOST(
'cancel',
'alpha');
96$backtopage =
GETPOST(
'backtopage',
'alpha');
97$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
109$extrafields->fetch_name_optionals_label($object->table_element);
110$extrafields->fetch_name_optionals_label($object->table_element_line);
111$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
114include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
117$hookmanager->initHooks(array(
'receptioncard',
'globalcard'));
119$date_delivery =
dol_mktime(
GETPOST(
'date_deliveryhour',
'int'),
GETPOST(
'date_deliverymin',
'int'), 0,
GETPOST(
'date_deliverymonth',
'int'),
GETPOST(
'date_deliveryday',
'int'),
GETPOST(
'date_deliveryyear',
'int'));
121if ($id > 0 || !empty($ref)) {
122 $object->fetch($id, $ref);
123 $object->fetch_thirdparty();
126 if (!empty($object->origin)) {
127 $origin = $object->origin;
129 $object->fetch_origin();
130 $typeobject = $object->origin;
134 if (($origin ==
'order_supplier' || $origin ==
'supplier_order') && is_object($object->origin_object) && isModEnabled(
"supplier_order")) {
135 $origin_id = $object->origin_object->id;
136 $objectsrc = $object->origin_object;
143 $socid = $user->socid;
147if (isModEnabled(
"reception") || $origin ==
'reception' || empty($origin)) {
151 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
152 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
153 } elseif (!$user->hasRight($origin,
'lire') && !$user->hasRight($origin,
'read')) {
158if (isModEnabled(
"reception")) {
159 $permissiontoread = $user->rights->reception->lire;
160 $permissiontoadd = $user->rights->reception->creer;
161 $permissiondellink = $user->rights->reception->creer;
162 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer)) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate)));
163 $permissiontodelete = $user->rights->reception->supprimer;
165 $permissiontoread = $user->rights->fournisseur->commande->receptionner;
166 $permissiontoadd = $user->rights->fournisseur->commande->receptionner;
167 $permissiondellink = $user->rights->fournisseur->commande->receptionner;
168 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande->receptionner)) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->fournisseur->commande_advance->check)));
169 $permissiontodelete = $user->rights->fournisseur->commande->receptionner;
177$parameters = array();
178$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
183if (empty($reshook)) {
199 if (!empty($backtopageforcancel)) {
200 header(
"Location: ".$backtopageforcancel);
202 } elseif (!empty($backtopage)) {
203 header(
"Location: ".$backtopage);
210 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
213 if ($action ==
'reopen' && $permissiontoadd) {
214 $result = $object->reOpen();
218 if ($action ==
'modif' && $permissiontoadd) {
219 $result = $object->setDraft($user);
223 $outputlangs = $langs;
226 $newlang =
GETPOST(
'lang_id',
'aZ09');
229 $newlang = $object->thirdparty->default_lang;
231 if (!empty($newlang)) {
233 $outputlangs->setDefaultLang($newlang);
235 $model = $object->model_pdf;
236 $ret = $object->fetch($id);
237 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
245 if ($action ==
'set_incoterms' && isModEnabled(
'incoterm') && $permissiontoadd) {
246 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
249 if ($action ==
'setref_supplier' && $permissiontoadd) {
254 $result = $object->setValueFrom(
'ref_supplier',
GETPOST(
'ref_supplier',
'alpha'),
'',
null,
'text',
'', $user,
'RECEPTION_MODIFY');
257 $action =
'editref_supplier';
259 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
264 if ($action ==
'update_extras' && $permissiontoadd) {
265 $object->oldcopy =
dol_clone($object, 2);
268 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
275 $result = $object->insertExtraFields(
'RECEPTION_MODIFY');
283 $action =
'edit_extras';
288 if ($action ==
'add' && $permissiontoadd) {
294 $object->note =
GETPOST(
'note',
'alpha');
295 $object->origin = $origin;
296 $object->origin_id = $origin_id;
297 $object->fk_project =
GETPOST(
'projectid',
'int');
298 $object->weight =
GETPOST(
'weight',
'int') ==
'' ? null :
GETPOST(
'weight',
'int');
299 $object->trueHeight =
GETPOST(
'trueHeight',
'int') ==
'' ? null :
GETPOST(
'trueHeight',
'int');
300 $object->trueWidth =
GETPOST(
'trueWidth',
'int') ==
'' ? null :
GETPOST(
'trueWidth',
'int');
301 $object->trueDepth =
GETPOST(
'trueDepth',
'int') ==
'' ? null :
GETPOST(
'trueDepth',
'int');
302 $object->size_units =
GETPOST(
'size_units',
'int');
303 $object->weight_units =
GETPOST(
'weight_units',
'int');
308 if ($object->origin ==
"supplierorder") {
309 $classname =
'CommandeFournisseur';
311 $classname = ucfirst($object->origin);
313 $objectsrc =
new $classname($db);
314 $objectsrc->fetch($object->origin_id);
316 $object->socid = $objectsrc->socid;
317 $object->ref_supplier =
GETPOST(
'ref_supplier',
'alpha');
318 $object->model_pdf =
GETPOST(
'model');
319 $object->date_delivery = $date_delivery;
320 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
321 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
322 $object->tracking_number =
GETPOST(
'tracking_number',
'alpha');
323 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
324 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
325 $object->fk_incoterms =
GETPOST(
'incoterm_id',
'int');
326 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
328 $batch_line = array();
329 $stockLine = array();
330 $array_options = array();
335 foreach ($_POST as $key => $value) {
338 if (strpos($key,
'qtyasked') !==
false) {
344 for ($i = 1; $i <= $num; $i++) {
356 if (
GETPOST($qty,
'alpha') > 0) {
361 $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
366 for ($i = 1; $i <= $num; $i++) {
369 $lineId =
GETPOST($idl,
'int');
370 foreach ($objectsrc->lines as $linesrc) {
371 if ($linesrc->id == $lineId) {
372 $lineToTest = $linesrc;
376 if (empty($lineToTest)) {
380 $comment =
"comment".$i;
385 $cost_price =
"cost_price".$i;
394 $entrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') :
GETPOST(
'entrepot_id',
'int');
402 $fk_product =
GETPOST(
"productl".$i,
'int');
404 if ($entrepot_id < 0) {
411 $eatby =
GETPOST($eatby,
'alpha');
412 $sellby =
GETPOST($sellby,
'alpha');
413 $eatbydate = str_replace(
'/',
'-', $eatby);
414 $sellbydate = str_replace(
'/',
'-', $sellby);
417 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
GETPOST($qty,
'int'), $array_options[$i],
GETPOST($comment,
'alpha'), strtotime($eatbydate), strtotime($sellbydate),
GETPOST($batch,
'alpha'),
price2num(
GETPOST($cost_price,
'double'),
'MU'));
419 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
GETPOST($qty,
'int'), $array_options[$i],
GETPOST($comment,
'alpha'), strtotime($eatbydate), strtotime($sellbydate),
GETPOST($batch,
'alpha'));
429 $ret = $extrafields->setOptionalsFromPost(
null, $object);
434 $ret = $object->create($user);
442 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"QtyToReceive").
'/'.$langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
448 header(
"Location: card.php?id=".$object->id);
452 $_GET[
"commande_id"] =
GETPOST(
'commande_id',
'int');
455 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && $permissiontovalidate) {
456 $object->fetch_thirdparty();
458 $result = $object->valid($user);
461 $langs->load(
"errors");
466 $outputlangs = $langs;
469 $newlang =
GETPOST(
'lang_id',
'aZ09');
472 $newlang = $object->thirdparty->default_lang;
474 if (!empty($newlang)) {
476 $outputlangs->setDefaultLang($newlang);
478 $model = $object->model_pdf;
479 $ret = $object->fetch($id);
481 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
487 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
488 $result = $object->delete($user);
490 header(
"Location: ".DOL_URL_ROOT.
'/reception/index.php');
502 } elseif ($action ==
'setdate_livraison' && $permissiontoadd) {
503 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
506 $result = $object->setDeliveryDate($user, $datedelivery);
510 } elseif ($action ==
'settracking_number' || $action ==
'settracking_url'
511 || $action ==
'settrueWeight'
512 || $action ==
'settrueWidth'
513 || $action ==
'settrueHeight'
514 || $action ==
'settrueDepth'
515 || $action ==
'setshipping_method_id') {
519 if ($action ==
'settracking_number') {
520 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
522 if ($action ==
'settracking_url') {
523 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'int'));
525 if ($action ==
'settrueWeight') {
526 $object->trueWeight = trim(
GETPOST(
'trueWeight',
'int'));
527 $object->weight_units =
GETPOST(
'weight_units',
'int');
529 if ($action ==
'settrueWidth') {
530 $object->trueWidth = trim(
GETPOST(
'trueWidth',
'int'));
532 if ($action ==
'settrueHeight') {
533 $object->trueHeight = trim(
GETPOST(
'trueHeight',
'int'));
534 $object->size_units =
GETPOST(
'size_units',
'int');
536 if ($action ==
'settrueDepth') {
537 $object->trueDepth = trim(
GETPOST(
'trueDepth',
'int'));
539 if ($action ==
'setshipping_method_id') {
540 $object->shipping_method_id = trim(
GETPOST(
'shipping_method_id',
'int'));
544 if ($object->update($user) >= 0) {
545 header(
"Location: card.php?id=".$object->id);
552 } elseif ($action ==
'builddoc' && $permissiontoread) {
557 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
561 $outputlangs = $langs;
564 $newlang =
GETPOST(
'lang_id',
'aZ09');
567 $newlang = $reception->thirdparty->default_lang;
569 if (!empty($newlang)) {
571 $outputlangs->setDefaultLang($newlang);
573 $result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
578 } elseif ($action ==
'remove_file' && $permissiontoadd) {
580 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
582 $upload_dir = $conf->reception->dir_output;
583 $file = $upload_dir.
'/'.
GETPOST(
'file');
590 } elseif ($action ==
'classifybilled') {
591 $result = $object->setBilled();
593 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
599 } elseif ($action ==
'classifyclosed' && $permissiontoread) {
600 $result = $object->setClosed();
602 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
608 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoread) {
610 $lines = $object->lines;
613 $num_prod = count($lines);
614 for ($i = 0; $i < $num_prod; $i++) {
615 if ($lines[$i]->
id == $line_id) {
617 $line->id = $line_id;
618 if (!$error && $line->delete($user) < 0) {
622 unset($_POST[
"lineid"]);
626 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
631 } elseif ($action ==
'updateline' &&
GETPOST(
'save') && $permissiontoadd) {
638 $lines = $object->lines;
639 $num_prod = count($lines);
640 for ($i = 0; $i < $num_prod; $i++) {
641 if ($lines[$i]->
id == $line_id) {
643 $line->fetch($line_id);
645 $extrafields->fetch_name_optionals_label($object->table_element_line);
646 $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
649 $line->fk_product = $lines[$i]->fk_product;
652 if ($lines[$i]->fk_product > 0) {
654 $stockLocation =
"entl".$line_id;
655 $qty =
"qtyl".$line_id;
656 $comment =
"comment".$line_id;
659 $line->id = $line_id;
660 $line->fk_entrepot =
GETPOST($stockLocation,
'int');
661 $line->qty =
GETPOST($qty,
'int');
662 $line->comment =
GETPOST($comment,
'alpha');
664 if (isModEnabled(
'productbatch')) {
665 $batch =
"batch".$line_id;
666 $dlc =
"dlc".$line_id;
667 $dluo =
"dluo".$line_id;
669 $eatby =
GETPOST($dluo,
'alpha');
670 $eatbydate = str_replace(
'/',
'-', $eatby);
672 $sellby =
GETPOST($dlc,
'alpha');
673 $sellbydate = str_replace(
'/',
'-', $sellby);
674 $line->batch =
GETPOST($batch,
'alpha');
675 $line->eatby = strtotime($eatbydate);
676 $line->sellby = strtotime($sellbydate);
679 if ($line->update($user) < 0) {
684 $qty =
"qtyl".$line_id;
685 $line->id = $line_id;
686 $line->qty =
GETPOST($qty,
'int');
687 $line->fk_entrepot = 0;
688 if ($line->update($user) < 0) {
697 unset($_POST[
"lineid"]);
702 $outputlangs = $langs;
705 $newlang =
GETPOST(
'lang_id',
'aZ09');
708 $newlang = $object->thirdparty->default_lang;
710 if (!empty($newlang)) {
712 $outputlangs->setDefaultLang($newlang);
715 $ret = $object->fetch($object->id);
716 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
719 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
722 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
723 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
727 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
733 $triggersendname =
'RECEPTION_SENTBYMAIL';
735 $mode =
'emailfromreception';
736 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECEPTION_TO';
737 $trackid =
'rec'.$object->id;
738 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
746$title = $object->ref.
' - '.$langs->trans(
'Reception');
750$form =
new Form($db);
753if (isModEnabled(
'project')) {
757$product_static =
new Product($db);
759$warehousestatic =
new Entrepot($db);
761if ($action ==
'create2') {
762 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
764 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
771if ($action ==
'create') {
780 if ($origin ==
'supplierorder') {
781 $classname =
'CommandeFournisseur';
783 $classname = ucfirst($origin);
786 $objectsrc =
new $classname($db);
787 if ($objectsrc->fetch($origin_id)) {
789 $soc->fetch($objectsrc->socid);
791 $author =
new User($db);
792 $author->fetch($objectsrc->user_author_id);
794 if (isModEnabled(
'stock')) {
798 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
799 print
'<input type="hidden" name="token" value="'.newToken().
'">';
800 print
'<input type="hidden" name="action" value="add">';
801 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
802 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
803 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
804 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
805 if (
GETPOST(
'entrepot_id',
'int')) {
806 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
811 print
'<table class="border centpercent">';
814 print
'<tr><td class="titlefieldcreate fieldrequired">';
815 if ($origin ==
'supplierorder' && isModEnabled(
"supplier_order")) {
816 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;
818 if ($origin ==
'propal' && isModEnabled(
"propal")) {
819 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;
826 if ($origin ==
'supplier_order') {
827 print $langs->trans(
'SupplierOrder');
829 print $langs->trans(
'RefSupplier');
831 print
'</td><td colspan="3">';
832 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
837 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
838 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
842 if (isModEnabled(
'project')) {
843 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
844 if (empty($projectid) && !empty($objectsrc->fk_project)) {
845 $projectid = $objectsrc->fk_project;
847 if ($origin ==
'project') {
848 $projectid = ($originid ? $originid : 0);
851 $langs->load(
"projects");
853 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
854 print
img_picto(
'',
'project',
'class="paddingright"');
855 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');
856 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>';
862 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
863 print
'<td colspan="3">';
864 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
865 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
870 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
871 print
'<td colspan="3">';
872 $doleditor =
new DolEditor(
'note_public', $objectsrc->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
873 print $doleditor->Create(1);
877 if ($objectsrc->note_private && !$user->socid) {
878 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
879 print
'<td colspan="3">';
880 $doleditor =
new DolEditor(
'note_private', $objectsrc->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
881 print $doleditor->Create(1);
887 print $langs->trans(
"Weight");
888 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
889 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
890 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
891 print $form->textwithpicto($text, $htmltext);
895 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
896 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth',
'int').
'">';
897 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight',
'int').
'">';
898 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth',
'int').
'">';
900 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
901 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
902 print $form->textwithpicto($text, $htmltext);
906 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
907 print
'<td colspan="3">';
908 $recept->fetch_delivery_methods();
909 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
911 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
913 print
"</td></tr>\n";
916 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
917 print
'<td colspan="3">';
918 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
919 print
"</td></tr>\n";
922 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid'=>$socid);
923 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $recept, $action);
924 print $hookmanager->resPrint;
927 $extrafields->fetch_name_optionals_label($object->table_element);
928 if (empty($reshook) && !empty($extrafields->attributes[$object->table_element][
'label'])) {
930 if ($objectsrc->fetch_optionals() > 0) {
931 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
933 print $recept->showOptionals($extrafields,
'create', $parameters);
937 if (isModEnabled(
'incoterm')) {
939 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
940 print
'<td colspan="3" class="maxwidthonsmartphone">';
941 print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
946 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
949 if (count($list) > 1) {
950 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
951 print
'<td colspan="3">';
952 print $form->selectarray(
'model', $list, $conf->global->RECEPTION_ADDON_PDF);
953 print
"</td></tr>\n";
967 $suffix2numAsked = array();
968 $dispatchLines = array();
970 foreach ($_POST as $key => $value) {
975 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
977 $paramSuffix = $reg[1] .
'_' . $reg[2];
978 $suffix2numAsked[$paramSuffix] = $numAsked;
981 $numline = $numAsked;
983 $prod =
"product_" . $paramSuffix;
984 $qty =
"qty_" . $paramSuffix;
985 $ent =
"entrepot_" . $paramSuffix;
986 $pu =
"pu_" . $paramSuffix;
987 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
988 $dispatchLines[$numAsked] = array(
'paramSuffix'=>$paramSuffix,
'prod' =>
GETPOST($prod,
'int'),
'qty' =>
price2num(
GETPOST($qty),
'MS'),
'ent' =>
GETPOST($ent,
'int'),
'pu' =>
price2num(
GETPOST($pu),
'MU'),
'comment' =>
GETPOST(
'comment'),
'fk_commandefourndet' =>
GETPOST($fk_commandefourndet,
'int'));
992 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
994 $paramSuffix = $reg[1] .
'_' . $reg[2];
995 $suffix2numAsked[$paramSuffix] = $numAsked;
999 $numline = $numAsked;
1001 $prod =
'product_batch_' . $paramSuffix;
1002 $qty =
'qty_' . $paramSuffix;
1003 $ent =
'entrepot_' . $paramSuffix;
1004 $pu =
'pu_' . $paramSuffix;
1005 $lot =
'lot_number_' . $paramSuffix;
1006 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'year',
'int'));
1007 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'year',
'int'));
1008 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
1009 $dispatchLines[$numAsked] = array(
'paramSuffix'=>$paramSuffix,
'prod' =>
GETPOST($prod,
'int'),
'qty' =>
price2num(
GETPOST($qty),
'MS'),
'ent' =>
GETPOST($ent,
'int'),
'pu' =>
price2num(
GETPOST($pu),
'MU'),
'comment' =>
GETPOST(
'comment'),
'fk_commandefourndet' =>
GETPOST($fk_commandefourndet,
'int'),
'DLC'=> $dDLC,
'DLUO'=> $dDLUO,
'lot'=>
GETPOST($lot,
'alpha'));
1013 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1015 $paramSuffix = $reg[1];
1016 $suffix2numAsked[$paramSuffix] = $numAsked;
1020 $numline = $numAsked;
1022 $prod =
'productid'.$paramSuffix;
1023 $comment =
'comment'.$paramSuffix;
1024 $qty =
'qtyl'.$paramSuffix;
1025 $ent =
'entl'.$paramSuffix;
1026 $pu =
'pul'.$paramSuffix;
1027 $lot =
'batch'.$paramSuffix;
1028 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'year',
'int'));
1029 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'year',
'int'));
1030 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1031 $dispatchLines[$numAsked] = array(
'prod' =>
GETPOST($prod,
'int'),
'qty' =>
price2num(
GETPOST($qty),
'MS'),
'ent' =>
GETPOST($ent,
'int'),
'pu' =>
price2num(
GETPOST($pu),
'MU'),
'comment' =>
GETPOST($comment),
'fk_commandefourndet' =>
GETPOST($fk_commandefourndet,
'int'),
'DLC'=> $dDLC,
'DLUO'=> $dDLUO,
'lot'=>
GETPOST($lot,
'alpha'));
1038 foreach ($suffix2numAsked as $suffix => $n) {
1039 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'commande_fournisseur_dispatch',
'_' . $suffix,
'');
1042 print
'<script type="text/javascript">
1043 jQuery(document).ready(function() {
1044 jQuery("#autofill").click(function(event) {
1045 event.preventDefault();';
1047 while ($i <= $numAsked) {
1048 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1052 jQuery("#autoreset").click(function(event) {
1053 event.preventDefault();';
1055 while ($i <= $numAsked) {
1056 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1065 print
'<table class="noborder centpercent">';
1068 $objectsrc->loadReceptions();
1071 print
'<tr class="liste_titre">';
1072 print
'<td>'.$langs->trans(
"Description").
'</td>';
1073 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1074 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1075 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1076 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1078 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1080 if (!isModEnabled(
'productbatch')) {
1081 print
' <br><center><a href="#" id="autofill"><span class="fas fa-fill pictofixedwidth" style=""></span> '.$langs->trans(
"Fill").
'</a>';
1082 print
' <a href="#" id="autoreset"><span class="fas fa-eraser pictofixedwidth" style=""></span>'.$langs->trans(
"Reset").
'</a></center><br>';
1085 if (isModEnabled(
'stock')) {
1086 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1088 if (isModEnabled(
'productbatch')) {
1089 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1091 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1094 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1103 $arrayofpurchaselinealreadyoutput= array();
1107 while ($indiceAsked <= $numAsked) {
1111 foreach ($objectsrc->lines as $supplierLine) {
1112 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1113 $line = $supplierLine;
1119 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1122 if (!empty($line->date_start)) {
1125 if (!empty($line->date_end)) {
1129 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1130 print
'<tr class="oddeven">'.
"\n";
1133 if ($line->fk_product > 0) {
1134 $product->fetch($line->fk_product);
1135 $product->load_stock(
'warehouseopen');
1140 print
'<a name="'.$line->id.
'"></a>';
1142 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1144 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1145 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1148 $product_static = $product;
1150 $text = $product_static->getNomUrl(1);
1151 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1153 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1156 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1160 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1166 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1168 $text =
img_object($langs->trans(
'Service'),
'service');
1170 $text =
img_object($langs->trans(
'Product'),
'product');
1173 if (!empty($line->label)) {
1174 $text .=
' <strong>'.$line->label.
'</strong>';
1175 print $form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1177 print $text.
' '.nl2br($line->desc);
1181 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1188 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1190 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1194 print
'<td class="center">';
1195 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1198 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1199 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->pu_ht.
'">';
1200 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1202 $qtyProdCom = $line->qty;
1205 print
'<td class="center">';
1206 $quantityDelivered = $objectsrc->receptions[$line->id];
1207 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1208 print $quantityDelivered;
1210 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1215 $quantityToBeDelivered = 0;
1217 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1219 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1222 $warehouseObject =
null;
1223 if (isModEnabled(
'stock')) {
1225 print
'<!-- Case warehouse already known or product not a predefined product -->';
1226 if (array_key_exists($dispatchLines[$indiceAsked][
'ent'], $product->stock_warehouse)) {
1227 $stock = +$product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1229 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1230 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1233 print
'<td class="center">';
1235 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1236 $defaultqty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1238 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1239 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1241 print $langs->trans(
"NA");
1247 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.$cost_price.
'">';
1252 if (isModEnabled(
'stock')) {
1253 print
'<td class="left">';
1256 $ent =
"entl".$indiceAsked;
1257 $idl =
"idl".$indiceAsked;
1258 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1259 if ($line->fk_product > 0) {
1260 print
'<!-- Show warehouse selection -->';
1261 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1264 print $langs->trans(
"Service");
1269 if (isModEnabled(
'productbatch')) {
1270 if (!empty($product->status_batch)) {
1271 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1273 print
'<td class="nowraponall">';
1274 print $form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked,
'',
'', 1,
"");
1278 print
'<td class="nowraponall">';
1279 print $form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked,
'',
'', 1,
"");
1283 print
'<td colspan="3"></td>';
1288 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1294 if (!empty($extrafields)) {
1296 if (isModEnabled(
'productbatch')) {
1308 $srcLine->id = $line->id;
1309 $srcLine->fetch_optionals();
1311 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1312 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1314 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1316 print $recLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1326 print $form->buttonsSaveCancel(
"Create");
1335} elseif ($id || $ref) {
1341 $lines = $object->lines;
1343 $num_prod = count($lines);
1346 if ($object->id <= 0) {
1347 print $langs->trans(
"NoRecordFound");
1352 if (!empty($object->origin) && $object->origin_id > 0) {
1353 $object->origin =
'CommandeFournisseur';
1354 $typeobject = $object->origin;
1355 $origin = $object->origin;
1356 $origin_id = $object->origin_id;
1357 $object->fetch_origin();
1361 $soc->fetch($object->socid);
1363 $res = $object->fetch_optionals();
1366 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1371 if ($action ==
'delete') {
1372 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception", $object->ref),
'confirm_delete',
'', 0, 1);
1376 if ($action ==
'valid') {
1377 $objectref = substr($object->ref, 1, 4);
1378 if ($objectref ==
'PROV') {
1379 $numref = $object->getNextNumRef($soc);
1381 $numref = $object->ref;
1384 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1386 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1388 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1391 if (isModEnabled(
'notification')) {
1392 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1393 $notify =
new Notify($db);
1395 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE', $object->socid, $object);
1398 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1, 250);
1402 if ($action ==
'annuler') {
1403 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception", $object->ref),
'confirm_cancel',
'', 0, 1);
1406 if (!$formconfirm) {
1407 $parameters = array(
'formConfirm' => $formconfirm);
1408 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1409 if (empty($reshook)) {
1410 $formconfirm .= $hookmanager->resPrint;
1411 } elseif ($reshook > 0) {
1412 $formconfirm = $hookmanager->resPrint;
1422 $tmparray = $object->getTotalWeightVolume();
1423 $totalWeight = $tmparray[
'weight'];
1424 $totalVolume = $tmparray[
'volume'];
1427 if ($typeobject ==
'commande' && $object->$typeobject->id && isModEnabled(
'commande')) {
1429 $objectsrc->fetch($object->$typeobject->id);
1431 if ($typeobject ==
'propal' && $object->$typeobject->id && isModEnabled(
"propal")) {
1432 $objectsrc =
new Propal($db);
1433 $objectsrc->fetch($object->$typeobject->id);
1435 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id && isModEnabled(
"supplier_order")) {
1437 $objectsrc->fetch($object->$typeobject->id);
1440 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1441 $morehtmlref =
'<div class="refidno">';
1444 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'', 0, 1);
1445 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'',
null,
null,
'', 1);
1448 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1450 if (isModEnabled(
'project')) {
1451 $langs->load(
"projects");
1452 $morehtmlref .=
'<br>';
1454 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1455 if ($action !=
'classify' && $permissiontoadd) {
1456 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1458 $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');
1460 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1462 $proj->fetch($objectsrc->fk_project);
1463 $morehtmlref .= $proj->getNomUrl(1);
1465 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1470 $morehtmlref .=
'</div>';
1472 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1475 print
'<div class="fichecenter">';
1476 print
'<div class="fichehalfleft">';
1477 print
'<div class="underbanner clearboth"></div>';
1479 print
'<table class="border centpercent tableforfield">';
1482 if ($typeobject ==
'commande' && $object->$typeobject->id && isModEnabled(
'commande')) {
1484 print $langs->trans(
"RefOrder").
'</td>';
1485 print
'<td colspan="3">';
1486 print $objectsrc->getNomUrl(1,
'commande');
1490 if ($typeobject ==
'propal' && $object->$typeobject->id && isModEnabled(
"propal")) {
1492 print $langs->trans(
"RefProposal").
'</td>';
1493 print
'<td colspan="3">';
1494 print $objectsrc->getNomUrl(1,
'reception');
1498 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id && isModEnabled(
"propal")) {
1500 print $langs->trans(
"SupplierOrder").
'</td>';
1501 print
'<td colspan="3">';
1502 print $objectsrc->getNomUrl(1,
'reception');
1508 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1509 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
1513 print
'<tr><td height="10">';
1514 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1515 print $langs->trans(
'DateDeliveryPlanned');
1518 if ($action !=
'editdate_livraison') {
1519 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>';
1521 print
'</tr></table>';
1522 print
'</td><td colspan="2">';
1523 if ($action ==
'editdate_livraison') {
1524 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1525 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1526 print
'<input type="hidden" name="action" value="setdate_livraison">';
1527 print $form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1528 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1531 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1538 print $form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->hasRight(
'reception',
'creer'));
1539 print
'</td><td colspan="3">';
1541 if ($action ==
'edittrueWeight') {
1542 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1543 print
'<input name="action" value="settrueWeight" type="hidden">';
1544 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1545 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1546 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
1547 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2);
1548 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1549 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1552 print $object->trueWeight;
1553 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1557 if ($totalWeight > 0) {
1558 if (!empty($object->trueWeight)) {
1559 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1561 print
showDimensionInBestUnit($totalWeight, 0,
"weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT :
'no');
1562 if (!empty($object->trueWeight)) {
1569 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1570 print $form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->hasRight(
'reception',
'creer'));
1571 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1575 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1576 if ($action ==
'edittrueHeight') {
1577 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1578 print
'<input name="action" value="settrueHeight" type="hidden">';
1579 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1580 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1581 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
1582 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1583 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1584 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1587 print $object->trueHeight;
1588 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1594 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1595 print $form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->hasRight(
'reception',
'creer'));
1596 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1601 print $langs->trans(
"Volume");
1603 print
'<td colspan="3">';
1604 $calculatedVolume = 0;
1606 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1607 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1608 $volumeUnit = $object->size_units * 3;
1611 if ($calculatedVolume > 0) {
1612 if ($volumeUnit < 50) {
1613 print
showDimensionInBestUnit($calculatedVolume, $volumeUnit,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
1618 if ($totalVolume > 0) {
1619 if ($calculatedVolume) {
1620 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1622 print
showDimensionInBestUnit($totalVolume, 0,
"volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT :
'no');
1624 if ($calculatedVolume) {
1634 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1639 print
'<div class="fichehalfright">';
1640 print
'<div class="underbanner clearboth"></div>';
1642 print
'<table class="border centpercent tableforfield">';
1645 print
'<tr><td height="10">';
1646 print
'<table class="nobordernopadding centpercent"><tr><td>';
1647 print $langs->trans(
'ReceptionMethod');
1650 if ($action !=
'editshipping_method_id') {
1651 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>';
1653 print
'</tr></table>';
1654 print
'</td><td colspan="2">';
1655 if ($action ==
'editshipping_method_id') {
1656 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1657 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1658 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1659 $object->fetch_delivery_methods();
1660 print $form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1662 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1664 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1667 if ($object->shipping_method_id > 0) {
1669 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1670 print $langs->trans(
"SendingMethod".strtoupper($code));
1677 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->hasRight(
'reception',
'creer')).
'</td><td colspan="3">';
1678 print $form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->hasRight(
'reception',
'creer'),
'safehtmlstring', $object->tracking_number);
1682 if (isModEnabled(
'incoterm')) {
1684 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1685 print $langs->trans(
'IncotermLabel');
1686 print
'<td><td class="right">';
1687 if ($user->hasRight(
'reception',
'creer')) {
1688 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.$object->id.
'&action=editincoterm&token='.newToken().
'">'.
img_edit().
'</a>';
1692 print
'</td></tr></table>';
1694 print
'<td colspan="3">';
1695 if ($action !=
'editincoterm') {
1696 print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
1698 print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
1708 print
'<div class="clearboth"></div>';
1712 if ($action ==
'editline') {
1713 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
1714 <input type="hidden" name="token" value="' . newToken().
'">
1715 <input type="hidden" name="action" value="updateline">
1716 <input type="hidden" name="mode" value="">
1717 <input type="hidden" name="id" value="' . $object->id.
'">';
1721 print
'<div class="div-table-responsive-no-min">';
1722 print
'<table id="tablelines" class="noborder centpercent">';
1724 print
'<tr class="liste_titre">';
1727 print
'<td width="5" class="center"> </td>';
1730 print
'<td>'.$langs->trans(
"Products").
'</td>';
1732 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1734 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1735 if ($origin && $origin_id > 0) {
1736 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
1738 if ($action ==
'editline') {
1740 if (!isModEnabled(
'stock')) {
1743 if (empty($conf->productbatch->enabled)) {
1746 print
'<td class="center" colspan="'.$editColspan.
'">';
1747 if ($object->statut <= 1) {
1748 print $langs->trans(
"QtyToReceive").
' - ';
1750 print $langs->trans(
"QtyReceived").
' - ';
1752 if (isModEnabled(
'stock')) {
1753 print $langs->trans(
"WarehouseTarget").
' - ';
1755 if (isModEnabled(
'productbatch')) {
1756 print $langs->trans(
"Batch");
1760 $statusreceived = $object::STATUS_CLOSED;
1762 $statusreceived = $object::STATUS_VALIDATED;
1765 $statusreceived = $object::STATUS_CLOSED;
1767 if ($object->statut < $statusreceived) {
1768 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
1770 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1772 if (isModEnabled(
'stock')) {
1773 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
1776 if (isModEnabled(
'productbatch')) {
1777 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
1780 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
1781 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
1783 if ($object->statut == 0) {
1784 print
'<td class="linecoledit"></td>';
1785 print
'<td class="linecoldelete" width="10"></td>';
1793 $object->fetch_thirdparty();
1794 $outputlangs = $langs;
1796 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1797 $newlang =
GETPOST(
'lang_id',
'aZ09');
1799 if (empty($newlang)) {
1800 $newlang = $object->thirdparty->default_lang;
1802 if (!empty($newlang)) {
1803 $outputlangs =
new Translate(
"", $conf);
1804 $outputlangs->setDefaultLang($newlang);
1809 $alreadysent = array();
1811 $origin =
'commande_fournisseur';
1813 if ($origin && $origin_id > 0) {
1814 $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";
1815 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
1816 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
1818 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
1819 $sql .=
', p.description as product_desc';
1820 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as ed";
1821 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
1822 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
1824 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
1825 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
1826 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
1827 $sql .=
" AND obj.rowid = ed.fk_commandefourndet";
1828 $sql .=
" AND ed.fk_reception = e.rowid";
1829 $sql .=
" AND ed.fk_reception !=".((int) $object->id);
1831 $sql .=
" ORDER BY obj.fk_product";
1833 dol_syslog(
"get list of reception lines", LOG_DEBUG);
1834 $resql = $db->query($sql);
1836 $num = $db->num_rows($resql);
1840 $obj = $db->fetch_object($resql);
1843 $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);
1851 $arrayofpurchaselinealreadyoutput = array();
1855 for ($i = 0; $i < $num_prod; $i++) {
1856 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
1857 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
1861 print
'<td class="center">'.($i + 1).
'</td>';
1865 if ($lines[$i]->fk_product > 0) {
1869 $prod->fetch($lines[$i]->fk_product);
1870 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
1872 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
1875 print
'<td class="linecoldescription">';
1876 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1877 $text = $lines[$i]->product->getNomUrl(1);
1878 $text .=
' - '.$label;
1880 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1881 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
1883 print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ?
'<br>'.dol_htmlentitiesbr($lines[$i]->
description) :
'';
1888 print
'<td class="linecoldescription">';
1889 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1891 $text =
img_object($langs->trans(
'Service'),
'service');
1893 $text =
img_object($langs->trans(
'Product'),
'product');
1896 if (!empty($lines[$i]->label)) {
1897 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
1898 print $form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
1908 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1909 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
1911 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
1916 print
'<td class="center linecolqty">';
1917 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1918 print $lines[$i]->qty_asked;
1923 if ($origin && $origin_id > 0) {
1924 print
'<td class="center nowrap linecolqtyinotherreceptions">';
1926 $qtyalreadyreceived = 0;
1927 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1928 foreach ($alreadysent as $key => $val) {
1929 if ($lines[$i]->fk_commandefourndet == $key) {
1931 foreach ($val as $receptionline_id => $receptionline_var) {
1932 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
1938 $htmltooltip .=
'<br>';
1940 $reception_static->fetch($receptionline_var[
'reception_id']);
1941 $htmltooltip .= $reception_static->getNomUrl(1, 0, 0, 0, 1);
1942 $htmltooltip .=
' - '.$receptionline_var[
'qty'];
1944 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
1945 if (isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
1946 $warehousestatic->fetch($receptionline_var[
'warehouse']);
1947 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
1949 $htmltooltip .=
' '.$form->textwithpicto(
'', $htmltext, 1);
1951 $qtyalreadyreceived += $receptionline_var[
'qty'];
1954 $htmltooltip = $langs->trans(
"QtyInOtherReceptions").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
1959 print $form->textwithpicto($qtyalreadyreceived, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
1963 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1965 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
1966 if (isModEnabled(
'stock')) {
1967 if ($lines[$i]->fk_product > 0) {
1968 print
'<!-- case edit 1 -->';
1971 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1973 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
1975 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
1976 print
'<td class="nowraponall left"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
1978 print $langs->trans(
'SellByDate').
' : ';
1979 print $form->selectDate($lines[$i]->sellby,
'dlc'.$line_id,
'',
'', 1,
"").
'</br>';
1982 print $langs->trans(
'EatByDate').
' : ';
1983 print $form->selectDate($lines[$i]->eatby,
'dluo'.$line_id,
'',
'', 1,
"");
1989 print
'<!-- case edit 2 -->';
1992 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
2000 print
'</table></td>';
2003 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
2006 if (isModEnabled(
'stock')) {
2007 if ($lines[$i]->fk_entrepot > 0) {
2009 $entrepot->fetch($lines[$i]->fk_entrepot);
2011 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
2012 print $entrepot->getNomUrl(1);
2020 if (isModEnabled(
'productbatch')) {
2021 if (isset($lines[$i]->batch)) {
2022 print
'<!-- Detail of lot -->';
2023 print
'<td class="linecolbatch nowrap">';
2024 $detail = $langs->trans(
"NA");
2025 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
2026 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
2028 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
2030 $detail = $productlot->getNomUrl(1);
2033 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
2035 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2038 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2040 $detail = $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2043 print $detail .
'</td>';
2051 print
'<td class="center linecolweight">';
2053 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2060 print
'<td class="center linecolvolume">';
2062 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2069 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2070 print
'<td class="center valignmiddle" colspan="2">';
2071 print
'<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2072 print
'<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2074 } elseif ($object->statut == Reception::STATUS_DRAFT) {
2076 print
'<td class="linecoledit center">';
2077 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2079 print
'<td class="linecoldelete" width="10">';
2080 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2084 if (!empty($rowExtrafieldsStart)) {
2085 print $rowExtrafieldsStart;
2086 print $rowExtrafieldsView;
2092 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2095 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2096 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2098 if (isModEnabled(
'stock')) {
2101 if (isModEnabled(
'productbatch')) {
2106 $line->id = $lines[$i]->id;
2107 $line->fetch_optionals();
2109 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2110 print $line->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan),
'');
2112 print $line->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan),
'');
2127 $object->fetchObjectLinked($object->id, $object->element);
2134 if (($user->socid == 0) && ($action !=
'presend')) {
2135 print
'<div class="tabsAction">';
2137 $parameters = array();
2138 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2139 if (empty($reshook)) {
2140 if ($object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2141 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer'))
2142 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate'))) {
2143 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2145 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2149 if ($object->statut == Reception::STATUS_VALIDATED && $user->hasRight(
'reception',
'creer')) {
2150 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2155 if ($object->statut == Reception::STATUS_CLOSED && $user->hasRight(
'reception',
'creer')) {
2156 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2160 if (empty($user->socid)) {
2161 if ($object->statut > 0) {
2162 if (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'reception',
'reception_advance',
'send')) {
2163 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2165 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2171 if (isModEnabled(
"supplier_invoice") && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) {
2172 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
2174 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>';
2181 if ($object->statut == Reception::STATUS_VALIDATED) {
2182 if ($user->hasRight(
'reception',
'creer') && $object->statut > 0) {
2184 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifybilled&token='.newToken().
'">'.$langs->trans(
'ClassifyBilled').
'</a>';
2186 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=classifyclosed&token='.newToken().
'">'.$langs->trans(
"Close").
'</a>';
2190 if ($user->hasRight(
'reception',
'supprimer')) {
2191 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2203 if ($action !=
'presend' && $action !=
'editline') {
2204 print
'<div class="fichecenter"><div class="fichehalfleft">';
2207 $filedir = $conf->reception->dir_output.
"/".$objectref;
2209 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2211 $genallowed = $user->rights->reception->lire;
2212 $delallowed = $user->rights->reception->creer;
2214 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2218 $somethingshown = $form->showLinkedObjectBlock($object,
'');
2220 print
'</div><div class="fichehalfright">';
2222 print
'</div></div>';
2226 $modelmail =
'shipping_send';
2227 $defaulttopic =
'SendReceptionRef';
2228 $diroutput = $conf->reception->dir_output;
2229 $trackid =
'rec'.$object->id;
2231 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage table commandefournisseurdispatch.
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 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_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
print_date_range($date_start, $date_end, $format='', $outputlangs='')
Format output for start and end date.
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 dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.