dolibarr  20.0.0-beta
note.php
Go to the documentation of this file.
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 
27 // Load Dolibarr environment
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
32 
33 
34 // Load translation files required by the page
35 $langs->loadLangs(array("companies", "members", "bills"));
36 
37 
38 // Get parameters
39 $action = GETPOST('action', 'aZ09');
40 $id = GETPOSTINT('id');
41 $ref = GETPOST('ref', 'alphanohtml');
42 
43 
44 // Initialize objects
45 $object = new Adherent($db);
46 
47 $result = $object->fetch($id);
48 if ($result > 0) {
49  $adht = new AdherentType($db);
50  $result = $adht->fetch($object->typeid);
51 }
52 
53 
54 $permissionnote = $user->hasRight('adherent', 'creer'); // Used by the include of actions_setnotes.inc.php
55 
56 // Fetch object
57 if ($id > 0 || !empty($ref)) {
58  // Load member
59  $result = $object->fetch($id, $ref);
60 
61  // Define variables to know what current user can do on users
62  $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
63  // Define variables to know what current user can do on properties of user linked to edited member
64  if ($object->user_id) {
65  // $User is the user who edits, $object->user_id is the id of the related user in the edited member
66  $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
67  || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
68  $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
69  || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
70  }
71 }
72 
73 // Define variables to determine what the current user can do on the members
74 $canaddmember = $user->hasRight('adherent', 'creer');
75 // Define variables to determine what the current user can do on the properties of a member
76 if ($id) {
77  $caneditfieldmember = $user->hasRight('adherent', 'creer');
78 }
79 
80 $hookmanager->initHooks(array('membernote'));
81 
82 // Security check
83 $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
84 
85 /*
86  * Actions
87  */
88 $parameters = array();
89 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90 if ($reshook < 0) {
91  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
92 }
93 if (empty($reshook)) {
94  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
95 }
96 
97 
98 /*
99  * View
100  */
101 
102 $title = $langs->trans("Member")." - ".$langs->trans("Note");
103 
104 $help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
105 
106 llxHeader("", $title, $help_url);
107 
108 $form = new Form($db);
109 
110 if ($id) {
111  $head = member_prepare_head($object);
112 
113  print dol_get_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
114 
115  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
116  print '<input type="hidden" name="token" value="'.newToken().'">';
117 
118  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
119 
120  $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
121  $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
122  $morehtmlref .= '</a>';
123 
124  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
125 
126  print '<div class="fichecenter">';
127 
128  print '<div class="underbanner clearboth"></div>';
129  print '<table class="border centpercent tableforfield">';
130 
131  // Login
132  if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
133  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
134  }
135 
136  // Type
137  print '<tr><td>'.$langs->trans("Type").'</td>';
138  print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
139 
140  // Morphy
141  print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td>';
142  print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
143  print '</tr>';
144 
145  // Company
146  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
147 
148  // Civility
149  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'</td>';
150  print '</tr>';
151 
152  print "</table>";
153 
154  print '</div>';
155 
156 
157  $cssclass = 'titlefield';
158  $permission = $user->hasRight('adherent', 'creer'); // Used by the include of notes.tpl.php
159  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
160 
161 
162  print dol_get_fiche_end();
163 }
164 
165 // End of page
166 llxFooter();
167 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
Class to manage members of a foundation.
Class to manage members type.
Class to manage generation of HTML components Only common components must be here.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.
Definition: member.lib.php:34
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.