2007-09-08 09:44:26 +00:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2015-05-30 18:07:44 +00:00
|
|
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
2018-10-27 12:43:12 +00:00
|
|
|
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
2007-09-08 09:44:26 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2007-09-08 09:44:26 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2007-09-08 09:44:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2009-08-17 17:32:38 +00:00
|
|
|
* \file htdocs/user/note.php
|
|
|
|
|
* \ingroup usergroup
|
|
|
|
|
* \brief Fiche de notes sur un utilisateur Dolibarr
|
|
|
|
|
*/
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2012-08-22 21:24:21 +00:00
|
|
|
require '../main.inc.php';
|
2012-08-22 21:11:24 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
$id = GETPOST('id', 'int');
|
|
|
|
|
$action = GETPOST('action', 'aZ09');
|
2020-02-13 09:44:08 +00:00
|
|
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'usernote'; // To manage different context of search
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2018-05-26 14:24:54 +00:00
|
|
|
// Load translation files required by page
|
|
|
|
|
$langs->loadLangs(array('companies', 'members', 'bills', 'users'));
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2015-06-26 13:26:08 +00:00
|
|
|
$object = new User($db);
|
2017-05-06 10:43:45 +00:00
|
|
|
$object->fetch($id, '', '', 1);
|
2016-12-10 22:30:31 +00:00
|
|
|
$object->getrights();
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2007-10-13 00:25:16 +00:00
|
|
|
// If user is not user read and no permission to read other users, we stop
|
2021-02-26 12:18:40 +00:00
|
|
|
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2009-08-17 17:32:38 +00:00
|
|
|
|
2009-08-06 13:07:25 +00:00
|
|
|
// Security check
|
2020-02-13 09:44:08 +00:00
|
|
|
$socid = 0;
|
2021-02-26 12:18:40 +00:00
|
|
|
if ($user->socid > 0) {
|
|
|
|
|
$socid = $user->socid;
|
|
|
|
|
}
|
2020-02-13 09:44:08 +00:00
|
|
|
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
|
2019-01-16 18:25:19 +00:00
|
|
|
|
2015-05-13 07:32:54 +00:00
|
|
|
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
2007-10-13 00:25:16 +00:00
|
|
|
|
2017-06-10 10:56:28 +00:00
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
2020-02-13 09:44:08 +00:00
|
|
|
$hookmanager->initHooks(array('usercard', 'usernote', 'globalcard'));
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2017-05-05 18:41:44 +00:00
|
|
|
|
2017-05-06 10:43:45 +00:00
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2020-02-13 09:44:08 +00:00
|
|
|
$parameters = array('id'=>$socid);
|
|
|
|
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
2021-02-26 12:18:40 +00:00
|
|
|
if ($reshook < 0) {
|
|
|
|
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
|
|
}
|
2015-09-16 07:37:49 +00:00
|
|
|
|
|
|
|
|
if (empty($reshook)) {
|
2021-03-24 18:06:44 +00:00
|
|
|
if ($action == 'update' && $user->rights->user->user->creer && !GETPOST("cancel")) {
|
2015-09-16 07:37:49 +00:00
|
|
|
$db->begin();
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
$res = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5));
|
2015-09-16 07:37:49 +00:00
|
|
|
if ($res < 0) {
|
|
|
|
|
$mesg = '<div class="error">'.$adh->error.'</div>';
|
|
|
|
|
$db->rollback();
|
|
|
|
|
} else {
|
|
|
|
|
$db->commit();
|
|
|
|
|
}
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-05-06 10:43:45 +00:00
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
2007-09-08 09:44:26 +00:00
|
|
|
|
|
|
|
|
llxHeader();
|
|
|
|
|
|
2011-11-08 09:18:45 +00:00
|
|
|
$form = new Form($db);
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2021-02-26 12:18:40 +00:00
|
|
|
if ($id) {
|
2015-06-26 13:26:08 +00:00
|
|
|
$head = user_prepare_head($object);
|
2009-05-04 15:42:04 +00:00
|
|
|
|
2009-05-05 00:25:14 +00:00
|
|
|
$title = $langs->trans("User");
|
2020-10-22 20:50:03 +00:00
|
|
|
print dol_get_fiche_head($head, 'note', $title, -1, 'user');
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2017-04-09 12:09:33 +00:00
|
|
|
$linkback = '';
|
|
|
|
|
|
|
|
|
|
if ($user->rights->user->user->lire || $user->admin) {
|
2018-10-09 12:20:53 +00:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
2017-04-09 12:09:33 +00:00
|
|
|
}
|
2017-11-04 14:40:35 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
|
2017-11-04 14:40:35 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
2017-11-04 14:40:35 +00:00
|
|
|
|
2021-03-29 13:49:34 +00:00
|
|
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
2019-12-01 09:20:11 +00:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2009-05-05 00:25:14 +00:00
|
|
|
|
2017-04-01 11:49:17 +00:00
|
|
|
print '<div class="fichecenter">';
|
2020-10-31 13:32:18 +00:00
|
|
|
print '<table class="border centpercent tableforfield">';
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// Login
|
2021-10-28 12:28:04 +00:00
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
|
|
|
|
if (!empty($object->ldap_sid) && $object->statut == 0) {
|
|
|
|
|
print '<td class="error">';
|
|
|
|
|
print $langs->trans("LoginAccountDisableInDolibarr");
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td>';
|
|
|
|
|
$addadmin = '';
|
|
|
|
|
if (property_exists($object, 'admin')) {
|
|
|
|
|
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
|
|
|
|
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
|
|
|
|
} elseif (!empty($object->admin)) {
|
|
|
|
|
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print showValueWithClipboardCPButton($object->login).$addadmin;
|
|
|
|
|
print '</td>';
|
|
|
|
|
}
|
|
|
|
|
print '</tr>';
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2020-11-18 15:23:08 +00:00
|
|
|
$editenabled = (($action == 'edit') && !empty($user->rights->user->user->creer));
|
|
|
|
|
|
2007-09-08 09:44:26 +00:00
|
|
|
// Note
|
2020-10-31 13:32:18 +00:00
|
|
|
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td>';
|
2020-11-18 15:23:08 +00:00
|
|
|
print '<td class="'.($editenabled ? '' : 'sensiblehtmlcontent').'">';
|
2021-02-26 12:18:40 +00:00
|
|
|
if ($editenabled) {
|
2007-09-08 09:44:26 +00:00
|
|
|
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
2015-06-26 13:26:08 +00:00
|
|
|
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
|
2020-10-31 13:32:18 +00:00
|
|
|
// Editeur wysiwyg
|
2012-08-22 21:11:24 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
2020-02-13 09:44:08 +00:00
|
|
|
$doleditor = new DolEditor('note_private', $object->note_private, '', 280, 'dolibarr_notes', 'In', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
|
2011-05-01 20:53:46 +00:00
|
|
|
$doleditor->Create();
|
2020-05-21 13:05:19 +00:00
|
|
|
} else {
|
2020-02-09 17:28:34 +00:00
|
|
|
print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private));
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
print "</td></tr>";
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
print "</table>";
|
|
|
|
|
print '</div>';
|
2011-11-05 22:18:49 +00:00
|
|
|
|
2020-10-27 17:19:31 +00:00
|
|
|
print dol_get_fiche_end();
|
2015-05-30 18:07:44 +00:00
|
|
|
|
2021-02-26 12:18:40 +00:00
|
|
|
if ($action == 'edit') {
|
2021-08-20 12:41:30 +00:00
|
|
|
print $form->buttonsSaveCancel();
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-05-30 18:07:44 +00:00
|
|
|
/*
|
2021-02-26 12:18:40 +00:00
|
|
|
* Actions
|
|
|
|
|
*/
|
2009-05-05 00:25:14 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
print '<div class="tabsAction">';
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2021-02-26 12:18:40 +00:00
|
|
|
if ($user->rights->user->user->creer && $action != 'edit') {
|
2021-09-27 10:24:01 +00:00
|
|
|
print '<a class="butAction" href="note.php?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify')."</a>";
|
2020-10-31 13:32:18 +00:00
|
|
|
}
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
print "</div>";
|
2007-09-08 09:44:26 +00:00
|
|
|
|
2015-05-30 18:07:44 +00:00
|
|
|
print "</form>\n";
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
2018-08-04 13:58:05 +00:00
|
|
|
// End of page
|
2011-08-27 14:24:16 +00:00
|
|
|
llxFooter();
|
2015-05-30 23:06:51 +00:00
|
|
|
$db->close();
|