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