33 global $langs,
$conf, $extrafields;
35 $extrafields->fetch_name_optionals_label(
'bom_bom');
36 $extrafields->fetch_name_optionals_label(
'bom_bomline');
43 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/bom.php");
44 $head[$h][1] = $langs->trans(
"Settings");
45 $head[$h][2] =
'settings';
48 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/bom_extrafields.php");
49 $head[$h][1] = $langs->trans(
"ExtraFields");
50 $nbExtrafields = (isset($extrafields->attributes[
'bom_bom'][
'label']) && is_countable($extrafields->attributes[
'bom_bom'][
'label'])) ? count($extrafields->attributes[
'bom_bom'][
'label']) : 0;
51 if ($nbExtrafields > 0) {
52 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbExtrafields .
'</span>';
54 $head[$h][2] =
'bom_extrafields';
57 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/admin/bomline_extrafields.php");
58 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
59 $nbExtrafields = (isset($extrafields->attributes[
'bom_bomline'][
'label']) && is_countable($extrafields->attributes[
'bom_bomline'][
'label'])) ? count($extrafields->attributes[
'bom_bomline'][
'label']) : 0;
60 if ($nbExtrafields > 0) {
61 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbExtrafields .
'</span>';
63 $head[$h][2] =
'bomline_extrafields';
100 $head[$h][1] = $langs->trans(
"BOM");
101 $head[$h][2] =
'card';
104 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/bom/bom_net_needs.php', [
'id' =>
$object->id]);
105 $head[$h][1] = $langs->trans(
"BOMNetNeeds");
106 $head[$h][2] =
'net_needs';
109 if (isset(
$object->fields[
'note_public']) || isset(
$object->fields[
'note_private'])) {
111 if (!empty(
$object->note_private)) {
114 if (!empty(
$object->note_public)) {
118 $head[$h][1] = $langs->trans(
'Notes');
120 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>' :
'');
122 $head[$h][2] =
'note';
126 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
127 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
129 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
131 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/bom/bom_document.php', [
'id' =>
$object->id]);
132 $head[$h][1] = $langs->trans(
'Documents');
133 if (($nbFiles + $nbLinks) > 0) {
134 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>' :
'');
136 $head[$h][2] =
'document';
139 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/bom/bom_agenda.php', [
'id' =>
$object->id]);
140 $head[$h][1] = $langs->trans(
"Events");
141 $head[$h][2] =
'agenda';
168 <script
type=
"text/javascript" language=
"javascript">
170 $(document).ready(
function () {
171 function folderManage(element, onClose = 0) {
172 let id_bom_line = element.attr(
'id').replace(
'collapse-',
'');
173 let TSubLines = $(
'[parentid="'+ id_bom_line +
'"]');
175 if(element.html().indexOf(
'folder-open') <= 0 && onClose < 1) {
176 $(
'[parentid="'+ id_bom_line +
'"]').show();
177 element.html(
'<?php echo dol_escape_js(img_picto('', 'folder-open
')); ?>');
180 for (let i = 0; i < TSubLines.length; i++) {
181 let subBomFolder = $(TSubLines[i]).children(
'.linecoldescription').children(
'.collapse_bom');
183 if (subBomFolder.length > 0) {
185 folderManage(subBomFolder, onClose);
189 element.html(
'<?php echo dol_escape_js(img_picto('', 'folder
')); ?>');
194 $(
".collapse_bom").click(
function() {
195 folderManage($(
this));
200 $(
"#show_all").click(
function() {
201 console.log(
"We click on show all");
202 $(
"[class^=sub_bom_lines]").show();
203 $(
"[class^=collapse_bom]").html(
'<?php echo dol_escape_js(img_picto('', 'folder-open
')); ?>');
208 $(
"#hide_all").click(
function() {
209 console.log(
"We click on hide all");
210 $(
"[class^=sub_bom_lines]").hide();
211 $(
"[class^=collapse_bom]").html(
'<?php echo dol_escape_js(img_picto('', 'folder
')); ?>');
if(! $sortfield) if(! $sortorder) $object
mrpCollapseBomManagement()
Manage collapse bom display.
bomAdminPrepareHead()
Prepare admin pages header.
bomPrepareHead($object)
Prepare array of tabs for BillOfMaterials.
static count($dbs, $objecttype, $objectid)
Return nb of links.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...