Fix: uniformize code

This commit is contained in:
Regis Houssin 2011-07-03 08:55:46 +00:00
parent b3e36430fc
commit ec68b60746

View File

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