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-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
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 // Load Dolibarr environment
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
30 
31 // Get parameters
32 $id = GETPOST('id', 'int');
33 $action = GETPOST('action', 'aZ09');
34 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'usernote'; // To manage different context of search
35 
36 // Load translation files required by page
37 $langs->loadLangs(array('companies', 'members', 'bills', 'users'));
38 
39 $object = new User($db);
40 $object->fetch($id, '', '', 1);
41 $object->getrights();
42 
43 // If user is not user read and no permission to read other users, we stop
44 if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) {
46 }
47 
48 // Permissions
49 $permissionnote = $user->hasRight("user", "self", "write"); // Used by the include of actions_setnotes.inc.php
50 
51 // Security check
52 $socid = 0;
53 if ($user->socid > 0) {
54  $socid = $user->socid;
55 }
56 $feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
57 
58 $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
59 
60 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
61 $hookmanager->initHooks(array('usercard', 'usernote', 'globalcard'));
62 
63 
64 /*
65  * Actions
66  */
67 $parameters = array('id'=>$socid);
68 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
69 if ($reshook < 0) {
70  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
71 }
72 if (empty($reshook)) {
73  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
74 }
75 
76 
77 /*
78  * View
79  */
80 
81 llxHeader();
82 
83 $form = new Form($db);
84 
85 if ($id) {
86  $head = user_prepare_head($object);
87 
88  $title = $langs->trans("User");
89  print dol_get_fiche_head($head, 'note', $title, -1, 'user');
90 
91  $linkback = '';
92 
93  if ($user->hasRight("user", "user", "read") || $user->admin) {
94  $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
95  }
96 
97  $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid">';
98  $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
99  $morehtmlref .= '</a>';
100 
101  dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
102 
103  print '<div class="underbanner clearboth"></div>';
104 
105  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
106  print '<input type="hidden" name="token" value="'.newToken().'">';
107 
108  print '<div class="fichecenter">';
109  print '<table class="border centpercent tableforfield">';
110 
111  // Login
112  print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
113  if (!empty($object->ldap_sid) && $object->statut == 0) {
114  print '<td class="error">';
115  print $langs->trans("LoginAccountDisableInDolibarr");
116  print '</td>';
117  } else {
118  print '<td>';
119  $addadmin = '';
120  if (property_exists($object, 'admin')) {
121  if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
122  $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
123  } elseif (!empty($object->admin)) {
124  $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
125  }
126  }
127  print showValueWithClipboardCPButton($object->login).$addadmin;
128  print '</td>';
129  }
130  print '</tr>';
131 
132  print "</table>";
133 
134  print '</div>';
135 
136 
137  //print '<br>';
138 
139  //print '<div class="underbanner clearboth"></div>';
140  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
141 
142  print dol_get_fiche_end();
143 } else {
144  $langs->load("errors");
145  print $langs->trans("ErrorRecordNotFound");
146 }
147 
148 // End of page
149 llxFooter();
150 $db->close();
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 generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
Definition: user.class.php:47
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.