39 global $db, $langs, $conf, $user;
40 $langs->load(
"interventions");
45 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/card.php?id='.
$object->id;
46 $head[$h][1] = $langs->trans(
"Intervention");
47 $head[$h][2] =
'card';
51 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
52 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/contact.php?id='.
$object->id;
53 $head[$h][1] = $langs->trans(
'InterventionContact');
55 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
57 $head[$h][2] =
'contact';
68 if (isModEnabled(
'resource')) {
69 require_once DOL_DOCUMENT_ROOT.
'/resource/class/dolresource.class.php';
71 $linked_resources = $objectres->getElementResources(
'fichinter',
$object->id);
72 $nbResource = (is_array($linked_resources) ? count($linked_resources) : 0);
85 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=fichinter&element_id='.
$object->id;
86 $head[$h][1] = $langs->trans(
"Resources");
87 if ($nbResource > 0) {
88 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbResource.
'</span>';
90 $head[$h][2] =
'resource';
96 if (!empty(
$object->note_private)) {
99 if (!empty(
$object->note_public)) {
102 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/note.php?id='.
$object->id;
103 $head[$h][1] = $langs->trans(
'Notes');
105 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
107 $head[$h][2] =
'note';
111 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
112 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
114 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
116 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/document.php?id='.
$object->id;
117 $head[$h][1] = $langs->trans(
"Documents");
118 if (($nbFiles + $nbLinks) > 0) {
119 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
121 $head[$h][2] =
'documents';
124 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/agenda.php?id='.
$object->id;
125 $head[$h][1] = $langs->trans(
'Events');
126 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
129 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
130 $cachekey =
'count_events_fichinter_'.$object->id;
132 if (!is_null($dataretrieved)) {
133 $nbEvent = $dataretrieved;
135 $sql =
"SELECT COUNT(id) as nb";
136 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
137 $sql .=
" WHERE fk_element = ".((int)
$object->id);
138 $sql .=
" AND elementtype = 'fichinter'";
139 $resql = $db->query($sql);
141 $obj = $db->fetch_object($resql);
144 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
150 $head[$h][1] .= $langs->trans(
"Agenda");
152 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
155 $head[$h][2] =
'agenda';
172 global $langs, $conf, $user, $db;
175 $extrafields->fetch_name_optionals_label(
'fichinter');
176 $extrafields->fetch_name_optionals_label(
'fichinterdet');
182 $head[$h][0] = DOL_URL_ROOT.
"/admin/fichinter.php";
183 $head[$h][1] = $langs->trans(
"Interventions");
184 $head[$h][2] =
'ficheinter';
187 $head[$h][0] = DOL_URL_ROOT.
"/admin/fichinter_xcal.php";
188 $head[$h][1] = $langs->trans(
"ExportCal");
189 $head[$h][2] =
'xcal';
198 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/admin/fichinter_extrafields.php';
199 $head[$h][1] = $langs->trans(
"ExtraFields");
200 $nbExtrafields = $extrafields->attributes[
'fichinter'][
'count'];
201 if ($nbExtrafields > 0) {
202 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
204 $head[$h][2] =
'attributes';
207 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/admin/fichinterdet_extrafields.php';
208 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
209 $nbExtrafields = $extrafields->attributes[
'fichinterdet'][
'count'];
210 if ($nbExtrafields > 0) {
211 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
213 $head[$h][2] =
'attributesdet';
229 global $langs, $conf;
234 $head[$h][0] = DOL_URL_ROOT.
'/fichinter/card-rec.php?id='.
$object->id;
235 $head[$h][1] = $langs->trans(
"CardFichinter");
236 $head[$h][2] =
'card';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
static count($dbs, $objecttype, $objectid)
Return nb of links.
fichinter_admin_prepare_head()
Return array head with list of tabs to view object information.
fichinter_rec_prepare_head($object)
Prepare array with list of tabs.
fichinter_prepare_head($object)
Prepare array with list of tabs.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_setcache($memoryid, $data, $expire=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.