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>
|
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
|
|
|
|
2012-04-07 09:14:33 +02:00
|
|
|
$action=GETPOST('action');
|
|
|
|
|
$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');
|
|
|
|
|
if ($page == -1) { $page = 0; }
|
|
|
|
|
$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";
|
|
|
|
|
if (! $sortfield) $sortfield="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 ;
|
2012-04-07 09:14:33 +02:00
|
|
|
$courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
2013-09-18 16:11:36 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.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);
|
|
|
|
|
|
2011-05-01 20:56:41 +02:00
|
|
|
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
|
|
|
|
llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Files"),$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
|
|
|
/*
|
2012-04-07 09:14:33 +02:00
|
|
|
* Affichage onglets
|
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);
|
|
|
|
|
|
|
|
|
|
dol_fiche_head($head, 'document', $langs->trans("ThirdParty"),0,'company');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Construit liste des fichiers
|
|
|
|
|
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
|
|
|
|
$totalsize=0;
|
|
|
|
|
foreach($filearray as $key => $file)
|
|
|
|
|
{
|
|
|
|
|
$totalsize+=$file['size'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<table class="border"width="100%">';
|
|
|
|
|
|
|
|
|
|
// Ref
|
2013-04-10 16:15:35 +02:00
|
|
|
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td>';
|
2012-07-02 19:30:37 +02:00
|
|
|
print '<td colspan="3">';
|
|
|
|
|
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
// Prefix
|
|
|
|
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
2012-05-30 12:43:23 +02:00
|
|
|
{
|
2012-07-02 19:30:37 +02:00
|
|
|
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($object->client)
|
|
|
|
|
{
|
|
|
|
|
print '<tr><td>';
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
print '<tr><td>';
|
|
|
|
|
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>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Nbre fichiers
|
|
|
|
|
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
|
|
|
|
|
|
|
|
|
//Total taille
|
|
|
|
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
2013-09-18 12:02:47 +02:00
|
|
|
$modulepart = 'societe';
|
|
|
|
|
$permission = $user->rights->societe->creer;
|
|
|
|
|
$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();
|
2004-02-08 12:50:05 +01:00
|
|
|
?>
|