33 global $db, $langs, $conf, $user;
38 $head[$h][0] = DOL_URL_ROOT.
'/contrat/card.php?id='.$object->id;
39 $head[$h][1] = $langs->trans(
"ContractCard");
40 $head[$h][2] =
'card';
43 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
44 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
45 $head[$h][0] = DOL_URL_ROOT.
'/contrat/contact.php?id='.$object->id;
46 $head[$h][1] = $langs->trans(
"ContactsAddresses");
48 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
50 $head[$h][2] =
'contact';
60 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
62 if (!empty($object->note_private)) {
65 if (!empty($object->note_public)) {
68 $head[$h][0] = DOL_URL_ROOT.
'/contrat/note.php?id='.$object->id;
69 $head[$h][1] = $langs->trans(
"Notes");
71 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
73 $head[$h][2] =
'note';
77 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
78 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
79 $upload_dir = $conf->contrat->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
80 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
81 $nbLinks =
Link::count($db, $object->element, $object->id);
82 $head[$h][0] = DOL_URL_ROOT.
'/contrat/document.php?id='.$object->id;
83 $head[$h][1] = $langs->trans(
"Documents");
84 if (($nbFiles + $nbLinks) > 0) {
85 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
87 $head[$h][2] =
'documents';
91 $head[$h][0] = DOL_URL_ROOT.
'/contrat/agenda.php?id='.$object->id;
92 $head[$h][1] = $langs->trans(
"Events");
93 if (isModEnabled(
'agenda')&& ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
96 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
97 $cachekey =
'count_events_contract_'.$object->id;
99 if (!is_null($dataretrieved)) {
100 $nbEvent = $dataretrieved;
102 $sql =
"SELECT COUNT(id) as nb";
103 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
104 $sql .=
" WHERE fk_element = ".((int) $object->id);
105 $sql .=
" AND elementtype = 'contract'";
106 $resql = $db->query($sql);
108 $obj = $db->fetch_object($resql);
111 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
117 $head[$h][1] .= $langs->trans(
"Agenda");
119 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
122 $head[$h][2] =
'agenda';
139 global $langs, $conf, $db;
142 $extrafields->fetch_name_optionals_label(
'contrat');
143 $extrafields->fetch_name_optionals_label(
'contratdet');
148 $head[$h][0] = DOL_URL_ROOT.
"/admin/contract.php";
149 $head[$h][1] = $langs->trans(
"Contracts");
150 $head[$h][2] =
'contract';
159 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contract_extrafields.php';
160 $head[$h][1] = $langs->trans(
"ExtraFields");
161 $nbExtrafields = $extrafields->attributes[
'contrat'][
'count'];
162 if ($nbExtrafields > 0) {
163 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
165 $head[$h][2] =
'attributes';
168 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contractdet_extrafields.php';
169 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
170 $nbExtrafields = $extrafields->attributes[
'contratdet'][
'count'];
171 if ($nbExtrafields > 0) {
172 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
174 $head[$h][2] =
'attributeslines';
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).
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.