dolibarr 23.0.3
webhook_triggerhistory.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2025 Alice Adminson <myemail@mycompany.com>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
31{
32 global $db, $langs, $conf;
33
34 $langs->load("webhook@webhook");
35
36 $showtabofpagecontact = 0;
37 $showtabofpagenote = 1;
38 $showtabofpagedocument = 0;
39 $showtabofpageagenda = 0;
40
41 $h = 0;
42 $head = array();
43
44 $head[$h][0] = dol_buildpath("/webhook/triggerhistory_card.php", 1).'?id='.$object->id;
45 $head[$h][1] = $langs->trans("Card");
46 $head[$h][2] = 'card';
47 $h++;
48
49 /*if ($showtabofpagecontact) {
50 $head[$h][0] = dol_buildpath("/webhook/history_contact.php", 1).'?id='.$object->id;
51 $head[$h][1] = $langs->trans("Contacts");
52 $head[$h][2] = 'contact';
53 $h++;
54 }*/
55
56 if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
57 $nbNote = 0;
58 if (!empty($object->note_private)) {
59 $nbNote++;
60 }
61 if (!empty($object->note_public)) {
62 $nbNote++;
63 }
64 $head[$h][0] = dol_buildpath('/webhook/triggerhistory_note.php', 1).'?id='.$object->id;
65 $head[$h][1] = $langs->trans('Notes');
66 if ($nbNote > 0) {
67 $head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
68 }
69 $head[$h][2] = 'note';
70 $h++;
71 }
72
73 /*if ($showtabofpagedocument) {
74 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
75 require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
76 $upload_dir = $conf->webhook->dir_output."/triggerhistory/".dol_sanitizeFileName($object->ref);
77 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
78 $nbLinks = Link::count($db, $object->element, $object->id);
79 $head[$h][0] = dol_buildpath("/webhook/history_document.php", 1).'?id='.$object->id;
80 $head[$h][1] = $langs->trans('Documents');
81 if (($nbFiles + $nbLinks) > 0) {
82 $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
83 }
84 $head[$h][2] = 'document';
85 $h++;
86 }
87
88 if ($showtabofpageagenda) {
89 $head[$h][0] = dol_buildpath("/webhook/history_agenda.php", 1).'?id='.$object->id;
90 $head[$h][1] = $langs->trans("Events");
91 $head[$h][2] = 'agenda';
92 $h++;
93 }*/
94
95 // Show more tabs from modules
96 // Entries must be declared in modules descriptor with line
97 //$this->tabs = array(
98 // 'entity:+tabname:Title:@webhook:/webhook/mypage.php?id=__ID__'
99 //); // to add new tab
100 //$this->tabs = array(
101 // 'entity:-tabname:Title:@webhook:/webhook/mypage.php?id=__ID__'
102 //); // to remove a tab
103 complete_head_from_modules($conf, $langs, $object, $head, $h, 'triggerhistory@webhook');
104
105 complete_head_from_modules($conf, $langs, $object, $head, $h, 'triggerhistory@webhook', 'remove');
106
107 return $head;
108}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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).
triggerhistoryPrepareHead($object)
Prepare array of tabs for.