2010-08-29 23:44:35 +02:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
2010-08-29 23:44:35 +02:00
|
|
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
2013-07-25 18:35:48 +02:00
|
|
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
2010-08-29 23:44:35 +02: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 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2010-08-29 23:44:35 +02: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 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2010-08-29 23:44:35 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \file htdocs/adherents/document.php
|
|
|
|
|
* \brief Tab for documents linked to third party
|
|
|
|
|
* \ingroup societe
|
|
|
|
|
*/
|
|
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2018-09-07 10:40:36 +02:00
|
|
|
// Load translation files required by the page
|
2020-04-10 10:59:32 +02:00
|
|
|
$langs->loadLangs(array("companies", "members", "other"));
|
2018-09-07 10:40:36 +02:00
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$id = GETPOST('id', 'int');
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2020-04-10 10:59:32 +02:00
|
|
|
$confirm = GETPOST('confirm', 'alpha');
|
2012-05-31 17:48:03 +02:00
|
|
|
|
2010-08-29 23:44:35 +02:00
|
|
|
// Security check
|
2020-04-10 10:59:32 +02:00
|
|
|
$result = restrictedArea($user, 'adherent', $id);
|
2010-08-29 23:44:35 +02:00
|
|
|
|
|
|
|
|
// Get parameters
|
2020-04-20 15:06:27 +02:00
|
|
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
2019-01-27 11:55:16 +01:00
|
|
|
$sortfield = GETPOST("sortfield", 'alpha');
|
|
|
|
|
$sortorder = GETPOST("sortorder", 'alpha');
|
2020-03-13 13:07:11 +01:00
|
|
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
2017-11-03 19:52:02 +01:00
|
|
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
2020-04-20 15:06:27 +02:00
|
|
|
$offset = $limit * $page;
|
2010-08-29 23:44:35 +02:00
|
|
|
$pageprev = $page - 1;
|
|
|
|
|
$pagenext = $page + 1;
|
2020-04-10 10:59:32 +02:00
|
|
|
if (!$sortorder) $sortorder = "ASC";
|
|
|
|
|
if (!$sortfield) $sortfield = "name";
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2010-11-20 14:08:44 +01:00
|
|
|
|
2013-07-25 18:35:48 +02:00
|
|
|
$form = new Form($db);
|
2020-04-10 10:59:32 +02:00
|
|
|
$object = new Adherent($db);
|
|
|
|
|
$membert = new AdherentType($db);
|
|
|
|
|
$result = $object->fetch($id);
|
2020-05-21 09:12:18 +02:00
|
|
|
if ($result < 0) {
|
2013-07-25 18:35:48 +02:00
|
|
|
dol_print_error($db);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2020-04-10 10:59:32 +02:00
|
|
|
$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
|
2015-05-18 22:25:51 +02:00
|
|
|
|
|
|
|
|
|
2010-08-29 23:44:35 +02:00
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
2010-08-29 23:44:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2015-10-16 20:16:28 +02:00
|
|
|
$form = new Form($db);
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$title = $langs->trans("Member")." - ".$langs->trans("Documents");
|
|
|
|
|
$helpurl = "EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
2019-01-27 11:55:16 +01:00
|
|
|
llxHeader("", $title, $helpurl);
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2020-05-21 09:12:18 +02:00
|
|
|
if ($id > 0) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$result = $membert->fetch($object->typeid);
|
2020-05-21 09:12:18 +02:00
|
|
|
if ($result > 0) {
|
2018-08-04 14:17:51 +02:00
|
|
|
// Build file list
|
2020-04-10 10:59:32 +02:00
|
|
|
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
|
|
|
|
$totalsize = 0;
|
2020-05-21 09:12:18 +02:00
|
|
|
foreach ($filearray as $key => $file) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$totalsize += $file['size'];
|
2010-08-29 23:44:35 +02:00
|
|
|
}
|
2017-10-03 16:00:52 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
if (!empty($conf->notification->enabled))
|
2015-10-16 20:16:28 +02:00
|
|
|
$langs->load("mails");
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2015-10-16 20:16:28 +02:00
|
|
|
$head = member_prepare_head($object);
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2020-10-22 16:47:35 +02:00
|
|
|
print dol_get_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
|
2012-07-28 21:49:47 +02:00
|
|
|
|
2017-10-03 16:00:52 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
|
|
|
|
|
2015-10-16 20:16:28 +02:00
|
|
|
dol_banner_tab($object, 'rowid', $linkback);
|
2017-10-03 16:00:52 +02:00
|
|
|
|
2015-10-16 20:16:28 +02:00
|
|
|
print '<div class="fichecenter">';
|
2017-10-03 16:00:52 +02:00
|
|
|
|
2015-10-16 20:16:28 +02:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
2019-03-29 13:26:26 +01:00
|
|
|
print '<table class="border tableforfield centpercent">';
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2019-12-05 15:22:06 +01:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2011-03-06 14:55:47 +01:00
|
|
|
// Login
|
2020-05-21 09:12:18 +02:00
|
|
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
2015-10-16 20:16:28 +02:00
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
2011-03-06 14:55:47 +01:00
|
|
|
}
|
|
|
|
|
|
2015-10-16 20:16:28 +02:00
|
|
|
// Type
|
|
|
|
|
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
|
|
|
|
|
|
2011-03-06 14:55:47 +01:00
|
|
|
// Morphy
|
2019-06-24 17:59:00 +02:00
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
2019-03-19 14:06:54 +01:00
|
|
|
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
|
2016-03-25 15:24:57 +01:00
|
|
|
print $form->showphoto('memberphoto',$object);
|
2011-03-06 14:55:47 +01:00
|
|
|
print '</td>';*/
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Company
|
2019-09-01 22:21:48 +02:00
|
|
|
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
|
2011-03-06 14:55:47 +01:00
|
|
|
|
|
|
|
|
// Civility
|
2013-07-23 18:22:10 +02:00
|
|
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().' </td>';
|
2011-03-06 14:55:47 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
|
2019-03-19 14:06:54 +01:00
|
|
|
// Number of Attached Files
|
2011-09-17 21:49:50 +02:00
|
|
|
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2019-03-19 14:06:54 +01:00
|
|
|
//Total Size Of Attached Files
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
|
2010-08-29 23:44:35 +02:00
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
2017-10-03 16:00:52 +02:00
|
|
|
|
2020-10-27 18:19:31 +01:00
|
|
|
print dol_get_fiche_end();
|
2010-08-29 23:44:35 +02:00
|
|
|
|
2013-09-18 14:55:25 +02:00
|
|
|
$modulepart = 'member';
|
|
|
|
|
$permission = $user->rights->adherent->creer;
|
2016-10-14 18:09:24 +02:00
|
|
|
$permtoedit = $user->rights->adherent->creer;
|
2020-04-10 10:59:32 +02:00
|
|
|
$param = '&id='.$object->id;
|
|
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
2010-08-29 23:44:35 +02:00
|
|
|
print "<br><br>";
|
2020-05-21 00:47:16 +02:00
|
|
|
} else {
|
2010-08-29 23:44:35 +02:00
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
2020-05-21 00:47:16 +02:00
|
|
|
} else {
|
2010-08-29 23:44:35 +02:00
|
|
|
$langs->load("errors");
|
|
|
|
|
print $langs->trans("ErrorRecordNotFound");
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-28 14:29:28 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-04-15 11:28:21 +02:00
|
|
|
$db->close();
|