2004-10-20 23:06:45 +02:00
|
|
|
<?php
|
2007-01-22 16:41:57 +01:00
|
|
|
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2010-03-28 23:49:43 +02:00
|
|
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2010-06-30 17:39:47 +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>
|
2015-02-27 15:08:08 +01:00
|
|
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
2004-02-08 12:50:05 +01: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
|
2004-02-08 12:50:05 +01: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
|
2011-08-01 01:19:04 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-02-08 12:50:05 +01:00
|
|
|
*/
|
2004-09-14 19:28:37 +02:00
|
|
|
|
2005-04-11 19:40:57 +02:00
|
|
|
/**
|
2008-05-04 17:26:01 +02:00
|
|
|
* \file htdocs/societe/document.php
|
2008-05-04 17:19:02 +02:00
|
|
|
* \brief Tab for documents linked to third party
|
|
|
|
|
* \ingroup societe
|
2009-05-06 15:39:43 +02:00
|
|
|
*/
|
2004-09-14 19:28:37 +02:00
|
|
|
|
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/company.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';
|
2004-02-08 12:50:05 +01:00
|
|
|
|
2004-11-12 01:50:14 +01:00
|
|
|
$langs->load("companies");
|
2006-01-21 20:47:43 +01:00
|
|
|
$langs->load('other');
|
2004-11-12 01:50:14 +01:00
|
|
|
|
2011-07-05 18:10:56 +02:00
|
|
|
|
2017-05-16 13:27:32 +02:00
|
|
|
$action=GETPOST('action','aZ09');
|
2012-04-07 09:14:33 +02:00
|
|
|
$confirm=GETPOST('confirm');
|
2012-07-02 19:30:37 +02:00
|
|
|
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
2012-04-07 09:14:33 +02:00
|
|
|
$ref = GETPOST('ref', 'alpha');
|
2006-03-10 18:32:47 +01:00
|
|
|
|
2008-05-04 17:19:02 +02:00
|
|
|
// Security check
|
2009-03-03 01:12:56 +01:00
|
|
|
if ($user->societe_id > 0)
|
2008-05-04 17:19:02 +02:00
|
|
|
{
|
2012-09-12 16:02:01 +02:00
|
|
|
unset($action);
|
2008-05-04 17:19:02 +02:00
|
|
|
$socid = $user->societe_id;
|
|
|
|
|
}
|
2012-04-07 09:14:33 +02:00
|
|
|
$result = restrictedArea($user, 'societe', $id, '&societe');
|
2008-05-04 17:19:02 +02:00
|
|
|
|
|
|
|
|
// Get parameters
|
2010-11-20 14:08:44 +01:00
|
|
|
$sortfield = GETPOST("sortfield",'alpha');
|
|
|
|
|
$sortorder = GETPOST("sortorder",'alpha');
|
|
|
|
|
$page = GETPOST("page",'int');
|
2017-06-06 10:53:53 +02:00
|
|
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
2010-11-20 14:08:44 +01:00
|
|
|
$offset = $conf->liste_limit * $page;
|
2008-05-04 17:19:02 +02:00
|
|
|
$pageprev = $page - 1;
|
|
|
|
|
$pagenext = $page + 1;
|
2007-11-11 16:55:45 +01:00
|
|
|
if (! $sortorder) $sortorder="ASC";
|
2017-11-10 18:14:29 +01:00
|
|
|
if (! $sortfield) $sortfield="position_name";
|
2004-02-08 12:50:05 +01:00
|
|
|
|
2011-07-03 10:55:46 +02:00
|
|
|
$object = new Societe($db);
|
2012-07-02 19:30:37 +02:00
|
|
|
if ($id > 0 || ! empty($ref))
|
|
|
|
|
{
|
2012-04-07 09:14:33 +02:00
|
|
|
$result = $object->fetch($id, $ref);
|
2012-05-29 23:50:13 +02:00
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ;
|
2015-05-18 22:25:51 +02:00
|
|
|
$courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id,0,0,0,$object,'thirdparty');
|
2012-04-07 09:14:33 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-30 16:44:58 +02:00
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
|
|
|
$hookmanager->initHooks(array('thirdpartydocument','globalcard'));
|
|
|
|
|
|
|
|
|
|
|
2004-12-05 00:24:25 +01:00
|
|
|
|
2004-12-25 21:23:24 +01:00
|
|
|
/*
|
2006-01-21 20:47:43 +01:00
|
|
|
* Actions
|
2004-12-25 21:23:24 +01:00
|
|
|
*/
|
2006-03-23 18:41:17 +01:00
|
|
|
|
2016-04-02 14:16:16 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
2004-02-08 12:50:05 +01:00
|
|
|
|
2008-02-24 15:41:07 +01:00
|
|
|
|
2004-02-08 12:50:05 +01:00
|
|
|
/*
|
2009-05-06 15:39:43 +02:00
|
|
|
* View
|
|
|
|
|
*/
|
2004-09-14 19:22:36 +02:00
|
|
|
|
2009-06-30 02:01:47 +02:00
|
|
|
$form = new Form($db);
|
|
|
|
|
|
2015-03-12 17:29:52 +01:00
|
|
|
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Files");
|
|
|
|
|
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files");
|
2011-05-01 20:56:41 +02:00
|
|
|
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
2015-03-12 17:29:52 +01:00
|
|
|
llxHeader('',$title,$help_url);
|
2006-01-21 20:47:43 +01:00
|
|
|
|
2012-04-07 09:14:33 +02:00
|
|
|
if ($object->id)
|
2004-02-08 12:50:05 +01:00
|
|
|
{
|
2012-07-02 19:30:37 +02:00
|
|
|
/*
|
2016-02-27 06:38:48 +01:00
|
|
|
* Show tabs
|
2012-07-02 19:30:37 +02:00
|
|
|
*/
|
2012-09-15 10:01:35 +02:00
|
|
|
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
2012-07-02 19:30:37 +02:00
|
|
|
$head = societe_prepare_head($object);
|
|
|
|
|
|
|
|
|
|
$form=new Form($db);
|
|
|
|
|
|
2017-03-23 13:06:38 +01:00
|
|
|
dol_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company');
|
2012-07-02 19:30:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// Construit liste des fichiers
|
2017-04-12 11:30:33 +02:00
|
|
|
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
2012-07-02 19:30:37 +02:00
|
|
|
$totalsize=0;
|
|
|
|
|
foreach($filearray as $key => $file)
|
|
|
|
|
{
|
|
|
|
|
$totalsize+=$file['size'];
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-01 14:18:09 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
|
|
|
|
|
2016-09-18 14:12:49 +02:00
|
|
|
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
|
2017-07-01 14:18:09 +02:00
|
|
|
|
2015-10-13 13:06:32 +02:00
|
|
|
print '<div class="fichecenter">';
|
2017-07-01 14:18:09 +02:00
|
|
|
|
2015-10-13 13:06:32 +02:00
|
|
|
print '<div class="underbanner clearboth"></div>';
|
|
|
|
|
print '<table class="border centpercent">';
|
2012-07-02 19:30:37 +02:00
|
|
|
|
|
|
|
|
// Prefix
|
|
|
|
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
2012-05-30 12:43:23 +02:00
|
|
|
{
|
2016-05-17 02:16:28 +02:00
|
|
|
print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
2012-07-02 19:30:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($object->client)
|
|
|
|
|
{
|
2016-05-17 02:16:28 +02:00
|
|
|
print '<tr><td class="titlefield">';
|
2012-07-02 19:30:37 +02:00
|
|
|
print $langs->trans('CustomerCode').'</td><td colspan="3">';
|
|
|
|
|
print $object->code_client;
|
|
|
|
|
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($object->fournisseur)
|
|
|
|
|
{
|
2016-05-17 02:16:28 +02:00
|
|
|
print '<tr><td class="titlefield">';
|
2012-07-02 19:30:37 +02:00
|
|
|
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
|
|
|
|
print $object->code_fournisseur;
|
|
|
|
|
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-27 06:38:48 +01:00
|
|
|
// Number of files
|
2016-05-17 02:16:28 +02:00
|
|
|
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
2012-07-02 19:30:37 +02:00
|
|
|
|
2016-02-27 06:38:48 +01:00
|
|
|
// Total size
|
2018-04-12 15:29:22 +02:00
|
|
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>';
|
2012-07-02 19:30:37 +02:00
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
2015-10-13 13:06:32 +02:00
|
|
|
print '</div>';
|
2017-07-01 14:18:09 +02:00
|
|
|
|
2014-12-07 18:24:45 +01:00
|
|
|
dol_fiche_end();
|
2012-07-02 19:30:37 +02:00
|
|
|
|
2013-09-18 12:02:47 +02:00
|
|
|
$modulepart = 'societe';
|
|
|
|
|
$permission = $user->rights->societe->creer;
|
2016-10-14 18:09:24 +02:00
|
|
|
$permtoedit = $user->rights->societe->creer;
|
2013-09-18 12:02:47 +02:00
|
|
|
$param = '&id=' . $object->id;
|
2013-09-18 16:11:36 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
2004-02-08 12:50:05 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-07-03 10:55:46 +02:00
|
|
|
accessforbidden('',0,0);
|
2004-02-08 12:50:05 +01:00
|
|
|
}
|
2004-09-14 19:22:36 +02:00
|
|
|
|
2005-06-11 14:11:28 +02:00
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-04-07 09:14:33 +02:00
|
|
|
$db->close();
|