29require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/mrp/lib/mrp_mo.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/bom/lib/bom.lib.php';
50 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
54$langs->loadLangs(array(
'mrp',
'other'));
60$action =
GETPOST(
'action',
'aZ09');
61$confirm =
GETPOST(
'confirm',
'alpha');
63$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mocard';
64$backtopage =
GETPOST(
'backtopage',
'alpha');
65$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
66$TBomLineId =
GETPOST(
'bomlineid',
'array:int');
74$diroutputmassaction =
$conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
75$hookmanager->initHooks(array(
'mocard',
'globalcard'));
78$extrafields->fetch_name_optionals_label(
$object->table_element);
80$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
83$search_all =
GETPOST(
"search_all",
'alpha');
85foreach (
$object->fields as $key => $val) {
86 if (
GETPOST(
'search_'.$key,
'alpha')) {
87 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
91if (empty($action) && empty($id) && empty($ref)) {
96include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
101 if ($action !=
'add') {
103 $_POST[
'fk_product'] = $objectbom->fk_product;
104 $_POST[
'qty'] = $objectbom->qty;
105 $_POST[
'mrptype'] = $objectbom->bomtype;
106 $_POST[
'fk_warehouse'] = $objectbom->fk_warehouse;
107 $_POST[
'note_private'] = $objectbom->note_private;
114$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
118$permissionnote = $user->hasRight(
'mrp',
'write');
119$permissiondellink = $user->hasRight(
'mrp',
'write');
120$permissiontoadd = $user->hasRight(
'mrp',
'write');
121$permissiontodelete = $user->hasRight(
'mrp',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
129$parameters = array();
130$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
135if (empty($reshook)) {
142 if (empty($backtopage) || ($cancel && empty($id))) {
143 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
144 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
145 $backtopage = $backurlforlist;
147 $backtopage = DOL_URL_ROOT.
'/mrp/mo_card.php?id='.(
$id > 0 ?
$id :
'__ID__');
151 if ($cancel && !empty($backtopageforcancel)) {
152 $backtopage = $backtopageforcancel;
154 $triggermodname =
'MO_MODIFY';
157 if ($action ==
'add' && empty($id) && !empty($TBomLineId) && $permissiontoadd) {
159 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
166 foreach ($TBomLineId as $id_bom_line) {
169 $objectbomchildline->fetch($id_bom_line);
171 $TMoLines = $moline->fetchAll(
'DESC',
'rowid', 1, 0, array(
'origin_id' => $id_bom_line));
173 foreach ($TMoLines as $tmpmoline) {
174 $_POST[
'fk_bom'] = $objectbomchildline->fk_bom_child;
175 $_POST[
'fk_parent_line'] = $tmpmoline->id;
176 $_POST[
'qty'] = $tmpmoline->qty;
177 $_POST[
'fk_product'] = $tmpmoline->fk_product;
180 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
182 $res =
$object->add_object_linked(
'mo', $mo_parent->id);
185 header(
"Location: ".
dol_buildpath(
'/mrp/mo_card.php?id='.((
int) $mo_parent->id), 1));
187 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && !empty($permissiontoadd)) {
188 $also_cancel_consumed_and_produced_lines = (
GETPOST(
'alsoCancelConsumedAndProducedLines',
'alpha') ? 1 : 0);
189 $result =
$object->cancel($user, 0, (
bool) $also_cancel_consumed_and_produced_lines);
197 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && !empty($permissiontodelete)) {
198 $also_cancel_consumed_and_produced_lines = (
GETPOST(
'alsoCancelConsumedAndProducedLines',
'alpha') ? 1 : 0);
199 $result =
$object->delete($user, 0, (
bool) $also_cancel_consumed_and_produced_lines);
201 header(
"Location: " . $backurlforlist);
207 } elseif ($action ==
'settags' &&
isModEnabled(
'category') && $permissiontoadd) {
214 if ($action ==
'confirm_delete' && !empty($permissiontodelete)) {
216 dol_print_error(
null,
'Error, object must be fetched before being deleted');
221 $deleteChilds =
GETPOST(
'deletechilds',
'aZ');
226 if ($deleteChilds ===
'on') {
227 $TMoChildren =
$object->getAllMoChilds();
229 foreach ($TMoChildren as $id => $childObject) {
230 if ($childObject->delete($user) == -1) {
232 if (!empty($childObject->errors)) {
242 $result =
$object->delete($user);
247 if ($deleteChilds ===
'on') {
251 if (empty($noback)) {
252 header(
"Location: " . $backurlforlist);
280 if ($action ==
'setqty' && $permissiontoadd &&
$object->status == Mo::STATUS_DRAFT) {
294 foreach (
$object->lines as $line) {
295 if ($line->role ===
'toproduce'
296 && (
int) $line->fk_product === (
int)
$object->fk_product
297 && empty($line->qty_frozen)
298 && (
float) $line->qty != (
float)
$object->qty) {
299 $line->qty = (float)
$object->qty;
300 $line->update($user);
308 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->trans(
"Qty")),
null,
'errors');
310 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".
$object->id);
315 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
318 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
321 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
324 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
326 if ($action ==
'set_thirdparty' && $permissiontoadd) {
327 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
329 if ($action ==
'classin' && $permissiontoadd) {
334 $triggersendname =
'MO_SENTBYMAIL';
335 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
336 $trackid =
'mo'.$object->id;
337 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
343 if ($action ==
'confirm_produced' && $confirm ==
'yes' && $permissiontoadd) {
344 $result =
$object->setStatut($object::STATUS_PRODUCED, 0,
'',
'MRP_MO_PRODUCED');
348 $outputlangs = $langs;
351 $newlang =
GETPOST(
'lang_id',
'aZ09');
354 $newlang =
$object->thirdparty->default_lang;
356 if (!empty($newlang)) {
358 $outputlangs->setDefaultLang($newlang);
363 $object->generateDocument($model, $outputlangs, 0, 0, 0);
382$title = $langs->trans(
'ManufacturingOrder').
" - ".$langs->trans(
"Card");
383$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
385llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-card');
389if ($action ==
'create') {
392 $titlelist = $langs->trans(
"ToConsume");
393 if ($objectbom->bomtype == 1) {
394 $titlelist = $langs->trans(
"ToObtain");
398 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Mo")),
'',
'mrp');
400 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
401 print
'<input type="hidden" name="token" value="'.newToken().
'">';
402 print
'<input type="hidden" name="action" value="add">';
404 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
406 if ($backtopageforcancel) {
407 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
412 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
415 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
418 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
422 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
423 print $form->selectCategories(Categorie::TYPE_MO,
'categories', $object);
427 print
'</table>'.
"\n";
433 $(document).ready(
function () {
434 jQuery(
'#fk_bom').change(
function() {
435 console.log(
'We change value of BOM with BOM of id '+jQuery(
'#fk_bom').val());
436 if (jQuery(
'#fk_bom').val() > 0)
439 window.location.href =
'<?php echo $_SERVER["PHP_SELF"] ?>?action=create&token=<?php echo newToken(); ?>&fk_bom='+jQuery(
'#fk_bom').val();
468 else if (jQuery(
'#fk_bom').val() < 0) {
470 console.log(jQuery(
'#fk_product').val());
471 window.location.href =
'<?php echo $_SERVER["PHP_SELF"] ?>?action=create&token=<?php echo newToken(); ?>&qty='+jQuery(
'#qty').val()+
'&mrptype='+jQuery(
'#mrptype').val()+
'&fk_product='+jQuery(
'#fk_product').val()+
'&label='+jQuery(
'#label').val()+
'&fk_project='+jQuery(
'#fk_project').val()+
'&fk_warehouse='+jQuery(
'#fk_warehouse').val();
489 print $form->buttonsSaveCancel(
"Create");
491 if ($objectbom->id > 0) {
494 print
'<!-- list of product/services to consume -->'.
"\n";
495 print
'<div class="div-table-responsive-no-min">';
496 print
'<table class="noborder centpercent">';
498 $arrayOfMoLines = array();
499 foreach ($objectbom->lines as $key => $val) {
501 $moLine->id = $objectbom->lines[$key]->id;
502 $moLine->position = $objectbom->lines[$key]->position;
503 $moLine->fk_product = $objectbom->lines[$key]->fk_product;
504 $moLine->fk_unit = $objectbom->lines[$key]->fk_unit;
505 $moLine->qty = $objectbom->lines[$key]->qty;
506 $moLine->qty_frozen = $objectbom->lines[$key]->qty_frozen;
507 $moLine->disable_stock_change = $objectbom->lines[$key]->disable_stock_change;
508 $moLine->fk_bom_child = $objectbom->lines[$key]->fk_bom_child;
510 $arrayOfMoLines[] = $moLine;
512 $object->lines = $arrayOfMoLines;
513 $object->mrptype = $objectbom->bomtype;
516 $object->printOriginLinesList(
'', array());
526if (($id || $ref) && $action ==
'edit') {
529 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
530 print
'<input type="hidden" name="token" value="'.newToken().
'">';
531 print
'<input type="hidden" name="action" value="update">';
532 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
534 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
536 if ($backtopageforcancel) {
537 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
542 $object->fields[
'fk_bom'][
'disabled'] = 1;
544 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
547 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
550 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
554 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
555 print $form->selectCategories(Categorie::TYPE_MO,
'categories', $object);
563 print $form->buttonsSaveCancel();
569if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
570 $res =
$object->fetch_thirdparty();
579 if ($action ==
'delete') {
580 $numberofmochilds = count(
$object->getAllMoChilds());
582 if ($numberofmochilds > 0) {
583 $label = $langs->trans(
"DeleteMoChild",
'('.strval($numberofmochilds).
')');
585 $label = $langs->trans(
"DeleteMoChild");
588 $formquestion = array(
589 array(
'type' =>
'checkbox',
'name' =>
'deletechilds',
'label' => $label,
'value' => 0),
591 'label' => $langs->trans(
'MoCancelConsumedAndProducedLines'),
592 'name' =>
'alsoCancelConsumedAndProducedLines',
593 'type' =>
'checkbox',
594 'value' => !
getDolGlobalString(
'MO_ALSO_CANCEL_CONSUMED_AND_PRODUCED_LINES_BY_DEFAULT') ? 0 : 1
597 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete', $formquestion, 0, 1);
600 if ($action ==
'deleteline') {
601 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
605 if ($action ==
'reload') {
606 $object->createProduction($user, 0);
610 if ($action ==
'validate') {
612 $ref = substr(
$object->ref, 1, 4);
613 if ($ref ==
'PROV') {
620 $text = $langs->trans(
'ConfirmValidateMo', $numref);
629 $formquestion = array();
632 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
635 if (
$conf->browser->name ==
'ie') {
638 $formquestion = array(
645 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Validate'), $text,
'confirm_validate', $formquestion, 0, 1, 220);
649 if ($action ==
'cancel') {
650 $formquestion = array(
652 'label' => $langs->trans(
'MoCancelConsumedAndProducedLines'),
653 'name' =>
'alsoCancelConsumedAndProducedLines',
654 'type' =>
'checkbox',
658 $formconfirm = $form->formconfirm(
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id]), $langs->trans(
'CancelMo'), $langs->trans(
'ConfirmCancelMo'),
'confirm_cancel', $formquestion, 0, 1);
662 if ($action ==
'clone') {
664 $formquestion = array();
665 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
669 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
670 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
671 if (empty($reshook)) {
672 $formconfirm .= $hookmanager->resPrint;
673 } elseif ($reshook > 0) {
674 $formconfirm = $hookmanager->resPrint;
683 $linkback =
'<a href="'.dol_buildpath(
'/mrp/mo_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
685 $morehtmlref =
'<div class="refidno">';
691 if (is_object(
$object->thirdparty)) {
692 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
694 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->thirdparty->id.
'&search_societe='.urlencode(
$object->thirdparty->name).
'">'.$langs->trans(
"OtherOrders").
'</a>)';
699 $langs->load(
"projects");
700 if (is_object(
$object->thirdparty)) {
701 $morehtmlref .=
'<br>';
703 if ($permissiontoadd) {
704 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
705 if ($action !=
'classify') {
706 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
708 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
710 if (!empty(
$object->fk_project)) {
712 $proj->fetch(
$object->fk_project);
713 $morehtmlref .= $proj->getNomUrl(1);
715 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
720 $morehtmlref .=
'</div>';
723 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
726 print
'<div class="fichecenter">';
727 print
'<div class="fichehalfleft">';
728 print
'<div class="underbanner clearboth"></div>';
729 print
'<table class="border centpercent tableforfield">'.
"\n";
732 $mo_parent =
$object->getMoParent();
733 if (is_object($mo_parent)) {
734 print
'<tr class="field_fk_mo_parent">';
735 print
'<td class="titlefield fieldname_fk_mo_parent">' . $langs->trans(
'ParentMo') .
'</td>';
736 print
'<td class="valuefield fieldname_fk_mo_parent">' .$mo_parent->getNomUrl(1).
'</td>';
741 $keyforbreak =
'fk_warehouse';
742 unset(
$object->fields[
'fk_project']);
743 unset(
$object->fields[
'fk_soc']);
749 if (
$object->status == Mo::STATUS_DRAFT && $permissiontoadd && isset(
$object->fields[
'qty'])) {
750 $object->fields[
'qty'][
'alwayseditable'] = 1;
751 if ($action ==
'editqty') {
752 $object->fields[
'qty'][
'type'] =
'numeric';
756 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
761 print
'<table class="nobordernopadding centpercent"><tr><td>';
762 print $langs->trans(
"Categories");
763 print
'<td><td class="right">';
764 if ($permissiontoadd) {
765 print
'<a class="editfielda" href="' . DOL_URL_ROOT .
'/mrp/mo_card.php?id=' .
$object->id .
'&action=edittags&token=' . newToken() .
'">' .
img_edit() .
'</a>';
769 print
'</td></tr></table>';
772 if ($action ==
'edittags') {
773 print
'<form method="POST" action="' . $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'">';
774 print
'<input type="hidden" name="action" value="settags">';
775 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
776 print $form->selectCategories(Categorie::TYPE_MO,
'categories', $object);
777 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans(
"Modify") .
'">';
780 print $form->showCategories(
$object->id, Categorie::TYPE_MO, 1);
786 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
792 print
'<div class="clearboth"></div>';
801 if (!empty(
$object->table_element_line)) {
806 print
' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">
807 <input type="hidden" name="token" value="' . newToken().
'">
808 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
809 <input type="hidden" name="mode" value="">
810 <input type="hidden" name="page_y" value="">
811 <input type="hidden" name="id" value="' .
$object->id.
'">
819 print
'<div class="div-table-responsive-no-min">';
820 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
822 print
'<tr class="liste_titre">';
823 print
'<td class="liste_titre">'.$langs->trans(
"Summary").
'</td>';
827 print
'<tr class="oddeven">';
828 print
'<td>'.$langs->trans(
"ProductsToConsume").
'</td>';
832 foreach (
$object->lines as $line) {
833 if ($line->role ==
'toconsume') {
838 $tmpproduct->fetch($line->fk_product);
839 print $tmpproduct->getNomUrl(1);
847 print
'<tr class="oddeven">';
848 print
'<td>'.$langs->trans(
"ProductsToProduce").
'</td>';
852 foreach (
$object->lines as $line) {
853 if ($line->role ==
'toproduce') {
858 $tmpproduct->fetch($line->fk_product);
859 print $tmpproduct->getNomUrl(1);
877 if ($action !=
'presend' && $action !=
'editline') {
878 print
'<div class="tabsAction">'.
"\n";
879 $parameters = array();
880 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
885 if (empty($reshook)) {
892 if (
$object->status == $object::STATUS_VALIDATED) {
893 if ($permissiontoadd) {
895 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_setdraft&confirm=yes&token='.newToken().
'">'.$langs->trans(
"SetToDraft").
'</a>';
900 if (
$object->status == $object::STATUS_DRAFT) {
901 if ($permissiontoadd) {
902 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
904 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dolPrintHTMLForAttribute($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Modify').
'</a>'.
"\n";
909 if (
$object->status == $object::STATUS_DRAFT &&
$object->fk_bom > 0) {
910 if ($permissiontoadd) {
911 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=reload&token='.newToken().
'" title="'.
dolPrintHTMLForAttribute($langs->trans(
"ReInitializeHelp")).
'">'.$langs->trans(
"ReInitialize").
'</a>';
913 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dolPrintHTMLForAttribute($langs->trans(
"ReInitializeHelp").
'<br>'.$langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'ReInitialize').
'</a>'.
"\n";
918 if (
$object->status == $object::STATUS_DRAFT) {
919 if ($permissiontoadd) {
921 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=validate&token='.newToken().
'">'.$langs->trans(
"Validate").
'</a>';
923 $langs->load(
"errors");
924 print
'<a class="butActionRefused" href="" title="'.$langs->trans(
"ErrorAddAtLeastOneLineFirst").
'">'.$langs->trans(
"Validate").
'</a>';
930 if ($permissiontoadd) {
931 print dolGetButtonAction($langs->trans(
"ToClone"),
'',
'clone', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.(!empty(
$object->socid) ?
'&socid='.$object->socid :
"").
'&action=clone&token='.newToken().
'&object=mo',
'clone', $permissiontoadd);
935 if ($permissiontoadd) {
936 if (
$object->status == $object::STATUS_VALIDATED ||
$object->status == $object::STATUS_INPROGRESS) {
937 $arrayproduced =
$object->fetchLinesLinked(
'produced', 0);
939 foreach ($arrayproduced as $lineproduced) {
940 $nbProduced += $lineproduced[
'qty'];
942 if ($nbProduced > 0) {
943 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_produced&confirm=yes&token='.newToken().
'">'.$langs->trans(
"Close").
'</a>'.
"\n";
945 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"GoOnTabProductionToProduceFirst", $langs->transnoentitiesnoconv(
"Production")).
'">'.$langs->trans(
"Close").
'</a>'.
"\n";
948 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.newToken().
'">'.$langs->trans(
"Cancel").
'</a>'.
"\n";
951 if (
$object->status == $object::STATUS_PRODUCED ||
$object->status == $object::STATUS_CANCELED) {
952 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_reopen&confirm=yes&token='.newToken().
'">'.$langs->trans(
"ReOpen").
'</a>'.
"\n";
957 print dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.newToken(),
'delete', $permissiontodelete);
964 if (
GETPOST(
'modelselected')) {
968 if ($action !=
'presend') {
969 print
'<div class="fichecenter"><div class="fichehalfleft">';
970 print
'<a name="builddoc"></a>';
974 $relativepath = $objref.
'/'.$objref.
'.pdf';
975 $filedir =
$conf->mrp->dir_output.
'/'.$objref;
976 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
977 $genallowed = $user->hasRight(
'mrp',
'read');
978 $delallowed = $user->hasRight(
"mrp",
"creer");
979 print $formfile->showdocuments(
'mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'',
$mysoc->default_lang,
'', $object);
982 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'mo'), 1);
983 $linktoelem = $tmparray[
'linktoelem'];
984 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
985 print $htmltoenteralink;
987 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, array());
990 print
'</div><div class="fichehalfright">';
994 $morehtmlcenter = dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/mrp/mo_agenda.php?id='.
$object->id);
997 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
999 $somethingshown = $formactions->showactions($object,
$object->element, $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1001 print
'</div></div>';
1005 if (
GETPOST(
'modelselected')) {
1006 $action =
'presend';
1011 $defaulttopic =
'InformationMessage';
1012 $diroutput =
$conf->mrp->dir_output;
1013 $trackid =
'mo'.$object->id;
1015 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
mrpCollapseBomManagement()
Manage collapse bom display.
Class to manage products or services.
Class to manage projects.
Class to manage translations.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
moPrepareHead($object)
Prepare array of tabs for Mo.
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.