dolibarr 21.0.0-alpha
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 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
32require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
33
34
35// Load translation files required by the page
36$langs->loadLangs(array("companies", "members", "bills"));
37
38
39// Get parameters
40$action = GETPOST('action', 'aZ09');
41$id = GETPOSTINT('id');
42$ref = GETPOST('ref', 'alphanohtml');
43
44
45// Initialize objects
46$object = new Adherent($db);
47
48$result = $object->fetch($id);
49if ($result > 0) {
50 $adht = new AdherentType($db);
51 $result = $adht->fetch($object->typeid);
52}
53
54
55$permissionnote = $user->hasRight('adherent', 'creer'); // Used by the include of actions_setnotes.inc.php
56
57// Fetch object
58if ($id > 0 || !empty($ref)) {
59 // Load member
60 $result = $object->fetch($id, $ref);
61
62 // Define variables to know what current user can do on users
63 $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
64 // Define variables to know what current user can do on properties of user linked to edited member
65 if ($object->user_id) {
66 // $User is the user who edits, $object->user_id is the id of the related user in the edited member
67 $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
68 || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
69 $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
70 || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
71 }
72}
73
74// Define variables to determine what the current user can do on the members
75$canaddmember = $user->hasRight('adherent', 'creer');
76// Define variables to determine what the current user can do on the properties of a member
77if ($id) {
78 $caneditfieldmember = $user->hasRight('adherent', 'creer');
79}
80
81$hookmanager->initHooks(array('membernote'));
82
83// Security check
84$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
85
86/*
87 * Actions
88 */
89$parameters = array();
90$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
91if ($reshook < 0) {
92 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
93}
94if (empty($reshook)) {
95 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
96}
97
98
99/*
100 * View
101 */
102
103$title = $langs->trans("Member")." - ".$langs->trans("Note");
104$help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
105
106llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-card_note');
107
108$form = new Form($db);
109
110if ($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
166llxFooter();
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
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.
llxFooter()
Footer empty.
Definition document.php:107
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.
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.