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');
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');
100$hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
101$hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
102$hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
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();
125 if (!empty($object->origin)) {
126 $origin = $object->origin;
128 $object->fetch_origin();
129 $typeobject = $object->origin;
133 if ($origin ==
'order_supplier' && $object->$typeobject->id && isModEnabled(
"supplier_order")) {
134 $origin_id = $object->$typeobject->id;
136 $objectsrc->fetch($object->$typeobject->id);
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 = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->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 = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->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);
222 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
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) {
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) {
407 if (!($fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
411 $eatby =
GETPOST($eatby,
'alpha');
412 $sellby =
GETPOST($sellby,
'alpha');
413 $eatbydate = str_replace(
'/',
'-', $eatby);
414 $sellbydate = str_replace(
'/',
'-', $sellby);
416 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
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");
465 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
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"]);
700 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
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 $trackid =
'rec'.$object->id;
737 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
745$title = $object->ref.
' - '.$langs->trans(
'Reception');
749$form =
new Form($db);
752if (isModEnabled(
'project')) {
756$product_static =
new Product($db);
758$warehousestatic =
new Entrepot($db);
760if ($action ==
'create2') {
761 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
763 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
764 $action =
''; $id =
''; $ref =
'';
768if ($action ==
'create') {
777 if ($origin ==
'supplierorder') {
778 $classname =
'CommandeFournisseur';
780 $classname = ucfirst($origin);
783 $objectsrc =
new $classname($db);
784 if ($objectsrc->fetch($origin_id)) {
786 $soc->fetch($objectsrc->socid);
788 $author =
new User($db);
789 $author->fetch($objectsrc->user_author_id);
791 if (isModEnabled(
'stock')) {
795 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
796 print
'<input type="hidden" name="token" value="'.newToken().
'">';
797 print
'<input type="hidden" name="action" value="add">';
798 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
799 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
800 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
801 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
802 if (
GETPOST(
'entrepot_id',
'int')) {
803 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
808 print
'<table class="border centpercent">';
811 print
'<tr><td class="titlefieldcreate fieldrequired">';
812 if ($origin ==
'supplierorder' && isModEnabled(
"supplier_order")) {
813 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;
815 if ($origin ==
'propal' && isModEnabled(
"propal")) {
816 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;
823 if ($origin ==
'supplier_order') {
824 print $langs->trans(
'SupplierOrder');
826 print $langs->trans(
'RefSupplier');
828 print
'</td><td colspan="3">';
829 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
834 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
835 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
839 if (isModEnabled(
'project')) {
840 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
841 if (empty($projectid) && !empty($objectsrc->fk_project)) {
842 $projectid = $objectsrc->fk_project;
844 if ($origin ==
'project') {
845 $projectid = ($originid ? $originid : 0);
848 $langs->load(
"projects");
850 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
851 print
img_picto(
'',
'project',
'class="paddingright"');
852 print $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $soc->id : -1), $projectid,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1, 0,
'maxwidth500');
853 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>';
859 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
860 print
'<td colspan="3">';
861 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
862 print $form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
867 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
868 print
'<td colspan="3">';
869 $doleditor =
new DolEditor(
'note_public', $objectsrc->note_public,
'', 60,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
870 print $doleditor->Create(1);
874 if ($objectsrc->note_private && !$user->socid) {
875 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
876 print
'<td colspan="3">';
877 $doleditor =
new DolEditor(
'note_private', $objectsrc->note_private,
'', 60,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
878 print $doleditor->Create(1);
884 print $langs->trans(
"Weight");
885 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
886 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
887 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
888 print $form->textwithpicto($text, $htmltext);
892 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
893 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth',
'int').
'">';
894 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight',
'int').
'">';
895 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth',
'int').
'">';
897 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
898 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
899 print $form->textwithpicto($text, $htmltext);
903 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
904 print
'<td colspan="3">';
905 $recept->fetch_delivery_methods();
906 print $form->selectarray(
"shipping_method_id", $recept->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
908 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
910 print
"</td></tr>\n";
913 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
914 print
'<td colspan="3">';
915 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
916 print
"</td></tr>\n";
919 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid'=>$socid);
920 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $recept, $action);
921 print $hookmanager->resPrint;
924 $extrafields->fetch_name_optionals_label($object->table_element);
925 if (empty($reshook) && !empty($extrafields->attributes[$object->table_element][
'label'])) {
927 if ($objectsrc->fetch_optionals() > 0) {
928 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
930 print $recept->showOptionals($extrafields,
'create', $parameters);
934 if (isModEnabled(
'incoterm')) {
936 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
937 print
'<td colspan="3" class="maxwidthonsmartphone">';
938 print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
943 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
946 if (count($list) > 1) {
947 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
948 print
'<td colspan="3">';
949 print $form->selectarray(
'model', $list, $conf->global->RECEPTION_ADDON_PDF);
950 print
"</td></tr>\n";
964 $suffix2numAsked = array();
965 $dispatchLines = array();
967 foreach ($_POST as $key => $value) {
972 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
974 $paramSuffix = $reg[1] .
'_' . $reg[2];
975 $suffix2numAsked[$paramSuffix] = $numAsked;
978 $numline = $numAsked;
980 $prod =
"product_" . $paramSuffix;
981 $qty =
"qty_" . $paramSuffix;
982 $ent =
"entrepot_" . $paramSuffix;
983 $pu =
"pu_" . $paramSuffix;
984 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
985 $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'));
989 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
991 $paramSuffix = $reg[1] .
'_' . $reg[2];
992 $suffix2numAsked[$paramSuffix] = $numAsked;
996 $numline = $numAsked;
998 $prod =
'product_batch_' . $paramSuffix;
999 $qty =
'qty_' . $paramSuffix;
1000 $ent =
'entrepot_' . $paramSuffix;
1001 $pu =
'pu_' . $paramSuffix;
1002 $lot =
'lot_number_' . $paramSuffix;
1003 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'year',
'int'));
1004 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'year',
'int'));
1005 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
1006 $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'));
1010 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1012 $paramSuffix = $reg[1];
1013 $suffix2numAsked[$paramSuffix] = $numAsked;
1017 $numline = $numAsked;
1019 $prod =
'productid'.$paramSuffix;
1020 $comment =
'comment'.$paramSuffix;
1021 $qty =
'qtyl'.$paramSuffix;
1022 $ent =
'entl'.$paramSuffix;
1023 $pu =
'pul'.$paramSuffix;
1024 $lot =
'batch'.$paramSuffix;
1025 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'year',
'int'));
1026 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'year',
'int'));
1027 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1028 $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'));
1035 foreach ($suffix2numAsked as $suffix => $n) {
1036 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'commande_fournisseur_dispatch',
'_' . $suffix,
'');
1039 print
'<script type="text/javascript">
1040 jQuery(document).ready(function() {
1041 jQuery("#autofill").click(function(event) {
1042 event.preventDefault();';
1044 while ($i <= $numAsked) {
1045 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1049 jQuery("#autoreset").click(function(event) {
1050 event.preventDefault();';
1052 while ($i <= $numAsked) {
1053 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1062 print
'<table class="noborder centpercent">';
1065 $objectsrc->loadReceptions();
1068 print
'<tr class="liste_titre">';
1069 print
'<td>'.$langs->trans(
"Description").
'</td>';
1070 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1071 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1072 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1073 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1075 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1077 if (isModEnabled(
'productbatch')) {
1078 print
' <br><center><a href="#" id="autofill"><span class="fas fa-fill pictofixedwidth" style=""></span> '.$langs->trans(
"Fill").
'</a>';
1079 print
' <a href="#" id="autoreset"><span class="fas fa-eraser pictofixedwidth" style=""></span>'.$langs->trans(
"Reset").
'</a></center><br>';
1082 if (isModEnabled(
'stock')) {
1083 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1085 if (isModEnabled(
'productbatch')) {
1086 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1088 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1091 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1100 $arrayofpurchaselinealreadyoutput= array();
1104 while ($indiceAsked <= $numAsked) {
1108 foreach ($objectsrc->lines as $supplierLine) {
1109 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1110 $line = $supplierLine;
1116 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1119 if (!empty($line->date_start)) {
1122 if (!empty($line->date_end)) {
1126 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1127 print
'<tr class="oddeven">'.
"\n";
1130 if ($line->fk_product > 0) {
1131 $product->fetch($line->fk_product);
1132 $product->load_stock(
'warehouseopen');
1137 print
'<a name="'.$line->id.
'"></a>';
1139 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1141 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1142 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1145 $product_static = $product;
1147 $text = $product_static->getNomUrl(1);
1148 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1150 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1153 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1157 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1163 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1165 $text =
img_object($langs->trans(
'Service'),
'service');
1167 $text =
img_object($langs->trans(
'Product'),
'product');
1170 if (!empty($line->label)) {
1171 $text .=
' <strong>'.$line->label.
'</strong>';
1172 print $form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1174 print $text.
' '.nl2br($line->desc);
1178 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1185 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1187 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1191 print
'<td class="center">';
1192 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1195 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1196 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->pu_ht.
'">';
1197 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1199 $qtyProdCom = $line->qty;
1202 print
'<td class="center">';
1203 $quantityDelivered = $objectsrc->receptions[$line->id];
1204 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1205 print $quantityDelivered;
1207 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1211 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1212 $quantityToBeDelivered = 0;
1214 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1216 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1219 $warehouseObject =
null;
1220 if (isModEnabled(
'stock')) {
1222 print
'<!-- Case warehouse already known or product not a predefined product -->';
1223 if (array_key_exists($dispatchLines[$indiceAsked][
'ent'], $product->stock_warehouse)) {
1224 $stock = +$product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1226 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1227 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1230 print
'<td class="center">';
1231 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1232 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1233 $defaultqty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1235 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1236 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1238 print $langs->trans(
"NA");
1242 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
1244 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.$cost_price.
'">';
1249 if (isModEnabled(
'stock')) {
1250 print
'<td class="left">';
1251 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1253 $ent =
"entl".$indiceAsked;
1254 $idl =
"idl".$indiceAsked;
1255 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1256 if ($line->fk_product > 0) {
1257 print
'<!-- Show warehouse selection -->';
1258 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1261 print $langs->trans(
"Service");
1266 if (isModEnabled(
'productbatch')) {
1267 if (!empty($product->status_batch)) {
1268 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1269 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1270 print
'<td class="nowraponall">';
1271 print $form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked,
'',
'', 1,
"");
1274 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1275 print
'<td class="nowraponall">';
1276 print $form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked,
'',
'', 1,
"");
1280 print
'<td colspan="3"></td>';
1285 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1291 if (!empty($extrafields)) {
1293 if (isModEnabled(
'productbatch')) {
1295 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1298 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1305 $srcLine->id = $line->id;
1306 $srcLine->fetch_optionals();
1308 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1309 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1311 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1313 print $recLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1323 print $form->buttonsSaveCancel(
"Create");
1332} elseif ($id || $ref) {
1338 $lines = $object->lines;
1340 $num_prod = count($lines);
1342 if ($object->id > 0) {
1343 if (!empty($object->origin) && $object->origin_id > 0) {
1344 $object->origin =
'CommandeFournisseur';
1345 $typeobject = $object->origin;
1346 $origin = $object->origin;
1347 $origin_id = $object->origin_id;
1348 $object->fetch_origin();
1352 $soc->fetch($object->socid);
1354 $res = $object->fetch_optionals();
1357 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1362 if ($action ==
'delete') {
1363 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception", $object->ref),
'confirm_delete',
'', 0, 1);
1367 if ($action ==
'valid') {
1368 $objectref = substr($object->ref, 1, 4);
1369 if ($objectref ==
'PROV') {
1370 $numref = $object->getNextNumRef($soc);
1372 $numref = $object->ref;
1375 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1377 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementWillBeRecorded").
'.';
1379 $text .=
'<br>'.img_picto(
'',
'movement',
'class="pictofixedwidth"').$langs->trans(
"StockMovementNotYetRecorded").
'.';
1382 if (isModEnabled(
'notification')) {
1383 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1384 $notify =
new Notify($db);
1386 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE', $object->socid, $object);
1389 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1, 250);
1393 if ($action ==
'annuler') {
1394 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception", $object->ref),
'confirm_cancel',
'', 0, 1);
1397 if (!$formconfirm) {
1398 $parameters = array(
'formConfirm' => $formconfirm);
1399 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1400 if (empty($reshook)) {
1401 $formconfirm .= $hookmanager->resPrint;
1402 } elseif ($reshook > 0) {
1403 $formconfirm = $hookmanager->resPrint;
1413 $tmparray = $object->getTotalWeightVolume();
1414 $totalWeight = $tmparray[
'weight'];
1415 $totalVolume = $tmparray[
'volume'];
1418 if ($typeobject ==
'commande' && $object->$typeobject->id && isModEnabled(
'commande')) {
1420 $objectsrc->fetch($object->$typeobject->id);
1422 if ($typeobject ==
'propal' && $object->$typeobject->id && isModEnabled(
"propal")) {
1423 $objectsrc =
new Propal($db);
1424 $objectsrc->fetch($object->$typeobject->id);
1426 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id && isModEnabled(
"supplier_order")) {
1428 $objectsrc->fetch($object->$typeobject->id);
1431 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1432 $morehtmlref =
'<div class="refidno">';
1435 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
1436 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
1439 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1441 if (isModEnabled(
'project')) {
1442 $langs->load(
"projects");
1443 $morehtmlref .=
'<br>';
1445 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1446 if ($action !=
'classify' && $permissiontoadd) {
1447 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1449 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1451 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1453 $proj->fetch($objectsrc->fk_project);
1454 $morehtmlref .= $proj->getNomUrl(1);
1456 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1461 $morehtmlref .=
'</div>';
1463 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1466 print
'<div class="fichecenter">';
1467 print
'<div class="fichehalfleft">';
1468 print
'<div class="underbanner clearboth"></div>';
1470 print
'<table class="border centpercent tableforfield">';
1473 if ($typeobject ==
'commande' && $object->$typeobject->id && isModEnabled(
'commande')) {
1475 print $langs->trans(
"RefOrder").
'</td>';
1476 print
'<td colspan="3">';
1477 print $objectsrc->getNomUrl(1,
'commande');
1481 if ($typeobject ==
'propal' && $object->$typeobject->id && isModEnabled(
"propal")) {
1483 print $langs->trans(
"RefProposal").
'</td>';
1484 print
'<td colspan="3">';
1485 print $objectsrc->getNomUrl(1,
'reception');
1489 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id && isModEnabled(
"propal")) {
1491 print $langs->trans(
"SupplierOrder").
'</td>';
1492 print
'<td colspan="3">';
1493 print $objectsrc->getNomUrl(1,
'reception');
1499 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1500 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
1504 print
'<tr><td height="10">';
1505 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1506 print $langs->trans(
'DateDeliveryPlanned');
1509 if ($action !=
'editdate_livraison') {
1510 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>';
1512 print
'</tr></table>';
1513 print
'</td><td colspan="2">';
1514 if ($action ==
'editdate_livraison') {
1515 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1516 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1517 print
'<input type="hidden" name="action" value="setdate_livraison">';
1518 print $form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1519 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1522 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1529 print $form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->reception->creer);
1530 print
'</td><td colspan="3">';
1532 if ($action ==
'edittrueWeight') {
1533 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1534 print
'<input name="action" value="settrueWeight" type="hidden">';
1535 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1536 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1537 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
1538 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2);
1539 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1540 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1543 print $object->trueWeight;
1544 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1548 if ($totalWeight > 0) {
1549 if (!empty($object->trueWeight)) {
1550 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1552 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');
1553 if (!empty($object->trueWeight)) {
1560 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1561 print $form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer);
1562 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1566 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1567 if ($action ==
'edittrueHeight') {
1568 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1569 print
'<input name="action" value="settrueHeight" type="hidden">';
1570 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1571 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1572 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
1573 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1574 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1575 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1578 print $object->trueHeight;
1579 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1585 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1586 print $form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer);
1587 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1592 print $langs->trans(
"Volume");
1594 print
'<td colspan="3">';
1595 $calculatedVolume = 0;
1597 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1598 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1599 $volumeUnit = $object->size_units * 3;
1602 if ($calculatedVolume > 0) {
1603 if ($volumeUnit < 50) {
1604 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');
1609 if ($totalVolume > 0) {
1610 if ($calculatedVolume) {
1611 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1613 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');
1615 if ($calculatedVolume) {
1625 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1630 print
'<div class="fichehalfright">';
1631 print
'<div class="underbanner clearboth"></div>';
1633 print
'<table class="border centpercent tableforfield">';
1636 print
'<tr><td height="10">';
1637 print
'<table class="nobordernopadding centpercent"><tr><td>';
1638 print $langs->trans(
'ReceptionMethod');
1641 if ($action !=
'editshipping_method_id') {
1642 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>';
1644 print
'</tr></table>';
1645 print
'</td><td colspan="2">';
1646 if ($action ==
'editshipping_method_id') {
1647 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1648 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1649 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1650 $object->fetch_delivery_methods();
1651 print $form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1653 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1655 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1658 if ($object->shipping_method_id > 0) {
1660 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1661 print $langs->trans(
"SendingMethod".strtoupper($code));
1668 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1669 print $form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->reception->creer,
'safehtmlstring', $object->tracking_number);
1673 if (isModEnabled(
'incoterm')) {
1675 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1676 print $langs->trans(
'IncotermLabel');
1677 print
'<td><td class="right">';
1678 if ($user->rights->reception->creer) {
1679 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.$object->id.
'&action=editincoterm&token='.newToken().
'">'.
img_edit().
'</a>';
1683 print
'</td></tr></table>';
1685 print
'<td colspan="3">';
1686 if ($action !=
'editincoterm') {
1687 print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
1689 print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
1699 print
'<div class="clearboth"></div>';
1703 if ($action ==
'editline') {
1704 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
1705 <input type="hidden" name="token" value="' . newToken().
'">
1706 <input type="hidden" name="action" value="updateline">
1707 <input type="hidden" name="mode" value="">
1708 <input type="hidden" name="id" value="' . $object->id.
'">';
1712 print
'<div class="div-table-responsive-no-min">';
1713 print
'<table id="tablelines" class="noborder centpercent">';
1715 print
'<tr class="liste_titre">';
1717 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1718 print
'<td width="5" class="center"> </td>';
1721 print
'<td>'.$langs->trans(
"Products").
'</td>';
1723 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1725 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1726 if ($origin && $origin_id > 0) {
1727 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
1729 if ($action ==
'editline') {
1731 if (!isModEnabled(
'stock')) {
1734 if (empty($conf->productbatch->enabled)) {
1737 print
'<td class="center" colspan="'.$editColspan.
'">';
1738 if ($object->statut <= 1) {
1739 print $langs->trans(
"QtyToReceive").
' - ';
1741 print $langs->trans(
"QtyReceived").
' - ';
1743 if (isModEnabled(
'stock')) {
1744 print $langs->trans(
"WarehouseTarget").
' - ';
1746 if (isModEnabled(
'productbatch')) {
1747 print $langs->trans(
"Batch");
1751 $statusreceived = $object::STATUS_CLOSED;
1753 $statusreceived = $object::STATUS_VALIDATED;
1756 $statusreceived = $object::STATUS_CLOSED;
1758 if ($object->statut < $statusreceived) {
1759 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
1761 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1763 if (isModEnabled(
'stock')) {
1764 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
1767 if (isModEnabled(
'productbatch')) {
1768 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
1771 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
1772 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
1774 if ($object->statut == 0) {
1775 print
'<td class="linecoledit"></td>';
1776 print
'<td class="linecoldelete" width="10"></td>';
1783 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1784 $object->fetch_thirdparty();
1785 $outputlangs = $langs;
1787 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1788 $newlang =
GETPOST(
'lang_id',
'aZ09');
1790 if (empty($newlang)) {
1791 $newlang = $object->thirdparty->default_lang;
1793 if (!empty($newlang)) {
1794 $outputlangs =
new Translate(
"", $conf);
1795 $outputlangs->setDefaultLang($newlang);
1800 $alreadysent = array();
1802 $origin =
'commande_fournisseur';
1804 if ($origin && $origin_id > 0) {
1805 $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";
1806 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
1807 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
1809 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
1810 $sql .=
', p.description as product_desc';
1811 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as ed";
1812 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
1813 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
1815 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
1816 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
1817 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
1818 $sql .=
" AND obj.rowid = ed.fk_commandefourndet";
1819 $sql .=
" AND ed.fk_reception = e.rowid";
1820 $sql .=
" AND ed.fk_reception !=".((int) $object->id);
1822 $sql .=
" ORDER BY obj.fk_product";
1824 dol_syslog(
"get list of reception lines", LOG_DEBUG);
1825 $resql = $db->query($sql);
1827 $num = $db->num_rows($resql);
1831 $obj = $db->fetch_object($resql);
1834 $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);
1842 $arrayofpurchaselinealreadyoutput = array();
1846 for ($i = 0; $i < $num_prod; $i++) {
1847 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
1848 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
1851 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1852 print
'<td class="center">'.($i + 1).
'</td>';
1856 if ($lines[$i]->fk_product > 0) {
1858 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1860 $prod->fetch($lines[$i]->fk_product);
1861 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
1863 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
1866 print
'<td class="linecoldescription">';
1867 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1868 $text = $lines[$i]->product->getNomUrl(1);
1869 $text .=
' - '.$label;
1871 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
1872 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
1874 print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ?
'<br>'.dol_htmlentitiesbr($lines[$i]->
description) :
'';
1879 print
'<td class="linecoldescription">';
1880 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1882 $text =
img_object($langs->trans(
'Service'),
'service');
1884 $text =
img_object($langs->trans(
'Product'),
'product');
1887 if (!empty($lines[$i]->label)) {
1888 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
1889 print $form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
1899 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1900 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
1902 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
1907 print
'<td class="center linecolqty">';
1908 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1909 print $lines[$i]->qty_asked;
1914 if ($origin && $origin_id > 0) {
1915 print
'<td class="center nowrap linecolqtyinotherreceptions">';
1917 $qtyalreadyreceived = 0;
1918 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1919 foreach ($alreadysent as $key => $val) {
1920 if ($lines[$i]->fk_commandefourndet == $key) {
1922 foreach ($val as $receptionline_id => $receptionline_var) {
1923 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
1929 $htmltooltip .=
'<br>';
1931 $reception_static->fetch($receptionline_var[
'reception_id']);
1932 $htmltooltip .= $reception_static->getNomUrl(1, 0, 0, 0, 1);
1933 $htmltooltip .=
' - '.$receptionline_var[
'qty'];
1935 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
1936 if (isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
1937 $warehousestatic->fetch($receptionline_var[
'warehouse']);
1938 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
1940 $htmltooltip .=
' '.$form->textwithpicto(
'', $htmltext, 1);
1942 $qtyalreadyreceived += $receptionline_var[
'qty'];
1945 $htmltooltip = $langs->trans(
"QtyInOtherReceptions").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
1950 print $form->textwithpicto($qtyalreadyreceived, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
1954 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1956 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
1957 if (isModEnabled(
'stock')) {
1958 if ($lines[$i]->fk_product > 0) {
1959 print
'<!-- case edit 1 -->';
1962 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1964 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
1966 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
1967 print
'<td class="nowraponall left"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
1968 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1969 print $langs->trans(
'SellByDate').
' : ';
1970 print $form->selectDate($lines[$i]->sellby,
'dlc'.$line_id,
'',
'', 1,
"").
'</br>';
1972 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1973 print $langs->trans(
'EatByDate').
' : ';
1974 print $form->selectDate($lines[$i]->eatby,
'dluo'.$line_id,
'',
'', 1,
"");
1980 print
'<!-- case edit 2 -->';
1983 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1991 print
'</table></td>';
1994 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
1997 if (isModEnabled(
'stock')) {
1998 if ($lines[$i]->fk_entrepot > 0) {
2000 $entrepot->fetch($lines[$i]->fk_entrepot);
2002 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
2003 print $entrepot->getNomUrl(1);
2011 if (isModEnabled(
'productbatch')) {
2012 if (isset($lines[$i]->batch)) {
2013 print
'<!-- Detail of lot -->';
2014 print
'<td class="linecolbatch nowrap">';
2015 $detail = $langs->trans(
"NA");
2016 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
2017 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
2019 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
2021 $detail = $productlot->getNomUrl(1);
2024 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
2025 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
2026 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2028 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2029 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2031 $detail = $form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2034 print $detail .
'</td>';
2042 print
'<td class="center linecolweight">';
2044 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2051 print
'<td class="center linecolvolume">';
2053 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2060 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2061 print
'<td class="center valignmiddle" colspan="2">';
2062 print
'<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2063 print
'<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2065 } elseif ($object->statut == Reception::STATUS_DRAFT) {
2067 print
'<td class="linecoledit center">';
2068 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2070 print
'<td class="linecoldelete" width="10">';
2071 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2075 if (!empty($rowExtrafieldsStart)) {
2076 print $rowExtrafieldsStart;
2077 print $rowExtrafieldsView;
2083 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2086 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2087 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2089 if (isModEnabled(
'stock')) { $colspan++; }
2090 if (isModEnabled(
'productbatch')) { $colspan++; }
2093 $line->id = $lines[$i]->id;
2094 $line->fetch_optionals();
2096 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2097 print $line->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan),
'');
2099 print $line->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan),
'');
2115 $object->fetchObjectLinked($object->id, $object->element);
2122 if (($user->socid == 0) && ($action !=
'presend')) {
2123 print
'<div class="tabsAction">';
2125 $parameters = array();
2126 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2127 if (empty($reshook)) {
2128 if ($object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2129 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer))
2130 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) {
2131 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2133 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2137 if ($object->statut == Reception::STATUS_VALIDATED && $user->rights->reception->creer) {
2138 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2143 if ($object->statut == Reception::STATUS_CLOSED && $user->rights->reception->creer) {
2144 if (isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2145 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.newToken().
'">'.$langs->trans(
"ClassifyUnbilled").
'</a>';
2147 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2152 if (empty($user->socid)) {
2153 if ($object->statut > 0) {
2154 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) {
2155 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2157 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2163 if (isModEnabled(
"supplier_invoice") && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) {
2164 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
2167 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>';
2173 if ($object->statut == Reception::STATUS_VALIDATED) {
2174 if ($user->rights->reception->creer && $object->statut > 0 && !$object->billed) {
2175 $label =
"Close"; $paramaction =
'classifyclosed';
2177 if (isModEnabled(
"supplier_order") && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2178 $label =
"ClassifyBilled";
2179 $paramaction =
'classifybilled';
2181 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action='.$paramaction.
'&token='.newToken().
'">'.$langs->trans($label).
'</a>';
2185 if ($user->rights->reception->supprimer) {
2186 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2198 if ($action !=
'presend' && $action !=
'editline') {
2199 print
'<div class="fichecenter"><div class="fichehalfleft">';
2202 $filedir = $conf->reception->dir_output.
"/".$objectref;
2204 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2206 $genallowed = $user->rights->reception->lire;
2207 $delallowed = $user->rights->reception->creer;
2209 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2213 $somethingshown = $form->showLinkedObjectBlock($object,
'');
2215 print
'</div><div class="fichehalfright">';
2217 print
'</div></div>';
2221 $modelmail =
'shipping_send';
2222 $defaulttopic =
'SendReceptionRef';
2223 $diroutput = $conf->reception->dir_output;
2224 $trackid =
'rec'.$object->id;
2226 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 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.