37 $extrafields->fetch_name_optionals_label(
'bom_bom');
38 $extrafields->fetch_name_optionals_label(
'bom_bomline');
45 $head[$h][0] = DOL_URL_ROOT.
"/admin/bom.php";
46 $head[$h][1] = $langs->trans(
"Settings");
47 $head[$h][2] =
'settings';
50 $head[$h][0] = DOL_URL_ROOT.
"/admin/bom_extrafields.php";
51 $head[$h][1] = $langs->trans(
"ExtraFields");
52 $nbExtrafields = (isset($extrafields->attributes[
'bom_bom'][
'label']) && is_countable($extrafields->attributes[
'bom_bom'][
'label'])) ? count($extrafields->attributes[
'bom_bom'][
'label']) : 0;
53 if ($nbExtrafields > 0) {
54 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbExtrafields .
'</span>';
56 $head[$h][2] =
'bom_extrafields';
59 $head[$h][0] = DOL_URL_ROOT.
"/admin/bomline_extrafields.php";
60 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
61 $nbExtrafields = (isset($extrafields->attributes[
'bom_bomline'][
'label']) && is_countable($extrafields->attributes[
'bom_bomline'][
'label'])) ? count($extrafields->attributes[
'bom_bomline'][
'label']) : 0;
62 if ($nbExtrafields > 0) {
63 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbExtrafields .
'</span>';
65 $head[$h][2] =
'bomline_extrafields';
94 global $db, $langs,
$conf;
101 $head[$h][0] = DOL_URL_ROOT.
"/bom/bom_card.php?id=".
$object->id;
102 $head[$h][1] = $langs->trans(
"BOM");
103 $head[$h][2] =
'card';
106 $head[$h][0] = DOL_URL_ROOT.
"/bom/bom_net_needs.php?id=".
$object->id;
107 $head[$h][1] = $langs->trans(
"BOMNetNeeds");
108 $head[$h][2] =
'net_needs';
111 if (isset(
$object->fields[
'note_public']) || isset(
$object->fields[
'note_private'])) {
113 if (!empty(
$object->note_private)) {
116 if (!empty(
$object->note_public)) {
119 $head[$h][0] = DOL_URL_ROOT.
'/bom/bom_note.php?id='.
$object->id;
120 $head[$h][1] = $langs->trans(
'Notes');
122 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>' :
'');
124 $head[$h][2] =
'note';
128 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
129 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
131 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
133 $head[$h][0] = DOL_URL_ROOT.
'/bom/bom_document.php?id='.
$object->id;
134 $head[$h][1] = $langs->trans(
'Documents');
135 if (($nbFiles + $nbLinks) > 0) {
136 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>' :
'');
138 $head[$h][2] =
'document';
141 $head[$h][0] = DOL_URL_ROOT.
'/bom/bom_agenda.php?id='.
$object->id;
142 $head[$h][1] = $langs->trans(
"Events");
143 $head[$h][2] =
'agenda';
170 <script
type=
"text/javascript" language=
"javascript">
172 $(document).ready(
function () {
173 function folderManage(element, onClose = 0) {
174 let id_bom_line = element.attr(
'id').replace(
'collapse-',
'');
175 let TSubLines = $(
'[parentid="'+ id_bom_line +
'"]');
177 if(element.html().indexOf(
'folder-open') <= 0 && onClose < 1) {
178 $(
'[parentid="'+ id_bom_line +
'"]').show();
179 element.html(
'<?php echo dol_escape_js(img_picto('', 'folder-open
')); ?>');
182 for (let i = 0; i < TSubLines.length; i++) {
183 let subBomFolder = $(TSubLines[i]).children(
'.linecoldescription').children(
'.collapse_bom');
185 if (subBomFolder.length > 0) {
187 folderManage(subBomFolder, onClose);
191 element.html(
'<?php echo dol_escape_js(img_picto('', 'folder
')); ?>');
196 $(
".collapse_bom").click(
function() {
197 folderManage($(
this));
202 $(
"#show_all").click(
function() {
203 console.log(
"We click on show all");
204 $(
"[class^=sub_bom_lines]").show();
205 $(
"[class^=collapse_bom]").html(
'<?php echo dol_escape_js(img_picto('', 'folder-open
')); ?>');
210 $(
"#hide_all").click(
function() {
211 console.log(
"We click on hide all");
212 $(
"[class^=sub_bom_lines]").hide();
213 $(
"[class^=collapse_bom]").html(
'<?php echo dol_escape_js(img_picto('', 'folder
')); ?>');
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type