contact.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <?php
  2. /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/projet/tasks/contact.php
  21. * \ingroup project
  22. * \brief Actors of a task
  23. */
  24. require "../../main.inc.php";
  25. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  30. // Load translation files required by the page
  31. $langs->loadLangs(array('projects', 'companies'));
  32. $id = GETPOST('id', 'int');
  33. $ref = GETPOST('ref', 'alpha');
  34. $action = GETPOST('action', 'aZ09');
  35. $confirm = GETPOST('confirm', 'alpha');
  36. $withproject = GETPOST('withproject', 'int');
  37. $project_ref = GETPOST('project_ref', 'alpha');
  38. $object = new Task($db);
  39. $projectstatic = new Project($db);
  40. if ($id > 0 || $ref) {
  41. $object->fetch($id, $ref);
  42. }
  43. // Security check
  44. $socid = 0;
  45. restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
  46. /*
  47. * Actions
  48. */
  49. // Add new contact
  50. if ($action == 'addcontact' && $user->rights->projet->creer) {
  51. $source = 'internal';
  52. if (GETPOST("addsourceexternal")) {
  53. $source = 'external';
  54. }
  55. $result = $object->fetch($id, $ref);
  56. if ($result > 0 && $id > 0) {
  57. if ($source == 'internal') {
  58. $idfortaskuser = ((GETPOST("userid") != 0 && GETPOST('userid') != -1) ? GETPOST("userid") : 0); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
  59. $typeid = GETPOST('type');
  60. } else {
  61. $idfortaskuser = ((GETPOST("contactid") > 0) ? GETPOST("contactid", 'int') : 0); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
  62. $typeid = GETPOST('typecontact');
  63. }
  64. if ($idfortaskuser == -2) {
  65. $result = $projectstatic->fetch($object->fk_project);
  66. if ($result <= 0) {
  67. dol_print_error($db, $projectstatic->error, $projectstatic->errors);
  68. } else {
  69. $contactsofproject = $projectstatic->getListContactId('internal');
  70. foreach ($contactsofproject as $key => $val) {
  71. $result = $object->add_contact($val, $typeid, $source);
  72. }
  73. }
  74. } else {
  75. $result = $object->add_contact($idfortaskuser, $typeid, $source);
  76. }
  77. }
  78. if ($result >= 0) {
  79. header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id.($withproject ? '&withproject=1' : ''));
  80. exit;
  81. } else {
  82. if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
  83. $langs->load("errors");
  84. setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
  85. } else {
  86. setEventMessages($object->error, $object->errors, 'errors');
  87. }
  88. }
  89. }
  90. // bascule du statut d'un contact
  91. if ($action == 'swapstatut' && $user->rights->projet->creer) {
  92. if ($object->fetch($id, $ref)) {
  93. $result = $object->swapContactStatus(GETPOST('ligne', 'int'));
  94. } else {
  95. dol_print_error($db);
  96. }
  97. }
  98. // Efface un contact
  99. if ($action == 'deleteline' && $user->rights->projet->creer) {
  100. $object->fetch($id, $ref);
  101. $result = $object->delete_contact(GETPOST("lineid", 'int'));
  102. if ($result >= 0) {
  103. header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id.($withproject ? '&withproject=1' : ''));
  104. exit;
  105. } else {
  106. dol_print_error($db);
  107. }
  108. }
  109. // Retrieve First Task ID of Project if withprojet is on to allow project prev next to work
  110. if (!empty($project_ref) && !empty($withproject)) {
  111. if ($projectstatic->fetch(0, $project_ref) > 0) {
  112. $tasksarray = $object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
  113. if (count($tasksarray) > 0) {
  114. $id = $tasksarray[0]->id;
  115. } else {
  116. header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode));
  117. exit;
  118. }
  119. }
  120. }
  121. /*
  122. * View
  123. */
  124. $form = new Form($db);
  125. $formcompany = new FormCompany($db);
  126. $contactstatic = new Contact($db);
  127. $userstatic = new User($db);
  128. $result = $projectstatic->fetch($object->fk_project);
  129. $title = $object->ref . ' - ' . $langs->trans("Contacts");
  130. if (!empty($withproject)) {
  131. $title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '') ;
  132. }
  133. $help_url = '';
  134. llxHeader('', $title, $help_url);
  135. /* *************************************************************************** */
  136. /* */
  137. /* Mode vue et edition */
  138. /* */
  139. /* *************************************************************************** */
  140. if ($id > 0 || !empty($ref)) {
  141. if ($object->fetch($id, $ref) > 0) {
  142. if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
  143. $object->fetchComments();
  144. }
  145. $id = $object->id; // So when doing a search from ref, id is also set correctly.
  146. if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
  147. $projectstatic->fetchComments();
  148. }
  149. if (!empty($projectstatic->socid)) {
  150. $projectstatic->fetch_thirdparty();
  151. }
  152. $object->project = clone $projectstatic;
  153. $userWrite = $projectstatic->restrictedProjectArea($user, 'write');
  154. if ($withproject) {
  155. // Tabs for project
  156. $tab = 'tasks';
  157. $head = project_prepare_head($projectstatic);
  158. print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
  159. $param = ($mode == 'mine' ? '&mode=mine' : '');
  160. // Project card
  161. $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  162. $morehtmlref = '<div class="refidno">';
  163. // Title
  164. $morehtmlref .= $projectstatic->title;
  165. // Thirdparty
  166. if ($projectstatic->thirdparty->id > 0) {
  167. $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
  168. }
  169. $morehtmlref .= '</div>';
  170. // Define a complementary filter for search of next/prev ref.
  171. if (empty($user->rights->projet->all->lire)) {
  172. $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
  173. $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
  174. }
  175. dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  176. print '<div class="fichecenter">';
  177. print '<div class="fichehalfleft">';
  178. print '<div class="underbanner clearboth"></div>';
  179. print '<table class="border tableforfield centpercent">';
  180. // Usage
  181. if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
  182. print '<tr><td class="tdtop">';
  183. print $langs->trans("Usage");
  184. print '</td>';
  185. print '<td>';
  186. if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
  187. print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
  188. $htmltext = $langs->trans("ProjectFollowOpportunity");
  189. print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
  190. print '<br>';
  191. }
  192. if (empty($conf->global->PROJECT_HIDE_TASKS)) {
  193. print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
  194. $htmltext = $langs->trans("ProjectFollowTasks");
  195. print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
  196. print '<br>';
  197. }
  198. if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
  199. print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
  200. $htmltext = $langs->trans("ProjectBillTimeDescription");
  201. print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
  202. print '<br>';
  203. }
  204. if (isModEnabled('eventorganization')) {
  205. print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
  206. $htmltext = $langs->trans("EventOrganizationDescriptionLong");
  207. print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
  208. }
  209. print '</td></tr>';
  210. }
  211. // Visibility
  212. print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
  213. if ($projectstatic->public) {
  214. print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
  215. print $langs->trans('SharedProject');
  216. } else {
  217. print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
  218. print $langs->trans('PrivateProject');
  219. }
  220. print '</td></tr>';
  221. // Budget
  222. print '<tr><td>'.$langs->trans("Budget").'</td><td>';
  223. if (strcmp($projectstatic->budget_amount, '')) {
  224. print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
  225. }
  226. print '</td></tr>';
  227. // Date start - end project
  228. print '<tr><td>'.$langs->trans("Dates").'</td><td>';
  229. $start = dol_print_date($projectstatic->date_start, 'day');
  230. print ($start ? $start : '?');
  231. $end = dol_print_date($projectstatic->date_end, 'day');
  232. print ' - ';
  233. print ($end ? $end : '?');
  234. if ($projectstatic->hasDelay()) {
  235. print img_warning("Late");
  236. }
  237. print '</td></tr>';
  238. // Other attributes
  239. $cols = 2;
  240. //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
  241. print '</table>';
  242. print '</div>';
  243. print '<div class="fichehalfright">';
  244. print '<div class="underbanner clearboth"></div>';
  245. print '<table class="border tableforfield centpercent">';
  246. // Description
  247. print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
  248. print nl2br($projectstatic->description);
  249. print '</td></tr>';
  250. // Categories
  251. if (isModEnabled('categorie')) {
  252. print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
  253. print $form->showCategories($projectstatic->id, 'project', 1);
  254. print "</td></tr>";
  255. }
  256. print '</table>';
  257. print '</div>';
  258. print '</div>';
  259. print '<div class="clearboth"></div>';
  260. print dol_get_fiche_end();
  261. print '<br>';
  262. }
  263. // To verify role of users
  264. //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
  265. //$arrayofuseridoftask=$object->getListContactId('internal');
  266. $head = task_prepare_head($object);
  267. print dol_get_fiche_head($head, 'task_contact', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
  268. $param = (GETPOST('withproject') ? '&withproject=1' : '');
  269. $linkback = GETPOST('withproject') ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : '';
  270. if (!GETPOST('withproject') || empty($projectstatic->id)) {
  271. $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
  272. $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")";
  273. } else {
  274. $object->next_prev_filter = " fk_projet = ".$projectstatic->id;
  275. }
  276. $morehtmlref = '';
  277. // Project
  278. if (empty($withproject)) {
  279. $result = $projectstatic->fetch($object->fk_project);
  280. $morehtmlref .= '<div class="refidno">';
  281. $morehtmlref .= $langs->trans("Project").': ';
  282. $morehtmlref .= $projectstatic->getNomUrl(1);
  283. $morehtmlref .= '<br>';
  284. // Third party
  285. $morehtmlref .= $langs->trans("ThirdParty").': ';
  286. if ($projectstatic->socid > 0) {
  287. $projectstatic->fetch_thirdparty();
  288. $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
  289. }
  290. $morehtmlref .= '</div>';
  291. }
  292. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1);
  293. print dol_get_fiche_end();
  294. /*
  295. * Lines of contacts
  296. */
  297. /*
  298. // Contacts lines (modules that overwrite templates must declare this into descriptor)
  299. $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
  300. foreach($dirtpls as $reldir)
  301. {
  302. $res=@include dol_buildpath($reldir.'/contacts.tpl.php');
  303. if ($res) break;
  304. }
  305. */
  306. /*
  307. * Add a new contact line
  308. */
  309. print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
  310. print '<input type="hidden" name="token" value="'.newToken().'">';
  311. print '<input type="hidden" name="action" value="addcontact">';
  312. print '<input type="hidden" name="id" value="'.$id.'">';
  313. if ($withproject) {
  314. print '<input type="hidden" name="withproject" value="'.$withproject.'">';
  315. }
  316. print '<table class="noborder centpercent">';
  317. if ($action != 'editline' && $user->rights->projet->creer) {
  318. print '<tr class="liste_titre">';
  319. print '<td>'.$langs->trans("NatureOfContact").'</td>';
  320. print '<td>'.$langs->trans("ThirdParty").'</td>';
  321. print '<td>'.$langs->trans("Users").'</td>';
  322. print '<td>'.$langs->trans("ContactType").'</td>';
  323. print '<td colspan="3">&nbsp;</td>';
  324. print "</tr>\n";
  325. // Ligne ajout pour contact interne
  326. print '<tr class="oddeven nohover">';
  327. print '<td class="nowrap">';
  328. print img_object('', 'user').' '.$langs->trans("Users");
  329. print '</td>';
  330. print '<td>';
  331. print $conf->global->MAIN_INFO_SOCIETE_NOM;
  332. print '</td>';
  333. print '<td>';
  334. // On recupere les id des users deja selectionnes
  335. if ($object->project->public) {
  336. $contactsofproject = ''; // Everybody
  337. } else {
  338. $contactsofproject = $projectstatic->getListContactId('internal');
  339. }
  340. print $form->select_dolusers((GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
  341. print '</td>';
  342. print '<td>';
  343. $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid');
  344. print '</td>';
  345. print '<td class="right" colspan="3" ><input type="submit" class="button button-add" value="'.$langs->trans("Add").'" name="addsourceinternal"></td>';
  346. print '</tr>';
  347. // Line to add an external contact. Only if project linked to a third party.
  348. if ($projectstatic->socid) {
  349. print '<tr class="oddeven">';
  350. print '<td class="nowrap">';
  351. print img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts");
  352. print '</td>';
  353. print '<td>';
  354. $thirdpartyofproject = $projectstatic->getListContactId('thirdparty');
  355. $selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : $projectstatic->socid;
  356. $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject);
  357. print '</td>';
  358. print '<td>';
  359. $contactofproject = $projectstatic->getListContactId('external');
  360. print $form->selectcontacts($selectedCompany, '', 'contactid', 0, '', $contactofproject, 0, '', false, 0, 0);
  361. $nbofcontacts = $form->num;
  362. print '</td>';
  363. print '<td>';
  364. $formcompany->selectTypeContact($object, '', 'typecontact', 'external', 'rowid');
  365. print '</td>';
  366. print '<td class="right" colspan="3" ><input type="submit" class="button" id="add-customer-contact" name="addsourceexternal" value="'.$langs->trans("Add").'"';
  367. if (!$nbofcontacts) {
  368. print ' disabled';
  369. }
  370. print '></td>';
  371. print '</tr>';
  372. }
  373. }
  374. // List of contact line
  375. print '<tr class="liste_titre">';
  376. print '<td>'.$langs->trans("Source").'</td>';
  377. print '<td>'.$langs->trans("ThirdParty").'</td>';
  378. print '<td>'.$langs->trans("TaskContact").'</td>';
  379. print '<td>'.$langs->trans("ContactType").'</td>';
  380. print '<td class="center">'.$langs->trans("Status").'</td>';
  381. print '<td colspan="2">&nbsp;</td>';
  382. print "</tr>\n";
  383. $companystatic = new Societe($db);
  384. foreach (array('internal', 'external') as $source) {
  385. $tab = $object->liste_contact(-1, $source);
  386. $num = count($tab);
  387. $i = 0;
  388. while ($i < $num) {
  389. print '<tr class="oddeven" valign="top">';
  390. // Source
  391. print '<td class="left">';
  392. if ($tab[$i]['source'] == 'internal') {
  393. print $langs->trans("User");
  394. }
  395. if ($tab[$i]['source'] == 'external') {
  396. print $langs->trans("ThirdPartyContact");
  397. }
  398. print '</td>';
  399. // Societe
  400. print '<td class="left">';
  401. if ($tab[$i]['socid'] > 0) {
  402. $companystatic->fetch($tab[$i]['socid']);
  403. print $companystatic->getNomUrl(1);
  404. }
  405. if ($tab[$i]['socid'] < 0) {
  406. print $conf->global->MAIN_INFO_SOCIETE_NOM;
  407. }
  408. if (!$tab[$i]['socid']) {
  409. print '&nbsp;';
  410. }
  411. print '</td>';
  412. // Contact
  413. print '<td>';
  414. if ($tab[$i]['source'] == 'internal') {
  415. $userstatic->id = $tab[$i]['id'];
  416. $userstatic->lastname = $tab[$i]['lastname'];
  417. $userstatic->firstname = $tab[$i]['firstname'];
  418. $userstatic->photo = $tab[$i]['photo'];
  419. $userstatic->login = $tab[$i]['login'];
  420. $userstatic->email = $tab[$i]['email'];
  421. $userstatic->statut = $tab[$i]['statuscontact'];
  422. print $userstatic->getNomUrl(-1);
  423. }
  424. if ($tab[$i]['source'] == 'external') {
  425. $contactstatic->id = $tab[$i]['id'];
  426. $contactstatic->lastname = $tab[$i]['lastname'];
  427. $contactstatic->firstname = $tab[$i]['firstname'];
  428. $contactstatic->email = $tab[$i]['email'];
  429. $contactstatic->statut = $tab[$i]['statuscontact'];
  430. print $contactstatic->getNomUrl(1);
  431. }
  432. print '</td>';
  433. // Type de contact
  434. print '<td>'.$tab[$i]['libelle'].'</td>';
  435. // Statut
  436. print '<td class="center">';
  437. // Activation desativation du contact
  438. if ($object->statut >= 0) {
  439. print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].($withproject ? '&withproject=1' : '').'">';
  440. }
  441. print $contactstatic->LibStatut($tab[$i]['status'], 3);
  442. if ($object->statut >= 0) {
  443. print '</a>';
  444. }
  445. print '</td>';
  446. // Icon update et delete
  447. print '<td class="center nowrap">';
  448. if ($user->rights->projet->creer) {
  449. print '&nbsp;';
  450. print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteline&token='.newToken().'&lineid='.$tab[$i]['rowid'].($withproject ? '&withproject=1' : '').'">';
  451. print img_picto($langs->trans('Unlink'), 'unlink');
  452. print '</a>';
  453. }
  454. print '</td>';
  455. print "</tr>\n";
  456. $i++;
  457. }
  458. }
  459. print "</table>";
  460. print "</form>";
  461. } else {
  462. print "ErrorRecordNotFound";
  463. }
  464. }
  465. if (is_object($hookmanager)) {
  466. $hookmanager->initHooks(array('contacttpl'));
  467. $parameters = array();
  468. $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
  469. }
  470. // End of page
  471. llxFooter();
  472. $db->close();