From c5a3b4481e382ac2042a4a0d01c27b56f7921fc4 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 15 Jan 2015 03:11:06 +0100
Subject: [PATCH] Fixed: use object

---
 htdocs/societe/agenda.php | 53 ++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 28 deletions(-)

diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php
index 8d731875442..a6ba3d7b1cf 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -59,9 +59,6 @@ $contactstatic = new Contact($db);
 
 $form = new Form($db);
 
-/*
- * Fiche categorie de client et/ou fournisseur
- */
 if ($socid)
 {
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@@ -70,79 +67,79 @@ if ($socid)
 	$langs->load("companies");
 
 
-	$soc = new Societe($db);
-	$result = $soc->fetch($socid);
+	$object = new Societe($db);
+	$result = $object->fetch($socid);
 	llxHeader("",$langs->trans("Agenda"),'');
 
 	if (! empty($conf->notification->enabled)) $langs->load("mails");
-	$head = societe_prepare_head($soc);
+	$head = societe_prepare_head($object);
 
 	dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company');
 
 	print '<table class="border" width="100%">';
 
 	print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
-	print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom');
+	print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
 	print '</td></tr>';
 
     if (! empty($conf->global->SOCIETE_USEPREFIX))  // Old not used prefix field
     {
-        print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
+        print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
     }
 
-	if ($soc->client)
+	if ($object->client)
 	{
 		print '<tr><td>';
 		print $langs->trans('CustomerCode').'</td><td colspan="3">';
-		print $soc->code_client;
-		if ($soc->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
+		print $object->code_client;
+		if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
 		print '</td></tr>';
 	}
 
-	if ($soc->fournisseur)
+	if ($object->fournisseur)
 	{
 		print '<tr><td>';
 		print $langs->trans('SupplierCode').'</td><td colspan="3">';
-		print $soc->code_fournisseur;
-		if ($soc->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
+		print $object->code_fournisseur;
+		if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
 		print '</td></tr>';
 	}
 
 	if (! empty($conf->barcode->enabled))
 	{
-		print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->barcode.'</td></tr>';
+		print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$object->barcode.'</td></tr>';
 	}
 
 	print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">";
-	dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id);
+	dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
 	print "</td></tr>";
 
 	// Zip / Town
-	print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>";
-	print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$soc->town."</td></tr>";
+	print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$object->zip."</td>";
+	print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$object->town."</td></tr>";
 
 	// Country
-	if ($soc->country) {
+	if ($object->country) {
 		print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
-		$img=picto_from_langcode($soc->country_code);
+		$img=picto_from_langcode($object->country_code);
 		print ($img?$img.' ':'');
-		print $soc->country;
+		print $object->country;
 		print '</td></tr>';
 	}
 
 	// EMail
 	print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">';
-	print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL');
+	print dol_print_email($object->email,0,$object->id,'AC_EMAIL');
 	print '</td></tr>';
 
 	// Web
 	print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
-	print dol_print_url($soc->url);
+	print dol_print_url($object->url);
 	print '</td></tr>';
 
 	// Phone / Fax
-	print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
-	print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
+	print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
+	print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
 
 	print '</table>';
 
@@ -171,7 +168,7 @@ if ($socid)
 
     print '<br>';
 
-    $objthirdparty=$soc;
+    $objthirdparty=$object;
     $objcon=new stdClass();
 
     $out='';
@@ -189,10 +186,10 @@ if ($socid)
     print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,'');
 
     // List of todo actions
-    show_actions_todo($conf,$langs,$db,$soc);
+    show_actions_todo($conf,$langs,$db,$object);
 
     // List of done actions
-    show_actions_done($conf,$langs,$db,$soc);
+    show_actions_done($conf,$langs,$db,$object);
 }
 
 
-- 
GitLab