37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
59 if (!empty($conf->project->enabled)) {
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'));
67 $langs->load(
'incoterm');
70 $langs->load(
'productbatch');
73 $origin =
GETPOST(
'origin',
'alpha') ?
GETPOST(
'origin',
'alpha') :
'reception';
76 if (empty($origin_id)) {
77 $origin_id =
GETPOST(
'origin_id',
'int');
79 if (empty($origin_id)) {
80 $origin_id =
GETPOST(
'object_id',
'int');
82 if (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');
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);
114 include 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'));
121 if ($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(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) ||
isModEnabled(
"supplier_order"))) {
134 $origin_id = $object->$typeobject->id;
136 $objectsrc->fetch($object->$typeobject->id);
143 $socid = $user->socid;
146 if (
isModEnabled(
"reception") || $origin ==
'reception' || empty($origin)) {
150 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
151 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
152 } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
158 $permissiontoread = $user->rights->reception->lire;
159 $permissiontoadd = $user->rights->reception->creer;
160 $permissiondellink = $user->rights->reception->creer;
161 $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)));
162 $permissiontodelete = $user->rights->reception->supprimer;
164 $permissiontoread = $user->rights->fournisseur->commande->receptionner;
165 $permissiontoadd = $user->rights->fournisseur->commande->receptionner;
166 $permissiondellink = $user->rights->fournisseur->commande->receptionner;
167 $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)));
168 $permissiontodelete = $user->rights->fournisseur->commande->receptionner;
177 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
182 if (empty($reshook)) {
198 if (!empty($backtopageforcancel)) {
199 header(
"Location: ".$backtopageforcancel);
201 } elseif (!empty($backtopage)) {
202 header(
"Location: ".$backtopage);
209 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
212 if ($action ==
'reopen' && $permissiontoadd) {
213 $result = $object->reOpen();
217 if ($action ==
'modif' && $permissiontoadd) {
218 $result = $object->setDraft($user);
221 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
222 $outputlangs = $langs;
225 $newlang =
GETPOST(
'lang_id',
'aZ09');
228 $newlang = $object->thirdparty->default_lang;
230 if (!empty($newlang)) {
232 $outputlangs->setDefaultLang($newlang);
234 $model = $object->model_pdf;
235 $ret = $object->fetch($id);
236 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
244 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm') && $permissiontoadd) {
245 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
248 if ($action ==
'setref_supplier' && $permissiontoadd) {
253 $result = $object->setValueFrom(
'ref_supplier',
GETPOST(
'ref_supplier',
'alpha'),
'',
null,
'text',
'', $user,
'RECEPTION_MODIFY');
256 $action =
'editref_supplier';
258 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
263 if ($action ==
'update_extras' && $permissiontoadd) {
267 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
274 $result = $object->insertExtraFields(
'RECEPTION_MODIFY');
282 $action =
'edit_extras';
287 if ($action ==
'add' && $permissiontoadd) {
293 $object->note =
GETPOST(
'note',
'alpha');
294 $object->origin = $origin;
295 $object->origin_id = $origin_id;
296 $object->fk_project =
GETPOST(
'projectid',
'int');
297 $object->weight =
GETPOST(
'weight',
'int') ==
'' ? null :
GETPOST(
'weight',
'int');
298 $object->trueHeight =
GETPOST(
'trueHeight',
'int') ==
'' ? null :
GETPOST(
'trueHeight',
'int');
299 $object->trueWidth =
GETPOST(
'trueWidth',
'int') ==
'' ? null :
GETPOST(
'trueWidth',
'int');
300 $object->trueDepth =
GETPOST(
'trueDepth',
'int') ==
'' ? null :
GETPOST(
'trueDepth',
'int');
301 $object->size_units =
GETPOST(
'size_units',
'int');
302 $object->weight_units =
GETPOST(
'weight_units',
'int');
307 if ($object->origin ==
"supplierorder") {
308 $classname =
'CommandeFournisseur';
310 $classname = ucfirst($object->origin);
312 $objectsrc =
new $classname($db);
313 $objectsrc->fetch($object->origin_id);
315 $object->socid = $objectsrc->socid;
316 $object->ref_supplier =
GETPOST(
'ref_supplier',
'alpha');
317 $object->model_pdf =
GETPOST(
'model');
318 $object->date_delivery = $date_delivery;
319 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
320 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
321 $object->tracking_number =
GETPOST(
'tracking_number',
'alpha');
322 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
323 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
324 $object->fk_incoterms =
GETPOST(
'incoterm_id',
'int');
325 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
327 $batch_line = array();
328 $stockLine = array();
329 $array_options = array();
334 foreach ($_POST as $key => $value) {
337 if (strpos($key,
'qtyasked') !==
false) {
343 for ($i = 1; $i <= $num; $i++) {
355 if (
GETPOST($qty,
'alpha') > 0) {
360 $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
365 for ($i = 1; $i <= $num; $i++) {
368 $lineId =
GETPOST($idl,
'int');
369 foreach ($objectsrc->lines as $linesrc) {
370 if ($linesrc->id == $lineId) {
371 $lineToTest = $linesrc;
375 if (empty($lineToTest)) {
379 $comment =
"comment".$i;
384 $cost_price =
"cost_price".$i;
393 $entrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') :
GETPOST(
'entrepot_id',
'int');
401 $fk_product =
GETPOST(
"productl".$i,
'int');
403 if ($entrepot_id < 0) {
406 if (!($fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
410 $eatby =
GETPOST($eatby,
'alpha');
411 $sellby =
GETPOST($sellby,
'alpha');
412 $eatbydate = str_replace(
'/',
'-', $eatby);
413 $sellbydate = str_replace(
'/',
'-', $sellby);
415 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
416 $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'));
418 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
GETPOST($qty,
'int'), $array_options[$i],
GETPOST($comment,
'alpha'), strtotime($eatbydate), strtotime($sellbydate),
GETPOST($batch,
'alpha'));
428 $ret = $extrafields->setOptionalsFromPost(
null, $object);
433 $ret = $object->create($user);
441 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"QtyToReceive").
'/'.$langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
447 header(
"Location: card.php?id=".$object->id);
451 $_GET[
"commande_id"] =
GETPOST(
'commande_id',
'int');
454 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && $permissiontovalidate) {
455 $object->fetch_thirdparty();
457 $result = $object->valid($user);
460 $langs->load(
"errors");
464 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
465 $outputlangs = $langs;
468 $newlang =
GETPOST(
'lang_id',
'aZ09');
471 $newlang = $object->thirdparty->default_lang;
473 if (!empty($newlang)) {
475 $outputlangs->setDefaultLang($newlang);
477 $model = $object->model_pdf;
478 $ret = $object->fetch($id);
480 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
486 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
487 $result = $object->delete($user);
489 header(
"Location: ".DOL_URL_ROOT.
'/reception/index.php');
501 } elseif ($action ==
'setdate_livraison' && $permissiontoadd) {
502 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
505 $result = $object->setDeliveryDate($user, $datedelivery);
509 } elseif ($action ==
'settracking_number' || $action ==
'settracking_url'
510 || $action ==
'settrueWeight'
511 || $action ==
'settrueWidth'
512 || $action ==
'settrueHeight'
513 || $action ==
'settrueDepth'
514 || $action ==
'setshipping_method_id') {
518 if ($action ==
'settracking_number') {
519 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
521 if ($action ==
'settracking_url') {
522 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'int'));
524 if ($action ==
'settrueWeight') {
525 $object->trueWeight = trim(
GETPOST(
'trueWeight',
'int'));
526 $object->weight_units =
GETPOST(
'weight_units',
'int');
528 if ($action ==
'settrueWidth') {
529 $object->trueWidth = trim(
GETPOST(
'trueWidth',
'int'));
531 if ($action ==
'settrueHeight') {
532 $object->trueHeight = trim(
GETPOST(
'trueHeight',
'int'));
533 $object->size_units =
GETPOST(
'size_units',
'int');
535 if ($action ==
'settrueDepth') {
536 $object->trueDepth = trim(
GETPOST(
'trueDepth',
'int'));
538 if ($action ==
'setshipping_method_id') {
539 $object->shipping_method_id = trim(
GETPOST(
'shipping_method_id',
'int'));
543 if ($object->update($user) >= 0) {
544 header(
"Location: card.php?id=".$object->id);
551 } elseif ($action ==
'builddoc' && $permissiontoread) {
556 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
560 $outputlangs = $langs;
563 $newlang =
GETPOST(
'lang_id',
'aZ09');
566 $newlang = $reception->thirdparty->default_lang;
568 if (!empty($newlang)) {
570 $outputlangs->setDefaultLang($newlang);
572 $result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
577 } elseif ($action ==
'remove_file' && $permissiontoadd) {
579 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
581 $upload_dir = $conf->reception->dir_output;
582 $file = $upload_dir.
'/'.
GETPOST(
'file');
589 } elseif ($action ==
'classifybilled') {
590 $result = $object->setBilled();
592 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
595 } elseif ($action ==
'classifyclosed' && $permissiontoread) {
596 $result = $object->setClosed();
598 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
601 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoread) {
603 $lines = $object->lines;
606 $num_prod = count($lines);
607 for ($i = 0; $i < $num_prod; $i++) {
608 if ($lines[$i]->
id == $line_id) {
610 $line->id = $line_id;
611 if (!$error && $line->delete($user) < 0) {
615 unset($_POST[
"lineid"]);
619 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
624 } elseif ($action ==
'updateline' &&
GETPOST(
'save') && $permissiontoadd) {
631 $lines = $object->lines;
632 $num_prod = count($lines);
633 for ($i = 0; $i < $num_prod; $i++) {
634 if ($lines[$i]->
id == $line_id) {
636 $line->fetch($line_id);
638 $extrafields->fetch_name_optionals_label($object->table_element_line);
639 $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
642 $line->fk_product = $lines[$i]->fk_product;
645 if ($lines[$i]->fk_product > 0) {
647 $stockLocation =
"entl".$line_id;
648 $qty =
"qtyl".$line_id;
649 $comment =
"comment".$line_id;
652 $line->id = $line_id;
653 $line->fk_entrepot =
GETPOST($stockLocation,
'int');
654 $line->qty =
GETPOST($qty,
'int');
655 $line->comment =
GETPOST($comment,
'alpha');
658 $batch =
"batch".$line_id;
659 $dlc =
"dlc".$line_id;
660 $dluo =
"dluo".$line_id;
662 $eatby =
GETPOST($dluo,
'alpha');
663 $eatbydate = str_replace(
'/',
'-', $eatby);
665 $sellby =
GETPOST($dlc,
'alpha');
666 $sellbydate = str_replace(
'/',
'-', $sellby);
667 $line->batch =
GETPOST($batch,
'alpha');
668 $line->eatby = strtotime($eatbydate);
669 $line->sellby = strtotime($sellbydate);
672 if ($line->update($user) < 0) {
677 $qty =
"qtyl".$line_id;
678 $line->id = $line_id;
679 $line->qty =
GETPOST($qty,
'int');
680 $line->fk_entrepot = 0;
681 if ($line->update($user) < 0) {
690 unset($_POST[
"lineid"]);
693 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
695 $outputlangs = $langs;
698 $newlang =
GETPOST(
'lang_id',
'aZ09');
701 $newlang = $object->thirdparty->default_lang;
703 if (!empty($newlang)) {
705 $outputlangs->setDefaultLang($newlang);
708 $ret = $object->fetch($object->id);
709 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
712 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
715 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
716 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
720 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
726 $triggersendname =
'RECEPTION_SENTBYMAIL';
728 $mode =
'emailfromreception';
729 $trackid =
'rec'.$object->id;
730 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
738 llxHeader(
'', $langs->trans(
'Reception'),
'Reception');
743 if (!empty($conf->project->enabled)) {
747 $product_static =
new Product($db);
749 $warehousestatic =
new Entrepot($db);
751 if ($action ==
'create2') {
752 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
754 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
755 $action =
''; $id =
''; $ref =
'';
759 if ($action ==
'create') {
768 if ($origin ==
'supplierorder') {
769 $classname =
'CommandeFournisseur';
771 $classname = ucfirst($origin);
774 $objectsrc =
new $classname($db);
775 if ($objectsrc->fetch($origin_id)) {
777 $soc->fetch($objectsrc->socid);
779 $author =
new User($db);
780 $author->fetch($objectsrc->user_author_id);
786 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
787 print
'<input type="hidden" name="token" value="'.newToken().
'">';
788 print
'<input type="hidden" name="action" value="add">';
789 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
790 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
791 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
792 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
793 if (
GETPOST(
'entrepot_id',
'int')) {
794 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
799 print
'<table class="border centpercent">';
802 print
'<tr><td class="titlefieldcreate fieldrequired">';
803 if ($origin ==
'supplierorder' && ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order"))) {
804 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;
807 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;
814 if ($origin ==
'supplier_order') {
815 print $langs->trans(
'SupplierOrder');
817 print $langs->trans(
'RefSupplier');
819 print
'</td><td colspan="3">';
820 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
825 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
826 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
830 if (!empty($conf->project->enabled)) {
831 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
832 if (empty($projectid) && !empty($objectsrc->fk_project)) {
833 $projectid = $objectsrc->fk_project;
835 if ($origin ==
'project') {
836 $projectid = ($originid ? $originid : 0);
839 $langs->load(
"projects");
841 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
842 print
img_picto(
'',
'project',
'class="paddingright"');
843 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');
844 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>';
850 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
851 print
'<td colspan="3">';
852 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
853 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
858 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
859 print
'<td colspan="3">';
860 $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%');
861 print $doleditor->Create(1);
865 if ($objectsrc->note_private && !$user->socid) {
866 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
867 print
'<td colspan="3">';
868 $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%');
869 print $doleditor->Create(1);
875 print $langs->trans(
"Weight");
876 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
877 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
878 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
879 print
$form->textwithpicto($text, $htmltext);
883 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
884 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth',
'int').
'">';
885 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight',
'int').
'">';
886 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth',
'int').
'">';
888 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
889 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
890 print
$form->textwithpicto($text, $htmltext);
894 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
895 print
'<td colspan="3">';
896 $recept->fetch_delivery_methods();
897 print
$form->selectarray(
"shipping_method_id", $recept->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
899 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
901 print
"</td></tr>\n";
904 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
905 print
'<td colspan="3">';
906 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
907 print
"</td></tr>\n";
910 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid'=>$socid);
911 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $recept, $action);
912 print $hookmanager->resPrint;
915 $extrafields->fetch_name_optionals_label($object->table_element);
916 if (empty($reshook) && !empty($extrafields->attributes[$object->table_element][
'label'])) {
918 if ($objectsrc->fetch_optionals() > 0) {
919 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
921 print $recept->showOptionals($extrafields,
'create',
$parameters);
927 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
928 print
'<td colspan="3" class="maxwidthonsmartphone">';
929 print
$form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
934 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
937 if (count($list) > 1) {
938 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
939 print
'<td colspan="3">';
940 print
$form->selectarray(
'model', $list, $conf->global->RECEPTION_ADDON_PDF);
941 print
"</td></tr>\n";
955 $suffix2numAsked = array();
956 $dispatchLines = array();
958 foreach ($_POST as $key => $value) {
963 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
965 $paramSuffix = $reg[1] .
'_' . $reg[2];
966 $suffix2numAsked[$paramSuffix] = $numAsked;
969 $numline = $numAsked;
971 $prod =
"product_" . $paramSuffix;
972 $qty =
"qty_" . $paramSuffix;
973 $ent =
"entrepot_" . $paramSuffix;
974 $pu =
"pu_" . $paramSuffix;
975 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
976 $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'));
980 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
982 $paramSuffix = $reg[1] .
'_' . $reg[2];
983 $suffix2numAsked[$paramSuffix] = $numAsked;
987 $numline = $numAsked;
989 $prod =
'product_batch_' . $paramSuffix;
990 $qty =
'qty_' . $paramSuffix;
991 $ent =
'entrepot_' . $paramSuffix;
992 $pu =
'pu_' . $paramSuffix;
993 $lot =
'lot_number_' . $paramSuffix;
994 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'year',
'int'));
995 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'year',
'int'));
996 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
997 $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'));
1001 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1003 $paramSuffix = $reg[1];
1004 $suffix2numAsked[$paramSuffix] = $numAsked;
1008 $numline = $numAsked;
1010 $prod =
'productid'.$paramSuffix;
1011 $comment =
'comment'.$paramSuffix;
1012 $qty =
'qtyl'.$paramSuffix;
1013 $ent =
'entl'.$paramSuffix;
1014 $pu =
'pul'.$paramSuffix;
1015 $lot =
'batch'.$paramSuffix;
1016 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'year',
'int'));
1017 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'year',
'int'));
1018 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1019 $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'));
1026 foreach ($suffix2numAsked as $suffix => $n) {
1027 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'commande_fournisseur_dispatch',
'_' . $suffix,
'');
1030 print
'<script type="text/javascript">
1031 jQuery(document).ready(function() {
1032 jQuery("#autofill").click(function() {';
1034 while ($i <= $numAsked) {
1035 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1039 jQuery("#autoreset").click(function() {';
1041 while ($i <= $numAsked) {
1042 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1051 print
'<table class="noborder centpercent">';
1054 $objectsrc->loadReceptions();
1057 print
'<tr class="liste_titre">';
1058 print
'<td>'.$langs->trans(
"Description").
'</td>';
1059 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1060 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1061 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1062 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1063 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
1064 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1066 if (empty($conf->productbatch->enabled)) {
1067 print
' <br>(<a href="#" id="autofill">'.$langs->trans(
"Fill").
'</a>';
1068 print
' / <a href="#" id="autoreset">'.$langs->trans(
"Reset").
'</a>)';
1072 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1075 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1076 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1077 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1079 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1080 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1089 $arrayofpurchaselinealreadyoutput= array();
1093 while ($indiceAsked <= $numAsked) {
1097 foreach ($objectsrc->lines as $supplierLine) {
1098 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1099 $line = $supplierLine;
1105 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1108 if (!empty($line->date_start)) {
1111 if (!empty($line->date_end)) {
1115 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1116 print
'<tr class="oddeven">'.
"\n";
1119 if ($line->fk_product > 0) {
1120 $product->fetch($line->fk_product);
1121 $product->load_stock(
'warehouseopen');
1126 print
'<a name="'.$line->id.
'"></a>';
1128 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1130 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1131 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1134 $product_static = $product;
1136 $text = $product_static->getNomUrl(1);
1137 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1139 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1142 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1146 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1152 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1154 $text =
img_object($langs->trans(
'Service'),
'service');
1156 $text =
img_object($langs->trans(
'Product'),
'product');
1159 if (!empty($line->label)) {
1160 $text .=
' <strong>'.$line->label.
'</strong>';
1161 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1163 print $text.
' '.nl2br($line->desc);
1167 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1174 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1176 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1180 print
'<td class="center">';
1181 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1184 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1185 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->pu_ht.
'">';
1186 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1188 $qtyProdCom = $line->qty;
1191 print
'<td class="center">';
1192 $quantityDelivered = $objectsrc->receptions[$line->id];
1193 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1194 print $quantityDelivered;
1196 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1200 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1201 $quantityToBeDelivered = 0;
1203 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1205 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1208 $warehouseObject =
null;
1210 print
'<!-- Case warehouse already known or product not a predefined product -->';
1212 $stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1213 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1214 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1217 print
'<td class="center">';
1218 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1219 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1220 $defaultqty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1222 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1223 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1225 print $langs->trans(
"NA");
1229 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
1231 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.$cost_price.
'">';
1237 print
'<td class="left">';
1238 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1240 $ent =
"entl".$indiceAsked;
1241 $idl =
"idl".$indiceAsked;
1242 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1243 if ($line->fk_product > 0) {
1244 print
'<!-- Show warehouse selection -->';
1245 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1248 print $langs->trans(
"Service");
1254 if (!empty($product->status_batch)) {
1255 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1256 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1257 print
'<td class="nowraponall">';
1258 print
$form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked,
'',
'', 1,
"");
1261 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1262 print
'<td class="nowraponall">';
1263 print
$form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked,
'',
'', 1,
"");
1267 print
'<td colspan="3"></td>';
1272 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1278 if (!empty($extrafields)) {
1282 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1285 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1292 $srcLine->id = $line->id;
1293 $srcLine->fetch_optionals();
1295 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1296 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1298 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1300 print $recLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1310 print
$form->buttonsSaveCancel(
"Create");
1319 } elseif ($id || $ref) {
1325 $lines = $object->lines;
1327 $num_prod = count($lines);
1329 if ($object->id > 0) {
1330 if (!empty($object->origin) && $object->origin_id > 0) {
1331 $object->origin =
'CommandeFournisseur';
1332 $typeobject = $object->origin;
1333 $origin = $object->origin;
1334 $origin_id = $object->origin_id;
1335 $object->fetch_origin();
1339 $soc->fetch($object->socid);
1341 $res = $object->fetch_optionals();
1344 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1349 if ($action ==
'delete') {
1350 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception", $object->ref),
'confirm_delete',
'', 0, 1);
1354 if ($action ==
'valid') {
1355 $objectref = substr($object->ref, 1, 4);
1356 if ($objectref ==
'PROV') {
1357 $numref = $object->getNextNumRef($soc);
1359 $numref = $object->ref;
1362 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1365 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1366 $notify =
new Notify($db);
1368 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE', $object->socid, $object);
1371 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1);
1375 if ($action ==
'annuler') {
1376 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception", $object->ref),
'confirm_cancel',
'', 0, 1);
1381 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1382 if (empty($reshook)) {
1384 } elseif ($reshook > 0) {
1395 $tmparray = $object->getTotalWeightVolume();
1396 $totalWeight = $tmparray[
'weight'];
1397 $totalVolume = $tmparray[
'volume'];
1400 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1402 $objectsrc->fetch($object->$typeobject->id);
1404 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1405 $objectsrc =
new Propal($db);
1406 $objectsrc->fetch($object->$typeobject->id);
1408 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id && ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order"))) {
1410 $objectsrc->fetch($object->$typeobject->id);
1413 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1414 $morehtmlref =
'<div class="refidno">';
1417 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
1418 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
1421 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1423 if (!empty($conf->project->enabled)) {
1424 $langs->load(
"projects");
1425 $morehtmlref .=
'<br>';
1427 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1428 if ($action !=
'classify' && $permissiontoadd) {
1429 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1431 $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');
1433 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1435 $proj->fetch($objectsrc->fk_project);
1436 $morehtmlref .= $proj->getNomUrl(1);
1438 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1443 $morehtmlref .=
'</div>';
1445 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1448 print
'<div class="fichecenter">';
1449 print
'<div class="fichehalfleft">';
1450 print
'<div class="underbanner clearboth"></div>';
1452 print
'<table class="border centpercent tableforfield">';
1455 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1457 print $langs->trans(
"RefOrder").
'</td>';
1458 print
'<td colspan="3">';
1459 print $objectsrc->getNomUrl(1,
'commande');
1463 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1465 print $langs->trans(
"RefProposal").
'</td>';
1466 print
'<td colspan="3">';
1467 print $objectsrc->getNomUrl(1,
'reception');
1471 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1473 print $langs->trans(
"SupplierOrder").
'</td>';
1474 print
'<td colspan="3">';
1475 print $objectsrc->getNomUrl(1,
'reception');
1481 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1482 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
1486 print
'<tr><td height="10">';
1487 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1488 print $langs->trans(
'DateDeliveryPlanned');
1491 if ($action !=
'editdate_livraison') {
1492 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>';
1494 print
'</tr></table>';
1495 print
'</td><td colspan="2">';
1496 if ($action ==
'editdate_livraison') {
1497 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1498 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1499 print
'<input type="hidden" name="action" value="setdate_livraison">';
1500 print
$form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1501 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1504 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1511 print
$form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->reception->creer);
1512 print
'</td><td colspan="3">';
1514 if ($action ==
'edittrueWeight') {
1515 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1516 print
'<input name="action" value="settrueWeight" type="hidden">';
1517 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1518 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1519 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
1520 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2);
1521 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1522 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1525 print $object->trueWeight;
1526 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1530 if ($totalWeight > 0) {
1531 if (!empty($object->trueWeight)) {
1532 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1534 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');
1535 if (!empty($object->trueWeight)) {
1542 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1543 print
$form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer);
1544 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1548 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1549 if ($action ==
'edittrueHeight') {
1550 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1551 print
'<input name="action" value="settrueHeight" type="hidden">';
1552 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1553 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1554 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
1555 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1556 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1557 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1560 print $object->trueHeight;
1561 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1567 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1568 print
$form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer);
1569 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1574 print $langs->trans(
"Volume");
1576 print
'<td colspan="3">';
1577 $calculatedVolume = 0;
1579 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1580 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1581 $volumeUnit = $object->size_units * 3;
1584 if ($calculatedVolume > 0) {
1585 if ($volumeUnit < 50) {
1586 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');
1591 if ($totalVolume > 0) {
1592 if ($calculatedVolume) {
1593 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1595 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');
1597 if ($calculatedVolume) {
1607 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1612 print
'<div class="fichehalfright">';
1613 print
'<div class="underbanner clearboth"></div>';
1615 print
'<table class="border centpercent tableforfield">';
1618 print
'<tr><td height="10">';
1619 print
'<table class="nobordernopadding centpercent"><tr><td>';
1620 print $langs->trans(
'ReceptionMethod');
1623 if ($action !=
'editshipping_method_id') {
1624 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>';
1626 print
'</tr></table>';
1627 print
'</td><td colspan="2">';
1628 if ($action ==
'editshipping_method_id') {
1629 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1630 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1631 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1632 $object->fetch_delivery_methods();
1633 print
$form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1635 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1637 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1640 if ($object->shipping_method_id > 0) {
1642 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1643 print $langs->trans(
"SendingMethod".strtoupper($code));
1650 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1651 print
$form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->reception->creer,
'safehtmlstring', $object->tracking_number);
1657 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1658 print $langs->trans(
'IncotermLabel');
1659 print
'<td><td class="right">';
1660 if ($user->rights->reception->creer) {
1661 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
1665 print
'</td></tr></table>';
1667 print
'<td colspan="3">';
1668 if ($action !=
'editincoterm') {
1669 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
1671 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
1681 print
'<div class="clearboth"></div>';
1685 if ($action ==
'editline') {
1686 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
1687 <input type="hidden" name="token" value="' .
newToken().
'">
1688 <input type="hidden" name="action" value="updateline">
1689 <input type="hidden" name="mode" value="">
1690 <input type="hidden" name="id" value="' . $object->id.
'">';
1694 print
'<div class="div-table-responsive-no-min">';
1695 print
'<table id="tablelines" class="noborder centpercent">';
1697 print
'<tr class="liste_titre">';
1699 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1700 print
'<td width="5" class="center"> </td>';
1703 print
'<td>'.$langs->trans(
"Products").
'</td>';
1705 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1707 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1708 if ($origin && $origin_id > 0) {
1709 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
1711 if ($action ==
'editline') {
1716 if (empty($conf->productbatch->enabled)) {
1719 print
'<td class="center" colspan="'.$editColspan.
'">';
1720 if ($object->statut <= 1) {
1721 print $langs->trans(
"QtyToReceive").
' - ';
1723 print $langs->trans(
"QtyReceived").
' - ';
1726 print $langs->trans(
"WarehouseTarget").
' - ';
1729 print $langs->trans(
"Batch");
1733 $statusreceived = $object::STATUS_CLOSED;
1735 $statusreceived = $object::STATUS_VALIDATED;
1738 $statusreceived = $object::STATUS_CLOSED;
1740 if ($object->statut < $statusreceived) {
1741 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
1743 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1746 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
1750 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
1753 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
1754 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
1756 if ($object->statut == 0) {
1757 print
'<td class="linecoledit"></td>';
1758 print
'<td class="linecoldelete" width="10"></td>';
1765 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1766 $object->fetch_thirdparty();
1767 $outputlangs = $langs;
1769 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1770 $newlang =
GETPOST(
'lang_id',
'aZ09');
1772 if (empty($newlang)) {
1773 $newlang = $object->thirdparty->default_lang;
1775 if (!empty($newlang)) {
1776 $outputlangs =
new Translate(
"", $conf);
1777 $outputlangs->setDefaultLang($newlang);
1782 $alreadysent = array();
1784 $origin =
'commande_fournisseur';
1786 if ($origin && $origin_id > 0) {
1787 $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";
1788 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
1789 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
1791 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
1792 $sql .=
', p.description as product_desc';
1793 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as ed";
1794 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
1795 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
1797 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
1798 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
1799 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
1800 $sql .=
" AND obj.rowid = ed.fk_commandefourndet";
1801 $sql .=
" AND ed.fk_reception = e.rowid";
1802 $sql .=
" AND ed.fk_reception !=".((int) $object->id);
1804 $sql .=
" ORDER BY obj.fk_product";
1806 dol_syslog(
"get list of reception lines", LOG_DEBUG);
1807 $resql = $db->query($sql);
1809 $num = $db->num_rows(
$resql);
1813 $obj = $db->fetch_object(
$resql);
1816 $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);
1824 $arrayofpurchaselinealreadyoutput = array();
1828 for ($i = 0; $i < $num_prod; $i++) {
1829 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
1830 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
1833 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1834 print
'<td class="center">'.($i + 1).
'</td>';
1838 if ($lines[$i]->fk_product > 0) {
1840 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1842 $prod->fetch($lines[$i]->fk_product);
1843 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
1845 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
1848 print
'<td class="linecoldescription">';
1849 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1850 $text = $lines[$i]->product->getNomUrl(1);
1851 $text .=
' - '.$label;
1853 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1854 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
1856 print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ?
'<br>'.dol_htmlentitiesbr($lines[$i]->
description) :
'';
1861 print
'<td class="linecoldescription">';
1862 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1864 $text =
img_object($langs->trans(
'Service'),
'service');
1866 $text =
img_object($langs->trans(
'Product'),
'product');
1869 if (!empty($lines[$i]->label)) {
1870 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
1871 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
1881 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1882 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
1884 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
1889 print
'<td class="center linecolqty">';
1890 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1891 print $lines[$i]->qty_asked;
1896 if ($origin && $origin_id > 0) {
1897 print
'<td class="center nowrap linecolqtyinotherreceptions">';
1898 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1899 foreach ($alreadysent as $key => $val) {
1900 if ($lines[$i]->fk_commandefourndet == $key) {
1902 foreach ($val as $receptionline_id => $receptionline_var) {
1903 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
1911 $reception_static->fetch($receptionline_var[
'reception_id']);
1912 print $reception_static->getNomUrl(1);
1913 print
' - '.$receptionline_var[
'qty'];
1915 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
1916 if (
isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
1917 $warehousestatic->fetch($receptionline_var[
'warehouse']);
1918 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
1920 print
' '.$form->textwithpicto(
'', $htmltext, 1);
1928 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1930 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
1932 if ($lines[$i]->fk_product > 0) {
1933 print
'<!-- case edit 1 -->';
1936 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1938 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
1940 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
1941 print
'<td class="nowraponall"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
1942 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1943 print $langs->trans(
'SellByDate').
' : ';
1944 print
$form->selectDate($lines[$i]->sellby,
'dlc'.$line_id,
'',
'', 1,
"").
'</br>';
1946 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1947 print $langs->trans(
'EatByDate').
' : ';
1948 print
$form->selectDate($lines[$i]->eatby,
'dluo'.$line_id,
'',
'', 1,
"");
1954 print
'<!-- case edit 2 -->';
1957 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1965 print
'</table></td>';
1968 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
1972 if ($lines[$i]->fk_entrepot > 0) {
1974 $entrepot->fetch($lines[$i]->fk_entrepot);
1976 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
1977 print $entrepot->getNomUrl(1);
1986 if (isset($lines[$i]->batch)) {
1987 print
'<!-- Detail of lot -->';
1988 print
'<td class="linecolbatch nowrap">';
1989 $detail = $langs->trans(
"NA");
1990 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
1991 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1993 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
1995 $detail = $productlot->getNomUrl(1);
1998 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
1999 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
2000 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2002 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2003 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2005 $detail =
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2007 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2008 $detail .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2012 print
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $detail);
2014 print $langs->trans(
"NA");
2024 print
'<td class="center linecolweight">';
2026 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2033 print
'<td class="center linecolvolume">';
2035 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2042 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2043 print
'<td class="center" colspan="2" valign="middle">';
2044 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2045 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2046 } elseif ($object->statut == Reception::STATUS_DRAFT) {
2048 print
'<td class="linecoledit center">';
2049 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2051 print
'<td class="linecoldelete" width="10">';
2052 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2056 if (!empty($rowExtrafieldsStart)) {
2057 print $rowExtrafieldsStart;
2058 print $rowExtrafieldsView;
2064 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2067 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2068 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2069 $colspan = empty($conf->productbatch->enabled) ? 8 : 9;
2071 $line->id = $lines[$i]->id;
2072 $line->fetch_optionals();
2074 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2075 print $line->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan), $indiceAsked);
2077 print $line->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan), $indiceAsked);
2093 $object->fetchObjectLinked($object->id, $object->element);
2100 if (($user->socid == 0) && ($action !=
'presend')) {
2101 print
'<div class="tabsAction">';
2104 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
2105 if (empty($reshook)) {
2106 if ($object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2107 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer))
2108 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) {
2109 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2111 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2115 if ($object->statut == Reception::STATUS_VALIDATED && $user->rights->reception->creer) {
2116 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2121 if ($object->statut == Reception::STATUS_CLOSED && $user->rights->reception->creer) {
2122 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2123 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ClassifyUnbilled").
'</a>';
2125 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2130 if (empty($user->socid)) {
2131 if ($object->statut > 0) {
2132 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) {
2133 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2135 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2141 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_invoice")) && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) {
2142 if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
2145 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>';
2151 if ($object->statut == Reception::STATUS_VALIDATED) {
2152 if ($user->rights->reception->creer && $object->statut > 0 && !$object->billed) {
2153 $label =
"Close"; $paramaction =
'classifyclosed';
2155 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order")) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2156 $label =
"ClassifyBilled";
2157 $paramaction =
'classifybilled';
2159 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action='.$paramaction.
'&token='.
newToken().
'">'.$langs->trans($label).
'</a>';
2163 if ($user->rights->reception->supprimer) {
2164 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2176 if ($action !=
'presend' && $action !=
'editline') {
2177 print
'<div class="fichecenter"><div class="fichehalfleft">';
2180 $filedir = $conf->reception->dir_output.
"/".$objectref;
2182 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2184 $genallowed = $user->rights->reception->lire;
2185 $delallowed = $user->rights->reception->creer;
2187 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2191 $somethingshown =
$form->showLinkedObjectBlock($object,
'');
2193 print
'</div><div class="fichehalfright">';
2195 print
'</div></div>';
2199 $modelmail =
'shipping_send';
2200 $defaulttopic =
'SendReceptionRef';
2201 $diroutput = $conf->reception->dir_output;
2202 $trackid =
'rec'.$object->id;
2204 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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
print *****$script_file(".$version.") pid 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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
isModEnabled($module)
Is Dolibarr module enabled.
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.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.