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';
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(
"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 $title = $object->ref.
' - '.$langs->trans(
'Reception');
749 $product_static =
new Product($db);
751 $warehousestatic =
new Entrepot($db);
753 if ($action ==
'create2') {
754 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
756 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
757 $action =
''; $id =
''; $ref =
'';
761 if ($action ==
'create') {
770 if ($origin ==
'supplierorder') {
771 $classname =
'CommandeFournisseur';
773 $classname = ucfirst($origin);
776 $objectsrc =
new $classname($db);
777 if ($objectsrc->fetch($origin_id)) {
779 $soc->fetch($objectsrc->socid);
781 $author =
new User($db);
782 $author->fetch($objectsrc->user_author_id);
788 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
789 print
'<input type="hidden" name="token" value="'.newToken().
'">';
790 print
'<input type="hidden" name="action" value="add">';
791 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
792 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
793 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
794 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
795 if (
GETPOST(
'entrepot_id',
'int')) {
796 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
801 print
'<table class="border centpercent">';
804 print
'<tr><td class="titlefieldcreate fieldrequired">';
805 if ($origin ==
'supplierorder' &&
isModEnabled(
"supplier_order")) {
806 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;
809 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;
816 if ($origin ==
'supplier_order') {
817 print $langs->trans(
'SupplierOrder');
819 print $langs->trans(
'RefSupplier');
821 print
'</td><td colspan="3">';
822 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
827 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
828 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
833 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
834 if (empty($projectid) && !empty($objectsrc->fk_project)) {
835 $projectid = $objectsrc->fk_project;
837 if ($origin ==
'project') {
838 $projectid = ($originid ? $originid : 0);
841 $langs->load(
"projects");
843 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
844 print
img_picto(
'',
'project',
'class="paddingright"');
845 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');
846 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>';
852 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
853 print
'<td colspan="3">';
854 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
855 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
860 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
861 print
'<td colspan="3">';
862 $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%');
863 print $doleditor->Create(1);
867 if ($objectsrc->note_private && !$user->socid) {
868 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
869 print
'<td colspan="3">';
870 $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%');
871 print $doleditor->Create(1);
877 print $langs->trans(
"Weight");
878 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
879 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
880 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
881 print
$form->textwithpicto($text, $htmltext);
885 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
886 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth',
'int').
'">';
887 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight',
'int').
'">';
888 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth',
'int').
'">';
890 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
891 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
892 print
$form->textwithpicto($text, $htmltext);
896 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
897 print
'<td colspan="3">';
898 $recept->fetch_delivery_methods();
899 print
$form->selectarray(
"shipping_method_id", $recept->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
901 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
903 print
"</td></tr>\n";
906 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
907 print
'<td colspan="3">';
908 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
909 print
"</td></tr>\n";
912 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid'=>$socid);
913 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $recept, $action);
914 print $hookmanager->resPrint;
917 $extrafields->fetch_name_optionals_label($object->table_element);
918 if (empty($reshook) && !empty($extrafields->attributes[$object->table_element][
'label'])) {
920 if ($objectsrc->fetch_optionals() > 0) {
921 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
923 print $recept->showOptionals($extrafields,
'create',
$parameters);
929 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
930 print
'<td colspan="3" class="maxwidthonsmartphone">';
931 print
$form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
936 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
939 if (count($list) > 1) {
940 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
941 print
'<td colspan="3">';
942 print
$form->selectarray(
'model', $list, $conf->global->RECEPTION_ADDON_PDF);
943 print
"</td></tr>\n";
957 $suffix2numAsked = array();
958 $dispatchLines = array();
960 foreach ($_POST as $key => $value) {
965 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
967 $paramSuffix = $reg[1] .
'_' . $reg[2];
968 $suffix2numAsked[$paramSuffix] = $numAsked;
971 $numline = $numAsked;
973 $prod =
"product_" . $paramSuffix;
974 $qty =
"qty_" . $paramSuffix;
975 $ent =
"entrepot_" . $paramSuffix;
976 $pu =
"pu_" . $paramSuffix;
977 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
978 $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'));
982 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
984 $paramSuffix = $reg[1] .
'_' . $reg[2];
985 $suffix2numAsked[$paramSuffix] = $numAsked;
989 $numline = $numAsked;
991 $prod =
'product_batch_' . $paramSuffix;
992 $qty =
'qty_' . $paramSuffix;
993 $ent =
'entrepot_' . $paramSuffix;
994 $pu =
'pu_' . $paramSuffix;
995 $lot =
'lot_number_' . $paramSuffix;
996 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'year',
'int'));
997 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'year',
'int'));
998 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
999 $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'));
1003 if (preg_match(
'/^productl([0-9]+)$/i', $key, $reg)) {
1005 $paramSuffix = $reg[1];
1006 $suffix2numAsked[$paramSuffix] = $numAsked;
1010 $numline = $numAsked;
1012 $prod =
'productid'.$paramSuffix;
1013 $comment =
'comment'.$paramSuffix;
1014 $qty =
'qtyl'.$paramSuffix;
1015 $ent =
'entl'.$paramSuffix;
1016 $pu =
'pul'.$paramSuffix;
1017 $lot =
'batch'.$paramSuffix;
1018 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'year',
'int'));
1019 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'year',
'int'));
1020 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
1021 $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'));
1028 foreach ($suffix2numAsked as $suffix => $n) {
1029 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'commande_fournisseur_dispatch',
'_' . $suffix,
'');
1032 print
'<script type="text/javascript">
1033 jQuery(document).ready(function() {
1034 jQuery("#autofill").click(function() {';
1036 while ($i <= $numAsked) {
1037 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1041 jQuery("#autoreset").click(function() {';
1043 while ($i <= $numAsked) {
1044 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1053 print
'<table class="noborder centpercent">';
1056 $objectsrc->loadReceptions();
1059 print
'<tr class="liste_titre">';
1060 print
'<td>'.$langs->trans(
"Description").
'</td>';
1061 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1062 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1063 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1064 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1066 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1069 print
' <br>(<a href="#" id="autofill">'.$langs->trans(
"Fill").
'</a>';
1070 print
' / <a href="#" id="autoreset">'.$langs->trans(
"Reset").
'</a>)';
1074 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1077 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1079 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1082 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1091 $arrayofpurchaselinealreadyoutput= array();
1095 while ($indiceAsked <= $numAsked) {
1099 foreach ($objectsrc->lines as $supplierLine) {
1100 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1101 $line = $supplierLine;
1107 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1110 if (!empty($line->date_start)) {
1113 if (!empty($line->date_end)) {
1117 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1118 print
'<tr class="oddeven">'.
"\n";
1121 if ($line->fk_product > 0) {
1122 $product->fetch($line->fk_product);
1123 $product->load_stock(
'warehouseopen');
1128 print
'<a name="'.$line->id.
'"></a>';
1130 print
'<input type="hidden" name="productl'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1132 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1133 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1136 $product_static = $product;
1138 $text = $product_static->getNomUrl(1);
1139 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1141 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1144 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1148 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1154 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1156 $text =
img_object($langs->trans(
'Service'),
'service');
1158 $text =
img_object($langs->trans(
'Product'),
'product');
1161 if (!empty($line->label)) {
1162 $text .=
' <strong>'.$line->label.
'</strong>';
1163 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1165 print $text.
' '.nl2br($line->desc);
1169 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1176 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1178 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1182 print
'<td class="center">';
1183 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1186 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1187 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->pu_ht.
'">';
1188 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1190 $qtyProdCom = $line->qty;
1193 print
'<td class="center">';
1194 $quantityDelivered = $objectsrc->receptions[$line->id];
1195 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1196 print $quantityDelivered;
1198 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1202 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1203 $quantityToBeDelivered = 0;
1205 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1207 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1210 $warehouseObject =
null;
1213 print
'<!-- Case warehouse already known or product not a predefined product -->';
1214 if (array_key_exists($dispatchLines[$indiceAsked][
'ent'], $product->stock_warehouse)) {
1215 $stock = +$product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1217 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1218 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1221 print
'<td class="center">';
1222 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1223 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1224 $defaultqty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1226 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1227 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1229 print $langs->trans(
"NA");
1233 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
1235 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.$cost_price.
'">';
1241 print
'<td class="left">';
1242 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1244 $ent =
"entl".$indiceAsked;
1245 $idl =
"idl".$indiceAsked;
1246 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1247 if ($line->fk_product > 0) {
1248 print
'<!-- Show warehouse selection -->';
1249 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1252 print $langs->trans(
"Service");
1258 if (!empty($product->status_batch)) {
1259 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1260 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1261 print
'<td class="nowraponall">';
1262 print
$form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked,
'',
'', 1,
"");
1265 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1266 print
'<td class="nowraponall">';
1267 print
$form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked,
'',
'', 1,
"");
1271 print
'<td colspan="3"></td>';
1276 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1282 if (!empty($extrafields)) {
1286 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1289 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1296 $srcLine->id = $line->id;
1297 $srcLine->fetch_optionals();
1299 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1300 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1302 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1304 print $recLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1314 print
$form->buttonsSaveCancel(
"Create");
1323 } elseif ($id || $ref) {
1329 $lines = $object->lines;
1331 $num_prod = count($lines);
1333 if ($object->id > 0) {
1334 if (!empty($object->origin) && $object->origin_id > 0) {
1335 $object->origin =
'CommandeFournisseur';
1336 $typeobject = $object->origin;
1337 $origin = $object->origin;
1338 $origin_id = $object->origin_id;
1339 $object->fetch_origin();
1343 $soc->fetch($object->socid);
1345 $res = $object->fetch_optionals();
1348 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1353 if ($action ==
'delete') {
1354 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception", $object->ref),
'confirm_delete',
'', 0, 1);
1358 if ($action ==
'valid') {
1359 $objectref = substr($object->ref, 1, 4);
1360 if ($objectref ==
'PROV') {
1361 $numref = $object->getNextNumRef($soc);
1363 $numref = $object->ref;
1366 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1369 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1370 $notify =
new Notify($db);
1372 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE', $object->socid, $object);
1375 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1);
1379 if ($action ==
'annuler') {
1380 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception", $object->ref),
'confirm_cancel',
'', 0, 1);
1385 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1386 if (empty($reshook)) {
1388 } elseif ($reshook > 0) {
1399 $tmparray = $object->getTotalWeightVolume();
1400 $totalWeight = $tmparray[
'weight'];
1401 $totalVolume = $tmparray[
'volume'];
1404 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1406 $objectsrc->fetch($object->$typeobject->id);
1408 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1409 $objectsrc =
new Propal($db);
1410 $objectsrc->fetch($object->$typeobject->id);
1412 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id &&
isModEnabled(
"supplier_order")) {
1414 $objectsrc->fetch($object->$typeobject->id);
1417 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1418 $morehtmlref =
'<div class="refidno">';
1421 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
1422 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
1425 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1428 $langs->load(
"projects");
1429 $morehtmlref .=
'<br>';
1431 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1432 if ($action !=
'classify' && $permissiontoadd) {
1433 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1435 $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');
1437 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1439 $proj->fetch($objectsrc->fk_project);
1440 $morehtmlref .= $proj->getNomUrl(1);
1442 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1447 $morehtmlref .=
'</div>';
1449 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1452 print
'<div class="fichecenter">';
1453 print
'<div class="fichehalfleft">';
1454 print
'<div class="underbanner clearboth"></div>';
1456 print
'<table class="border centpercent tableforfield">';
1459 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1461 print $langs->trans(
"RefOrder").
'</td>';
1462 print
'<td colspan="3">';
1463 print $objectsrc->getNomUrl(1,
'commande');
1467 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1469 print $langs->trans(
"RefProposal").
'</td>';
1470 print
'<td colspan="3">';
1471 print $objectsrc->getNomUrl(1,
'reception');
1475 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1477 print $langs->trans(
"SupplierOrder").
'</td>';
1478 print
'<td colspan="3">';
1479 print $objectsrc->getNomUrl(1,
'reception');
1485 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1486 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
1490 print
'<tr><td height="10">';
1491 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1492 print $langs->trans(
'DateDeliveryPlanned');
1495 if ($action !=
'editdate_livraison') {
1496 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>';
1498 print
'</tr></table>';
1499 print
'</td><td colspan="2">';
1500 if ($action ==
'editdate_livraison') {
1501 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1502 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1503 print
'<input type="hidden" name="action" value="setdate_livraison">';
1504 print
$form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1505 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1508 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1515 print
$form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->reception->creer);
1516 print
'</td><td colspan="3">';
1518 if ($action ==
'edittrueWeight') {
1519 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1520 print
'<input name="action" value="settrueWeight" type="hidden">';
1521 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1522 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1523 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
1524 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2);
1525 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1526 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1529 print $object->trueWeight;
1530 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1534 if ($totalWeight > 0) {
1535 if (!empty($object->trueWeight)) {
1536 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1538 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');
1539 if (!empty($object->trueWeight)) {
1546 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1547 print
$form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer);
1548 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1552 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1553 if ($action ==
'edittrueHeight') {
1554 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1555 print
'<input name="action" value="settrueHeight" type="hidden">';
1556 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1557 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1558 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
1559 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1560 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1561 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1564 print $object->trueHeight;
1565 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1571 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1572 print
$form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer);
1573 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1578 print $langs->trans(
"Volume");
1580 print
'<td colspan="3">';
1581 $calculatedVolume = 0;
1583 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1584 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1585 $volumeUnit = $object->size_units * 3;
1588 if ($calculatedVolume > 0) {
1589 if ($volumeUnit < 50) {
1590 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');
1595 if ($totalVolume > 0) {
1596 if ($calculatedVolume) {
1597 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1599 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');
1601 if ($calculatedVolume) {
1611 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1616 print
'<div class="fichehalfright">';
1617 print
'<div class="underbanner clearboth"></div>';
1619 print
'<table class="border centpercent tableforfield">';
1622 print
'<tr><td height="10">';
1623 print
'<table class="nobordernopadding centpercent"><tr><td>';
1624 print $langs->trans(
'ReceptionMethod');
1627 if ($action !=
'editshipping_method_id') {
1628 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>';
1630 print
'</tr></table>';
1631 print
'</td><td colspan="2">';
1632 if ($action ==
'editshipping_method_id') {
1633 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1634 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1635 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1636 $object->fetch_delivery_methods();
1637 print
$form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1639 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1641 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1644 if ($object->shipping_method_id > 0) {
1646 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1647 print $langs->trans(
"SendingMethod".strtoupper($code));
1654 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1655 print
$form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->reception->creer,
'safehtmlstring', $object->tracking_number);
1661 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1662 print $langs->trans(
'IncotermLabel');
1663 print
'<td><td class="right">';
1664 if ($user->rights->reception->creer) {
1665 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
1669 print
'</td></tr></table>';
1671 print
'<td colspan="3">';
1672 if ($action !=
'editincoterm') {
1673 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
1675 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
1685 print
'<div class="clearboth"></div>';
1689 if ($action ==
'editline') {
1690 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
1691 <input type="hidden" name="token" value="' .
newToken().
'">
1692 <input type="hidden" name="action" value="updateline">
1693 <input type="hidden" name="mode" value="">
1694 <input type="hidden" name="id" value="' . $object->id.
'">';
1698 print
'<div class="div-table-responsive-no-min">';
1699 print
'<table id="tablelines" class="noborder centpercent">';
1701 print
'<tr class="liste_titre">';
1703 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1704 print
'<td width="5" class="center"> </td>';
1707 print
'<td>'.$langs->trans(
"Products").
'</td>';
1709 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1711 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1712 if ($origin && $origin_id > 0) {
1713 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
1715 if ($action ==
'editline') {
1720 if (empty($conf->productbatch->enabled)) {
1723 print
'<td class="center" colspan="'.$editColspan.
'">';
1724 if ($object->statut <= 1) {
1725 print $langs->trans(
"QtyToReceive").
' - ';
1727 print $langs->trans(
"QtyReceived").
' - ';
1730 print $langs->trans(
"WarehouseTarget").
' - ';
1733 print $langs->trans(
"Batch");
1737 $statusreceived = $object::STATUS_CLOSED;
1739 $statusreceived = $object::STATUS_VALIDATED;
1742 $statusreceived = $object::STATUS_CLOSED;
1744 if ($object->statut < $statusreceived) {
1745 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
1747 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1750 print
'<td class="left">'.$langs->trans(
"WarehouseTarget").
'</td>';
1754 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
1757 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
1758 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
1760 if ($object->statut == 0) {
1761 print
'<td class="linecoledit"></td>';
1762 print
'<td class="linecoldelete" width="10"></td>';
1769 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1770 $object->fetch_thirdparty();
1771 $outputlangs = $langs;
1773 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1774 $newlang =
GETPOST(
'lang_id',
'aZ09');
1776 if (empty($newlang)) {
1777 $newlang = $object->thirdparty->default_lang;
1779 if (!empty($newlang)) {
1780 $outputlangs =
new Translate(
"", $conf);
1781 $outputlangs->setDefaultLang($newlang);
1786 $alreadysent = array();
1788 $origin =
'commande_fournisseur';
1790 if ($origin && $origin_id > 0) {
1791 $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";
1792 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
1793 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
1795 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
1796 $sql .=
', p.description as product_desc';
1797 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as ed";
1798 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
1799 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
1801 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
1802 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
1803 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
1804 $sql .=
" AND obj.rowid = ed.fk_commandefourndet";
1805 $sql .=
" AND ed.fk_reception = e.rowid";
1806 $sql .=
" AND ed.fk_reception !=".((int) $object->id);
1808 $sql .=
" ORDER BY obj.fk_product";
1810 dol_syslog(
"get list of reception lines", LOG_DEBUG);
1811 $resql = $db->query(
$sql);
1813 $num = $db->num_rows($resql);
1817 $obj = $db->fetch_object($resql);
1820 $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);
1828 $arrayofpurchaselinealreadyoutput = array();
1832 for ($i = 0; $i < $num_prod; $i++) {
1833 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
1834 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
1837 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1838 print
'<td class="center">'.($i + 1).
'</td>';
1842 if ($lines[$i]->fk_product > 0) {
1844 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1846 $prod->fetch($lines[$i]->fk_product);
1847 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
1849 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
1852 print
'<td class="linecoldescription">';
1853 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1854 $text = $lines[$i]->product->getNomUrl(1);
1855 $text .=
' - '.$label;
1857 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1858 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
1860 print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ?
'<br>'.dol_htmlentitiesbr($lines[$i]->
description) :
'';
1865 print
'<td class="linecoldescription">';
1866 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1868 $text =
img_object($langs->trans(
'Service'),
'service');
1870 $text =
img_object($langs->trans(
'Product'),
'product');
1873 if (!empty($lines[$i]->label)) {
1874 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
1875 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
1885 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1886 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
1888 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
1893 print
'<td class="center linecolqty">';
1894 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1895 print $lines[$i]->qty_asked;
1900 if ($origin && $origin_id > 0) {
1901 print
'<td class="center nowrap linecolqtyinotherreceptions">';
1903 $qtyalreadyreceived = 0;
1904 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1905 foreach ($alreadysent as $key => $val) {
1906 if ($lines[$i]->fk_commandefourndet == $key) {
1908 foreach ($val as $receptionline_id => $receptionline_var) {
1909 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
1915 $htmltooltip .=
'<br>';
1917 $reception_static->fetch($receptionline_var[
'reception_id']);
1918 $htmltooltip .= $reception_static->getNomUrl(1, 0, 0, 0, 1);
1919 $htmltooltip .=
' - '.$receptionline_var[
'qty'];
1921 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
1922 if (
isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
1923 $warehousestatic->fetch($receptionline_var[
'warehouse']);
1924 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
1926 $htmltooltip .=
' '.$form->textwithpicto(
'', $htmltext, 1);
1928 $qtyalreadyreceived += $receptionline_var[
'qty'];
1931 $htmltooltip = $langs->trans(
"QtyInOtherReceptions").
'...<br><br>'.$htmltooltip.
'<br><input type="submit" name="dummyhiddenbuttontogetfocus" style="display:none" autofocus>';
1936 print
$form->textwithpicto($qtyalreadyreceived, $htmltooltip, 1,
'info',
'', 0, 3,
'tooltip'.$lines[$i]->
id);
1940 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1942 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
1944 if ($lines[$i]->fk_product > 0) {
1945 print
'<!-- case edit 1 -->';
1948 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1950 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
1952 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
1953 print
'<td class="nowraponall left"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
1954 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1955 print $langs->trans(
'SellByDate').
' : ';
1956 print
$form->selectDate($lines[$i]->sellby,
'dlc'.$line_id,
'',
'', 1,
"").
'</br>';
1958 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1959 print $langs->trans(
'EatByDate').
' : ';
1960 print
$form->selectDate($lines[$i]->eatby,
'dluo'.$line_id,
'',
'', 1,
"");
1966 print
'<!-- case edit 2 -->';
1969 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1977 print
'</table></td>';
1980 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
1984 if ($lines[$i]->fk_entrepot > 0) {
1986 $entrepot->fetch($lines[$i]->fk_entrepot);
1988 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
1989 print $entrepot->getNomUrl(1);
1998 if (isset($lines[$i]->batch)) {
1999 print
'<!-- Detail of lot -->';
2000 print
'<td class="linecolbatch nowrap">';
2001 $detail = $langs->trans(
"NA");
2002 if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) {
2003 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
2005 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
2007 $detail = $productlot->getNomUrl(1);
2010 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
2011 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
2012 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
2014 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
2015 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
2017 $detail =
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
2020 print $detail .
'</td>';
2028 print
'<td class="center linecolweight">';
2030 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
2037 print
'<td class="center linecolvolume">';
2039 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2046 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2047 print
'<td class="center valignmiddle" colspan="2">';
2048 print
'<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2049 print
'<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2051 } elseif ($object->statut == Reception::STATUS_DRAFT) {
2053 print
'<td class="linecoledit center">';
2054 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2056 print
'<td class="linecoldelete" width="10">';
2057 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2061 if (!empty($rowExtrafieldsStart)) {
2062 print $rowExtrafieldsStart;
2063 print $rowExtrafieldsView;
2069 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2072 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2073 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2079 $line->id = $lines[$i]->id;
2080 $line->fetch_optionals();
2082 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2083 print $line->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan), $indiceAsked);
2085 print $line->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan), $indiceAsked);
2101 $object->fetchObjectLinked($object->id, $object->element);
2108 if (($user->socid == 0) && ($action !=
'presend')) {
2109 print
'<div class="tabsAction">';
2112 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
2113 if (empty($reshook)) {
2114 if ($object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2115 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer))
2116 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) {
2117 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2119 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2123 if ($object->statut == Reception::STATUS_VALIDATED && $user->rights->reception->creer) {
2124 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2129 if ($object->statut == Reception::STATUS_CLOSED && $user->rights->reception->creer) {
2130 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2131 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ClassifyUnbilled").
'</a>';
2133 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2138 if (empty($user->socid)) {
2139 if ($object->statut > 0) {
2140 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) {
2141 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2143 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2149 if (
isModEnabled(
"supplier_invoice") && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) {
2150 if ($user->hasRight(
'fournisseur',
'facture',
'creer') || $user->hasRight(
'supplier_invoice',
'creer')) {
2153 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>';
2159 if ($object->statut == Reception::STATUS_VALIDATED) {
2160 if ($user->rights->reception->creer && $object->statut > 0 && !$object->billed) {
2161 $label =
"Close"; $paramaction =
'classifyclosed';
2163 if (
isModEnabled(
"supplier_order") && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2164 $label =
"ClassifyBilled";
2165 $paramaction =
'classifybilled';
2167 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action='.$paramaction.
'&token='.
newToken().
'">'.$langs->trans($label).
'</a>';
2171 if ($user->rights->reception->supprimer) {
2172 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2184 if ($action !=
'presend' && $action !=
'editline') {
2185 print
'<div class="fichecenter"><div class="fichehalfleft">';
2188 $filedir = $conf->reception->dir_output.
"/".$objectref;
2190 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2192 $genallowed = $user->rights->reception->lire;
2193 $delallowed = $user->rights->reception->creer;
2195 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2199 $somethingshown =
$form->showLinkedObjectBlock($object,
'');
2201 print
'</div><div class="fichehalfright">';
2203 print
'</div></div>';
2207 $modelmail =
'shipping_send';
2208 $defaulttopic =
'SendReceptionRef';
2209 $diroutput = $conf->reception->dir_output;
2210 $trackid =
'rec'.$object->id;
2212 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') && $user->hasRight('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') && $user->hasRight('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)) $sql
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.
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.
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.
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.
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.
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...
$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.