agenda.lib.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <?php
  2. /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
  4. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  5. * Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. * or see https://www.gnu.org/
  20. */
  21. /**
  22. * \file htdocs/core/lib/agenda.lib.php
  23. * \brief Set of function for the agenda module
  24. */
  25. /**
  26. * Show filter form in agenda view
  27. *
  28. * @param Form $form Form object
  29. * @param int $canedit Can edit filter fields
  30. * @param int $status Status
  31. * @param int $year Year
  32. * @param int $month Month
  33. * @param int $day Day
  34. * @param int $showbirthday Show birthday
  35. * @param string $filtera Filter on create by user
  36. * @param string $filtert Filter on assigned to user
  37. * @param string $filterd Filter of done by user
  38. * @param int $pid Product id
  39. * @param int $socid Third party id
  40. * @param string $action Action string
  41. * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
  42. * @param string|array $actioncode Preselected value(s) of actioncode for filter on event type
  43. * @param int $usergroupid Id of group to filter on users
  44. * @param string $excludetype A type to exclude ('systemauto', 'system', '')
  45. * @param int $resourceid Preselected value of resource for filter on resource
  46. * @return void
  47. */
  48. function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode = '', $usergroupid = '', $excludetype = '', $resourceid = 0)
  49. {
  50. global $conf, $user, $langs, $db, $hookmanager;
  51. global $begin_h, $end_h, $begin_d, $end_d;
  52. global $massaction;
  53. $langs->load("companies");
  54. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
  55. $formactions = new FormActions($db);
  56. // Filters
  57. //print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
  58. print '<input type="hidden" name="token" value="'.newToken().'">';
  59. print '<input type="hidden" name="year" value="'.((int) $year).'">';
  60. print '<input type="hidden" name="month" value="'.((int) $month).'">';
  61. print '<input type="hidden" name="day" value="'.((int) $day).'">';
  62. if ($massaction != 'predelete' && $massaction != 'preaffecttag') { // When $massaction == 'predelete', action may be already output to 'delete' by the mass action system.
  63. print '<input type="hidden" name="action" value="'.$action.'">';
  64. }
  65. print '<input type="hidden" name="search_showbirthday" value="'.((int) $showbirthday).'">';
  66. if ($canedit) {
  67. print '<div class="divsearchfield">';
  68. // Type
  69. $multiselect = 0;
  70. if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
  71. $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
  72. }
  73. print img_picto($langs->trans("ActionType"), 'square', 'class="pictofixedwidth inline-block" style="color: #ddd;"');
  74. print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500 widthcentpercentminusx');
  75. print '</div>';
  76. // Assigned to user
  77. print '<div class="divsearchfield">';
  78. print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="pictofixedwidth inline-block"');
  79. print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'minwidth150 maxwidth500 widthcentpercentminusxx');
  80. print '</div>';
  81. // Assigned to user group
  82. print '<div class="divsearchfield">';
  83. print img_picto($langs->trans("ToUserOfGroup"), 'object_group', 'class="pictofixedwidth inline-block"');
  84. print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'minwidth100 maxwidth500 widthcentpercentminusxx');
  85. print '</div>';
  86. if (isModEnabled('resource')) {
  87. include_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
  88. $formresource = new FormResource($db);
  89. // Resource
  90. print '<div class="divsearchfield">';
  91. print img_picto($langs->trans("Resource"), 'object_resource', 'class="pictofixedwidth inline-block"');
  92. print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2, 0, 'maxwidth500');
  93. print '</div>';
  94. }
  95. }
  96. if (isModEnabled('societe') && $user->hasRight('societe', 'lire')) {
  97. print '<div class="divsearchfield">';
  98. print img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth inline-block"');
  99. print $form->select_company($socid, 'search_socid', '', '&nbsp;', 0, 0, null, 0, 'minwidth100 maxwidth500');
  100. print '</div>';
  101. }
  102. if (isModEnabled('projet') && !empty($user->rights->projet->lire)) {
  103. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  104. $formproject = new FormProjets($db);
  105. print '<div class="divsearchfield">';
  106. print img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth inline-block"');
  107. print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
  108. print '</div>';
  109. }
  110. if ($canedit && !preg_match('/list/', $_SERVER["PHP_SELF"])) {
  111. // Status
  112. print '<div class="divsearchfield">';
  113. print img_picto($langs->trans("Status"), 'setup', 'class="pictofixedwidth inline-block"');
  114. $formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
  115. print '</div>';
  116. }
  117. // Hooks
  118. $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
  119. $object = null;
  120. $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
  121. print '<div style="clear:both"></div>';
  122. }
  123. /**
  124. * Show actions to do array
  125. *
  126. * @param int $max Max nb of records
  127. * @return void
  128. */
  129. function show_array_actions_to_do($max = 5)
  130. {
  131. global $langs, $conf, $user, $db, $socid;
  132. $now = dol_now();
  133. include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
  134. include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
  135. $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent";
  136. $sql .= ", c.code, c.libelle as type_label";
  137. $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
  138. $sql .= ", s.code_client, s.code_compta, s.client";
  139. $sql .= ", s.logo, s.email, s.entity";
  140. $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
  141. $sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
  142. $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
  143. if (empty($user->rights->societe->client->voir) && !$socid) {
  144. $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
  145. }
  146. $sql .= " WHERE a.entity IN (".getEntity('agenda').")";
  147. $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
  148. if (empty($user->rights->societe->client->voir) && !$socid) {
  149. $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
  150. }
  151. if ($socid) {
  152. $sql .= " AND s.rowid = ".((int) $socid);
  153. }
  154. $sql .= " ORDER BY a.datep DESC, a.id DESC";
  155. $sql .= $db->plimit($max, 0);
  156. $resql = $db->query($sql);
  157. if ($resql) {
  158. $num = $db->num_rows($resql);
  159. print '<div class="div-table-responsive-no-min">';
  160. print '<table class="noborder centpercent">';
  161. print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo", $max).'</th>';
  162. print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&status=todo">'.$langs->trans("FullList").'</a></th>';
  163. print '</tr>';
  164. $i = 0;
  165. $staticaction = new ActionComm($db);
  166. $customerstatic = new Client($db);
  167. while ($i < $num) {
  168. $obj = $db->fetch_object($resql);
  169. print '<tr class="oddeven">';
  170. $staticaction->type_code = $obj->code;
  171. $staticaction->label = ($obj->label ? $obj->label : $obj->type_label);
  172. $staticaction->id = $obj->id;
  173. print '<td>'.$staticaction->getNomUrl(1, 34).'</td>';
  174. // print '<td>'.dol_trunc($obj->label,22).'</td>';
  175. print '<td>';
  176. if ($obj->socid > 0) {
  177. $customerstatic->id = $obj->socid;
  178. $customerstatic->name = $obj->name;
  179. //$customerstatic->name_alias = $obj->name_alias;
  180. $customerstatic->code_client = $obj->code_client;
  181. $customerstatic->code_compta = $obj->code_compta;
  182. $customerstatic->client = $obj->client;
  183. $customerstatic->logo = $obj->logo;
  184. $customerstatic->email = $obj->email;
  185. $customerstatic->entity = $obj->entity;
  186. print $customerstatic->getNomUrl(1, '', 40);
  187. }
  188. print '</td>';
  189. $datep = $db->jdate($obj->dp);
  190. $datep2 = $db->jdate($obj->dp2);
  191. // Date
  192. print '<td width="100" class="right tddate">'.dol_print_date($datep, 'day').'&nbsp;';
  193. $late = 0;
  194. if ($obj->percent == 0 && $datep && $datep < time()) {
  195. $late = 1;
  196. }
  197. if ($obj->percent == 0 && !$datep && $datep2 && $datep2 < time()) {
  198. $late = 1;
  199. }
  200. if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) {
  201. $late = 1;
  202. }
  203. if ($obj->percent > 0 && $obj->percent < 100 && !$datep2 && $datep && $datep < time()) {
  204. $late = 1;
  205. }
  206. if ($late) {
  207. print img_warning($langs->trans("Late"));
  208. }
  209. print "</td>";
  210. // Statut
  211. print '<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3)."</td>\n";
  212. print "</tr>\n";
  213. $i++;
  214. }
  215. print "</table></div><br>";
  216. $db->free($resql);
  217. } else {
  218. dol_print_error($db);
  219. }
  220. }
  221. /**
  222. * Show last actions array
  223. *
  224. * @param int $max Max nb of records
  225. * @return void
  226. */
  227. function show_array_last_actions_done($max = 5)
  228. {
  229. global $langs, $conf, $user, $db, $socid;
  230. $now = dol_now();
  231. $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label";
  232. $sql .= ", c.code, c.libelle";
  233. $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
  234. $sql .= ", s.code_client, s.code_compta, s.client";
  235. $sql .= ", s.logo, s.email, s.entity";
  236. $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
  237. $sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
  238. $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
  239. if (empty($user->rights->societe->client->voir) && !$socid) {
  240. $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
  241. }
  242. $sql .= " WHERE a.entity IN (".getEntity('agenda').")";
  243. $sql .= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
  244. if (empty($user->rights->societe->client->voir) && !$socid) {
  245. $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
  246. }
  247. if ($socid) {
  248. $sql .= " AND s.rowid = ".((int) $socid);
  249. }
  250. $sql .= " ORDER BY a.datep2 DESC";
  251. $sql .= $db->plimit($max, 0);
  252. $resql = $db->query($sql);
  253. if ($resql) {
  254. $num = $db->num_rows($resql);
  255. print '<div class="div-table-responsive-no-min">';
  256. print '<table class="noborder centpercent">';
  257. print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks", $max).'</th>';
  258. print '<th colspan="2" class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&status=done">'.$langs->trans("FullList").'</a></th>';
  259. print '</tr>';
  260. $i = 0;
  261. $staticaction = new ActionComm($db);
  262. $customerstatic = new Societe($db);
  263. while ($i < $num) {
  264. $obj = $db->fetch_object($resql);
  265. print '<tr class="oddeven">';
  266. $staticaction->type_code = $obj->code;
  267. $staticaction->label = $obj->label;
  268. $staticaction->id = $obj->id;
  269. print '<td>'.$staticaction->getNomUrl(1, 34).'</td>';
  270. //print '<td>'.dol_trunc($obj->label,24).'</td>';
  271. print '<td>';
  272. if ($obj->socid > 0) {
  273. $customerstatic->id = $obj->socid;
  274. $customerstatic->name = $obj->name;
  275. //$customerstatic->name_alias = $obj->name_alias;
  276. $customerstatic->code_client = $obj->code_client;
  277. $customerstatic->code_compta = $obj->code_compta;
  278. $customerstatic->client = $obj->client;
  279. $customerstatic->logo = $obj->logo;
  280. $customerstatic->email = $obj->email;
  281. $customerstatic->entity = $obj->entity;
  282. print $customerstatic->getNomUrl(1, '', 30);
  283. }
  284. print '</td>';
  285. // Date
  286. print '<td width="100" class="right tddate">'.dol_print_date($db->jdate($obj->da2), 'day');
  287. print "</td>";
  288. // Status
  289. print '<td class="right" width="14">'.$staticaction->LibStatut($obj->percent, 3)."</td>\n";
  290. print "</tr>\n";
  291. $i++;
  292. }
  293. // TODO Ajouter rappel pour "il y a des contrats a mettre en service"
  294. // TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration"
  295. print "</table></div><br>";
  296. $db->free($resql);
  297. } else {
  298. dol_print_error($db);
  299. }
  300. }
  301. /**
  302. * Prepare array with list of tabs
  303. *
  304. * @return array Array of tabs to show
  305. */
  306. function agenda_prepare_head()
  307. {
  308. global $langs, $conf, $user, $db;
  309. $extrafields = new ExtraFields($db);
  310. $extrafields->fetch_name_optionals_label('actioncomm');
  311. $h = 0;
  312. $head = array();
  313. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
  314. $head[$h][1] = $langs->trans("Miscellaneous");
  315. $head[$h][2] = 'other';
  316. $h++;
  317. $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php";
  318. $head[$h][1] = $langs->trans("AutoActions");
  319. $head[$h][2] = 'autoactions';
  320. $h++;
  321. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php";
  322. $head[$h][1] = $langs->trans("Reminders");
  323. $head[$h][2] = 'reminders';
  324. $h++;
  325. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php";
  326. $head[$h][1] = $langs->trans("ExportCal");
  327. $head[$h][2] = 'xcal';
  328. $h++;
  329. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php";
  330. $head[$h][1] = $langs->trans("ExtSites");
  331. $head[$h][2] = 'extsites';
  332. $h++;
  333. complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda_admin');
  334. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
  335. $head[$h][1] = $langs->trans("ExtraFields");
  336. $nbExtrafields = $extrafields->attributes['actioncomm']['count'];
  337. if ($nbExtrafields > 0) {
  338. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  339. }
  340. $head[$h][2] = 'attributes';
  341. $h++;
  342. complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda_admin', 'remove');
  343. return $head;
  344. }
  345. /**
  346. * Prepare array with list of tabs
  347. *
  348. * @param object $object Object related to tabs
  349. * @return array Array of tabs to show
  350. */
  351. function actions_prepare_head($object)
  352. {
  353. global $db, $langs, $conf, $user;
  354. $h = 0;
  355. $head = array();
  356. $head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id;
  357. $head[$h][1] = $langs->trans("CardAction");
  358. $head[$h][2] = 'card';
  359. $h++;
  360. // Tab to link resources
  361. if (isModEnabled('resource')) {
  362. include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
  363. $resource = new DolResource($db);
  364. $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
  365. $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
  366. $nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0);
  367. $head[$h][1] = $langs->trans("Resources");
  368. if ($nbResources > 0) {
  369. $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbResources).'</span>' : '');
  370. }
  371. $head[$h][2] = 'resources';
  372. $h++;
  373. }
  374. // Attached files
  375. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  376. require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
  377. $upload_dir = $conf->agenda->dir_output."/".$object->id;
  378. $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
  379. $nbLinks = Link::count($db, $object->element, $object->id);
  380. $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
  381. $head[$h][1] = $langs->trans("Documents");
  382. if (($nbFiles + $nbLinks) > 0) {
  383. $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
  384. }
  385. $head[$h][2] = 'documents';
  386. $h++;
  387. $head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$object->id;
  388. $head[$h][1] = $langs->trans('Info');
  389. $head[$h][2] = 'info';
  390. $h++;
  391. complete_head_from_modules($conf, $langs, $object, $head, $h, 'action');
  392. complete_head_from_modules($conf, $langs, $object, $head, $h, 'action', 'remove');
  393. return $head;
  394. }
  395. /**
  396. * Define head array for tabs of agenda setup pages
  397. *
  398. * @param string $param Parameters to add to url
  399. * @return array Array of head
  400. */
  401. function calendars_prepare_head($param)
  402. {
  403. global $langs, $conf, $user;
  404. $h = 0;
  405. $head = array();
  406. $head[$h][0] = DOL_URL_ROOT.'/comm/action/list.php?mode=show_list'.($param ? '&'.$param : '');
  407. $head[$h][1] = $langs->trans("ViewList");
  408. $head[$h][2] = 'cardlist';
  409. $h++;
  410. $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?mode=show_month'.($param ? '&'.$param : '');
  411. $head[$h][1] = $langs->trans("ViewCal");
  412. $head[$h][2] = 'cardmonth';
  413. $h++;
  414. $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?mode=show_week'.($param ? '&'.$param : '');
  415. $head[$h][1] = $langs->trans("ViewWeek");
  416. $head[$h][2] = 'cardweek';
  417. $h++;
  418. $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?mode=show_day'.($param ? '&'.$param : '');
  419. $head[$h][1] = $langs->trans("ViewDay");
  420. $head[$h][2] = 'cardday';
  421. $h++;
  422. //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
  423. if (!empty($conf->global->AGENDA_SHOW_PERTYPE)) {
  424. $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param ? '?'.$param : '');
  425. $head[$h][1] = $langs->trans("ViewPerType");
  426. $head[$h][2] = 'cardpertype';
  427. $h++;
  428. }
  429. $newparam = $param;
  430. $newparam = preg_replace('/&?search_filtert=\d+/', '', $newparam);
  431. $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($newparam ? '?'.$newparam : '');
  432. $head[$h][1] = $langs->trans("ViewPerUser");
  433. $head[$h][2] = 'cardperuser';
  434. $h++;
  435. // Show more tabs from modules
  436. // Entries must be declared in modules descriptor with line
  437. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  438. // $this->tabs = array('entity:-tabname); to remove a tab
  439. complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda');
  440. complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda', 'remove');
  441. return $head;
  442. }