dolibarr/htdocs/adherents/note.php

159 lines
5.6 KiB
PHP
Raw Normal View History

<?php
2015-04-06 18:58:36 +02:00
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/adherents/note.php
* \ingroup member
* \brief Tab for note of a member
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
2018-09-07 10:40:36 +02:00
// Load translation files required by the page
$langs->loadLangs(array("companies", "members", "bills"));
2020-09-16 19:39:50 +02:00
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
2021-03-29 15:24:47 +02:00
$ref = GETPOST('ref', 'alphanohtml');
$object = new Adherent($db);
$result = $object->fetch($id);
2020-05-21 09:12:18 +02:00
if ($result > 0) {
$adht = new AdherentType($db);
$result = $adht->fetch($object->typeid);
}
$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
2021-03-29 15:24:47 +02:00
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to determine what the current user can do on the members
$canaddmember = $user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
2021-07-09 18:36:21 +02:00
$hookmanager->initHooks(array('membernote'));
2021-03-29 15:24:47 +02:00
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*
* Actions
*/
2021-07-09 18:36:21 +02:00
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
2021-07-11 09:42:35 +02:00
if ($reshook < 0) {
2021-07-09 18:36:21 +02:00
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2021-07-11 09:42:35 +02:00
}
2021-07-11 09:43:02 +02:00
if (empty($reshook)) {
2021-07-09 18:36:21 +02:00
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
2021-07-11 09:42:35 +02:00
}
2009-08-12 14:59:14 +02:00
/*
* View
*/
$title = $langs->trans("Member")." - ".$langs->trans("Note");
$help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
llxHeader("", $title, $help_url);
$form = new Form($db);
2020-05-21 09:12:18 +02:00
if ($id) {
$head = member_prepare_head($object);
2009-07-28 20:55:36 +02:00
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
2021-03-29 21:04:33 +02:00
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
2009-07-28 20:55:36 +02:00
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
2021-12-25 17:08:40 +01:00
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
2019-09-02 04:38:01 +02:00
print '<table class="border centpercent tableforfield">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
2011-03-06 14:55:47 +01:00
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
2021-03-01 00:19:52 +01:00
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
2011-03-06 14:55:47 +01:00
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
2011-03-06 14:55:47 +01:00
print "</table>";
print '</div>';
2009-07-28 20:55:36 +02:00
$cssclass = 'titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print dol_get_fiche_end();
}
2018-07-28 14:29:28 +02:00
// End of page
llxFooter();
2012-04-15 11:28:21 +02:00
$db->close();