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';
90 $head[$h][0] = DOL_URL_ROOT.
'/contrat/agenda.php?id='.$object->id;
91 $head[$h][1] = $langs->trans(
"Events");
92 if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
94 $head[$h][1] .= $langs->trans(
"Agenda");
96 $head[$h][2] =
'agenda';
113 global $langs, $conf, $db;
116 $extrafields->fetch_name_optionals_label(
'contrat');
117 $extrafields->fetch_name_optionals_label(
'contratdet');
122 $head[$h][0] = DOL_URL_ROOT.
"/admin/contract.php";
123 $head[$h][1] = $langs->trans(
"Contracts");
124 $head[$h][2] =
'contract';
133 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contract_extrafields.php';
134 $head[$h][1] = $langs->trans(
"ExtraFields");
135 $nbExtrafields = $extrafields->attributes[
'contrat'][
'count'];
136 if ($nbExtrafields > 0) {
137 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
139 $head[$h][2] =
'attributes';
142 $head[$h][0] = DOL_URL_ROOT.
'/contrat/admin/contractdet_extrafields.php';
143 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
144 $nbExtrafields = $extrafields->attributes[
'contratdet'][
'count'];
145 if ($nbExtrafields > 0) {
146 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
148 $head[$h][2] =
'attributeslines';
Class to manage contracts.
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 informations.
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.
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).
isModEnabled($module)
Is Dolibarr module enabled.