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');
|
|
|
|
|
$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
|
2015-06-26 13:26:08 +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
|
|
|
|
|
$socid=0;
|
2019-10-31 19:46:31 +00:00
|
|
|
if ($user->socid > 0) $socid = $user->socid;
|
2009-08-06 13:07:25 +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
|
2018-03-31 16:48:27 +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
|
|
|
|
2015-09-16 07:37:49 +00:00
|
|
|
$parameters=array('id'=>$socid);
|
2019-01-27 10:55:16 +00:00
|
|
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
2015-09-16 07:37:49 +00:00
|
|
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
|
|
|
|
|
|
|
if (empty($reshook)) {
|
|
|
|
|
if ($action == 'update' && $user->rights->user->user->creer && !$_POST["cancel"]) {
|
|
|
|
|
$db->begin();
|
|
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
$res = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES));
|
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
|
|
|
|
|
|
|
|
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");
|
2017-04-01 11:49:17 +00:00
|
|
|
dol_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
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
|
2017-11-04 14:40:35 +00:00
|
|
|
|
2015-10-11 14:12:12 +00:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
2017-11-04 14:40:35 +00:00
|
|
|
|
2015-10-11 14:12:12 +00:00
|
|
|
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
2009-05-17 08:01:54 +00:00
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2009-05-05 00:25:14 +00:00
|
|
|
|
2017-04-01 11:49:17 +00:00
|
|
|
print '<div class="fichecenter">';
|
2019-10-06 13:34:22 +00:00
|
|
|
print '<table class="border centpercent tableforfield">';
|
2007-09-08 09:44:26 +00:00
|
|
|
|
|
|
|
|
// Login
|
2015-10-11 14:12:12 +00:00
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
2007-09-08 09:44:26 +00:00
|
|
|
|
|
|
|
|
// Note
|
2015-05-30 23:06:51 +00:00
|
|
|
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td>';
|
2015-10-11 14:12:12 +00:00
|
|
|
print '<td>';
|
2007-09-08 09:44:26 +00:00
|
|
|
if ($action == 'edit' && $user->rights->user->user->creer)
|
|
|
|
|
{
|
|
|
|
|
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."\">";
|
2011-05-01 20:53:46 +00:00
|
|
|
// Editeur wysiwyg
|
2012-08-22 21:11:24 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
2019-01-27 10:55:16 +00:00
|
|
|
$doleditor=new DolEditor('note_private', $object->note, '', 280, 'dolibarr_notes', 'In', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%');
|
2011-05-01 20:53:46 +00:00
|
|
|
$doleditor->Create();
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-06-26 13:26:08 +00:00
|
|
|
print dol_htmlentitiesbr($object->note);
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
print "</td></tr>";
|
|
|
|
|
|
2011-11-05 22:18:49 +00:00
|
|
|
print "</table>";
|
2017-04-01 11:49:17 +00:00
|
|
|
print '</div>';
|
2011-11-05 22:18:49 +00:00
|
|
|
|
2015-05-30 18:07:44 +00:00
|
|
|
dol_fiche_end();
|
|
|
|
|
|
2007-09-08 09:44:26 +00:00
|
|
|
if ($action == 'edit')
|
|
|
|
|
{
|
2015-05-30 18:07:44 +00:00
|
|
|
print '<div class="center">';
|
2007-09-08 09:44:26 +00:00
|
|
|
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Save").'">';
|
2014-11-24 05:43:15 +00:00
|
|
|
print ' ';
|
2007-09-08 09:44:26 +00:00
|
|
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
2014-11-24 05:43:15 +00:00
|
|
|
print '</div>';
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-05-30 18:07:44 +00:00
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2009-05-05 00:25:14 +00:00
|
|
|
|
2007-09-08 09:44:26 +00:00
|
|
|
print '<div class="tabsAction">';
|
|
|
|
|
|
|
|
|
|
if ($user->rights->user->user->creer && $action != 'edit')
|
|
|
|
|
{
|
2015-06-26 13:26:08 +00:00
|
|
|
print "<a class=\"butAction\" href=\"note.php?id=".$object->id."&action=edit\">".$langs->trans('Modify')."</a>";
|
2007-09-08 09:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
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();
|