note.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /* Copyright (C) 2001-2003,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/contact/note.php
  23. * \brief Tab for notes on contact
  24. * \ingroup societe
  25. */
  26. // Load Dolibarr environment
  27. require '../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
  30. $action = GETPOST('action', 'aZ09');
  31. // Load translation files required by the page
  32. $langs->load("companies");
  33. $id = GETPOST('id', 'int');
  34. $object = new Contact($db);
  35. if ($id > 0) {
  36. $object->fetch($id);
  37. }
  38. // Security check
  39. if ($user->socid > 0) {
  40. if ($object->fk_soc > 0 && $object->fk_soc != $user->socid) {
  41. accessforbidden();
  42. }
  43. }
  44. $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
  45. $permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
  46. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  47. // $hookmanager->initHooks(array('contactcard')); -> Name conflict with product/card.php
  48. $hookmanager->initHooks(array('contactnote'));
  49. /*
  50. * Actions
  51. */
  52. $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
  53. if ($reshook < 0) {
  54. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  55. }
  56. if (empty($reshook)) {
  57. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  58. }
  59. /*
  60. * View
  61. */
  62. $now = dol_now();
  63. $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
  64. $form = new Form($db);
  65. $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
  66. llxHeader('', $title, $help_url);
  67. if ($id > 0) {
  68. /*
  69. * Affichage onglets
  70. */
  71. if (isModEnabled('notification')) {
  72. $langs->load("mails");
  73. }
  74. $head = contact_prepare_head($object);
  75. print dol_get_fiche_head($head, 'note', $title, -1, 'contact');
  76. $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  77. $morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
  78. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  79. $morehtmlref .= '</a>';
  80. $morehtmlref .= '<div class="refidno">';
  81. if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
  82. $objsoc = new Societe($db);
  83. $objsoc->fetch($object->socid);
  84. // Thirdparty
  85. if ($objsoc->id > 0) {
  86. $morehtmlref .= $objsoc->getNomUrl(1);
  87. } else {
  88. $morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
  89. }
  90. }
  91. $morehtmlref .= '</div>';
  92. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
  93. $cssclass = 'titlefield';
  94. //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
  95. //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
  96. print '<div class="fichecenter">';
  97. print '<div class="underbanner clearboth"></div>';
  98. print '<table class="border centpercent tableforfield">';
  99. // Civility
  100. print '<tr><td class="'.$cssclass.'">'.$langs->trans("UserTitle").'</td><td>';
  101. print $object->getCivilityLabel();
  102. print '</td></tr>';
  103. print "</table>";
  104. $cssclass = "titlefield";
  105. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  106. print '</div>';
  107. print dol_get_fiche_end();
  108. }
  109. llxFooter();
  110. $db->close();