29require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/mrp/lib/mrp_mo.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/bom/lib/bom.lib.php';
40if (isModEnabled(
'workstation')) {
41 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
55$langs->loadLangs(array(
'mrp',
'other'));
61$action =
GETPOST(
'action',
'aZ09');
62$confirm =
GETPOST(
'confirm',
'alpha');
64$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mocard';
65$backtopage =
GETPOST(
'backtopage',
'alpha');
66$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
67$TBomLineId =
GETPOST(
'bomlineid',
'array:int');
73$objectbom =
new BOM($db);
76$diroutputmassaction =
$conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
77$hookmanager->initHooks(array(
'mocard',
'globalcard'));
80$extrafields->fetch_name_optionals_label(
$object->table_element);
82$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
85$search_all =
GETPOST(
"search_all",
'alpha');
87foreach (
$object->fields as $key => $val) {
88 if (
GETPOST(
'search_'.$key,
'alpha')) {
89 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
93if (empty($action) && empty($id) && empty($ref)) {
98include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
103 if ($action !=
'add') {
105 $_POST[
'fk_product'] = $objectbom->fk_product;
106 $_POST[
'qty'] = $objectbom->qty;
107 $_POST[
'mrptype'] = $objectbom->bomtype;
108 $_POST[
'fk_warehouse'] = $objectbom->fk_warehouse;
109 $_POST[
'note_private'] = $objectbom->note_private;
116$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
120$permissionnote = $user->hasRight(
'mrp',
'write');
121$permissiondellink = $user->hasRight(
'mrp',
'write');
122$permissiontoadd = $user->hasRight(
'mrp',
'write');
123$permissiontodelete = $user->hasRight(
'mrp',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
131$parameters = array();
132$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
137if (empty($reshook)) {
144 if (empty($backtopage) || ($cancel && empty($id))) {
145 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
146 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
147 $backtopage = $backurlforlist;
149 $backtopage = DOL_URL_ROOT.
'/mrp/mo_card.php?id='.(
$id > 0 ?
$id :
'__ID__');
153 if ($cancel && !empty($backtopageforcancel)) {
154 $backtopage = $backtopageforcancel;
156 $triggermodname =
'MO_MODIFY';
159 if ($action ==
'add' && empty($id) && !empty($TBomLineId) && $permissiontoadd) {
161 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
165 $moline =
new MoLine($db);
166 $objectbomchildline =
new BOMLine($db);
168 foreach ($TBomLineId as $id_bom_line) {
171 $objectbomchildline->fetch((
int) $id_bom_line);
177 $filter =
'(fk_mo:=:'.((int) $mo_parent->id).
') AND (origin_id:=:'.((int) $id_bom_line).
") AND (origin_type:=:'bomline')";
178 $TMoLines = $moline->fetchAll(
'DESC',
'rowid', 1, 0, $filter);
180 if (empty($TMoLines)) {
184 foreach ($TMoLines as $tmpmoline) {
185 $_POST[
'fk_bom'] = $objectbomchildline->fk_bom_child;
186 $_POST[
'fk_parent_line'] = $tmpmoline->id;
187 $_POST[
'qty'] = $tmpmoline->qty;
188 $_POST[
'fk_product'] = $tmpmoline->fk_product;
191 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
193 $res =
$object->add_object_linked(
'mo', $mo_parent->id);
196 header(
"Location: ".
dol_buildpath(
'/mrp/mo_card.php?id='.((
int) $mo_parent->id), 1));
198 } elseif ($action ==
'confirm_cancel' && $confirm ==
'yes' && !empty($permissiontoadd)) {
199 $also_cancel_consumed_and_produced_lines = (
GETPOST(
'alsoCancelConsumedAndProducedLines',
'alpha') ? 1 : 0);
200 $result =
$object->cancel($user, 0, (
bool) $also_cancel_consumed_and_produced_lines);
208 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && !empty($permissiontodelete)) {
209 $also_cancel_consumed_and_produced_lines = (
GETPOST(
'alsoCancelConsumedAndProducedLines',
'alpha') ? 1 : 0);
210 $result =
$object->delete($user, 0, (
bool) $also_cancel_consumed_and_produced_lines);
212 header(
"Location: " . $backurlforlist);
220 if ($action ==
'confirm_delete' && !empty($permissiontodelete)) {
222 dol_print_error(
null,
'Error, object must be fetched before being deleted');
227 $deleteChilds =
GETPOST(
'deletechilds',
'aZ');
232 if ($deleteChilds ===
'on') {
233 $TMoChildren =
$object->getAllMoChilds();
235 foreach ($TMoChildren as $id => $childObject) {
236 if ($childObject->delete($user) == -1) {
238 if (!empty($childObject->errors)) {
248 $result =
$object->delete($user);
253 if ($deleteChilds ===
'on') {
257 if (empty($noback)) {
258 header(
"Location: " . $backurlforlist);
281 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
284 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
287 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
290 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
292 if ($action ==
'set_thirdparty' && $permissiontoadd) {
293 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
295 if ($action ==
'classin' && $permissiontoadd) {
300 $triggersendname =
'MO_SENTBYMAIL';
301 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
302 $trackid =
'mo'.$object->id;
303 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
309 if ($action ==
'confirm_produced' && $confirm ==
'yes' && $permissiontoadd) {
310 $result =
$object->setStatut($object::STATUS_PRODUCED, 0,
'',
'MRP_MO_PRODUCED');
314 $outputlangs = $langs;
317 $newlang =
GETPOST(
'lang_id',
'aZ09');
320 $newlang =
$object->thirdparty->default_lang;
322 if (!empty($newlang)) {
324 $outputlangs->setDefaultLang($newlang);
329 $object->generateDocument($model, $outputlangs, 0, 0, 0);
344$form =
new Form($db);
348$title = $langs->trans(
'ManufacturingOrder').
" - ".$langs->trans(
"Card");
349$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
351llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-card');
355if ($action ==
'create') {
358 $titlelist = $langs->trans(
"ToConsume");
359 if ($objectbom->bomtype == 1) {
360 $titlelist = $langs->trans(
"ToObtain");
364 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Mo")),
'',
'mrp');
366 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
367 print
'<input type="hidden" name="token" value="'.newToken().
'">';
368 print
'<input type="hidden" name="action" value="add">';
370 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
372 if ($backtopageforcancel) {
373 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
378 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
381 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
384 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
386 print
'</table>'.
"\n";
392 $(document).ready(
function () {
393 jQuery(
'#fk_bom').change(
function() {
394 console.log(
'We change value of BOM with BOM of id '+jQuery(
'#fk_bom').val());
395 if (jQuery(
'#fk_bom').val() > 0)
398 window.location.href =
'<?php echo $_SERVER["PHP_SELF"] ?>?action=create&token=<?php echo newToken(); ?>&fk_bom='+jQuery(
'#fk_bom').val();
427 else if (jQuery(
'#fk_bom').val() < 0) {
429 console.log(jQuery(
'#fk_product').val());
430 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();
448 print $form->buttonsSaveCancel(
"Create");
450 if ($objectbom->id > 0) {
453 print
'<!-- list of product/services to consume -->'.
"\n";
454 print
'<div class="div-table-responsive-no-min">';
455 print
'<table class="noborder centpercent">';
457 $arrayOfMoLines = array();
458 foreach ($objectbom->lines as $key => $val) {
459 $moLine =
new MoLine($db);
460 $moLine->id = $objectbom->lines[$key]->id;
461 $moLine->position = $objectbom->lines[$key]->position;
462 $moLine->fk_product = $objectbom->lines[$key]->fk_product;
463 $moLine->fk_unit = $objectbom->lines[$key]->fk_unit;
464 $moLine->qty = $objectbom->lines[$key]->qty;
465 $moLine->qty_frozen = $objectbom->lines[$key]->qty_frozen;
466 $moLine->disable_stock_change = $objectbom->lines[$key]->disable_stock_change;
467 $moLine->fk_bom_child = $objectbom->lines[$key]->fk_bom_child;
469 $arrayOfMoLines[] = $moLine;
471 $object->lines = $arrayOfMoLines;
472 $object->mrptype = $objectbom->bomtype;
475 $object->printOriginLinesList(
'', array());
485if (($id || $ref) && $action ==
'edit') {
488 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
489 print
'<input type="hidden" name="token" value="'.newToken().
'">';
490 print
'<input type="hidden" name="action" value="update">';
491 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
493 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
495 if ($backtopageforcancel) {
496 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
501 $object->fields[
'fk_bom'][
'disabled'] = 1;
503 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
506 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
509 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
515 print $form->buttonsSaveCancel();
521if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
522 $res =
$object->fetch_thirdparty();
531 if ($action ==
'delete') {
532 $numberofmochilds = count(
$object->getAllMoChilds());
534 if ($numberofmochilds > 0) {
535 $label = $langs->trans(
"DeleteMoChild",
'('.strval($numberofmochilds).
')');
537 $label = $langs->trans(
"DeleteMoChild");
540 $formquestion = array(
541 array(
'type' =>
'checkbox',
'name' =>
'deletechilds',
'label' => $label,
'value' => 0),
543 'label' => $langs->trans(
'MoCancelConsumedAndProducedLines'),
544 'name' =>
'alsoCancelConsumedAndProducedLines',
545 'type' =>
'checkbox',
546 'value' => !
getDolGlobalString(
'MO_ALSO_CANCEL_CONSUMED_AND_PRODUCED_LINES_BY_DEFAULT') ? 0 : 1
549 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete', $formquestion, 0, 1);
552 if ($action ==
'deleteline') {
553 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
557 if ($action ==
'validate') {
559 $ref = substr(
$object->ref, 1, 4);
560 if ($ref ==
'PROV') {
567 $text = $langs->trans(
'ConfirmValidateMo', $numref);
576 $formquestion = array();
577 if (isModEnabled(
'mrp')) {
579 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
582 if (
$conf->browser->name ==
'ie') {
585 $formquestion = array(
592 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Validate'), $text,
'confirm_validate', $formquestion, 0, 1, 220);
596 if ($action ==
'cancel') {
597 $formquestion = array(
599 'label' => $langs->trans(
'MoCancelConsumedAndProducedLines'),
600 'name' =>
'alsoCancelConsumedAndProducedLines',
601 'type' =>
'checkbox',
605 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'CancelMo'), $langs->trans(
'ConfirmCancelMo'),
'confirm_cancel', $formquestion, 0, 1);
609 if ($action ==
'clone') {
611 $formquestion = array();
612 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
616 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
617 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
618 if (empty($reshook)) {
619 $formconfirm .= $hookmanager->resPrint;
620 } elseif ($reshook > 0) {
621 $formconfirm = $hookmanager->resPrint;
630 $linkback =
'<a href="'.dol_buildpath(
'/mrp/mo_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
632 $morehtmlref =
'<div class="refidno">';
638 if (is_object(
$object->thirdparty)) {
639 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
641 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->thirdparty->id.
'">'.$langs->trans(
"OtherOrders").
'</a>)';
645 if (isModEnabled(
'project')) {
646 $langs->load(
"projects");
647 if (is_object(
$object->thirdparty)) {
648 $morehtmlref .=
'<br>';
650 if ($permissiontoadd) {
651 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
652 if ($action !=
'classify') {
653 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
655 $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');
657 if (!empty(
$object->fk_project)) {
659 $proj->fetch(
$object->fk_project);
660 $morehtmlref .= $proj->getNomUrl(1);
662 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
667 $morehtmlref .=
'</div>';
670 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
673 print
'<div class="fichecenter">';
674 print
'<div class="fichehalfleft">';
675 print
'<div class="underbanner clearboth"></div>';
676 print
'<table class="border centpercent tableforfield">'.
"\n";
679 $mo_parent =
$object->getMoParent();
680 if (is_object($mo_parent)) {
681 print
'<tr class="field_fk_mo_parent">';
682 print
'<td class="titlefield fieldname_fk_mo_parent">' . $langs->trans(
'ParentMo') .
'</td>';
683 print
'<td class="valuefield fieldname_fk_mo_parent">' .$mo_parent->getNomUrl(1).
'</td>';
688 $keyforbreak =
'fk_warehouse';
689 unset(
$object->fields[
'fk_project']);
690 unset(
$object->fields[
'fk_soc']);
691 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
694 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
700 print
'<div class="clearboth"></div>';
709 if (!empty(
$object->table_element_line)) {
714 print
' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">
715 <input type="hidden" name="token" value="' .
newToken().
'">
716 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
717 <input type="hidden" name="mode" value="">
718 <input type="hidden" name="page_y" value="">
719 <input type="hidden" name="id" value="' .
$object->id.
'">
727 print
'<div class="div-table-responsive-no-min">';
728 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
730 print
'<tr class="liste_titre">';
731 print
'<td class="liste_titre">'.$langs->trans(
"Summary").
'</td>';
735 print
'<tr class="oddeven">';
736 print
'<td>'.$langs->trans(
"ProductsToConsume").
'</td>';
740 foreach (
$object->lines as $line) {
741 if ($line->role ==
'toconsume') {
745 $tmpproduct =
new Product($db);
746 $tmpproduct->fetch($line->fk_product);
747 print $tmpproduct->getNomUrl(1);
755 print
'<tr class="oddeven">';
756 print
'<td>'.$langs->trans(
"ProductsToProduce").
'</td>';
760 foreach (
$object->lines as $line) {
761 if ($line->role ==
'toproduce') {
765 $tmpproduct =
new Product($db);
766 $tmpproduct->fetch($line->fk_product);
767 print $tmpproduct->getNomUrl(1);
785 if ($action !=
'presend' && $action !=
'editline') {
786 print
'<div class="tabsAction">'.
"\n";
787 $parameters = array();
788 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
793 if (empty($reshook)) {
800 if (
$object->status == $object::STATUS_VALIDATED) {
801 if ($permissiontoadd) {
803 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_setdraft&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"SetToDraft").
'</a>';
808 if (
$object->status == $object::STATUS_DRAFT) {
809 if ($permissiontoadd) {
810 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
812 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Modify').
'</a>'.
"\n";
817 if (
$object->status == $object::STATUS_DRAFT) {
818 if ($permissiontoadd) {
820 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>';
822 $langs->load(
"errors");
823 print
'<a class="butActionRefused" href="" title="'.$langs->trans(
"ErrorAddAtLeastOneLineFirst").
'">'.$langs->trans(
"Validate").
'</a>';
829 if ($permissiontoadd) {
830 print
dolGetButtonAction($langs->trans(
"ToClone"),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.(!empty(
$object->socid) ?
'&socid='.$object->socid :
"").
'&action=clone&token='.
newToken().
'&object=mo',
'clone', $permissiontoadd);
834 if ($permissiontoadd) {
835 if (
$object->status == $object::STATUS_VALIDATED ||
$object->status == $object::STATUS_INPROGRESS) {
836 $arrayproduced =
$object->fetchLinesLinked(
'produced', 0);
838 foreach ($arrayproduced as $lineproduced) {
839 $nbProduced += $lineproduced[
'qty'];
841 if ($nbProduced > 0) {
842 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_produced&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"Close").
'</a>'.
"\n";
844 print
'<a class="butActionRefused" href="#" title="'.$langs->trans(
"GoOnTabProductionToProduceFirst", $langs->transnoentitiesnoconv(
"Production")).
'">'.$langs->trans(
"Close").
'</a>'.
"\n";
847 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'">'.$langs->trans(
"Cancel").
'</a>'.
"\n";
850 if (
$object->status == $object::STATUS_PRODUCED ||
$object->status == $object::STATUS_CANCELED) {
851 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_reopen&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a>'.
"\n";
856 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete);
863 if (
GETPOST(
'modelselected')) {
867 if ($action !=
'presend') {
868 print
'<div class="fichecenter"><div class="fichehalfleft">';
869 print
'<a name="builddoc"></a>';
873 $relativepath = $objref.
'/'.$objref.
'.pdf';
874 $filedir =
$conf->mrp->dir_output.
'/'.$objref;
875 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
876 $genallowed = $user->hasRight(
'mrp',
'read');
877 $delallowed = $user->hasRight(
"mrp",
"creer");
878 print $formfile->showdocuments(
'mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $mysoc->default_lang,
'', $object);
881 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'mo'), 1);
882 $linktoelem = $tmparray[
'linktoelem'];
883 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
884 print $htmltoenteralink;
886 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, array());
889 print
'</div><div class="fichehalfright">';
893 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/mrp/mo_agenda.php?id='.
$object->id);
896 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
898 $somethingshown = $formactions->showactions($object,
$object->element, $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
900 print
'</div></div>';
904 if (
GETPOST(
'modelselected')) {
910 $defaulttopic =
'InformationMessage';
911 $diroutput =
$conf->mrp->dir_output;
912 $trackid =
'mo'.$object->id;
914 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.