note.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/adherents/note.php
  20. * \ingroup member
  21. * \brief Fiche de notes sur un adherent
  22. */
  23. require("../main.inc.php");
  24. require_once(DOL_DOCUMENT_ROOT.'/lib/member.lib.php');
  25. require_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php');
  26. require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
  27. $action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:"");
  28. $id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:"");
  29. $langs->load("companies");
  30. $langs->load("members");
  31. $langs->load("bills");
  32. if (!$user->rights->adherent->lire)
  33. accessforbidden();
  34. $adh = new Adherent($db);
  35. $result=$adh->fetch($id);
  36. if ($result > 0)
  37. {
  38. $adht = new AdherentType($db);
  39. $result=$adht->fetch($adh->typeid);
  40. }
  41. /******************************************************************************/
  42. /* Actions */
  43. /******************************************************************************/
  44. if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
  45. {
  46. $db->begin();
  47. $res=$adh->update_note($_POST["note"],$user);
  48. if ($res < 0)
  49. {
  50. $mesg='<div class="error">'.$adh->error.'</div>';
  51. $db->rollback();
  52. }
  53. else
  54. {
  55. $db->commit();
  56. }
  57. }
  58. /*
  59. * View
  60. */
  61. llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
  62. $html = new Form($db);
  63. if ($id)
  64. {
  65. $head = member_prepare_head($adh);
  66. dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
  67. if ($msg) print '<div class="error">'.$msg.'</div>';
  68. print "<form method=\"post\" action=\"note.php\">";
  69. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  70. print '<table class="border" width="100%">';
  71. // Reference
  72. print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
  73. print '<td colspan="3">';
  74. print $html->showrefnav($adh,'id');
  75. print '</td>';
  76. print '</tr>';
  77. // Login
  78. if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
  79. {
  80. print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.'&nbsp;</td></tr>';
  81. }
  82. // Morphy
  83. print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$adh->getmorphylib().'</td>';
  84. /*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
  85. print $html->showphoto('memberphoto',$member);
  86. print '</td>';*/
  87. print '</tr>';
  88. // Type
  89. print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
  90. // Company
  91. print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.'</td></tr>';
  92. // Civility
  93. print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$adh->getCivilityLabel().'&nbsp;</td>';
  94. print '</tr>';
  95. // Lastname
  96. print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$adh->nom.'&nbsp;</td>';
  97. print '</tr>';
  98. // Firstname
  99. print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$adh->prenom.'&nbsp;</td></tr>';
  100. // Status
  101. print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
  102. // Note
  103. print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
  104. print '<td valign="top" colspan="3">';
  105. if ($action == 'edit' && $user->rights->adherent->creer)
  106. {
  107. print "<input type=\"hidden\" name=\"action\" value=\"update\">";
  108. print "<input type=\"hidden\" name=\"id\" value=\"".$adh->id."\">";
  109. require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
  110. $doleditor=new DolEditor('note',$adh->note,'',280,'dolibarr_notes','',true,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MEMBER,10,80);
  111. $doleditor->Create();
  112. }
  113. else
  114. {
  115. print nl2br($adh->note);
  116. }
  117. print "</td></tr>";
  118. if ($action == 'edit')
  119. {
  120. print '<tr><td colspan="4" align="center">';
  121. print '<input type="submit" class="button" name="update" value="'.$langs->trans("Save").'">';
  122. print '&nbsp; &nbsp;';
  123. print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
  124. print '</td></tr>';
  125. }
  126. print "</table>";
  127. print "</form>\n";
  128. /*
  129. * Actions
  130. */
  131. print '</div>';
  132. print '<div class="tabsAction">';
  133. if ($user->rights->adherent->creer && $action != 'edit')
  134. {
  135. print "<a class=\"butAction\" href=\"note.php?id=$adh->id&amp;action=edit\">".$langs->trans('Modify')."</a>";
  136. }
  137. print "</div>";
  138. }
  139. $db->close();
  140. llxFooter();
  141. ?>