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');
98 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
99 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
100 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
107 $extrafields->fetch_name_optionals_label($object->table_element);
108 $extrafields->fetch_name_optionals_label($object->table_element_line);
109 $extrafields->fetch_name_optionals_label($objectorder->table_element_line);
112 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
115 $hookmanager->initHooks(array(
'receptioncard',
'globalcard'));
117 $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'));
119 if ($id > 0 || !empty($ref)) {
120 $object->fetch($id, $ref);
121 $object->fetch_thirdparty();
123 if (!empty($object->origin)) {
124 $origin = $object->origin;
126 $object->fetch_origin();
127 $typeobject = $object->origin;
131 if ($origin ==
'order_supplier' && $object->$typeobject->id && (
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) ||
isModEnabled(
"supplier_order"))) {
132 $origin_id = $object->$typeobject->id;
134 $objectsrc->fetch($object->$typeobject->id);
141 $socid = $user->socid;
144 if (
isModEnabled(
"reception") || $origin ==
'reception' || empty($origin)) {
148 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
149 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
150 } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
156 $permissiontoread = $user->rights->reception->lire;
157 $permissiontoadd = $user->rights->reception->creer;
158 $permissiondellink = $user->rights->reception->creer;
159 $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)));
160 $permissiontodelete = $user->rights->reception->supprimer;
162 $permissiontoread = $user->rights->fournisseur->commande->receptionner;
163 $permissiontoadd = $user->rights->fournisseur->commande->receptionner;
164 $permissiondellink = $user->rights->fournisseur->commande->receptionner;
165 $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)));
166 $permissiontodelete = $user->rights->fournisseur->commande->receptionner;
175 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
180 if (empty($reshook)) {
185 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
188 if ($action ==
'reopen' && $permissiontoadd) {
189 $result = $object->reOpen();
193 if ($action ==
'modif' && $permissiontoadd) {
194 $result = $object->setDraft($user);
197 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
198 $outputlangs = $langs;
201 $newlang =
GETPOST(
'lang_id',
'aZ09');
204 $newlang = $object->thirdparty->default_lang;
206 if (!empty($newlang)) {
208 $outputlangs->setDefaultLang($newlang);
210 $model = $object->model_pdf;
211 $ret = $object->fetch($id);
212 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
220 if ($action ==
'set_incoterms' &&
isModEnabled(
'incoterm') && $permissiontoadd) {
221 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
224 if ($action ==
'setref_supplier' && $permissiontoadd) {
229 $result = $object->setValueFrom(
'ref_supplier',
GETPOST(
'ref_supplier',
'alpha'),
'',
null,
'text',
'', $user,
'RECEPTION_MODIFY');
232 $action =
'editref_supplier';
234 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
239 if ($action ==
'update_extras' && $permissiontoadd) {
243 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
250 $result = $object->insertExtraFields(
'RECEPTION_MODIFY');
258 $action =
'edit_extras';
263 if ($action ==
'add' && $permissiontoadd) {
269 $object->note =
GETPOST(
'note',
'alpha');
270 $object->origin = $origin;
271 $object->origin_id = $origin_id;
272 $object->fk_project =
GETPOST(
'projectid',
'int');
273 $object->weight =
GETPOST(
'weight',
'int') ==
'' ? null :
GETPOST(
'weight',
'int');
274 $object->trueHeight =
GETPOST(
'trueHeight',
'int') ==
'' ? null :
GETPOST(
'trueHeight',
'int');
275 $object->trueWidth =
GETPOST(
'trueWidth',
'int') ==
'' ? null :
GETPOST(
'trueWidth',
'int');
276 $object->trueDepth =
GETPOST(
'trueDepth',
'int') ==
'' ? null :
GETPOST(
'trueDepth',
'int');
277 $object->size_units =
GETPOST(
'size_units',
'int');
278 $object->weight_units =
GETPOST(
'weight_units',
'int');
283 if ($object->origin ==
"supplierorder") {
284 $classname =
'CommandeFournisseur';
286 $classname = ucfirst($object->origin);
288 $objectsrc =
new $classname($db);
289 $objectsrc->fetch($object->origin_id);
291 $object->socid = $objectsrc->socid;
292 $object->ref_supplier =
GETPOST(
'ref_supplier',
'alpha');
293 $object->model_pdf =
GETPOST(
'model');
294 $object->date_delivery = $date_delivery;
295 $object->fk_delivery_address = $objectsrc->fk_delivery_address;
296 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
297 $object->tracking_number =
GETPOST(
'tracking_number',
'alpha');
298 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
299 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
300 $object->fk_incoterms =
GETPOST(
'incoterm_id',
'int');
301 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
303 $batch_line = array();
304 $stockLine = array();
305 $array_options = array();
310 foreach ($_POST as $key => $value) {
313 if (strpos($key,
'qtyasked') !==
false) {
318 for ($i = 1; $i <= $num; $i++) {
325 $batch =
"batchl".$i.
"_0";
326 $stockLocation =
"ent1".$i.
"_0";
330 if (
GETPOST($qty,
'alpha') > 0) {
335 $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
340 for ($i = 1; $i <= $num; $i++) {
342 $lineId =
GETPOST($idl,
'int');
343 foreach ($objectsrc->lines as $linesrc) {
344 if ($linesrc->id == $lineId) {
345 $lineToTest = $linesrc;
349 if (empty($lineToTest)) {
353 $comment =
"comment".$i;
359 $cost_price =
"cost_price".$i;
362 if (
GETPOST($qty,
'int') > 0 || (
GETPOST($qty,
'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) {
367 $entrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') :
GETPOST(
'entrepot_id',
'int');
369 if (!empty($lineToTest)) {
370 $fk_product = $lineToTest->fk_product;
372 $fk_product = $linesrc->fk_product;
375 if ($entrepot_id < 0) {
378 if (!($fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
381 $eatby =
GETPOST($eatby,
'alpha');
382 $sellby =
GETPOST($sellby,
'alpha');
383 $eatbydate = str_replace(
'/',
'-', $eatby);
384 $sellbydate = str_replace(
'/',
'-', $sellby);
386 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
387 $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'));
389 $ret = $object->addline($entrepot_id,
GETPOST($idl,
'int'),
GETPOST($qty,
'int'), $array_options[$i],
GETPOST($comment,
'alpha'), strtotime($eatbydate), strtotime($sellbydate),
GETPOST($batch,
'alpha'));
400 $ret = $extrafields->setOptionalsFromPost(
null, $object);
405 $ret = $object->create($user);
413 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"QtyToReceive").
'/'.$langs->transnoentitiesnoconv(
"Warehouse")),
null,
'errors');
419 header(
"Location: card.php?id=".$object->id);
423 $_GET[
"commande_id"] =
GETPOST(
'commande_id',
'int');
426 } elseif ($action ==
'confirm_valid' && $confirm ==
'yes' && $permissiontovalidate) {
427 $object->fetch_thirdparty();
429 $result = $object->valid($user);
432 $langs->load(
"errors");
436 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
437 $outputlangs = $langs;
440 $newlang =
GETPOST(
'lang_id',
'aZ09');
443 $newlang = $object->thirdparty->default_lang;
445 if (!empty($newlang)) {
447 $outputlangs->setDefaultLang($newlang);
449 $model = $object->model_pdf;
450 $ret = $object->fetch($id);
452 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
458 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
459 $result = $object->delete($user);
461 header(
"Location: ".DOL_URL_ROOT.
'/reception/index.php');
473 } elseif ($action ==
'setdate_livraison' && $permissiontoadd) {
474 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
477 $result = $object->setDeliveryDate($user, $datedelivery);
481 } elseif ($action ==
'settracking_number' || $action ==
'settracking_url'
482 || $action ==
'settrueWeight'
483 || $action ==
'settrueWidth'
484 || $action ==
'settrueHeight'
485 || $action ==
'settrueDepth'
486 || $action ==
'setshipping_method_id') {
490 if ($action ==
'settracking_number') {
491 $object->tracking_number = trim(
GETPOST(
'tracking_number',
'alpha'));
493 if ($action ==
'settracking_url') {
494 $object->tracking_url = trim(
GETPOST(
'tracking_url',
'int'));
496 if ($action ==
'settrueWeight') {
497 $object->trueWeight = trim(
GETPOST(
'trueWeight',
'int'));
498 $object->weight_units =
GETPOST(
'weight_units',
'int');
500 if ($action ==
'settrueWidth') {
501 $object->trueWidth = trim(
GETPOST(
'trueWidth',
'int'));
503 if ($action ==
'settrueHeight') {
504 $object->trueHeight = trim(
GETPOST(
'trueHeight',
'int'));
505 $object->size_units =
GETPOST(
'size_units',
'int');
507 if ($action ==
'settrueDepth') {
508 $object->trueDepth = trim(
GETPOST(
'trueDepth',
'int'));
510 if ($action ==
'setshipping_method_id') {
511 $object->shipping_method_id = trim(
GETPOST(
'shipping_method_id',
'int'));
515 if ($object->update($user) >= 0) {
516 header(
"Location: card.php?id=".$object->id);
523 } elseif ($action ==
'builddoc' && $permissiontoread) {
528 $object->setDocModel($user,
GETPOST(
'model',
'alpha'));
532 $outputlangs = $langs;
535 $newlang =
GETPOST(
'lang_id',
'aZ09');
538 $newlang = $reception->thirdparty->default_lang;
540 if (!empty($newlang)) {
542 $outputlangs->setDefaultLang($newlang);
544 $result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
549 } elseif ($action ==
'remove_file' && $permissiontoadd) {
551 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
553 $upload_dir = $conf->reception->dir_output;
554 $file = $upload_dir.
'/'.
GETPOST(
'file');
561 } elseif ($action ==
'classifybilled') {
562 $result = $object->setBilled();
564 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
567 } elseif ($action ==
'classifyclosed' && $permissiontoread) {
568 $result = $object->setClosed();
570 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
573 } elseif ($action ==
'deleteline' && !empty($line_id) && $permissiontoread) {
575 $lines = $object->lines;
578 $num_prod = count($lines);
579 for ($i = 0; $i < $num_prod; $i++) {
580 if ($lines[$i]->
id == $line_id) {
582 $line->id = $line_id;
583 if (!$error && $line->delete($user) < 0) {
587 unset($_POST[
"lineid"]);
591 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
596 } elseif ($action ==
'updateline' &&
GETPOST(
'save') && $permissiontoadd) {
603 $lines = $object->lines;
604 $num_prod = count($lines);
605 for ($i = 0; $i < $num_prod; $i++) {
606 if ($lines[$i]->
id == $line_id) {
608 $line->fetch($line_id);
610 $extrafields->fetch_name_optionals_label($object->table_element_line);
611 $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
614 $line->fk_product = $lines[$i]->fk_product;
617 if ($lines[$i]->fk_product > 0) {
619 $stockLocation =
"entl".$line_id;
620 $qty =
"qtyl".$line_id;
621 $comment =
"comment".$line_id;
624 $line->id = $line_id;
625 $line->fk_entrepot =
GETPOST($stockLocation,
'int');
626 $line->qty =
GETPOST($qty,
'int');
627 $line->comment =
GETPOST($comment,
'alpha');
630 $batch =
"batch".$line_id;
631 $dlc =
"dlc".$line_id;
632 $dluo =
"dluo".$line_id;
634 $eatby =
GETPOST($dluo,
'alpha');
635 $eatbydate = str_replace(
'/',
'-', $eatby);
637 $sellby =
GETPOST($dlc,
'alpha');
638 $sellbydate = str_replace(
'/',
'-', $sellby);
639 $line->batch =
GETPOST($batch,
'alpha');
640 $line->eatby = strtotime($eatbydate);
641 $line->sellby = strtotime($sellbydate);
644 if ($line->update($user) < 0) {
649 $qty =
"qtyl".$line_id;
650 $line->id = $line_id;
651 $line->qty =
GETPOST($qty,
'int');
652 $line->fk_entrepot = 0;
653 if ($line->update($user) < 0) {
662 unset($_POST[
"lineid"]);
665 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
667 $outputlangs = $langs;
670 $newlang =
GETPOST(
'lang_id',
'aZ09');
673 $newlang = $object->thirdparty->default_lang;
675 if (!empty($newlang)) {
677 $outputlangs->setDefaultLang($newlang);
680 $ret = $object->fetch($object->id);
681 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
684 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
687 } elseif ($action ==
'updateline' && $permissiontoadd &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
688 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
692 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
698 $triggersendname =
'RECEPTION_SENTBYMAIL';
700 $mode =
'emailfromreception';
701 $trackid =
'rec'.$object->id;
702 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
710 llxHeader(
'', $langs->trans(
'Reception'),
'Reception');
715 if (!empty($conf->project->enabled)) {
719 $product_static =
new Product($db);
721 $warehousestatic =
new Entrepot($db);
723 if ($action ==
'create2') {
724 print
load_fiche_titre($langs->trans(
"CreateReception"),
'',
'dollyrevert');
726 print
'<br>'.$langs->trans(
"ReceptionCreationIsDoneFromOrder");
727 $action =
''; $id =
''; $ref =
'';
731 if ($action ==
'create') {
740 if ($origin ==
'supplierorder') {
741 $classname =
'CommandeFournisseur';
743 $classname = ucfirst($origin);
746 $objectsrc =
new $classname($db);
747 if ($objectsrc->fetch($origin_id)) {
749 $soc->fetch($objectsrc->socid);
751 $author =
new User($db);
752 $author->fetch($objectsrc->user_author_id);
758 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
759 print
'<input type="hidden" name="token" value="'.newToken().
'">';
760 print
'<input type="hidden" name="action" value="add">';
761 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
762 print
'<input type="hidden" name="origin_id" value="'.$objectsrc->id.
'">';
763 if (
GETPOST(
'entrepot_id',
'int')) {
764 print
'<input type="hidden" name="entrepot_id" value="'.GETPOST(
'entrepot_id',
'int').
'">';
769 print
'<table class="border centpercent">';
772 print
'<tr><td class="titlefieldcreate fieldrequired">';
773 if ($origin ==
'supplierorder' && ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order"))) {
774 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;
777 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;
784 if ($origin ==
'supplier_order') {
785 print $langs->trans(
'SupplierOrder');
787 print $langs->trans(
'RefSupplier');
789 print
'</td><td colspan="3">';
790 print
'<input type="text" name="ref_supplier" value="'.$objectsrc->ref_supplier.
'" />';
795 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Company').
'</td>';
796 print
'<td colspan="3">'.$soc->getNomUrl(1).
'</td>';
800 if (!empty($conf->project->enabled)) {
801 $projectid =
GETPOST(
'projectid',
'int') ?
GETPOST(
'projectid',
'int') : 0;
802 if (empty($projectid) && !empty($objectsrc->fk_project)) {
803 $projectid = $objectsrc->fk_project;
805 if ($origin ==
'project') {
806 $projectid = ($originid ? $originid : 0);
809 $langs->load(
"projects");
811 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
812 print
img_picto(
'',
'project',
'class="paddingright"');
813 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');
814 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>';
820 print
'<tr><td>'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
821 print
'<td colspan="3">';
822 $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date);
823 print
$form->selectDate($date_delivery ? $date_delivery : -1,
'date_delivery', 1, 1, 1);
828 print
'<tr><td>'.$langs->trans(
"NotePublic").
'</td>';
829 print
'<td colspan="3">';
830 $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%');
831 print $doleditor->Create(1);
835 if ($objectsrc->note_private && !$user->socid) {
836 print
'<tr><td>'.$langs->trans(
"NotePrivate").
'</td>';
837 print
'<td colspan="3">';
838 $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%');
839 print $doleditor->Create(1);
845 print $langs->trans(
"Weight");
846 print
'</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST(
'weight',
'int').
'"> ';
847 $text = $formproduct->selectMeasuringUnits(
"weight_units",
"weight",
GETPOST(
'weight_units',
'int'), 0, 2);
848 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
849 print
$form->textwithpicto($text, $htmltext);
853 print $langs->trans(
"Width").
' x '.$langs->trans(
"Height").
' x '.$langs->trans(
"Depth");
854 print
' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST(
'trueWidth',
'int').
'">';
855 print
' x <input name="trueHeight" size="4" value="'.GETPOST(
'trueHeight',
'int').
'">';
856 print
' x <input name="trueDepth" size="4" value="'.GETPOST(
'trueDepth',
'int').
'">';
858 $text = $formproduct->selectMeasuringUnits(
"size_units",
"size",
GETPOST(
'size_units',
'int'), 0, 2);
859 $htmltext = $langs->trans(
"KeepEmptyForAutoCalculation");
860 print
$form->textwithpicto($text, $htmltext);
864 print
"<tr><td>".$langs->trans(
"ReceptionMethod").
"</td>";
865 print
'<td colspan="3">';
866 $recept->fetch_delivery_methods();
867 print
$form->selectarray(
"shipping_method_id", $recept->meths,
GETPOST(
'shipping_method_id',
'int'), 1, 0, 0,
"", 1);
869 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
871 print
"</td></tr>\n";
874 print
"<tr><td>".$langs->trans(
"TrackingNumber").
"</td>";
875 print
'<td colspan="3">';
876 print
'<input name="tracking_number" size="20" value="'.GETPOST(
'tracking_number',
'alpha').
'">';
877 print
"</td></tr>\n";
880 $parameters = array(
'objectsrc' => $objectsrc,
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'socid'=>$socid);
881 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $recept, $action);
882 print $hookmanager->resPrint;
885 $extrafields->fetch_name_optionals_label($object->table_element);
886 if (empty($reshook) && !empty($extrafields->attributes[$object->table_element][
'label'])) {
888 if ($objectsrc->fetch_optionals() > 0) {
889 $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
891 print $object->showOptionals($extrafields,
'create',
$parameters);
897 print
'<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans(
"IncotermLabel"), $objectsrc->label_incoterms, 1).
'</label></td>';
898 print
'<td colspan="3" class="maxwidthonsmartphone">';
899 print
$form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms :
''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms :
''));
904 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
907 if (count($list) > 1) {
908 print
"<tr><td>".$langs->trans(
"DefaultModel").
"</td>";
909 print
'<td colspan="3">';
910 print
$form->selectarray(
'model', $list, $conf->global->RECEPTION_ADDON_PDF);
911 print
"</td></tr>\n";
925 $suffix2numAsked = array();
926 $dispatchLines = array();
928 foreach ($_POST as $key => $value) {
933 if (preg_match(
'/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
935 $paramSuffix = $reg[1] .
'_' . $reg[2];
936 $suffix2numAsked[$paramSuffix] = $numAsked;
939 $numline = $numAsked;
941 $prod =
"product_" . $paramSuffix;
942 $qty =
"qty_" . $paramSuffix;
943 $ent =
"entrepot_" . $paramSuffix;
944 $pu =
"pu_" . $paramSuffix;
945 $fk_commandefourndet =
"fk_commandefourndet_" . $paramSuffix;
946 $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'));
950 if (preg_match(
'/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) {
952 $paramSuffix = $reg[1] .
'_' . $reg[2];
953 $suffix2numAsked[$paramSuffix] = $numAsked;
957 $numline = $numAsked;
959 $prod =
'product_batch_' . $paramSuffix;
960 $qty =
'qty_' . $paramSuffix;
961 $ent =
'entrepot_' . $paramSuffix;
962 $pu =
'pu_' . $paramSuffix;
963 $lot =
'lot_number_' . $paramSuffix;
964 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo_'.$paramSuffix.
'year',
'int'));
965 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc_'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc_'.$paramSuffix.
'year',
'int'));
966 $fk_commandefourndet =
'fk_commandefourndet_'.$paramSuffix;
967 $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'));
971 if (preg_match(
'/^productid([0-9]+)$/i', $key, $reg)) {
973 $paramSuffix = $reg[1];
974 $suffix2numAsked[$paramSuffix] = $numAsked;
978 $numline = $numAsked;
980 $prod =
'productid'.$paramSuffix;
981 $comment =
'comment'.$paramSuffix;
982 $qty =
'qtyl'.$paramSuffix;
983 $ent =
'entl'.$paramSuffix;
984 $pu =
'pul'.$paramSuffix;
985 $lot =
'batch'.$paramSuffix;
986 $dDLUO =
dol_mktime(12, 0, 0,
GETPOST(
'dluo'.$paramSuffix.
'month',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'day',
'int'),
GETPOST(
'dluo'.$paramSuffix.
'year',
'int'));
987 $dDLC =
dol_mktime(12, 0, 0,
GETPOST(
'dlc'.$paramSuffix.
'month',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'day',
'int'),
GETPOST(
'dlc'.$paramSuffix.
'year',
'int'));
988 $fk_commandefourndet =
'fk_commandefournisseurdet'.$paramSuffix;
989 $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'));
996 foreach ($suffix2numAsked as $suffix => $n) {
997 $dispatchLines[$n][
'array_options'] = $extrafields->getOptionalsFromPost(
'commande_fournisseur_dispatch',
'_' . $suffix,
'');
1000 print
'<script type="text/javascript">
1001 jQuery(document).ready(function() {
1002 jQuery("#autofill").click(function() {';
1004 while ($i <= $numAsked) {
1005 print
'jQuery("#qtyl'.$i.
'").val(jQuery("#qtyasked'.$i.
'").val() - jQuery("#qtydelivered'.$i.
'").val());'.
"\n";
1009 jQuery("#autoreset").click(function() {';
1011 while ($i <= $numAsked) {
1012 print
'jQuery("#qtyl'.$i.
'").val(0);'.
"\n";
1021 print
'<table class="noborder centpercent">';
1024 $objectsrc->loadReceptions();
1027 print
'<tr class="liste_titre">';
1028 print
'<td>'.$langs->trans(
"Description").
'</td>';
1029 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1030 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1031 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1032 print
'<td class="center">'.$langs->trans(
"QtyToReceive");
1033 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
1034 print
'<td>'.$langs->trans(
"BuyingPrice").
'</td>';
1036 if (empty($conf->productbatch->enabled)) {
1037 print
' <br>(<a href="#" id="autofill">'.$langs->trans(
"Fill").
'</a>';
1038 print
' / <a href="#" id="autoreset">'.$langs->trans(
"Reset").
'</a>)';
1042 print
'<td class="left">'.$langs->trans(
"Warehouse").
' ('.$langs->trans(
"Stock").
')</td>';
1045 print
'<td class="left">'.$langs->trans(
"batch_number").
'</td>';
1046 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1047 print
'<td class="left">'.$langs->trans(
"SellByDate").
'</td>';
1049 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1050 print
'<td class="left">'.$langs->trans(
"EatByDate").
'</td>';
1059 $arrayofpurchaselinealreadyoutput= array();
1063 while ($indiceAsked <= $numAsked) {
1067 foreach ($objectsrc->lines as $supplierLine) {
1068 if ($dispatchLines[$indiceAsked][
'fk_commandefourndet'] == $supplierLine->id) {
1069 $line = $supplierLine;
1075 $type = $line->product_type ? $line->product_type : $line->fk_product_type;
1078 if (!empty($line->date_start)) {
1081 if (!empty($line->date_end)) {
1085 print
'<!-- line fk_commandefourndet='.$line->id.
' for product='.$line->fk_product.
' -->'.
"\n";
1086 print
'<tr class="oddeven">'.
"\n";
1089 if ($line->fk_product > 0) {
1090 $product->fetch($line->fk_product);
1091 $product->load_stock(
'warehouseopen');
1095 print
'<a name="'.$line->id.
'"></a>';
1096 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1097 print
'<input type="hidden" name="productid'.$indiceAsked.
'" value="'.$line->fk_product.
'">';
1100 $product_static = $product;
1102 $text = $product_static->getNomUrl(1);
1103 $text .=
' - '.(!empty($line->label) ? $line->label : $line->product_label);
1105 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1108 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1112 print ($line->desc && $line->desc != $line->product_label) ?
'<br>'.dol_htmlentitiesbr($line->desc) :
'';
1118 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1120 $text =
img_object($langs->trans(
'Service'),
'service');
1122 $text =
img_object($langs->trans(
'Product'),
'product');
1125 if (!empty($line->label)) {
1126 $text .=
' <strong>'.$line->label.
'</strong>';
1127 print
$form->textwithtooltip($text, $line->desc, 3,
'',
'', $i);
1129 print $text.
' '.nl2br($line->desc);
1133 print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
1140 $defaultcomment = $dispatchLines[$indiceAsked][
'comment'];
1142 print
'<input type="text" class="maxwidth100" name="comment'.$indiceAsked.
'" value="'.$defaultcomment.
'">';
1146 print
'<td class="center">';
1147 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1150 print
'<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.
'" value="'.$line->id.
'">';
1151 print
'<input type="hidden" name="pul'.$indiceAsked.
'" value="'.$line->pu_ht.
'">';
1152 print
'<input name="qtyasked'.$indiceAsked.
'" id="qtyasked'.$indiceAsked.
'" type="hidden" value="'.$line->qty.
'">';
1154 $qtyProdCom = $line->qty;
1157 print
'<td class="center">';
1158 $quantityDelivered = $objectsrc->receptions[$line->id];
1159 if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) {
1160 print $quantityDelivered;
1162 print
'<input name="qtydelivered'.$indiceAsked.
'" id="qtydelivered'.$indiceAsked.
'" type="hidden" value="'.$quantityDelivered.
'">';
1166 if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1167 $quantityToBeDelivered = 0;
1169 $quantityToBeDelivered = $dispatchLines[$indiceAsked][
'qty'];
1171 $warehouse_id = $dispatchLines[$indiceAsked][
'ent'];
1174 $warehouseObject =
null;
1176 print
'<!-- Case warehouse already known or product not a predefined product -->';
1178 $stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked][
'ent']]->real;
1179 $deliverableQty = $dispatchLines[$indiceAsked][
'qty'];
1180 $cost_price = $dispatchLines[$indiceAsked][
'pu'];
1183 print
'<td class="center">';
1184 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1185 if (
GETPOST(
'qtyl'.$indiceAsked,
'int')) {
1186 $defaultqty =
GETPOST(
'qtyl'.$indiceAsked,
'int');
1188 print
'<input name="idl'.$indiceAsked.
'" type="hidden" value="'.$line->id.
'">';
1189 print
'<input class="right" name="qtyl'.$indiceAsked.
'" id="qtyl'.$indiceAsked.
'" type="text" size="4" value="'.$deliverableQty.
'">';
1191 print $langs->trans(
"NA");
1195 if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
1197 print
'<input class="width75 right" name="cost_price'.$indiceAsked.
'" id="cost_price'.$indiceAsked.
'" value="'.$cost_price.
'">';
1203 print
'<td class="left">';
1204 if ($line->product_type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
1206 $ent =
"entl".$indiceAsked;
1207 $idl =
"idl".$indiceAsked;
1208 $tmpentrepot_id = is_numeric(
GETPOST($ent,
'int')) ?
GETPOST($ent,
'int') : $warehouse_id;
1209 if ($line->fk_product > 0) {
1210 print
'<!-- Show warehouse selection -->';
1211 print $formproduct->selectWarehouses($tmpentrepot_id,
'entl'.$indiceAsked,
'', 0, 0, $line->fk_product,
'', 1);
1214 print $langs->trans(
"Service");
1220 if (!empty($product->status_batch)) {
1221 print
'<td><input name="batch'.$indiceAsked.
'" value="'.$dispatchLines[$indiceAsked][
'lot'].
'"></td>';
1222 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1223 print
'<td class="nowraponall">';
1224 print
$form->selectDate($dispatchLines[$indiceAsked][
'DLC'],
'dlc'.$indiceAsked,
'',
'', 1,
"");
1227 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1228 print
'<td class="nowraponall">';
1229 print
$form->selectDate($dispatchLines[$indiceAsked][
'DLUO'],
'dluo'.$indiceAsked,
'',
'', 1,
"");
1233 print
'<td colspan="3"></td>';
1238 $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
1244 if (!empty($extrafields)) {
1248 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1251 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1258 $srcLine->id = $line->id;
1259 $srcLine->fetch_optionals();
1261 if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked][
'array_options'])) {
1262 $recLine->array_options = $dispatchLines[$indiceAsked][
'array_options'];
1264 $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
1266 print $recLine->showOptionals($extrafields,
'edit', array(
'style'=>
'class="oddeven"',
'colspan'=>$colspan), $indiceAsked,
'', 1);
1276 print
$form->buttonsSaveCancel(
"Create");
1285 } elseif ($id || $ref) {
1291 $lines = $object->lines;
1293 $num_prod = count($lines);
1295 if ($object->id > 0) {
1296 if (!empty($object->origin) && $object->origin_id > 0) {
1297 $object->origin =
'CommandeFournisseur';
1298 $typeobject = $object->origin;
1299 $origin = $object->origin;
1300 $origin_id = $object->origin_id;
1301 $object->fetch_origin();
1305 $soc->fetch($object->socid);
1307 $res = $object->fetch_optionals();
1310 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Reception"), -1,
'dollyrevert');
1315 if ($action ==
'delete') {
1316 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteReception'), $langs->trans(
"ConfirmDeleteReception", $object->ref),
'confirm_delete',
'', 0, 1);
1320 if ($action ==
'valid') {
1321 $objectref = substr($object->ref, 1, 4);
1322 if ($objectref ==
'PROV') {
1323 $numref = $object->getNextNumRef($soc);
1325 $numref = $object->ref;
1328 $text = $langs->trans(
"ConfirmValidateReception", $numref);
1331 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1332 $notify =
new Notify($db);
1334 $text .= $notify->confirmMessage(
'RECEPTION_VALIDATE', $object->socid, $object);
1337 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'ValidateReception'), $text,
'confirm_valid',
'', 0, 1);
1341 if ($action ==
'annuler') {
1342 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'CancelReception'), $langs->trans(
"ConfirmCancelReception", $object->ref),
'confirm_cancel',
'', 0, 1);
1347 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
1348 if (empty($reshook)) {
1350 } elseif ($reshook > 0) {
1361 $tmparray = $object->getTotalWeightVolume();
1362 $totalWeight = $tmparray[
'weight'];
1363 $totalVolume = $tmparray[
'volume'];
1366 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1368 $objectsrc->fetch($object->$typeobject->id);
1370 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1371 $objectsrc =
new Propal($db);
1372 $objectsrc->fetch($object->$typeobject->id);
1374 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id && ((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order"))) {
1376 $objectsrc->fetch($object->$typeobject->id);
1379 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1380 $morehtmlref =
'<div class="refidno">';
1383 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
1384 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
1387 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
1389 if (!empty($conf->project->enabled)) {
1390 $langs->load(
"projects");
1391 $morehtmlref .=
'<br>';
1393 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1394 if ($action !=
'classify' && $permissiontoadd) {
1395 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1397 $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, ($action ==
'classify' ? 1 : 0), 0, 1,
'');
1399 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
1401 $proj->fetch($objectsrc->fk_project);
1402 $morehtmlref .= $proj->getNomUrl(1);
1404 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1409 $morehtmlref .=
'</div>';
1411 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1414 print
'<div class="fichecenter">';
1415 print
'<div class="fichehalfleft">';
1416 print
'<div class="underbanner clearboth"></div>';
1418 print
'<table class="border centpercent tableforfield">';
1421 if ($typeobject ==
'commande' && $object->$typeobject->id &&
isModEnabled(
'commande')) {
1423 print $langs->trans(
"RefOrder").
'</td>';
1424 print
'<td colspan="3">';
1425 print $objectsrc->getNomUrl(1,
'commande');
1429 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1431 print $langs->trans(
"RefProposal").
'</td>';
1432 print
'<td colspan="3">';
1433 print $objectsrc->getNomUrl(1,
'reception');
1437 if ($typeobject ==
'CommandeFournisseur' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
1439 print $langs->trans(
"SupplierOrder").
'</td>';
1440 print
'<td colspan="3">';
1441 print $objectsrc->getNomUrl(1,
'reception');
1447 print
'<tr><td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1448 print
'<td colspan="3">'.dol_print_date($object->date_creation,
"dayhour",
"tzuserrel").
"</td>\n";
1452 print
'<tr><td height="10">';
1453 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1454 print $langs->trans(
'DateDeliveryPlanned');
1457 if ($action !=
'editdate_livraison') {
1458 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>';
1460 print
'</tr></table>';
1461 print
'</td><td colspan="2">';
1462 if ($action ==
'editdate_livraison') {
1463 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1464 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1465 print
'<input type="hidden" name="action" value="setdate_livraison">';
1466 print
$form->selectDate($object->date_delivery ? $object->date_delivery : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
1467 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1470 print $object->date_delivery ?
dol_print_date($object->date_delivery,
'dayhour') :
' ';
1477 print
$form->editfieldkey(
"Weight",
'trueWeight', $object->trueWeight, $object, $user->rights->reception->creer);
1478 print
'</td><td colspan="3">';
1480 if ($action ==
'edittrueWeight') {
1481 print
'<form name="settrueweight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1482 print
'<input name="action" value="settrueWeight" type="hidden">';
1483 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1484 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1485 print
'<input id="trueWeight" name="trueWeight" value="'.$object->trueWeight.
'" type="text">';
1486 print $formproduct->selectMeasuringUnits(
"weight_units",
"weight", $object->weight_units, 0, 2);
1487 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1488 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1491 print $object->trueWeight;
1492 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
1496 if ($totalWeight > 0) {
1497 if (!empty($object->trueWeight)) {
1498 print
' ('.$langs->trans(
"SumOfProductWeights").
': ';
1500 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');
1501 if (!empty($object->trueWeight)) {
1508 print
'<tr><td>'.$form->editfieldkey(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1509 print
$form->editfieldval(
"Width",
'trueWidth', $object->trueWidth, $object, $user->rights->reception->creer);
1510 print ($object->trueWidth && $object->width_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->width_units) :
'';
1514 print
'<tr><td>'.$form->editfieldkey(
"Height",
'trueHeight', $object->trueHeight, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1515 if ($action ==
'edittrueHeight') {
1516 print
'<form name="settrueHeight" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1517 print
'<input name="action" value="settrueHeight" type="hidden">';
1518 print
'<input name="id" value="'.$object->id.
'" type="hidden">';
1519 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1520 print
'<input id="trueHeight" name="trueHeight" value="'.$object->trueHeight.
'" type="text">';
1521 print $formproduct->selectMeasuringUnits(
"size_units",
"size", $object->size_units, 0, 2);
1522 print
' <input class="button" name="modify" value="'.$langs->trans(
"Modify").
'" type="submit">';
1523 print
' <input class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit">';
1526 print $object->trueHeight;
1527 print ($object->trueHeight && $object->height_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->height_units) :
'';
1533 print
'<tr><td>'.$form->editfieldkey(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1534 print
$form->editfieldval(
"Depth",
'trueDepth', $object->trueDepth, $object, $user->rights->reception->creer);
1535 print ($object->trueDepth && $object->depth_units !=
'') ?
' '.measuringUnitString(0,
"size", $object->depth_units) :
'';
1540 print $langs->trans(
"Volume");
1542 print
'<td colspan="3">';
1543 $calculatedVolume = 0;
1545 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
1546 $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
1547 $volumeUnit = $object->size_units * 3;
1550 if ($calculatedVolume > 0) {
1551 if ($volumeUnit < 50) {
1552 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');
1557 if ($totalVolume > 0) {
1558 if ($calculatedVolume) {
1559 print
' ('.$langs->trans(
"SumOfProductVolumes").
': ';
1561 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');
1563 if ($calculatedVolume) {
1573 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1578 print
'<div class="fichehalfright">';
1579 print
'<div class="underbanner clearboth"></div>';
1581 print
'<table class="border centpercent tableforfield">';
1584 print
'<tr><td height="10">';
1585 print
'<table class="nobordernopadding centpercent"><tr><td>';
1586 print $langs->trans(
'ReceptionMethod');
1589 if ($action !=
'editshipping_method_id') {
1590 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>';
1592 print
'</tr></table>';
1593 print
'</td><td colspan="2">';
1594 if ($action ==
'editshipping_method_id') {
1595 print
'<form name="setshipping_method_id" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
1596 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1597 print
'<input type="hidden" name="action" value="setshipping_method_id">';
1598 $object->fetch_delivery_methods();
1599 print
$form->selectarray(
"shipping_method_id", $object->meths, $object->shipping_method_id, 1, 0, 0,
"", 1);
1601 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1603 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1606 if ($object->shipping_method_id > 0) {
1608 $code = $langs->getLabelFromKey($db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1609 print $langs->trans(
"SendingMethod".strtoupper($code));
1616 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"TrackingNumber",
'tracking_number', $object->tracking_number, $object, $user->rights->reception->creer).
'</td><td colspan="3">';
1617 print
$form->editfieldval(
"TrackingNumber",
'tracking_number', $object->tracking_url, $object, $user->rights->reception->creer,
'safehtmlstring', $object->tracking_number);
1623 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1624 print $langs->trans(
'IncotermLabel');
1625 print
'<td><td class="right">';
1626 if ($user->rights->reception->creer) {
1627 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/reception/card.php?id='.$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit().
'</a>';
1631 print
'</td></tr></table>';
1633 print
'<td colspan="3">';
1634 if ($action !=
'editincoterm') {
1635 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
1637 print
$form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?id='.$object->id);
1647 print
'<div class="clearboth"></div>';
1651 if ($action ==
'editline') {
1652 print
'<form name="updateline" id="updateline" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$line_id.
'" method="POST">
1653 <input type="hidden" name="token" value="' .
newToken().
'">
1654 <input type="hidden" name="action" value="updateline">
1655 <input type="hidden" name="mode" value="">
1656 <input type="hidden" name="id" value="' . $object->id.
'">';
1660 print
'<div class="div-table-responsive-no-min">';
1661 print
'<table id="tablelines" class="noborder centpercent">';
1663 print
'<tr class="liste_titre">';
1665 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1666 print
'<td width="5" class="center"> </td>';
1669 print
'<td>'.$langs->trans(
"Products").
'</td>';
1671 print
'<td>'.$langs->trans(
"Comment").
'</td>';
1673 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
1674 if ($origin && $origin_id > 0) {
1675 print
'<td class="center">'.$langs->trans(
"QtyInOtherReceptions").
'</td>';
1677 if ($action ==
'editline') {
1682 if (empty($conf->productbatch->enabled)) {
1685 print
'<td class="center" colspan="'.$editColspan.
'">';
1686 if ($object->statut <= 1) {
1687 print $langs->trans(
"QtyToReceive").
' - ';
1689 print $langs->trans(
"QtyReceived").
' - ';
1692 print $langs->trans(
"WarehouseSource").
' - ';
1695 print $langs->trans(
"Batch");
1699 $statusreceived = $object::STATUS_CLOSED;
1701 $statusreceived = $object::STATUS_VALIDATED;
1704 $statusreceived = $object::STATUS_CLOSED;
1706 if ($object->statut < $statusreceived) {
1707 print
'<td class="center">'.$langs->trans(
"QtyToReceive").
'</td>';
1709 print
'<td class="center">'.$langs->trans(
"QtyReceived").
'</td>';
1712 print
'<td class="left">'.$langs->trans(
"WarehouseSource").
'</td>';
1716 print
'<td class="left">'.$langs->trans(
"Batch").
'</td>';
1719 print
'<td class="center">'.$langs->trans(
"CalculatedWeight").
'</td>';
1720 print
'<td class="center">'.$langs->trans(
"CalculatedVolume").
'</td>';
1722 if ($object->statut == 0) {
1723 print
'<td class="linecoledit"></td>';
1724 print
'<td class="linecoldelete" width="10"></td>';
1731 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1732 $object->fetch_thirdparty();
1733 $outputlangs = $langs;
1735 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
1736 $newlang =
GETPOST(
'lang_id',
'aZ09');
1738 if (empty($newlang)) {
1739 $newlang = $object->thirdparty->default_lang;
1741 if (!empty($newlang)) {
1742 $outputlangs =
new Translate(
"", $conf);
1743 $outputlangs->setDefaultLang($newlang);
1748 $alreadysent = array();
1750 $origin =
'commande_fournisseur';
1752 if ($origin && $origin_id > 0) {
1753 $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";
1754 $sql .=
", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
1755 $sql .=
", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";
1757 $sql .=
', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
1758 $sql .=
', p.description as product_desc';
1759 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commande_fournisseur_dispatch as ed";
1760 $sql .=
", ".MAIN_DB_PREFIX.
"reception as e";
1761 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
1763 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
1764 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
1765 $sql .=
" AND obj.fk_commande = ".((int) $origin_id);
1766 $sql .=
" AND obj.rowid = ed.fk_commandefourndet";
1767 $sql .=
" AND ed.fk_reception = e.rowid";
1768 $sql .=
" AND ed.fk_reception !=".((int) $object->id);
1770 $sql .=
" ORDER BY obj.fk_product";
1772 dol_syslog(
"get list of reception lines", LOG_DEBUG);
1773 $resql = $db->query($sql);
1775 $num = $db->num_rows(
$resql);
1779 $obj = $db->fetch_object(
$resql);
1782 $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);
1790 $arrayofpurchaselinealreadyoutput = array();
1794 for ($i = 0; $i < $num_prod; $i++) {
1795 print
'<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).
' -->';
1796 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'" data-id="'.$lines[$i]->id.
'" data-element="'.$lines[$i]->element.
'">';
1799 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
1800 print
'<td class="center">'.($i + 1).
'</td>';
1804 if ($lines[$i]->fk_product > 0) {
1806 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
1808 $prod->fetch($lines[$i]->fk_product);
1809 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $lines[$i]->product->label;
1811 $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label);
1814 print
'<td class="linecoldescription">';
1815 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1816 $text = $lines[$i]->product->getNomUrl(1);
1817 $text .=
' - '.$label;
1819 print
$form->textwithtooltip($text, $description, 3,
'',
'', $i);
1820 print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
1822 print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ?
'<br>'.dol_htmlentitiesbr($lines[$i]->
description) :
'';
1827 print
'<td class="linecoldescription">';
1828 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1830 $text =
img_object($langs->trans(
'Service'),
'service');
1832 $text =
img_object($langs->trans(
'Product'),
'product');
1835 if (!empty($lines[$i]->label)) {
1836 $text .=
' <strong>'.$lines[$i]->label.
'</strong>';
1837 print
$form->textwithtooltip($text, $lines[$i]->
description, 3,
'',
'', $i);
1847 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1848 print
'<td><input name="comment'.$line_id.
'" id="comment'.$line_id.
'" value="'.
dol_escape_htmltag($lines[$i]->comment).
'"></td>';
1850 print
'<td style="white-space: pre-wrap; max-width: 200px;">'.dol_escape_htmltag($lines[$i]->comment).
'</td>';
1855 print
'<td class="center linecolqty">';
1856 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1857 print $lines[$i]->qty_asked;
1862 if ($origin && $origin_id > 0) {
1863 print
'<td class="center nowrap linecolqtyinotherreceptions">';
1864 if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
1865 foreach ($alreadysent as $key => $val) {
1866 if ($lines[$i]->fk_commandefourndet == $key) {
1868 foreach ($val as $receptionline_id => $receptionline_var) {
1869 if ($receptionline_var[
'reception_id'] == $lines[$i]->fk_reception) {
1877 $reception_static->fetch($receptionline_var[
'reception_id']);
1878 print $reception_static->getNomUrl(1);
1879 print
' - '.$receptionline_var[
'qty'];
1881 $htmltext = $langs->trans(
"DateValidation").
' : '.(empty($receptionline_var[
'date_valid']) ? $langs->trans(
"Draft") :
dol_print_date($receptionline_var[
'date_valid'],
'dayhour'));
1882 if (
isModEnabled(
'stock') && $receptionline_var[
'warehouse'] > 0) {
1883 $warehousestatic->fetch($receptionline_var[
'warehouse']);
1884 $htmltext .=
'<br>'.$langs->trans(
"From").
' : '.$warehousestatic->getNomUrl(1,
'', 0, 1);
1886 print
' '.$form->textwithpicto(
'', $htmltext, 1);
1894 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
1896 print
'<td colspan="'.$editColspan.
'" class="center"><table class="nobordernopadding">';
1898 if ($lines[$i]->fk_product > 0) {
1899 print
'<!-- case edit 1 -->';
1902 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1904 print
'<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot,
'entl'.$line_id,
'', 1, 0, $lines[$i]->fk_product,
'', 1).
'</td>';
1906 if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
1907 print
'<td class="nowraponall"><input name="batch'.$line_id.
'" id="batch'.$line_id.
'" type="text" value="'.$lines[$i]->batch.
'"><br>';
1908 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1909 print $langs->trans(
'SellByDate').
' : ';
1910 print
$form->selectDate($lines[$i]->sellby,
'dlc'.$line_id,
'',
'', 1,
"").
'</br>';
1912 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1913 print $langs->trans(
'EatByDate').
' : ';
1914 print
$form->selectDate($lines[$i]->eatby,
'dluo'.$line_id,
'',
'', 1,
"");
1920 print
'<!-- case edit 2 -->';
1923 print
'<td><input name="qtyl'.$line_id.
'" id="qtyl'.$line_id.
'" type="text" size="4" value="'.$lines[$i]->qty.
'"></td>';
1931 print
'</table></td>';
1934 print
'<td class="center linecolqtytoreceive">'.$lines[$i]->qty.
'</td>';
1938 if ($lines[$i]->fk_entrepot > 0) {
1940 $entrepot->fetch($lines[$i]->fk_entrepot);
1942 print
'<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).
'">';
1943 print $entrepot->getNomUrl(1);
1952 if (isset($lines[$i]->batch)) {
1953 print
'<!-- Detail of lot -->';
1954 print
'<td class="linecolbatch nowrap">';
1955 $detail = $langs->trans(
"NA");
1956 if ($lines[$i]->product->status_batch && $lines[$i]->fk_product > 0) {
1957 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
1959 $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch);
1961 $detail = $productlot->getNomUrl(1);
1964 $batchinfo = $langs->trans(
"Batch").
': '.$lines[$i]->batch;
1965 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
1966 $batchinfo .=
' - '.$langs->trans(
"SellByDate").
': '.
dol_print_date($lines[$i]->sellby,
"day");
1968 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
1969 $batchinfo .=
' - '.$langs->trans(
"EatByDate").
': '.
dol_print_date($lines[$i]->eatby,
"day");
1971 $detail =
$form->textwithtooltip(
img_picto(
'',
'object_barcode').
' '.$langs->trans(
"DetailBatchNumber"), $batchinfo);
1974 print $detail .
'</td>';
1982 print
'<td class="center linecolweight">';
1984 print $lines[$i]->product->weight * $lines[$i]->qty.
' '.
measuringUnitString(0,
"weight", $lines[$i]->product->weight_units);
1991 print
'<td class="center linecolvolume">';
1993 print $lines[$i]->product->volume * $lines[$i]->qty.
' '.
measuringUnitString(0,
"volume", $lines[$i]->product->volume_units);
2000 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2001 print
'<td class="center" colspan="2" valign="middle">';
2002 print
'<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans(
"Save").
'"><br>';
2003 print
'<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans(
"Cancel").
'"><br>';
2004 } elseif ($object->statut == Reception::STATUS_DRAFT) {
2006 print
'<td class="linecoledit center">';
2007 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_edit().
'</a>';
2009 print
'<td class="linecoldelete" width="10">';
2010 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=deleteline&token='.
newToken().
'&lineid='.$lines[$i]->id.
'">'.
img_delete().
'</a>';
2014 if (!empty($rowExtrafieldsStart)) {
2015 print $rowExtrafieldsStart;
2016 print $rowExtrafieldsView;
2022 $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
2025 $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
2026 if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
2027 $colspan = empty($conf->productbatch->enabled) ? 8 : 9;
2029 $line->id = $lines[$i]->id;
2030 $line->fetch_optionals();
2032 if ($action ==
'editline' && $lines[$i]->
id == $line_id) {
2033 print $line->showOptionals($extrafields,
'edit', array(
'colspan'=>$colspan), $indiceAsked);
2035 print $line->showOptionals($extrafields,
'view', array(
'colspan'=>$colspan), $indiceAsked);
2051 $object->fetchObjectLinked($object->id, $object->element);
2058 if (($user->socid == 0) && ($action !=
'presend')) {
2059 print
'<div class="tabsAction">';
2062 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
2063 if (empty($reshook)) {
2064 if ($object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
2065 if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer))
2066 || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) {
2067 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
2069 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"Validate").
'</a>';
2073 if ($object->statut == Reception::STATUS_VALIDATED && $user->rights->reception->creer) {
2074 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'SetToDraft').
'</a></div>';
2079 if ($object->statut == Reception::STATUS_CLOSED && $user->rights->reception->creer) {
2080 if (
isModEnabled(
'facture') && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2081 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ClassifyUnbilled").
'</a>';
2083 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>';
2088 if (empty($user->socid)) {
2089 if ($object->statut > 0) {
2090 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) {
2091 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendByMail').
'</a>';
2093 print
'<a class="butActionRefused" href="#">'.$langs->trans(
'SendByMail').
'</a>';
2099 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_invoice")) && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) {
2100 if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
2103 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>';
2109 if ($object->statut == Reception::STATUS_VALIDATED) {
2110 if ($user->rights->reception->creer && $object->statut > 0 && !$object->billed) {
2111 $label =
"Close"; $paramaction =
'classifyclosed';
2113 if (((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order")) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
2114 $label =
"ClassifyBilled";
2115 $paramaction =
'classifybilled';
2117 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action='.$paramaction.
'&token='.
newToken().
'">'.$langs->trans($label).
'</a>';
2121 if ($user->rights->reception->supprimer) {
2122 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
2134 if ($action !=
'presend' && $action !=
'editline') {
2135 print
'<div class="fichecenter"><div class="fichehalfleft">';
2138 $filedir = $conf->reception->dir_output.
"/".$objectref;
2140 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2142 $genallowed = $user->rights->reception->lire;
2143 $delallowed = $user->rights->reception->creer;
2145 print $formfile->showdocuments(
'reception', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2149 $somethingshown =
$form->showLinkedObjectBlock($object,
'');
2151 print
'</div><div class="fichehalfright">';
2153 print
'</div></div>';
2157 $modelmail =
'shipping_send';
2158 $defaulttopic =
'SendReceptionRef';
2159 $diroutput = $conf->reception->dir_output;
2160 $trackid =
'rec'.$object->id;
2162 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.
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.