dolibarr 25.0.0-alpha
mo_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
28// Load Dolibarr environment
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';
48
49if (isModEnabled('workstation')) {
50 require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
51}
52
53// Load translation files required by the page
54$langs->loadLangs(array('mrp', 'other'));
55
56
57// Get parameters
58$id = GETPOSTINT('id');
59$ref = GETPOST('ref', 'alpha');
60$action = GETPOST('action', 'aZ09');
61$confirm = GETPOST('confirm', 'alpha');
62$cancel = GETPOST('cancel');
63$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
64$backtopage = GETPOST('backtopage', 'alpha');
65$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
66$TBomLineId = GETPOST('bomlineid', 'array:int');
67$lineid = GETPOSTINT('lineid');
68$socid = GETPOSTINT("socid");
69
70// Initialize a technical objects
71$object = new Mo($db);
72$objectbom = new BOM($db);
73
74$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id;
75$hookmanager->initHooks(array('mocard', 'globalcard')); // Note that conf->hooks_modules contains array
76
77// Fetch optionals attributes and labels
78$extrafields->fetch_name_optionals_label($object->table_element);
79
80$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
81
82// Initialize array of search criteria
83$search_all = GETPOST("search_all", 'alpha');
84$search = array();
85foreach ($object->fields as $key => $val) {
86 if (GETPOST('search_'.$key, 'alpha')) {
87 $search[$key] = GETPOST('search_'.$key, 'alpha');
88 }
89}
90
91if (empty($action) && empty($id) && empty($ref)) {
92 $action = 'view';
93}
94
95// Load object
96include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
97
98if (GETPOSTINT('fk_bom') > 0) {
99 $objectbom->fetch(GETPOSTINT('fk_bom'));
100
101 if ($action != 'add') {
102 // We force calling parameters if we are not in the submit of creation of MO
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;
108 }
109}
110
111// Security check - Protection if external user
112//if ($user->socid > 0) accessforbidden();
113//if ($user->socid > 0) $socid = $user->socid;
114$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
115$result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft);
116
117// Permissions
118$permissionnote = $user->hasRight('mrp', 'write'); // Used by the include of actions_setnotes.inc.php
119$permissiondellink = $user->hasRight('mrp', 'write'); // Used by the include of actions_dellink.inc.php
120$permissiontoadd = $user->hasRight('mrp', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
121$permissiontodelete = $user->hasRight('mrp', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
122$upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
123
124
125/*
126 * Actions
127 */
128
129$parameters = array();
130$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
131if ($reshook < 0) {
132 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
133}
134
135if (empty($reshook)) {
136 $error = 0;
137
138 $backurlforlist = dol_buildpath('/mrp/mo_list.php', 1);
139
140 $object->oldQty = (float) $object->qty;
141
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;
146 } else {
147 $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__');
148 }
149 }
150 }
151 if ($cancel && !empty($backtopageforcancel)) {
152 $backtopage = $backtopageforcancel;
153 }
154 $triggermodname = 'MO_MODIFY'; // Name of trigger action code to execute when we modify record
155
156 // Create MO with Children
157 if ($action == 'add' && empty($id) && !empty($TBomLineId) && $permissiontoadd) {
158 $noback = 1;
159 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
160
161 $mo_parent = $object;
162
163 $moline = new MoLine($db);
164 $objectbomchildline = new BOMLine($db);
165
166 foreach ($TBomLineId as $id_bom_line) {
167 $object = new Mo($db); // modified by the actions_addupdatedelete.inc.php
168
169 $objectbomchildline->fetch((int) $id_bom_line);
170
171 // Find the consume line of the parent MO generated from this BOM line.
172 // The lookup must be scoped to the parent MO and use an exact match on origin_id/origin_type,
173 // otherwise the default 'origin_id LIKE %..%' filter can return an unrelated line (or none),
174 // which would let the child MO be created from the leftover parent POST data (duplicate MO).
175 $TMoLines = $moline->fetchAll('DESC', 'rowid', 1, 0, array('fk_mo' => $mo_parent->id, 'origin_id' => (int) $id_bom_line, 'origin_type' => 'bomline'));
176
177 if (empty($TMoLines)) {
178 continue;
179 }
180
181 foreach ($TMoLines as $tmpmoline) {
182 $_POST['fk_bom'] = $objectbomchildline->fk_bom_child;
183 $_POST['fk_parent_line'] = $tmpmoline->id;
184 $_POST['qty'] = $tmpmoline->qty;
185 $_POST['fk_product'] = $tmpmoline->fk_product;
186 }
187
188 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
189
190 $res = $object->add_object_linked('mo', $mo_parent->id);
191 }
192
193 header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $mo_parent->id), 1));
194 exit;
195 } elseif ($action == 'confirm_cancel' && $confirm == 'yes' && !empty($permissiontoadd)) {
196 $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);
197 $result = $object->cancel($user, 0, (bool) $also_cancel_consumed_and_produced_lines);
198 if ($result > 0) {
199 header("Location: " . dol_buildpath('/mrp/mo_card.php?id=' . $object->id, 1));
200 exit;
201 } else {
202 $action = '';
203 setEventMessages($object->error, $object->errors, 'errors');
204 }
205 } elseif ($action == 'confirm_delete' && $confirm == 'yes' && !empty($permissiontodelete)) {
206 $also_cancel_consumed_and_produced_lines = (GETPOST('alsoCancelConsumedAndProducedLines', 'alpha') ? 1 : 0);
207 $result = $object->delete($user, 0, (bool) $also_cancel_consumed_and_produced_lines);
208 if ($result > 0) {
209 header("Location: " . $backurlforlist);
210 exit;
211 } else {
212 $action = '';
213 setEventMessages($object->error, $object->errors, 'errors');
214 }
215 } elseif ($action == 'settags' && isModEnabled('category') && $permissiontoadd) {
216 $result = $object->setCategories(GETPOST('categories', 'array'));
217 if ($result < 0) {
218 setEventMessages($object->error, $object->errors, 'errors');
219 }
220 }
221
222 if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
223 if (!($object->id > 0)) {
224 dol_print_error(null, 'Error, object must be fetched before being deleted');
225 exit;
226 }
227
228 $error = 0;
229 $deleteChilds = GETPOST('deletechilds', 'aZ');
230
231 // Start the database transaction
232 $db->begin();
233
234 if ($deleteChilds === 'on') {
235 $TMoChildren = $object->getAllMoChilds();
236
237 foreach ($TMoChildren as $id => $childObject) {
238 if ($childObject->delete($user) == -1) {
239 $error++;
240 if (!empty($childObject->errors)) {
241 setEventMessages(null, $childObject->errors, 'errors');
242 } else {
243 setEventMessages($childObject->error, null, 'errors');
244 }
245 }
246 }
247 }
248
249 if (!$error) {
250 $result = $object->delete($user);
251
252 if ($result > 0) {
253 setEventMessages("RecordDeleted", null, 'mesgs');
254
255 if ($deleteChilds === 'on') {
256 setEventMessages("MoChildsDeleted", null, 'mesgs');
257 }
258
259 if (empty($noback)) {
260 header("Location: " . $backurlforlist);
261 exit;
262 }
263 } else {
264 $error++;
265 if (!empty($object->errors)) {
266 setEventMessages(null, $object->errors, 'errors');
267 } else {
268 setEventMessages($object->error, null, 'errors');
269 }
270 }
271 }
272
273 // Commit or rollback the database transaction based on whether there was an error
274 if ($error) {
275 $db->rollback();
276 } else {
277 $db->commit();
278 }
279 }
280
281
282 // Allow editing qty while MO is still in draft status.
283 // IMPORTANT: this handler MUST run BEFORE actions_addupdatedelete.inc.php,
284 // which has a generic 'set<key>' matcher that would intercept 'setqty' and
285 // call $object->fetch() + update() without setting $object->oldQty, so
286 // Mo::updateProduction() would skip the line scaling (its condition is
287 // !empty($this->oldQty)).
288 if ($action == 'setqty' && $permissiontoadd && $object->status == Mo::STATUS_DRAFT) {
289 $newqty = GETPOSTFLOAT('qty');
290 if ($newqty > 0) {
291 $object->oldQty = (float) $object->qty;
292 $object->qty = $newqty;
293 $res = $object->update($user);
294 if ($res > 0) {
295 // Enforce invariant: the 'toproduce' line for the MO's main product
296 // must equal the MO qty. Mo::updateProduction() scales by ratio
297 // (newQty/oldQty) which can drift if the line state was already
298 // inconsistent (e.g. legacy data from before this patch). Realign
299 // the main product line, leaving sub-products and frozen lines
300 // untouched.
301 $object->fetchLines();
302 foreach ($object->lines as $line) {
303 if ($line->role === 'toproduce'
304 && (int) $line->fk_product === (int) $object->fk_product
305 && empty($line->qty_frozen)
306 && (float) $line->qty != (float) $object->qty) {
307 $line->qty = (float) $object->qty;
308 $line->update($user);
309 }
310 }
311 setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
312 } else {
313 setEventMessages($object->error, $object->errors, 'errors');
314 }
315 } else {
316 setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Qty")), null, 'errors');
317 }
318 header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
319 exit;
320 }
321
322 // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
323 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
324
325 // Actions when linking object each other
326 include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
327
328 // Actions when printing a doc from card
329 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
330
331 // Action to build doc
332 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
333
334 if ($action == 'set_thirdparty' && $permissiontoadd) {
335 $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname);
336 }
337 if ($action == 'classin' && $permissiontoadd) {
338 $object->setProject(GETPOSTINT('projectid'));
339 }
340
341 // Actions to send emails
342 $triggersendname = 'MO_SENTBYMAIL';
343 $autocopy = 'MAIN_MAIL_AUTOCOPY_MO_TO';
344 $trackid = 'mo'.$object->id;
345 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
346
347 // Action to move up and down lines of object
348 //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
349
350 // Action close produced
351 if ($action == 'confirm_produced' && $confirm == 'yes' && $permissiontoadd) {
352 $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
353 if ($result >= 0) {
354 // Define output language
355 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
356 $outputlangs = $langs;
357 $newlang = '';
358 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
359 $newlang = GETPOST('lang_id', 'aZ09');
360 }
361 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
362 $newlang = $object->thirdparty->default_lang;
363 }
364 if (!empty($newlang)) {
365 $outputlangs = new Translate("", $conf);
366 $outputlangs->setDefaultLang($newlang);
367 }
368 $model = $object->model_pdf;
369 $ret = $object->fetch($id); // Reload to get new records
370
371 $object->generateDocument($model, $outputlangs, 0, 0, 0);
372 }
373 } else {
374 setEventMessages($object->error, $object->errors, 'errors');
375 }
376 }
377}
378
379
380
381
382/*
383 * View
384 */
385
386$form = new Form($db);
387$formfile = new FormFile($db);
388$formproject = new FormProjets($db);
389
390$title = $langs->trans('ManufacturingOrder')." - ".$langs->trans("Card");
391$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
392
393llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-mrp page-card');
394
395
396// Part to create
397if ($action == 'create') {
398 $titlelist = null;
399 if (GETPOSTINT('fk_bom') > 0) {
400 $titlelist = $langs->trans("ToConsume");
401 if ($objectbom->bomtype == 1) {
402 $titlelist = $langs->trans("ToObtain");
403 }
404 }
405
406 print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Mo")), '', 'mrp');
407
408 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
409 print '<input type="hidden" name="token" value="'.newToken().'">';
410 print '<input type="hidden" name="action" value="add">';
411 if ($backtopage) {
412 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
413 }
414 if ($backtopageforcancel) {
415 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
416 }
417
418 print dol_get_fiche_head(array(), '');
419
420 print '<table class="border centpercent tableforfieldcreate">'."\n";
421
422 // Common attributes
423 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
424
425 // Other attributes
426 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
427
428 if (isModEnabled('category')) {
429 // Categories
430 print '<tr><td>'.$langs->trans("Categories").'</td><td>';
431 print $form->selectCategories(Categorie::TYPE_MO, 'categories', $object);
432 print '</td></tr>';
433 }
434
435 print '</table>'."\n";
436
437 print dol_get_fiche_end();
438
440 <script>
441 $(document).ready(function () {
442 jQuery('#fk_bom').change(function() {
443 console.log('We change value of BOM with BOM of id '+jQuery('#fk_bom').val());
444 if (jQuery('#fk_bom').val() > 0)
445 {
446 // Redirect to page with fk_bom set
447 window.location.href = '<?php echo $_SERVER["PHP_SELF"] ?>?action=create&token=<?php echo newToken(); ?>&fk_bom='+jQuery('#fk_bom').val();
448 /*
449 $.getJSON('<?php echo DOL_URL_ROOT ?>/mrp/ajax/ajax_bom.php?action=getBoms&idbom='+jQuery('#fk_bom').val(), function(data) {
450 console.log(data);
451 if (typeof data.rowid != "undefined") {
452 console.log("New BOM loaded, we set values in form");
453 console.log(data);
454 $('#qty').val(data.qty);
455 $("#mrptype").val(data.bomtype); // We set bomtype into mrptype
456 $('#mrptype').trigger('change'); // Notify any JS components that the value changed
457 $("#fk_product").val(data.fk_product);
458 $('#fk_product').trigger('change'); // Notify any JS components that the value changed
459 $('#note_private').val(data.description);
460 $('#note_private').trigger('change'); // Notify any JS components that the value changed
461 $('#fk_warehouse').val(data.fk_warehouse);
462 $('#fk_warehouse').trigger('change'); // Notify any JS components that the value changed
463 if (typeof CKEDITOR != "undefined") {
464 if (typeof CKEDITOR.instances != "undefined") {
465 if (typeof CKEDITOR.instances.note_private != "undefined") {
466 console.log(CKEDITOR.instances.note_private);
467 CKEDITOR.instances.note_private.setData(data.description);
468 }
469 }
470 }
471 } else {
472 console.log("Failed to get BOM");
473 }
474 });*/
475 }
476 else if (jQuery('#fk_bom').val() < 0) {
477 // Redirect to page with all fields defined except fk_bom set
478 console.log(jQuery('#fk_product').val());
479 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();
480 /*
481 $('#qty').val('');
482 $("#fk_product").val('');
483 $('#fk_product').trigger('change'); // Notify any JS components that the value changed
484 $('#note_private').val('');
485 $('#note_private').trigger('change'); // Notify any JS components that the value changed
486 $('#fk_warehouse').val('');
487 $('#fk_warehouse').trigger('change'); // Notify any JS components that the value changed
488 */
489 }
490 });
491
492 //jQuery('#fk_bom').trigger('change');
493 })
494 </script>
495 <?php
496
497 print $form->buttonsSaveCancel("Create");
498
499 if ($objectbom->id > 0) {
500 print load_fiche_titre((string) $titlelist);
501
502 print '<!-- list of product/services to consume -->'."\n";
503 print '<div class="div-table-responsive-no-min">';
504 print '<table class="noborder centpercent">';
505
506 $arrayOfMoLines = array();
507 foreach ($objectbom->lines as $key => $val) {
508 $moLine = new MoLine($db);
509 $moLine->id = $objectbom->lines[$key]->id;
510 $moLine->position = $objectbom->lines[$key]->position;
511 $moLine->fk_product = $objectbom->lines[$key]->fk_product;
512 $moLine->fk_unit = $objectbom->lines[$key]->fk_unit;
513 $moLine->qty = $objectbom->lines[$key]->qty;
514 $moLine->qty_frozen = $objectbom->lines[$key]->qty_frozen;
515 $moLine->disable_stock_change = $objectbom->lines[$key]->disable_stock_change;
516 $moLine->fk_bom_child = $objectbom->lines[$key]->fk_bom_child;
517
518 $arrayOfMoLines[] = $moLine;
519 }
520 $object->lines = $arrayOfMoLines;
521 $object->mrptype = $objectbom->bomtype;
522 $object->bom = $objectbom;
523
524 $object->printOriginLinesList('', array());
525
526 print '</table>';
527 print '</div>';
528 }
529
530 print '</form>';
531}
532
533// Part to edit record
534if (($id || $ref) && $action == 'edit') {
535 print load_fiche_titre($langs->trans("ManufacturingOrder"), '', 'mrp');
536
537 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
538 print '<input type="hidden" name="token" value="'.newToken().'">';
539 print '<input type="hidden" name="action" value="update">';
540 print '<input type="hidden" name="id" value="'.$object->id.'">';
541 if ($backtopage) {
542 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
543 }
544 if ($backtopageforcancel) {
545 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
546 }
547
548 print dol_get_fiche_head();
549
550 $object->fields['fk_bom']['disabled'] = 1;
551
552 print '<table class="border centpercent tableforfieldedit">'."\n";
553
554 // Common attributes
555 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
556
557 // Other attributes
558 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
559
560 if (isModEnabled('category')) {
561 // Categories
562 print '<tr><td>'.$langs->trans("Categories").'</td><td>';
563 print $form->selectCategories(Categorie::TYPE_MO, 'categories', $object);
564 print '</td></tr>';
565 }
566
567 print '</table>';
568
569 print dol_get_fiche_end();
570
571 print $form->buttonsSaveCancel();
572
573 print '</form>';
574}
575
576// Part to show record
577if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
578 $res = $object->fetch_thirdparty();
579
580 $head = moPrepareHead($object);
581
582 print dol_get_fiche_head($head, 'card', $langs->trans("ManufacturingOrder"), -1, $object->picto);
583
584 $formconfirm = '';
585
586 // Confirmation to delete
587 if ($action == 'delete') {
588 $numberofmochilds = count($object->getAllMoChilds());
589
590 if ($numberofmochilds > 0) {
591 $label = $langs->trans("DeleteMoChild", '('.strval($numberofmochilds).')');
592 } else {
593 $label = $langs->trans("DeleteMoChild");
594 }
595
596 $formquestion = array(
597 array('type' => 'checkbox', 'name' => 'deletechilds', 'label' => $label, 'value' => 0),
598 array(
599 'label' => $langs->trans('MoCancelConsumedAndProducedLines'),
600 'name' => 'alsoCancelConsumedAndProducedLines',
601 'type' => 'checkbox',
602 'value' => !getDolGlobalString('MO_ALSO_CANCEL_CONSUMED_AND_PRODUCED_LINES_BY_DEFAULT') ? 0 : 1
603 )
604 );
605 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', $formquestion, 0, 1);
606 }
607 // Confirmation to delete line
608 if ($action == 'deleteline') {
609 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
610 }
611
612 // Reload BOM to consume and produce
613 if ($action == 'reload') {
614 $object->createProduction($user, 0);
615 }
616
617 // Confirmation of validation
618 if ($action == 'validate') {
619 // We check that object has a temporary ref
620 $ref = substr($object->ref, 1, 4);
621 if ($ref == 'PROV') {
622 $object->fetch_product();
623 $numref = $object->getNextNumRef($object->product);
624 } else {
625 $numref = (string) $object->ref;
626 }
627
628 $text = $langs->trans('ConfirmValidateMo', $numref);
629 /*if (isModEnabled('notification'))
630 {
631 require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
632 $notify = new Notify($db);
633 $text .= '<br>';
634 $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
635 }*/
636
637 $formquestion = array();
638 if (isModEnabled('mrp')) {
639 $langs->load("mrp");
640 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
641 $formproduct = new FormProduct($db);
642 $forcecombo = 0;
643 if ($conf->browser->name == 'ie') {
644 $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
645 }
646 $formquestion = array(
647 // 'text' => $langs->trans("ConfirmClone"),
648 // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
649 // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
650 );
651 }
652
653 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
654 }
655
656 // Confirmation to cancel
657 if ($action == 'cancel') {
658 $formquestion = array(
659 array(
660 'label' => $langs->trans('MoCancelConsumedAndProducedLines'),
661 'name' => 'alsoCancelConsumedAndProducedLines',
662 'type' => 'checkbox',
663 'value' => 0
664 ),
665 );
666 $formconfirm = $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id]), $langs->trans('CancelMo'), $langs->trans('ConfirmCancelMo'), 'confirm_cancel', $formquestion, 0, 1);
667 }
668
669 // Clone confirmation
670 if ($action == 'clone') {
671 // Create an array for form
672 $formquestion = array();
673 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
674 }
675
676 // Call Hook formConfirm
677 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
678 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
679 if (empty($reshook)) {
680 $formconfirm .= $hookmanager->resPrint;
681 } elseif ($reshook > 0) {
682 $formconfirm = $hookmanager->resPrint;
683 }
684
685 // Print form confirm
686 print $formconfirm;
687
688
689 // Object card
690 // ------------------------------------------------------------
691 $linkback = '<a href="'.dol_buildpath('/mrp/mo_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
692
693 $morehtmlref = '<div class="refidno">';
694 /*
695 // Ref bis
696 $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', 0, 1);
697 $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', null, null, '', 1);*/
698 // Thirdparty
699 if (is_object($object->thirdparty)) {
700 $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer');
701 if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
702 $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)';
703 }
704 }
705 // Project
706 if (isModEnabled('project')) {
707 $langs->load("projects");
708 if (is_object($object->thirdparty)) {
709 $morehtmlref .= '<br>';
710 }
711 if ($permissiontoadd) {
712 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
713 if ($action != 'classify') {
714 $morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
715 }
716 $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');
717 } else {
718 if (!empty($object->fk_project)) {
719 $proj = new Project($db);
720 $proj->fetch($object->fk_project);
721 $morehtmlref .= $proj->getNomUrl(1);
722 if ($proj->title) {
723 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
724 }
725 }
726 }
727 }
728 $morehtmlref .= '</div>';
729
730
731 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
732
733
734 print '<div class="fichecenter">';
735 print '<div class="fichehalfleft">';
736 print '<div class="underbanner clearboth"></div>';
737 print '<table class="border centpercent tableforfield">'."\n";
738
739 //Mo Parent
740 $mo_parent = $object->getMoParent();
741 if (is_object($mo_parent)) {
742 print '<tr class="field_fk_mo_parent">';
743 print '<td class="titlefield fieldname_fk_mo_parent">' . $langs->trans('ParentMo') . '</td>';
744 print '<td class="valuefield fieldname_fk_mo_parent">' .$mo_parent->getNomUrl(1).'</td>';
745 print '</tr>';
746 }
747
748 // Common attributes
749 $keyforbreak = 'fk_warehouse';
750 unset($object->fields['fk_project']);
751 unset($object->fields['fk_soc']);
752 // Allow inline edit of qty while MO is in draft status.
753 // Note: editfieldval() does not handle type 'real' (no <input> rendered, only
754 // Save/Cancel buttons appear). So we override the type to 'numeric' only when
755 // the user has actually clicked the edit pencil (action=editqty). This keeps
756 // the read-mode rendering (price() format) untouched.
757 if ($object->status == Mo::STATUS_DRAFT && $permissiontoadd && isset($object->fields['qty'])) {
758 $object->fields['qty']['alwayseditable'] = 1;
759 if ($action == 'editqty') {
760 $object->fields['qty']['type'] = 'numeric';
761 }
762 }
763
764 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
765
766 // Tags-Categories
767 if (isModEnabled('category')) {
768 print '<tr><td>';
769 print '<table class="nobordernopadding centpercent"><tr><td>';
770 print $langs->trans("Categories");
771 print '<td><td class="right">';
772 if ($permissiontoadd) {
773 print '<a class="editfielda" href="' . DOL_URL_ROOT . '/mrp/mo_card.php?id=' . $object->id . '&action=edittags&token=' . newToken() . '">' . img_edit() . '</a>';
774 } else {
775 print '&nbsp;';
776 }
777 print '</td></tr></table>';
778 print '</td>';
779 print '<td>';
780 if ($action == 'edittags') {
781 print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
782 print '<input type="hidden" name="action" value="settags">';
783 print '<input type="hidden" name="token" value="' . newToken() . '">';
784 print $form->selectCategories(Categorie::TYPE_MO, 'categories', $object);
785 print '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
786 print '</form>';
787 } else {
788 print $form->showCategories($object->id, Categorie::TYPE_MO, 1);
789 }
790 print "</td></tr>";
791 }
792
793 // Other attributes
794 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
795
796 print '</table>';
797 print '</div>';
798 print '</div>';
799
800 print '<div class="clearboth"></div>';
801
802 print dol_get_fiche_end();
803
804
805 /*
806 * Lines
807 */
808
809 if (!empty($object->table_element_line)) {
810 // Show object lines
811 //$result = $object->getLinesArray();
812 $object->fetchLines();
813
814 print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOSTINT('lineid')).'" method="POST">
815 <input type="hidden" name="token" value="' . newToken().'">
816 <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
817 <input type="hidden" name="mode" value="">
818 <input type="hidden" name="page_y" value="">
819 <input type="hidden" name="id" value="' . $object->id.'">
820 ';
821
822 /*if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
823 include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
824 }*/
825
826 if (!empty($object->lines)) {
827 print '<div class="div-table-responsive-no-min">';
828 print '<table id="tablelines" class="noborder noshadow" width="100%">';
829
830 print '<tr class="liste_titre">';
831 print '<td class="liste_titre">'.$langs->trans("Summary").'</td>';
832 print '<td></td>';
833 print '</tr>';
834
835 print '<tr class="oddeven">';
836 print '<td>'.$langs->trans("ProductsToConsume").'</td>';
837 print '<td>';
838 if (!empty($object->lines)) {
839 $i = 0;
840 foreach ($object->lines as $line) {
841 if ($line->role == 'toconsume') {
842 if ($i) {
843 print ', ';
844 }
845 $tmpproduct = new Product($db);
846 $tmpproduct->fetch($line->fk_product);
847 print $tmpproduct->getNomUrl(1);
848 $i++;
849 }
850 }
851 }
852 print '</td>';
853 print '</tr>';
854
855 print '<tr class="oddeven">';
856 print '<td>'.$langs->trans("ProductsToProduce").'</td>';
857 print '<td>';
858 if (!empty($object->lines)) {
859 $i = 0;
860 foreach ($object->lines as $line) {
861 if ($line->role == 'toproduce') {
862 if ($i) {
863 print ', ';
864 }
865 $tmpproduct = new Product($db);
866 $tmpproduct->fetch($line->fk_product);
867 print $tmpproduct->getNomUrl(1);
868 $i++;
869 }
870 }
871 }
872 print '</td>';
873 print '</tr>';
874
875 print '</table>';
876 print '</div>';
877 }
878
879 print "</form>\n";
880 }
881
882
883 // Buttons for actions
884
885 if ($action != 'presend' && $action != 'editline') {
886 print '<div class="tabsAction">'."\n";
887 $parameters = array();
888 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
889 if ($reshook < 0) {
890 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
891 }
892
893 if (empty($reshook)) {
894 // Send
895 //if (empty($user->socid)) {
896 // print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
897 //}
898
899 // Back to draft
900 if ($object->status == $object::STATUS_VALIDATED) {
901 if ($permissiontoadd) {
902 // TODO Add test that production has not started
903 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>';
904 }
905 }
906
907 // Modify
908 if ($object->status == $object::STATUS_DRAFT) {
909 if ($permissiontoadd) {
910 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
911 } else {
912 print '<a class="butActionRefused classfortooltip" href="#" title="'.dolPrintHTMLForAttribute($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
913 }
914 }
915
916 // Reload BOM
917 if ($object->status == $object::STATUS_DRAFT && $object->fk_bom > 0) {
918 if ($permissiontoadd) {
919 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reload&token='.newToken().'" title="'.dolPrintHTMLForAttribute($langs->trans("ReInitializeHelp")).'">'.$langs->trans("ReInitialize").'</a>';
920 } else {
921 print '<a class="butActionRefused classfortooltip" href="#" title="'.dolPrintHTMLForAttribute($langs->trans("ReInitializeHelp").'<br>'.$langs->trans("NotEnoughPermissions")).'">'.$langs->trans('ReInitialize').'</a>'."\n";
922 }
923 }
924
925 // Validate
926 if ($object->status == $object::STATUS_DRAFT) {
927 if ($permissiontoadd) {
928 if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
929 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans("Validate").'</a>';
930 } else {
931 $langs->load("errors");
932 print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
933 }
934 }
935 }
936
937 // Clone
938 if ($permissiontoadd) {
939 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);
940 }
941
942 // Cancel - Reopen
943 if ($permissiontoadd) {
944 if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS) {
945 $arrayproduced = $object->fetchLinesLinked('produced', 0);
946 $nbProduced = 0;
947 foreach ($arrayproduced as $lineproduced) {
948 $nbProduced += $lineproduced['qty'];
949 }
950 if ($nbProduced > 0) { // If production has started, we can close it
951 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_produced&confirm=yes&token='.newToken().'">'.$langs->trans("Close").'</a>'."\n";
952 } else {
953 print '<a class="butActionRefused" href="#" title="'.$langs->trans("GoOnTabProductionToProduceFirst", $langs->transnoentitiesnoconv("Production")).'">'.$langs->trans("Close").'</a>'."\n";
954 }
955
956 print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
957 }
958
959 if ($object->status == $object::STATUS_PRODUCED || $object->status == $object::STATUS_CANCELED) {
960 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("ReOpen").'</a>'."\n";
961 }
962 }
963
964 // Delete
965 print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
966 }
967 print '</div>'."\n";
968 }
969
970
971 // Select mail models is same action as presend
972 if (GETPOST('modelselected')) {
973 $action = 'presend';
974 }
975
976 if ($action != 'presend') {
977 print '<div class="fichecenter"><div class="fichehalfleft">';
978 print '<a name="builddoc"></a>'; // ancre
979
980 // Documents
981 $objref = dol_sanitizeFileName($object->ref);
982 $relativepath = $objref.'/'.$objref.'.pdf';
983 $filedir = $conf->mrp->dir_output.'/'.$objref;
984 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
985 $genallowed = $user->hasRight('mrp', 'read'); // If you can read, you can build the PDF to read content
986 $delallowed = $user->hasRight("mrp", "creer"); // If you can create/edit, you can remove a file on card
987 print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang, '', $object);
988
989 // Show links to link elements
990 $tmparray = $form->showLinkToObjectBlock($object, array(), array('mo'), 1);
991 $linktoelem = $tmparray['linktoelem'];
992 $htmltoenteralink = $tmparray['htmltoenteralink'];
993 print $htmltoenteralink;
994
995 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, array());
996
997
998 print '</div><div class="fichehalfright">';
999
1000 $MAXEVENT = 10;
1001
1002 $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/mrp/mo_agenda.php?id='.$object->id);
1003
1004 // List of actions on element
1005 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
1006 $formactions = new FormActions($db);
1007 $somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT, '', $morehtmlcenter);
1008
1009 print '</div></div>';
1010 }
1011
1012 //Select mail models is same action as presend
1013 if (GETPOST('modelselected')) {
1014 $action = 'presend';
1015 }
1016
1017 // Presend form
1018 $modelmail = 'mo';
1019 $defaulttopic = 'InformationMessage';
1020 $diroutput = $conf->mrp->dir_output;
1021 $trackid = 'mo'.$object->id;
1022
1023 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
1024}
1025
1026// End of page
1027llxFooter();
1028$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
mrpCollapseBomManagement()
Manage collapse bom display.
Definition bom.lib.php:164
Class for BOM.
Definition bom.class.php:42
Class for BOMLine.
Class to manage building of HTML components.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage building of HTML components.
Class for Mo.
Definition mo.class.php:35
Class MoLine.
Class to manage products or services.
Class to manage projects.
Class to manage translations.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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)
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.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.