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