35 global $db, $langs, $conf, $user;
40 $head[$h][0] = DOL_URL_ROOT.
'/contrat/card.php?id='.
$object->id;
41 $head[$h][1] = $langs->trans(
"ContractCard");
42 $head[$h][2] =
'card';
46 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
47 $head[$h][0] = DOL_URL_ROOT.
'/contrat/contact.php?id='.
$object->id;
48 $head[$h][1] = $langs->trans(
"ContactsAddresses");
50 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
52 $head[$h][2] =
'contact';
57 if (isModEnabled(
'ticket') &&
getDolGlobalString(
'TICKET_LINK_TO_CONTRACT_WITH_HARDLINK')) {
58 $head[$h][0] = DOL_URL_ROOT.
'/contrat/ticket.php?id='.
$object->id;
59 $head[$h][1] = $langs->trans(
"Tickets");
60 $head[$h][2] =
'ticket';
72 if (!empty(
$object->note_private)) {
75 if (!empty(
$object->note_public)) {
78 $head[$h][0] = DOL_URL_ROOT.
'/contrat/note.php?id='.
$object->id;
79 $head[$h][1] = $langs->trans(
"Notes");
81 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
83 $head[$h][2] =
'note';
87 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
88 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
90 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
92 $head[$h][0] = DOL_URL_ROOT.
'/contrat/document.php?id='.
$object->id;
93 $head[$h][1] = $langs->trans(
"Documents");
94 if (($nbFiles + $nbLinks) > 0) {
95 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
97 $head[$h][2] =
'documents';
101 $head[$h][0] = DOL_URL_ROOT.
'/contrat/agenda.php?id='.
$object->id;
102 $head[$h][1] = $langs->trans(
"Events");
103 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
106 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
107 $cachekey =
'count_events_contract_'.$object->id;
109 if (!is_null($dataretrieved)) {
110 $nbEvent = $dataretrieved;
112 $sql =
"SELECT COUNT(id) as nb";
113 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
114 $sql .=
" WHERE fk_element = ".((int)
$object->id);
115 $sql .=
" AND elementtype = 'contract'";
116 $resql = $db->query($sql);
118 $obj = $db->fetch_object($resql);
121 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
127 $head[$h][1] .= $langs->trans(
"Agenda");
129 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
132 $head[$h][2] =
'agenda';
149 global $langs, $conf, $db;
152 $extrafields->fetch_name_optionals_label(
'contrat');
153 $extrafields->fetch_name_optionals_label(
'contratdet');
158 $head[$h][0] = DOL_URL_ROOT.
"/admin/contract.php";
159 $head[$h][1] = $langs->trans(
"Contracts");
160 $head[$h][2] =
'contract';
169 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contract_extrafields.php';
170 $head[$h][1] = $langs->trans(
"ExtraFields");
171 $nbExtrafields = $extrafields->attributes[
'contrat'][
'count'];
172 if ($nbExtrafields > 0) {
173 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
175 $head[$h][2] =
'attributes';
178 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contractdet_extrafields.php';
179 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
180 $nbExtrafields = $extrafields->attributes[
'contratdet'][
'count'];
181 if ($nbExtrafields > 0) {
182 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
184 $head[$h][2] =
'attributeslines';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
static count($dbs, $objecttype, $objectid)
Return nb of links.
contract_prepare_head(Contrat $object)
Prepare array with list of tabs.
contract_admin_prepare_head()
Return array head with list of tabs to view object information.
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.