* Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin * * 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 * the Free Software Foundation; either version 3 of the License, or * (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 * along with this program. If not, see . */ /** * \file htdocs/user/note.php * \ingroup usergroup * \brief Fiche de notes sur un utilisateur Dolibarr */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'usernote'; // To manage different context of search // Load translation files required by page $langs->loadLangs(array('companies', 'members', 'bills', 'users')); $object = new User($db); $object->fetch($id, '', '', 1); $object->getrights(); // If user is not user read and no permission to read other users, we stop if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) { accessforbidden(); } // Security check $socid = 0; if ($user->socid > 0) { $socid = $user->socid; } $feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('usercard', 'usernote', 'globalcard')); /* * Actions */ $parameters = array('id'=>$socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { if ($action == 'update' && $user->hasRight("user", "user", "write") && !GETPOST("cancel")) { $db->begin(); $res = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5)); if ($res < 0) { $mesg = '
'.$adh->error.'
'; $db->rollback(); } else { $db->commit(); } } } /* * View */ $form = new Form($db); $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; $title = $person_name." - ".$langs->trans('Notes'); $help_url = ''; llxHeader('', $title, $help_url); if ($id) { $head = user_prepare_head($object); $title = $langs->trans("User"); print dol_get_fiche_head($head, 'note', $title, -1, 'user'); $linkback = ''; if ($user->hasRight("user", "user", "read") || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; print '
'; print ''; print '
'; print ''; // Login print ''; if (!empty($object->ldap_sid) && $object->statut == 0) { print ''; } else { print ''; } print ''; $editenabled = (($action == 'edit') && !empty($user->hasRight("user", "user", "write"))); // Note print ''; print '"; print "
'.$langs->trans("Login").''; print $langs->trans("LoginAccountDisableInDolibarr"); print ''; $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 '
'.$langs->trans("Note").''; if ($editenabled) { print ""; print "id."\">"; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('note_private', $object->note_private, '', 280, 'dolibarr_notes', 'In', true, false, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_8, '90%'); $doleditor->Create(); } else { print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); } print "
"; print '
'; print dol_get_fiche_end(); if ($action == 'edit') { print $form->buttonsSaveCancel(); } /* * Actions */ print '
'; if ($user->hasRight("user", "user", "write") && $action != 'edit') { print ''.$langs->trans('Modify').""; } print "
"; print "
\n"; } // End of page llxFooter(); $db->close();