note.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
  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/adherents/note.php
  21. * \ingroup member
  22. * \brief Tab for note of a member
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
  28. // Load translation files required by the page
  29. $langs->loadLangs(array("companies", "members", "bills"));
  30. $action = GETPOST('action', 'aZ09');
  31. $id = GETPOST('id', 'int');
  32. $ref = GETPOST('ref', 'alphanohtml');
  33. $object = new Adherent($db);
  34. $result = $object->fetch($id);
  35. if ($result > 0) {
  36. $adht = new AdherentType($db);
  37. $result = $adht->fetch($object->typeid);
  38. }
  39. $permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
  40. // Fetch object
  41. if ($id > 0 || !empty($ref)) {
  42. // Load member
  43. $result = $object->fetch($id, $ref);
  44. // Define variables to know what current user can do on users
  45. $canadduser = ($user->admin || $user->rights->user->user->creer);
  46. // Define variables to know what current user can do on properties of user linked to edited member
  47. if ($object->user_id) {
  48. // $User is the user who edits, $object->user_id is the id of the related user in the edited member
  49. $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
  50. || (($user->id != $object->user_id) && $user->rights->user->user->creer));
  51. $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
  52. || (($user->id != $object->user_id) && $user->rights->user->user->password));
  53. }
  54. }
  55. // Define variables to determine what the current user can do on the members
  56. $canaddmember = $user->rights->adherent->creer;
  57. // Define variables to determine what the current user can do on the properties of a member
  58. if ($id) {
  59. $caneditfieldmember = $user->rights->adherent->creer;
  60. }
  61. $hookmanager->initHooks(array('membernote'));
  62. // Security check
  63. $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
  64. /*
  65. * Actions
  66. */
  67. $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
  68. if ($reshook < 0) {
  69. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  70. }
  71. if (empty($reshook)) {
  72. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  73. }
  74. /*
  75. * View
  76. */
  77. $title = $langs->trans("Member")." - ".$langs->trans("Note");
  78. $help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
  79. llxHeader("", $title, $help_url);
  80. $form = new Form($db);
  81. if ($id) {
  82. $head = member_prepare_head($object);
  83. print dol_get_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
  84. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
  85. print '<input type="hidden" name="token" value="'.newToken().'">';
  86. $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  87. $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
  88. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  89. $morehtmlref .= '</a>';
  90. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
  91. print '<div class="fichecenter">';
  92. print '<div class="underbanner clearboth"></div>';
  93. print '<table class="border centpercent tableforfield">';
  94. // Login
  95. if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
  96. print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
  97. }
  98. // Type
  99. print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
  100. // Morphy
  101. print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
  102. /*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
  103. print $form->showphoto('memberphoto',$member);
  104. print '</td>';*/
  105. print '</tr>';
  106. // Company
  107. print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
  108. // Civility
  109. print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
  110. print '</tr>';
  111. print "</table>";
  112. print '</div>';
  113. $cssclass = 'titlefield';
  114. $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
  115. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  116. print dol_get_fiche_end();
  117. }
  118. // End of page
  119. llxFooter();
  120. $db->close();