diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index fef3f1edb2d..ed7115063da 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -23,7 +23,7 @@
* \file htdocs/societe/document.php
* \brief Tab for documents linked to third party
* \ingroup societe
- * \version $Id$
+ * \version $Id: document.php,v 1.30 2011/07/03 08:55:46 hregis Exp $
*/
require("../main.inc.php");
@@ -38,7 +38,7 @@ $langs->load('other');
$mesg = "";
// Security check
-$socid = isset($_GET["socid"])?$_GET["socid"]:(! empty($_GET["id"])?$_GET["id"]:'');
+$socid = (GETPOST('socid') ? GETPOST('socid') : GETPOST('id'));
if ($user->societe_id > 0)
{
unset($_GET["action"]);
@@ -61,6 +61,7 @@ if (! $sortfield) $sortfield="name";
$upload_dir = $conf->societe->dir_output . "/" . $socid ;
$courrier_dir = $conf->societe->dir_output . "/courrier/" . get_exdir($socid) ;
+$object = new Societe($db);
/*
* Actions
@@ -125,14 +126,13 @@ llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Files"),$help_url)
if ($socid > 0)
{
- $societe = new Societe($db);
- if ($societe->fetch($socid))
+ if ($object->fetch($socid))
{
/*
* Affichage onglets
*/
if ($conf->notification->enabled) $langs->load("mails");
- $head = societe_prepare_head($societe);
+ $head = societe_prepare_head($object);
$html=new Form($db);
@@ -153,30 +153,30 @@ if ($socid > 0)
// Ref
print '
| '.$langs->trans("ThirdPartyName").' | ';
print '';
- print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom');
+ print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print ' |
';
// Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
- print '| '.$langs->trans('Prefix').' | '.$societe->prefix_comm.' |
';
+ print '| '.$langs->trans('Prefix').' | '.$object->prefix_comm.' |
';
}
- if ($societe->client)
+ if ($object->client)
{
print '| ';
print $langs->trans('CustomerCode').' | ';
- print $societe->code_client;
- if ($societe->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
+ print $object->code_client;
+ if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
print ' |
';
}
- if ($societe->fournisseur)
+ if ($object->fournisseur)
{
print '| ';
print $langs->trans('SupplierCode').' | ';
- print $societe->code_fournisseur;
- if ($societe->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
+ print $object->code_fournisseur;
+ if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
print ' |
';
}
@@ -190,7 +190,7 @@ if ($socid > 0)
print '';
- if ($mesg) { print "$mesg
"; }
+ dol_htmloutput_mesg($mesg,$mesgs);
/*
* Confirmation suppression fichier
@@ -208,8 +208,8 @@ if ($socid > 0)
// List of document
- $param='&socid='.$societe->id;
- $formfile->list_of_documents($filearray,$societe,'societe',$param);
+ $param='&socid='.$object->id;
+ $formfile->list_of_documents($filearray,$object,'societe',$param);
print "
";
@@ -268,12 +268,12 @@ if ($socid > 0)
}
else
{
- dol_print_error();
+ accessforbidden('',0,0);
}
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/03 08:55:46 $ - $Revision: 1.30 $');
?>