32 global $langs, $conf, $db;
35 $extrafields->fetch_name_optionals_label(
'asset');
36 $extrafields->fetch_name_optionals_label(
'asset_model');
38 $langs->load(
"assets");
43 $head[$h][0] = DOL_URL_ROOT.
'/asset/admin/setup.php';
44 $head[$h][1] = $langs->trans(
"Settings");
45 $head[$h][2] =
'settings';
58 $head[$h][0] = DOL_URL_ROOT.
'/asset/admin/asset_extrafields.php';
59 $head[$h][1] = $langs->trans(
"ExtraFields");
60 $nbExtrafields = $extrafields->attributes[
'asset'][
'count'];
61 if ($nbExtrafields > 0) {
62 $head[$h][1] .=
' <span class="badge">'.$nbExtrafields.
'</span>';
64 $head[$h][2] =
'asset_extrafields';
67 $head[$h][0] = DOL_URL_ROOT.
'/asset/admin/assetmodel_extrafields.php';
68 $head[$h][1] = $langs->trans(
"ExtraFieldsAssetModel");
69 $nbExtrafields = $extrafields->attributes[
'asset_model'][
'count'];
70 if ($nbExtrafields > 0) {
71 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
73 $head[$h][2] =
'assetmodel_extrafields';
89 global $db, $langs, $conf;
91 $langs->load(
"assets",
"admin");
96 $head[$h][0] = DOL_URL_ROOT .
'/asset/card.php?id=' . $object->id;
97 $head[$h][1] = $langs->trans(
"Card");
98 $head[$h][2] =
'card';
101 if (empty($object->not_depreciated)) {
102 $head[$h][0] = DOL_URL_ROOT .
'/asset/depreciation_options.php?id=' . $object->id;
103 $head[$h][1] = $langs->trans(
"AssetDepreciationOptions");
104 $head[$h][2] =
'depreciation_options';
108 $head[$h][0] = DOL_URL_ROOT .
'/asset/accountancy_codes.php?id=' . $object->id;
109 $head[$h][1] = $langs->trans(
"AssetAccountancyCodes");
110 $head[$h][2] =
'accountancy_codes';
113 if (empty($object->not_depreciated)) {
114 $head[$h][0] = DOL_URL_ROOT .
'/asset/depreciation.php?id=' . $object->id;
115 $head[$h][1] = $langs->trans(
"AssetDepreciation");
116 $head[$h][2] =
'depreciation';
120 if (isset($object->disposal_date) && $object->disposal_date !==
"") {
121 $head[$h][0] = DOL_URL_ROOT .
'/asset/disposal.php?id=' . $object->id;
122 $head[$h][1] = $langs->trans(
"AssetDisposal");
123 $head[$h][2] =
'disposal';
127 if (isset($object->fields[
'note_public']) || isset($object->fields[
'note_private'])) {
129 if (!empty($object->note_private)) {
132 if (!empty($object->note_public)) {
135 $head[$h][0] = DOL_URL_ROOT .
'/asset/note.php?id=' . $object->id;
136 $head[$h][1] = $langs->trans(
'Notes');
138 $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>' :
'');
140 $head[$h][2] =
'note';
144 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
145 require_once DOL_DOCUMENT_ROOT .
'/core/class/link.class.php';
147 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
148 $nbLinks =
Link::count($db, $object->element, $object->id);
149 $head[$h][0] = DOL_URL_ROOT .
'/asset/document.php?id=' . $object->id;
150 $head[$h][1] = $langs->trans(
'Documents');
151 if (($nbFiles + $nbLinks) > 0) {
152 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) .
'</span>';
154 $head[$h][2] =
'document';
157 $head[$h][0] = DOL_URL_ROOT .
'/asset/agenda.php?id=' . $object->id;
158 $head[$h][1] = $langs->trans(
"Events");
159 $head[$h][2] =
'agenda';
185 global $langs, $conf;
187 $langs->load(
"assets",
"admin");
192 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/card.php?id=' . $object->id;
193 $head[$h][1] = $langs->trans(
"Card");
194 $head[$h][2] =
'card';
197 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/depreciation_options.php?id=' . $object->id;
198 $head[$h][1] = $langs->trans(
"AssetDepreciationOptions");
199 $head[$h][2] =
'depreciation_options';
202 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/accountancy_codes.php?id=' . $object->id;
203 $head[$h][1] = $langs->trans(
"AssetAccountancyCodes");
204 $head[$h][2] =
'accountancy_codes';
207 if (isset($object->fields[
'note_public']) || isset($object->fields[
'note_private'])) {
209 if (!empty($object->note_private)) {
212 if (!empty($object->note_public)) {
215 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/note.php?id=' . $object->id;
216 $head[$h][1] = $langs->trans(
'Notes');
218 $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>' :
'');
220 $head[$h][2] =
'note';
224 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/agenda.php?id=' . $object->id;
225 $head[$h][1] = $langs->trans(
"Events");
226 $head[$h][2] =
'agenda';
dol_dir_list($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).