dolibarr  17.0.4
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 = GETPOST('id', 'int');
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 $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
89 if ($reshook < 0) {
90  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
91 }
92 if (empty($reshook)) {
93  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
94 }
95 
96 
97 /*
98  * View
99  */
100 
101 $title = $langs->trans("Member")." - ".$langs->trans("Note");
102 
103 $help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
104 
105 llxHeader("", $title, $help_url);
106 
107 $form = new Form($db);
108 
109 if ($id) {
110  $head = member_prepare_head($object);
111 
112  print dol_get_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
113 
114  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
115  print '<input type="hidden" name="token" value="'.newToken().'">';
116 
117  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
118 
119  $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
120  $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
121  $morehtmlref .= '</a>';
122 
123  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
124 
125  print '<div class="fichecenter">';
126 
127  print '<div class="underbanner clearboth"></div>';
128  print '<table class="border centpercent tableforfield">';
129 
130  // Login
131  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
132  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
133  }
134 
135  // Type
136  print '<tr><td>'.$langs->trans("Type").'</td>';
137  print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
138 
139  // Morphy
140  print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td>';
141  print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
142  print '</tr>';
143 
144  // Company
145  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
146 
147  // Civility
148  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'</td>';
149  print '</tr>';
150 
151  print "</table>";
152 
153  print '</div>';
154 
155 
156  $cssclass = 'titlefield';
157  $permission = $user->hasRight('adherent', 'creer'); // Used by the include of notes.tpl.php
158  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
159 
160 
161  print dol_get_fiche_end();
162 }
163 
164 // End of page
165 llxFooter();
166 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
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.