33 global $langs,
$conf, $db;
36 $extrafields->fetch_name_optionals_label(
'asset');
37 $extrafields->fetch_name_optionals_label(
'asset_model');
39 $langs->load(
"assets");
44 $head[$h][0] = DOL_URL_ROOT.
'/asset/admin/setup.php';
45 $head[$h][1] = $langs->trans(
"Settings");
46 $head[$h][2] =
'settings';
59 $head[$h][0] = DOL_URL_ROOT.
'/asset/admin/asset_extrafields.php';
60 $head[$h][1] = $langs->trans(
"ExtraFields");
61 $nbExtrafields = $extrafields->attributes[
'asset'][
'count'];
62 if ($nbExtrafields > 0) {
63 $head[$h][1] .=
' <span class="badge">'.$nbExtrafields.
'</span>';
65 $head[$h][2] =
'asset_extrafields';
68 $head[$h][0] = DOL_URL_ROOT.
'/asset/admin/assetmodel_extrafields.php';
69 $head[$h][1] = $langs->trans(
"ExtraFieldsAssetModel");
70 $nbExtrafields = $extrafields->attributes[
'asset_model'][
'count'];
71 if ($nbExtrafields > 0) {
72 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
74 $head[$h][2] =
'assetmodel_extrafields';
90 global $db, $langs,
$conf;
92 $langs->loadLangs(array(
"assets",
"admin"));
97 $head[$h][0] = DOL_URL_ROOT .
'/asset/card.php?id=' .
$object->id;
98 $head[$h][1] = $langs->trans(
"Card");
99 $head[$h][2] =
'card';
102 if (empty(
$object->not_depreciated)) {
103 $head[$h][0] = DOL_URL_ROOT .
'/asset/depreciation_options.php?id=' .
$object->id;
104 $head[$h][1] = $langs->trans(
"AssetDepreciationOptions");
105 $head[$h][2] =
'depreciation_options';
109 $head[$h][0] = DOL_URL_ROOT .
'/asset/accountancy_codes.php?id=' .
$object->id;
110 $head[$h][1] = $langs->trans(
"AssetAccountancyCodes");
111 $head[$h][2] =
'accountancy_codes';
114 if (empty(
$object->not_depreciated)) {
115 $head[$h][0] = DOL_URL_ROOT .
'/asset/depreciation.php?id=' .
$object->id;
116 $head[$h][1] = $langs->trans(
"AssetDepreciation");
117 $head[$h][2] =
'depreciation';
121 if (isset(
$object->disposal_date) &&
$object->disposal_date !==
"") {
122 $head[$h][0] = DOL_URL_ROOT .
'/asset/disposal.php?id=' .
$object->id;
123 $head[$h][1] = $langs->trans(
"AssetDisposal");
124 $head[$h][2] =
'disposal';
128 if (isset(
$object->fields[
'note_public']) || isset(
$object->fields[
'note_private'])) {
130 if (!empty(
$object->note_private)) {
133 if (!empty(
$object->note_public)) {
136 $head[$h][0] = DOL_URL_ROOT .
'/asset/note.php?id=' .
$object->id;
137 $head[$h][1] = $langs->trans(
'Notes');
139 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>' :
'');
141 $head[$h][2] =
'note';
145 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
146 require_once DOL_DOCUMENT_ROOT .
'/core/class/link.class.php';
148 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
150 $head[$h][0] = DOL_URL_ROOT .
'/asset/document.php?id=' .
$object->id;
151 $head[$h][1] = $langs->trans(
'Documents');
152 if (($nbFiles + $nbLinks) > 0) {
153 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) .
'</span>';
155 $head[$h][2] =
'document';
158 $head[$h][0] = DOL_URL_ROOT .
'/asset/agenda.php?id=' .
$object->id;
159 $head[$h][1] = $langs->trans(
"Events");
160 $head[$h][2] =
'agenda';
186 global $langs,
$conf;
188 $langs->loadLangs(array(
"assets",
"admin"));
193 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/card.php?id=' .
$object->id;
194 $head[$h][1] = $langs->trans(
"Card");
195 $head[$h][2] =
'card';
198 if (isset(
$object->fields[
'note_public']) || isset(
$object->fields[
'note_private'])) {
200 if (!empty(
$object->note_private)) {
203 if (!empty(
$object->note_public)) {
206 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/note.php?id=' .
$object->id;
207 $head[$h][1] = $langs->trans(
'Notes');
209 $head[$h][1] .= (!
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER') ?
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>' :
'');
211 $head[$h][2] =
'note';
215 $head[$h][0] = DOL_URL_ROOT .
'/asset/model/agenda.php?id=' .
$object->id;
216 $head[$h][1] = $langs->trans(
"Events");
217 $head[$h][2] =
'agenda';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
assetAdminPrepareHead()
Prepare admin pages header.
assetPrepareHead(Asset $object)
Prepare array of tabs for Asset.
assetModelPrepareHead($object)
Prepare array of tabs for AssetModel.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...