dolibarr 23.0.3
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-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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
29// Load Dolibarr environment
30require '../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
41require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
42
43
44// Load translation files required by the page
45$langs->loadLangs(array("companies", "members", "bills"));
46
47
48// Get parameters
49$action = GETPOST('action', 'aZ09');
50$id = GETPOSTINT('id');
51$ref = GETPOST('ref', 'alphanohtml');
52
53
54// Initialize objects
55$object = new Adherent($db);
56
57$result = $object->fetch($id);
58if ($result > 0) {
59 $adht = new AdherentType($db);
60 $result = $adht->fetch($object->typeid);
61} else {
62 $adht = null;
63}
64
65
66$permissionnote = $user->hasRight('adherent', 'creer'); // Used by the include of actions_setnotes.inc.php
67
68// Fetch object
69if ($id > 0 || !empty($ref)) {
70 // Load member
71 $result = $object->fetch($id, $ref);
72
73 // Define variables to know what current user can do on users
74 $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
75 // Define variables to know what current user can do on properties of user linked to edited member
76 if ($object->user_id) {
77 // $User is the user who edits, $object->user_id is the id of the related user in the edited member
78 $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
79 || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
80 $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
81 || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
82 }
83}
84
85// Define variables to determine what the current user can do on the members
86$canaddmember = $user->hasRight('adherent', 'creer');
87// Define variables to determine what the current user can do on the properties of a member
88if ($id) {
89 $caneditfieldmember = $user->hasRight('adherent', 'creer');
90}
91
92$hookmanager->initHooks(array('membernote'));
93
94// Security check
95$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
96
97
98/*
99 * Actions
100 */
101
102$parameters = array();
103$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
104if ($reshook < 0) {
105 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
106}
107if (empty($reshook)) {
108 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
109}
110
111
112/*
113 * View
114 */
115
116$title = $langs->trans("Member")." - ".$langs->trans("Note");
117$help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
118
119llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-card_note');
120
121$form = new Form($db);
122
123if (is_object($adht)) {
124 $head = member_prepare_head($object);
125
126 print dol_get_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
127
128 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
129 print '<input type="hidden" name="token" value="'.newToken().'">';
130
131 $linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/adherents/list.php', ['restore_lastsearch_values' => 1]).'">'.$langs->trans("BackToList").'</a>';
132
133 $morehtmlref = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/adherents/vcard.php', ['id' => $object->id]).'" class="refid">';
134 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard', 'class="valignmiddle marginleftonly paddingrightonly"');
135 $morehtmlref .= '</a>';
136
137 dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
138
139 print '<div class="fichecenter">';
140
141 print '<div class="underbanner clearboth"></div>';
142 print '<table class="border centpercent tableforfield">';
143
144 // Login
145 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
146 print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
147 }
148
149 // Type
150 print '<tr><td class="titlefield">'.$langs->trans("Type").'</td>';
151 print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
152
153 // Morphy
154 print '<tr><td>'.$langs->trans("MemberNature").'</td>';
155 print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
156 print '</tr>';
157
158 // Company
159 print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
160
161 // Civility
162 print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'</td>';
163 print '</tr>';
164
165 print "</table>";
166
167 print '</div>';
168
169
170 $cssclass = 'titlefield';
171 $permission = $user->hasRight('adherent', 'creer'); // Used by the include of notes.tpl.php
172 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
173
174
175 print dol_get_fiche_end();
176}
177
178// End of page
179llxFooter();
180$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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, $morecssdiv='')
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.
getDolGlobalString($key, $default='')
Return a 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.
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.