25 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
41 $langs->loadLangs(array(
"mrp",
"stocks",
"other",
"product",
"productbatch"));
46 $action =
GETPOST(
'action',
'aZ09');
47 $confirm =
GETPOST(
'confirm',
'alpha');
48 $cancel =
GETPOST(
'cancel',
'aZ09');
49 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mocard';
50 $backtopage =
GETPOST(
'backtopage',
'alpha');
51 $lineid =
GETPOST(
'lineid',
'int');
52 $fk_movement =
GETPOST(
'fk_movement',
'int');
53 $fk_default_warehouse =
GETPOST(
'fk_default_warehouse',
'int');
55 $collapse =
GETPOST(
'collapse',
'aZ09comma');
58 $object =
new Mo($db);
60 $diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
61 $hookmanager->initHooks(array(
'mocard',
'globalcard'));
64 $extrafields->fetch_name_optionals_label($object->table_element);
66 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
69 $search_all =
GETPOST(
"search_all",
'alpha');
71 foreach ($object->fields as $key => $val) {
72 if (
GETPOST(
'search_'.$key,
'alpha')) {
73 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
77 if (empty($action) && empty($id) && empty($ref)) {
82 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
87 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
88 $result =
restrictedArea($user,
'mrp', $object->id,
'mrp_mo',
'',
'fk_soc',
'rowid', $isdraft);
90 $permissionnote = $user->rights->mrp->write;
91 $permissiondellink = $user->rights->mrp->write;
92 $permissiontoadd = $user->rights->mrp->write;
93 $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
94 $upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
96 $permissiontoproduce = $permissiontoadd;
97 $permissiontoupdatecost = $user->rights->bom->read;
104 $parameters = array();
105 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110 if (empty($reshook)) {
115 if (empty($backtopage) || ($cancel && empty($id))) {
117 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
118 $backtopage = $backurlforlist;
120 $backtopage = DOL_URL_ROOT.
'/mrp/mo_production.php?id='.($id > 0 ? $id :
'__ID__');
123 $triggermodname =
'MRP_MO_MODIFY';
126 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
129 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
132 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
135 $triggersendname =
'MO_SENTBYMAIL';
136 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
137 $trackid =
'mo'.$object->id;
138 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
143 if ($action ==
'set_thirdparty' && $permissiontoadd) {
144 $object->setValueFrom(
'fk_soc',
GETPOST(
'fk_soc',
'int'),
'',
'',
'date',
'', $user,
'MO_MODIFY');
146 if ($action ==
'classin' && $permissiontoadd) {
147 $object->setProject(
GETPOST(
'projectid',
'int'));
150 if ($action ==
'confirm_reopen' && $permissiontoadd) {
151 $result = $object->setStatut($object::STATUS_INPROGRESS, 0,
'',
'MRP_REOPEN');
154 if (($action ==
'confirm_addconsumeline' &&
GETPOST(
'addconsumelinebutton') && $permissiontoadd)
155 || ($action ==
'confirm_addproduceline' &&
GETPOST(
'addproducelinebutton') && $permissiontoadd)) {
156 $moline =
new MoLine($db);
159 $moline->fk_mo = $object->id;
160 $moline->qty =
GETPOST(
'qtytoadd',
'int'); ;
161 $moline->fk_product =
GETPOST(
'productidtoadd',
'int');
162 if (
GETPOST(
'addconsumelinebutton')) {
163 $moline->role =
'toconsume';
165 $moline->role =
'toproduce';
167 $moline->origin_type =
'free';
168 $moline->position = 0;
170 $resultline = $moline->create($user,
false);
171 if ($resultline <= 0) {
179 if (in_array($action, array(
'confirm_consumeorproduce',
'confirm_consumeandproduceall')) && $permissiontoproduce) {
182 $labelmovement =
GETPOST(
'inventorylabel',
'alphanohtml');
183 $codemovement =
GETPOST(
'inventorycode',
'alphanohtml');
188 foreach ($object->lines as $line) {
189 if ($line->role ==
'toconsume') {
190 $tmpproduct =
new Product($db);
191 $tmpproduct->fetch($line->fk_product);
197 if ($qtytoprocess != 0) {
200 if (!(
GETPOST(
'idwarehouse-'.$line->id.
'-'.$i) > 0)) {
201 $langs->load(
"errors");
202 setEventMessages($langs->trans(
"ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv(
"Warehouse"), $tmpproduct->ref), null,
'errors');
205 if ($tmpproduct->status_batch && (!
GETPOST(
'batch-'.$line->id.
'-'.$i))) {
206 $langs->load(
"errors");
207 setEventMessages($langs->trans(
"ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv(
"Batch"), $tmpproduct->ref), null,
'errors');
213 if (!$error &&
GETPOST(
'idwarehouse-'.$line->id.
'-'.$i) > 0) {
215 $id_product_batch = 0;
216 $stockmove->setOrigin($object->element, $object->id);
218 if ($qtytoprocess >= 0) {
219 $idstockmove = $stockmove->livraison($user, $line->fk_product,
GETPOST(
'idwarehouse-'.$line->id.
'-'.$i), $qtytoprocess, 0, $labelmovement,
dol_now(),
'',
'',
GETPOST(
'batch-'.$line->id.
'-'.$i), $id_product_batch, $codemovement);
221 $idstockmove = $stockmove->reception($user, $line->fk_product,
GETPOST(
'idwarehouse-'.$line->id.
'-'.$i), $qtytoprocess, 0, $labelmovement,
dol_now(),
'',
'',
GETPOST(
'batch-'.$line->id.
'-'.$i), $id_product_batch, $codemovement);
223 if ($idstockmove < 0) {
231 $moline =
new MoLine($db);
232 $moline->fk_mo = $object->id;
233 $moline->position = $pos;
234 $moline->fk_product = $line->fk_product;
235 $moline->fk_warehouse =
GETPOST(
'idwarehouse-'.$line->id.
'-'.$i);
236 $moline->qty = $qtytoprocess;
237 $moline->batch =
GETPOST(
'batch-'.$line->id.
'-'.$i);
238 $moline->role =
'consumed';
239 $moline->fk_mrp_production = $line->id;
240 $moline->fk_stock_movement = $idstockmove;
241 $moline->fk_user_creat = $user->id;
243 $resultmoline = $moline->create($user);
244 if ($resultmoline <= 0) {
260 foreach ($object->lines as $line) {
261 if ($line->role ==
'toproduce') {
262 $tmpproduct =
new Product($db);
263 $tmpproduct->fetch($line->fk_product);
266 while (
GETPOSTISSET(
'qtytoproduce-'.$line->id.
'-'.$i)) {
268 $pricetoprocess =
GETPOST(
'pricetoproduce-'.$line->id.
'-'.$i) ?
price2num(
GETPOST(
'pricetoproduce-'.$line->id.
'-'.$i)) : 0;
270 if ($qtytoprocess != 0) {
272 if (
GETPOSTISSET(
'idwarehousetoproduce-'.$line->id.
'-'.$i)) {
273 if (!(
GETPOST(
'idwarehousetoproduce-'.$line->id.
'-'.$i) > 0)) {
274 $langs->load(
"errors");
275 setEventMessages($langs->trans(
"ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv(
"Warehouse"), $tmpproduct->ref), null,
'errors');
278 if (!empty($conf->productbatch->enabled) && $tmpproduct->status_batch && (!
GETPOST(
'batchtoproduce-'.$line->id.
'-'.$i))) {
279 $langs->load(
"errors");
280 setEventMessages($langs->trans(
"ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv(
"Batch"), $tmpproduct->ref), null,
'errors');
286 if (!$error &&
GETPOST(
'idwarehousetoproduce-'.$line->id.
'-'.$i) > 0) {
288 $id_product_batch = 0;
289 $stockmove->origin_type = $object->element;
290 $stockmove->origin_id = $object->id;
292 $idstockmove = $stockmove->reception($user, $line->fk_product,
GETPOST(
'idwarehousetoproduce-'.$line->id.
'-'.$i), $qtytoprocess, $pricetoprocess, $labelmovement,
'',
'',
GETPOST(
'batchtoproduce-'.$line->id.
'-'.$i),
dol_now(), $id_product_batch, $codemovement);
293 if ($idstockmove < 0) {
301 $moline =
new MoLine($db);
302 $moline->fk_mo = $object->id;
303 $moline->position = $pos;
304 $moline->fk_product = $line->fk_product;
305 $moline->fk_warehouse =
GETPOST(
'idwarehousetoproduce-'.$line->id.
'-'.$i);
306 $moline->qty = $qtytoprocess;
307 $moline->batch =
GETPOST(
'batchtoproduce-'.$line->id.
'-'.$i);
308 $moline->role =
'produced';
309 $moline->fk_mrp_production = $line->id;
310 $moline->fk_stock_movement = $idstockmove;
311 $moline->fk_user_creat = $user->id;
313 $resultmoline = $moline->create($user);
314 if ($resultmoline <= 0) {
329 $consumptioncomplete =
true;
330 $productioncomplete =
true;
332 if (
GETPOST(
'autoclose',
'int')) {
333 foreach ($object->lines as $line) {
334 if ($line->role ==
'toconsume') {
335 $arrayoflines = $object->fetchLinesLinked(
'consumed', $line->id);
336 $alreadyconsumed = 0;
337 foreach ($arrayoflines as $line2) {
338 $alreadyconsumed += $line2[
'qty'];
341 if ($alreadyconsumed < $line->qty) {
342 $consumptioncomplete =
false;
345 if ($line->role ==
'toproduce') {
346 $arrayoflines = $object->fetchLinesLinked(
'produced', $line->id);
347 $alreadyproduced = 0;
348 foreach ($arrayoflines as $line2) {
349 $alreadyproduced += $line2[
'qty'];
352 if ($alreadyproduced < $line->qty) {
353 $productioncomplete =
false;
358 $consumptioncomplete =
false;
359 $productioncomplete =
false;
363 dol_syslog(
"consumptioncomplete = ".$consumptioncomplete.
" productioncomplete = ".$productioncomplete);
365 if ($consumptioncomplete && $productioncomplete) {
366 $result = $object->setStatut($object::STATUS_PRODUCED, 0,
'',
'MRP_MO_PRODUCED');
368 $result = $object->setStatut($object::STATUS_INPROGRESS, 0,
'',
'MRP_MO_PRODUCED');
377 $action = str_replace(
'confirm_',
'', $action);
383 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
389 if ($action ==
'confirm_produced' && $confirm ==
'yes' && $permissiontoadd) {
390 $result = $object->setStatut($object::STATUS_PRODUCED, 0,
'',
'MRP_MO_PRODUCED');
393 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
394 $outputlangs = $langs;
396 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
397 $newlang =
GETPOST(
'lang_id',
'aZ09');
399 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
400 $newlang = $object->thirdparty->default_lang;
402 if (!empty($newlang)) {
404 $outputlangs->setDefaultLang($newlang);
406 $model = $object->model_pdf;
407 $ret = $object->fetch($id);
409 $object->generateDocument($model, $outputlangs, 0, 0, 0);
430 $help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication';
431 llxHeader(
'', $langs->trans(
'Mo'),
$help_url,
'', 0, 0, array(
'/mrp/js/lib_dispatch.js.php'));
434 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
435 $res = $object->fetch_thirdparty();
436 $res = $object->fetch_optionals();
440 print
dol_get_fiche_head($head,
'production', $langs->trans(
"ManufacturingOrder"), -1, $object->picto);
445 if ($action ==
'delete') {
446 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete',
'', 0, 1);
449 if ($action ==
'deleteline') {
450 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid.
'&fk_movement='.$fk_movement, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
453 if ($action ==
'clone') {
455 $formquestion = array();
456 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
460 if ($action ==
'validate') {
462 $ref = substr($object->ref, 1, 4);
463 if ($ref ==
'PROV') {
464 $object->fetch_product();
465 $numref = $object->getNextNumRef($object->fk_product);
467 $numref = $object->ref;
470 $text = $langs->trans(
'ConfirmValidateMo', $numref);
479 $formquestion = array();
480 if (!empty($conf->mrp->enabled)) {
482 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
485 if ($conf->browser->name ==
'ie') {
488 $formquestion = array(
495 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'Validate'), $text,
'confirm_validate', $formquestion, 0, 1, 220);
499 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
500 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
501 if (empty($reshook)) {
502 $formconfirm .= $hookmanager->resPrint;
503 } elseif ($reshook > 0) {
504 $formconfirm = $hookmanager->resPrint;
513 $linkback =
'<a href="'.DOL_URL_ROOT.
'/mrp/mo_list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
515 $morehtmlref =
'<div class="refidno">';
521 $morehtmlref .= $langs->trans(
'ThirdParty').
' : '.(is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) :
'');
523 if (!empty($conf->project->enabled)) {
524 $langs->load(
"projects");
525 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
526 if ($permissiontoadd) {
527 if ($action !=
'classify') {
528 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
530 if ($action ==
'classify') {
532 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
533 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
534 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
535 $morehtmlref .= $formproject->select_projects($object->fk_soc, $object->fk_project,
'projectid', 0, 0, 1, 0, 1, 0, 0,
'', 1);
536 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
537 $morehtmlref .=
'</form>';
539 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_soc, $object->fk_project,
'none', 0, 0, 0, 1);
542 if (!empty($object->fk_project)) {
544 $proj->fetch($object->fk_project);
545 $morehtmlref .= $proj->getNomUrl();
551 $morehtmlref .=
'</div>';
554 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
557 print
'<div class="fichecenter">';
558 print
'<div class="fichehalfleft">';
559 print
'<div class="underbanner clearboth"></div>';
560 print
'<table class="border centpercent tableforfield">'.
"\n";
563 $keyforbreak =
'fk_warehouse';
564 unset($object->fields[
'fk_project']);
565 unset($object->fields[
'fk_soc']);
566 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
569 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
575 print
'<div class="clearboth"></div>';
580 if (!in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
581 print
'<div class="tabsAction">';
583 $parameters = array();
585 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
586 if (empty($reshook)) {
588 if ($object->status == $object::STATUS_DRAFT) {
589 if ($permissiontoadd) {
590 if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
591 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=validate">'.$langs->trans(
"Validate").
'</a>';
593 $langs->load(
"errors");
594 print
'<a class="butActionRefused" href="" title="'.$langs->trans(
"ErrorAddAtLeastOneLineFirst").
'">'.$langs->trans(
"Validate").
'</a>';
600 if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
601 if ($permissiontoproduce) {
602 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=consumeorproduce">'.$langs->trans(
'ConsumeOrProduce').
'</a>';
604 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
'ConsumeOrProduce').
'</a>';
606 } elseif ($object->status == Mo::STATUS_DRAFT) {
607 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"ValidateBefore").
'">'.$langs->trans(
'ConsumeOrProduce').
'</a>';
611 if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
612 if ($permissiontoproduce) {
613 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=consumeandproduceall">'.$langs->trans(
'ConsumeAndProduceAll').
'</a>';
615 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
'ConsumeAndProduceAll').
'</a>';
617 } elseif ($object->status == Mo::STATUS_DRAFT) {
618 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"ValidateBefore").
'">'.$langs->trans(
'ConsumeAndProduceAll').
'</a>';
622 if ($permissiontoadd) {
623 if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS) {
624 $arrayproduced = $object->fetchLinesLinked(
'produced', 0);
626 foreach ($arrayproduced as $lineproduced) {
627 $nbProduced += $lineproduced[
'qty'];
629 if ($nbProduced > 0) {
630 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=confirm_produced&confirm=yes">'.$langs->trans(
"Close").
'</a>'.
"\n";
632 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"GoOnTabProductionToProduceFirst", $langs->transnoentitiesnoconv(
"Production")).
'">'.$langs->trans(
"Close").
'</a>'.
"\n";
635 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=confirm_close&confirm=yes">'.$langs->trans(
"Cancel").
'</a>'.
"\n";
638 if ($object->status == $object::STATUS_CANCELED) {
639 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=confirm_reopen&confirm=yes">'.$langs->trans(
"Re-Open").
'</a>'.
"\n";
642 if ($object->status == $object::STATUS_PRODUCED) {
643 if ($permissiontoproduce) {
644 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=confirm_reopen">'.$langs->trans(
'ReOpen').
'</a>';
646 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"NotEnoughPermissions").
'">'.$langs->trans(
'ReOpen').
'</a>';
655 if (in_array($action, array(
'consumeorproduce',
'consumeandproduceall',
'addconsumeline',
'addproduceline'))) {
656 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
657 print
'<input type="hidden" name="token" value="'.newToken().
'">';
658 print
'<input type="hidden" name="action" value="confirm_'.$action.
'">';
659 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
660 print
'<input type="hidden" name="id" value="'.$id.
'">';
663 if (in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
664 $defaultstockmovementlabel =
GETPOST(
'inventorylabel',
'alphanohtml') ?
GETPOST(
'inventorylabel',
'alphanohtml') : $langs->trans(
"ProductionForRef", $object->
ref);
667 print
'<div class="center'.(in_array($action, array(
'consumeorproduce',
'consumeandproduceall')) ?
' formconsumeproduce' :
'').
'">';
668 print
'<div class="opacitymedium hideonsmartphone paddingbottom">'.$langs->trans(
"ConfirmProductionDesc", $langs->transnoentitiesnoconv(
"Confirm")).
'<br></div>';
669 print
'<span class="fieldrequired">'.$langs->trans(
"InventoryCode").
':</span> <input type="text" class="minwidth200 maxwidth250" name="inventorycode" value="'.$defaultstockmovementcode.
'"> ';
670 print
'<span class="clearbothonsmartphone"></span>';
671 print $langs->trans(
"MovementLabel").
': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.
'"><br><br>';
672 print
'<input type="checkbox" id="autoclose" name="autoclose" value="1"'.(GETPOSTISSET(
'inventorylabel') ? (
GETPOST(
'autoclose') ?
' checked="checked"' :
'') :
' checked="checked"').
'> <label for="autoclose">'.$langs->trans(
"AutoCloseMO").
'</label><br>';
673 print
'<input type="submit" class="button" value="'.$langs->trans(
"Confirm").
'" name="confirm">';
675 print
'<input class="button button-cancel" type="submit" value="'.$langs->trans(
"Cancel").
'" name="cancel">';
689 if (!empty($object->table_element_line)) {
691 $object->fetchLines();
694 if ($object->fk_bom > 0) {
696 $res = $bom->fetch($object->fk_bom);
698 $bom->calculateCosts();
699 $bomcost = $bom->unit_cost;
705 print
'<div class="fichecenter">';
706 print
'<div class="fichehalfleft">';
707 print
'<div class="clearboth"></div>';
709 $url = $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=addconsumeline&token='.
newToken();
710 $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED;
711 $parameters = array(
'morecss'=>
'reposition');
714 if ($action !=
'consumeorproduce' && $action !=
'consumeandproduceall') {
715 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddNewConsumeLines'),
'',
'fa fa-plus-circle size15x', $url,
'', $permissiontoaddaconsumeline, $parameters);
718 print
load_fiche_titre($langs->trans(
'Consumption'), $newcardbutton,
'', 0,
'',
'',
'');
720 print
'<div class="div-table-responsive-no-min">';
721 print
'<table class="noborder noshadow centpercent nobottom">';
723 print
'<tr class="liste_titre">';
724 print
'<td>'.$langs->trans(
"Product").
'</td>';
726 print
'<td class="right">'.$langs->trans(
"Qty").
'</td>';
728 if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) {
729 print
'<td class="right">'.$langs->trans(
"UnitCost").
'</td>';
732 print
'<td class="right">'.$langs->trans(
"QtyAlreadyConsumed").
'</td>';
735 if ($collapse || in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
736 print $langs->trans(
"Warehouse");
739 if (in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
740 $listwarehouses = $tmpwarehouse->list_array(1);
741 if (count($listwarehouses) > 1) {
742 print
'<br><span class="opacitymedium">' . $langs->trans(
"ForceTo") .
'</span> ' .
$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth300', 1);
743 } elseif (count($listwarehouses) == 1) {
744 print
'<br><span class="opacitymedium">' . $langs->trans(
"ForceTo") .
'</span> ' .
$form->selectarray(
'fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth300', 1);
751 print
'<td align="right">';
752 if ($collapse || in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
753 print $langs->trans(
"Stock");
760 if ($collapse || in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
761 print $langs->trans(
"Batch");
766 if ($permissiontodelete) {
771 if ($action ==
'addconsumeline') {
772 print
'<!-- Add line to consume -->'.
"\n";
773 print
'<tr class="liste_titre">';
775 print
$form->select_produits(
'',
'productidtoadd',
'', 0, 0, -1, 2,
'', 1, array(), 0,
'1', 0,
'maxwidth300');
778 print
'<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
780 if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) {
784 print
'<td colspan="2">';
786 print
'<input type="submit" class="button buttongen button-add" name="addconsumelinebutton" value="'.$langs->trans(
"Add").
'">';
787 print
'<input type="submit" class="button buttongen button-cancel" name="canceladdconsumelinebutton" value="'.$langs->trans(
"Cancel").
'">';
797 if ($permissiontodelete) {
805 if (!empty($object->lines)) {
806 $nblinetoconsume = 0;
807 foreach ($object->lines as $line) {
808 if ($line->role ==
'toconsume') {
813 $nblinetoconsumecursor = 0;
814 foreach ($object->lines as $line) {
815 if ($line->role ==
'toconsume') {
816 $nblinetoconsumecursor++;
818 $tmpproduct =
new Product($db);
819 $tmpproduct->fetch($line->fk_product);
820 $linecost =
price2num($tmpproduct->pmp,
'MT');
822 if ($object->qty > 0) {
824 $costprice =
price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
825 if (empty($costprice)) {
826 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
828 if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
829 $costprice = $productFournisseur->fourn_unitprice;
834 $linecost =
price2num(($line->qty * $costprice) / $object->qty,
'MT');
835 $bomcost += $linecost;
840 $arrayoflines = $object->fetchLinesLinked(
'consumed', $line->id);
841 $alreadyconsumed = 0;
842 foreach ($arrayoflines as $line2) {
843 $alreadyconsumed += $line2[
'qty'];
846 $suffix =
'_'.$line->id;
847 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
849 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$line->qty.
'">';
850 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.$alreadyconsumed.
'">';
854 print
'<td>'.$tmpproduct->getNomUrl(1);
855 print
'<br><span class="opacitymedium small">'.$tmpproduct->label.
'</span>';
858 print
'<td class="right nowraponall">';
860 if ($line->qty_frozen) {
861 $help .= ($help ?
'<br>' :
'').
'<strong>'.$langs->trans(
"QuantityFrozen").
'</strong>: '.
yn(1).
' ('.$langs->trans(
"QuantityConsumedInvariable").
')';
863 if ($line->disable_stock_change) {
864 $help .= ($help ?
'<br>' :
'').
'<strong>'.$langs->trans(
"DisableStockChange").
'</strong>: '.
yn(1).
' ('.(($tmpproduct->type ==
Product::TYPE_SERVICE && empty($conf->global->STOCK_SUPPORTS_SERVICES)) ? $langs->trans(
"NoStockChangeOnServices") : $langs->trans(
"DisableStockChangeHelp")).
')';
867 print
$form->textwithpicto($line->qty, $help, -1);
873 if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) {
874 print
'<td class="right nowraponall">';
875 print
price($linecost);
879 print
'<td class="right">';
880 if ($alreadyconsumed) {
882 print
'jQuery(document).ready(function() {
883 jQuery("#expandtoproduce'.$line->id.
'").click(function() {
884 console.log("Expand mrp_production line '.$line->id.
'");
885 jQuery(".expanddetail'.$line->id.
'").toggle();';
886 if ($nblinetoconsume == $nblinetoconsumecursor) {
887 print
'if (jQuery("#tablelines").hasClass("nobottom")) { jQuery("#tablelines").removeClass("nobottom"); } else { jQuery("#tablelines").addClass("nobottom"); }';
893 if (empty($conf->use_javascript_ajax)) {
894 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?collapse='.$collapse.
','.$line->id.
'">';
896 print
img_picto($langs->trans(
"ShowDetails"),
"chevron-down",
'id="expandtoproduce'.$line->id.
'"');
897 if (empty($conf->use_javascript_ajax)) {
901 if ($nblinetoconsume == $nblinetoconsumecursor) {
902 print
'<script>jQuery("#tablelines").removeClass("nobottom");</script>';
905 print
' '.price2num($alreadyconsumed,
'MS');
912 print
'<td class="nowraponall right">';
913 if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) {
914 print
img_warning($langs->trans(
'StockTooLow')).
' ';
916 print
price2num($tmpproduct->stock_reel,
'MS');
924 if ($permissiontodelete) {
925 $href = $_SERVER[
"PHP_SELF"].
'?id='.((int) $object->id).
'&action=deleteline&token='.
newToken().
'&lineid='.((int) $line->id);
926 print
'<td class="center">';
927 print
'<a class="reposition" href="'.$href.
'">';
928 print
img_picto($langs->trans(
'TooltipDeleteAndRevertStockMovement'),
'delete');
935 foreach ($arrayoflines as $line2) {
936 print
'<tr class="expanddetail'.$line->id.
' hideobject opacitylow">';
940 $tmpstockmovement->id = $line2[
'fk_stock_movement'];
941 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?search_ref='.$tmpstockmovement->id.
'">'.
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="paddingright"').
'</a>';
949 print
'<td class="right">'.$line2[
'qty'].
'</td>';
952 if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) {
957 print
'<td class="tdoverflowmax150">';
958 if ($line2[
'fk_warehouse'] > 0) {
959 $result = $tmpwarehouse->fetch($line2[
'fk_warehouse']);
961 print $tmpwarehouse->getNomUrl(1);
974 if ($line2[
'batch'] !=
'') {
975 $tmpbatch->fetch(0, $line2[
'fk_product'], $line2[
'batch']);
976 print $tmpbatch->getNomUrl(1);
982 if ($permissiontodelete) {
983 $href = $_SERVER[
"PHP_SELF"].
'?id='.((int) $object->id).
'&action=deleteline&token='.
newToken().
'&lineid='.((int) $line->id).
'&fk_movement='.((int) $line2[
'fk_stock_movement']);
984 print
'<td class="center">';
985 print
'<a class="reposition" href="'.$href.
'">';
986 print
img_picto($langs->trans(
'TooltipDeleteAndRevertStockMovement'),
'delete');
994 if (in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
996 print
'<!-- Enter line to consume -->'.
"\n";
997 print
'<tr name="batch_'.$line->id.
'_'.$i.
'">';
999 print
'<td><span class="opacitymedium">'.$langs->trans(
"ToConsume").
'</span></td>';
1000 $preselected = (
GETPOSTISSET(
'qty-'.$line->id.
'-'.$i) ?
GETPOST(
'qty-'.$line->id.
'-'.$i) : max(0, $line->qty - $alreadyconsumed));
1001 if ($action ==
'consumeorproduce' && !
GETPOSTISSET(
'qty-'.$line->id.
'-'.$i)) {
1006 if (!empty($conf->global->MRP_NEVER_CONSUME_MORE_THAN_EXPECTED) && ($line->qty - $alreadyconsumed) <= 0) {
1007 $disable =
'disabled';
1011 print
'<input type="hidden" name="product-'.$line->id.
'-'.$i.
'" value="'.$line->fk_product.
'">';
1014 print
'<td class="right"><input type="text" class="width50 right" id="qtytoconsume-'.$line->id.
'-'.$i.
'" name="qty-'.$line->id.
'-'.$i.
'" value="'.$preselected.
'" '.$disable.
'></td>';
1017 if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) {
1027 if (empty($line->disable_stock_change)) {
1028 $preselected = (
GETPOSTISSET(
'idwarehouse-'.$line->id.
'-'.$i) ?
GETPOST(
'idwarehouse-'.$line->id.
'-'.$i) : ($tmpproduct->fk_default_warehouse > 0 ? $tmpproduct->fk_default_warehouse :
'ifone'));
1029 print $formproduct->selectWarehouses($preselected,
'idwarehouse-'.$line->id.
'-'.$i,
'', 1, 0, $line->fk_product,
'', 1, 0, null,
'maxwidth200 csswarehouse_'.$line->id.
'_'.$i);
1031 print
'<span class="opacitymedium">'.$langs->trans(
"DisableStockChange").
'</span>';
1034 print
'<span class="opacitymedium">'.$langs->trans(
"NoStockChangeOnServices").
'</span>';
1046 if ($tmpproduct->status_batch) {
1047 $preselected = (
GETPOSTISSET(
'batch-'.$line->id.
'-'.$i) ?
GETPOST(
'batch-'.$line->id.
'-'.$i) :
'');
1048 print
'<input type="text" class="width50" name="batch-'.$line->id.
'-'.$i.
'" value="'.$preselected.
'" list="batch-'.$line->id.
'-'.$i.
'">';
1049 print $formproduct->selectLotDataList(
'batch-'.$line->id.
'-'.$i, 0, $line->fk_product,
'',
'');
1052 print
' '.img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" onClick="addDispatchLine('.((int) $line->id).
', \''.
dol_escape_js($type).
'\', \
'qtymissingconsume\')"');
1058 if ($permissiontodelete) {
1072 print
'<script type="text/javascript">
1073 $(document).ready(function () {
1074 $("select[name=fk_default_warehouse]").change(function() {
1075 var fk_default_warehouse = $("option:selected", this).val();
1076 $("select[name^=idwarehouse-]").val(fk_default_warehouse).change();
1085 print
'<div class="fichehalfright">';
1086 print
'<div class="clearboth"></div>';
1088 $nblinetoproduce = 0;
1089 foreach ($object->lines as $line) {
1090 if ($line->role ==
'toproduce') {
1095 $newcardbutton =
'';
1096 $url = $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=addproduceline&token='.
newToken();
1097 $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED;
1098 $parameters = array(
'morecss'=>
'reposition');
1099 if ($action !=
'consumeorproduce' && $action !=
'consumeandproduceall') {
1100 if ($nblinetoproduce == 0 || $object->mrptype == 1) {
1101 $newcardbutton =
dolGetButtonTitle($langs->trans(
'AddNewProduceLines'),
'',
'fa fa-plus-circle size15x', $url,
'', $permissiontoaddaproductline, $parameters);
1105 print
load_fiche_titre($langs->trans(
'Production'), $newcardbutton,
'', 0,
'',
'');
1107 print
'<div class="div-table-responsive-no-min">';
1108 print
'<table id="tablelinestoproduce" class="noborder noshadow nobottom centpercent">';
1110 print
'<tr class="liste_titre">';
1111 print
'<td>'.$langs->trans(
"Product").
'</td>';
1112 print
'<td class="right">'.$langs->trans(
"Qty").
'</td>';
1113 if ($permissiontoupdatecost) {
1114 if (empty($bomcost)) {
1115 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"UnitCost"), $langs->trans(
"AmountUsedToUpdateWAP")).
'</td>';
1117 print
'<td class="right">'.$form->textwithpicto($langs->trans(
"ManufacturingPrice"), $langs->trans(
"AmountUsedToUpdateWAP")).
'</td>';
1120 print
'<td class="right">'.$langs->trans(
"QtyAlreadyProduced").
'</td>';
1122 if ($collapse || in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
1123 print $langs->trans(
"Warehouse");
1128 if ($collapse || in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
1129 print $langs->trans(
"Batch");
1136 if ($action ==
'addproduceline') {
1137 print
'<!-- Add line to produce -->'.
"\n";
1138 print
'<tr class="liste_titre">';
1140 print
$form->select_produits(
'',
'productidtoadd',
'', 0, 0, -1, 2,
'', 1, array(), 0,
'1', 0,
'maxwidth300');
1143 print
'<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
1148 print
'<td colspan="2">';
1150 print
'<input type="submit" class="button buttongen button-add" name="addproducelinebutton" value="'.$langs->trans(
"Add").
'">';
1151 print
'<input type="submit" class="button buttongen button-cancel" name="canceladdproducelinebutton" value="'.$langs->trans(
"Cancel").
'">';
1158 if ($permissiontodelete) {
1164 if (!empty($object->lines)) {
1165 $nblinetoproduce = 0;
1166 foreach ($object->lines as $line) {
1167 if ($line->role ==
'toproduce') {
1172 $nblinetoproducecursor = 0;
1173 foreach ($object->lines as $line) {
1174 if ($line->role ==
'toproduce') {
1177 $nblinetoproducecursor++;
1179 $tmpproduct =
new Product($db);
1180 $tmpproduct->fetch($line->fk_product);
1182 $arrayoflines = $object->fetchLinesLinked(
'produced', $line->id);
1183 $alreadyproduced = 0;
1184 foreach ($arrayoflines as $line2) {
1185 $alreadyproduced += $line2[
'qty'];
1188 $suffix =
'_'.$line->id;
1189 print
'<!-- Line to dispatch '.$suffix.
' -->'.
"\n";
1191 print
'<input id="qty_ordered'.$suffix.
'" type="hidden" value="'.$line->qty.
'">';
1192 print
'<input id="qty_dispatched'.$suffix.
'" type="hidden" value="'.$alreadyproduced.
'">';
1195 print
'<td>'.$tmpproduct->getNomUrl(1);
1196 print
'<br><span class="opacitymedium small">'.$tmpproduct->label.
'</span>';
1198 print
'<td class="right">'.$line->qty.
'</td>';
1199 if ($permissiontoupdatecost) {
1201 $manufacturingcost = 0;
1202 if ($object->mrptype == 0) {
1203 $manufacturingcost = $bomcost;
1204 if (empty($manufacturingcost)) {
1205 $manufacturingcost =
price2num($tmpproduct->cost_price,
'MU');
1207 if (empty($manufacturingcost)) {
1208 $manufacturingcost =
price2num($tmpproduct->pmp,
'MU');
1212 print
'<td class="right nowraponall">';
1213 if ($manufacturingcost) {
1214 print
price($manufacturingcost);
1218 print
'<td class="right nowraponall">';
1219 if ($alreadyproduced) {
1221 print
'jQuery(document).ready(function() {
1222 jQuery("#expandtoproduce'.$line->id.
'").click(function() {
1223 console.log("Expand mrp_production line '.$line->id.
'");
1224 jQuery(".expanddetailtoproduce'.$line->id.
'").toggle();';
1225 if ($nblinetoproduce == $nblinetoproducecursor) {
1226 print
'if (jQuery("#tablelinestoproduce").hasClass("nobottom")) { jQuery("#tablelinestoproduce").removeClass("nobottom"); } else { jQuery("#tablelinestoproduce").addClass("nobottom"); }';
1232 if (empty($conf->use_javascript_ajax)) {
1233 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?collapse='.$collapse.
','.$line->id.
'">';
1235 print
img_picto($langs->trans(
"ShowDetails"),
"chevron-down",
'id="expandtoproduce'.$line->id.
'"');
1236 if (empty($conf->use_javascript_ajax)) {
1240 print
' '.$alreadyproduced;
1248 if ($permissiontodelete && $line->origin_type ==
'free') {
1249 $href = $_SERVER[
"PHP_SELF"];
1250 $href .=
'?id='.$object->id;
1251 $href .=
'&action=deleteline';
1252 $href .=
'&lineid='.$line->id;
1253 print
'<td class="center">';
1254 print
'<a class="reposition" href="'.$href.
'">';
1255 print
img_picto($langs->trans(
'TooltipDeleteAndRevertStockMovement'),
"delete");
1262 foreach ($arrayoflines as $line2) {
1263 print
'<tr class="expanddetailtoproduce'.$line->id.
' hideobject opacitylow">';
1265 $tmpstockmovement->id = $line2[
'fk_stock_movement'];
1266 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?search_ref='.$tmpstockmovement->id.
'">'.
img_picto($langs->trans(
"StockMovement"),
'movement',
'class="paddingright"').
'</a>';
1272 if ($permissiontoupdatecost) {
1276 print
'<td class="right">'.$line2[
'qty'].
'</td>';
1277 print
'<td class="tdoverflowmax150">';
1278 if ($line2[
'fk_warehouse'] > 0) {
1279 $result = $tmpwarehouse->fetch($line2[
'fk_warehouse']);
1281 print $tmpwarehouse->getNomUrl(1);
1287 if ($line2[
'batch'] !=
'') {
1288 $tmpbatch->fetch(0, $line2[
'fk_product'], $line2[
'batch']);
1289 print $tmpbatch->getNomUrl(1);
1297 if (in_array($action, array(
'consumeorproduce',
'consumeandproduceall'))) {
1298 print
'<!-- Enter line to produce -->'.
"\n";
1299 print
'<tr name="batch_'.$line->id.
'_'.$i.
'">';
1300 print
'<td><span class="opacitymedium">'.$langs->trans(
"ToProduce").
'</span></td>';
1301 $preselected = (
GETPOSTISSET(
'qtytoproduce-'.$line->id.
'-'.$i) ?
GETPOST(
'qtytoproduce-'.$line->id.
'-'.$i) : max(0, $line->qty - $alreadyproduced));
1302 if ($action ==
'consumeorproduce' && !
GETPOSTISSET(
'qtytoproduce-'.$line->id.
'-'.$i)) {
1305 print
'<td class="right"><input type="text" class="width50 right" id="qtytoproduce-'.$line->id.
'-'.$i.
'" name="qtytoproduce-'.$line->id.
'-'.$i.
'" value="'.$preselected.
'"></td>';
1306 if ($permissiontoupdatecost) {
1308 $manufacturingcost = 0;
1309 if ($object->mrptype == 0) {
1310 $manufacturingcost = $bomcost;
1311 if (empty($manufacturingcost)) {
1312 $manufacturingcost =
price2num($tmpproduct->cost_price,
'MU');
1314 if (empty($manufacturingcost)) {
1315 $manufacturingcost =
price2num($tmpproduct->pmp,
'MU');
1320 $preselected = (
GETPOSTISSET(
'pricetoproduce-'.$line->id.
'-'.$i) ?
GETPOST(
'pricetoproduce-'.$line->id.
'-'.$i) : ($manufacturingcost ?
price($manufacturingcost) :
''));
1321 print
'<td class="right"><input type="text" class="width50 right" name="pricetoproduce-'.$line->id.
'-'.$i.
'" value="'.$preselected.
'"></td>';
1323 print
'<td><input type="hidden" class="width50 right" name="pricetoproduce-'.$line->id.
'-'.$i.
'" value="'.($manufacturingcost ? $manufacturingcost :
'').
'"></td>';
1329 $preselected = (
GETPOSTISSET(
'idwarehousetoproduce-'.$line->id.
'-'.$i) ?
GETPOST(
'idwarehousetoproduce-'.$line->id.
'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse :
'ifone'));
1330 print $formproduct->selectWarehouses($preselected,
'idwarehousetoproduce-'.$line->id.
'-'.$i,
'', 1, 0, $line->fk_product,
'', 1, 0, null,
'maxwidth200 csswarehouse_'.$line->id.
'_'.$i);
1332 print
'<span class="opacitymedium">'.$langs->trans(
"NoStockChangeOnServices").
'</span>';
1337 if ($tmpproduct->status_batch) {
1338 $preselected = (
GETPOSTISSET(
'batchtoproduce-'.$line->id.
'-'.$i) ?
GETPOST(
'batchtoproduce-'.$line->id.
'-'.$i) :
'');
1339 print
'<input type="text" class="width50" name="batchtoproduce-'.$line->id.
'-'.$i.
'" value="'.$preselected.
'">';
1344 if ($tmpproduct->status_batch) {
1346 print
img_picto($langs->trans(
'AddStockLocationLine'),
'split.png',
'class="splitbutton" onClick="addDispatchLine('.$line->id.
', \''.$type.
'\', \
'qtymissing\')"');
1363 if (in_array($action, array(
'consumeorproduce',
'consumeandproduceall',
'addconsumeline'))) {
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage stock movements.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
Class with list of lots and properties.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Class to manage products or services.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_now($mode= 'auto')
Return date for now.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
const TYPE_SERVICE
Service.
const TYPE_PRODUCT
Regular product.
moPrepareHead($object)
Prepare array of tabs for Mo.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage translations.
restrictedArea($user, $features, $objectid=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.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
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.
$formconfirm
if ($action == 'delbookkeepingyear') {
Class to manage predefined suppliers products.
Class to manage warehouses.