34 global $db, $langs, $conf, $user;
39 $head[$h][0] = DOL_URL_ROOT.
'/contrat/card.php?id='.$object->id;
40 $head[$h][1] = $langs->trans(
"ContractCard");
41 $head[$h][2] =
'card';
45 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
46 $head[$h][0] = DOL_URL_ROOT.
'/contrat/contact.php?id='.$object->id;
47 $head[$h][1] = $langs->trans(
"ContactsAddresses");
49 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
51 $head[$h][2] =
'contact';
56 if (isModEnabled(
'ticket') &&
getDolGlobalString(
'TICKET_LINK_TO_CONTRACT_WITH_HARDLINK')) {
57 $head[$h][0] = DOL_URL_ROOT.
'/contrat/ticket.php?id='.$object->id;
58 $head[$h][1] = $langs->trans(
"Tickets");
59 $head[$h][2] =
'ticket';
71 if (!empty($object->note_private)) {
74 if (!empty($object->note_public)) {
77 $head[$h][0] = DOL_URL_ROOT.
'/contrat/note.php?id='.$object->id;
78 $head[$h][1] = $langs->trans(
"Notes");
80 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
82 $head[$h][2] =
'note';
86 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
87 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
88 $upload_dir = $conf->contrat->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
89 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
90 $nbLinks =
Link::count($db, $object->element, $object->id);
91 $head[$h][0] = DOL_URL_ROOT.
'/contrat/document.php?id='.$object->id;
92 $head[$h][1] = $langs->trans(
"Documents");
93 if (($nbFiles + $nbLinks) > 0) {
94 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
96 $head[$h][2] =
'documents';
100 $head[$h][0] = DOL_URL_ROOT.
'/contrat/agenda.php?id='.$object->id;
101 $head[$h][1] = $langs->trans(
"Events");
102 if (isModEnabled(
'agenda')&& ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
105 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
106 $cachekey =
'count_events_contract_'.$object->id;
108 if (!is_null($dataretrieved)) {
109 $nbEvent = $dataretrieved;
111 $sql =
"SELECT COUNT(id) as nb";
112 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
113 $sql .=
" WHERE fk_element = ".((int) $object->id);
114 $sql .=
" AND elementtype = 'contract'";
115 $resql = $db->query($sql);
117 $obj = $db->fetch_object($resql);
120 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
126 $head[$h][1] .= $langs->trans(
"Agenda");
128 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
131 $head[$h][2] =
'agenda';
148 global $langs, $conf, $db;
151 $extrafields->fetch_name_optionals_label(
'contrat');
152 $extrafields->fetch_name_optionals_label(
'contratdet');
157 $head[$h][0] = DOL_URL_ROOT.
"/admin/contract.php";
158 $head[$h][1] = $langs->trans(
"Contracts");
159 $head[$h][2] =
'contract';
168 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contract_extrafields.php';
169 $head[$h][1] = $langs->trans(
"ExtraFields");
170 $nbExtrafields = $extrafields->attributes[
'contrat'][
'count'];
171 if ($nbExtrafields > 0) {
172 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
174 $head[$h][2] =
'attributes';
177 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contractdet_extrafields.php';
178 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
179 $nbExtrafields = $extrafields->attributes[
'contratdet'][
'count'];
180 if ($nbExtrafields > 0) {
181 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
183 $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.