From fe8a652fe04cdc8e1436187ffa6008204cc4de3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 9 May 2010 14:47:02 +0000 Subject: [PATCH] Remove deprecated properties and use a method instead to get the full address string. --- htdocs/comm/class/adresse_livraison.class.php | 23 ++++++++----------- .../modules/commande/pdf_edison.modules.php | 2 +- .../modules/commande/pdf_einstein.modules.php | 2 +- .../modules/facture/pdf_crabe.modules.php | 2 +- .../modules/facture/pdf_oursin.modules.php | 2 +- .../propale/pdf_propale_azur.modules.php | 2 +- .../propale/pdf_propale_jaune.modules.php | 2 +- .../societe/doc/doc_generic_odt.modules.php | 9 ++++---- htdocs/lib/pdf.lib.php | 16 ++++++------- htdocs/master.inc.php | 10 ++++---- htdocs/paybox/paybox.lib.php | 16 ++++++------- htdocs/societe/class/societe.class.php | 16 ++++++++++--- 12 files changed, 53 insertions(+), 49 deletions(-) diff --git a/htdocs/comm/class/adresse_livraison.class.php b/htdocs/comm/class/adresse_livraison.class.php index 05c458f3312..ff1f0ab2ff9 100644 --- a/htdocs/comm/class/adresse_livraison.class.php +++ b/htdocs/comm/class/adresse_livraison.class.php @@ -304,8 +304,6 @@ class AdresseLivraison $ligne->adresse = $objp->address; // TODO obsolete $ligne->cp = $objp->cp; $ligne->ville = $objp->ville; - $ligne->adresse_full = $objp->address . "\n". $objp->cp . ' '. $objp->ville; - $ligne->full_address = $objp->address . "\n". $objp->cp . ' '. $objp->ville; // TODO obsolete $ligne->pays_id = $objp->fk_pays; $ligne->pays_code = $objp->fk_pays?$objp->pays_code:''; $ligne->pays = $objp->fk_pays?($langs->trans('Country'.$objp->pays_code)!='Country'.$objp->pays_code?strtoupper($langs->trans('Country'.$objp->pays_code)):$objp->pays):''; @@ -349,8 +347,8 @@ class AdresseLivraison global $langs; global $conf; - $sql = 'SELECT a.rowid, a.fk_societe, a.label, a.nom, a.address,'.$this->db->pdate('a.datec').' as dc'; - $sql .= ','. $this->db->pdate('a.tms').' as date_update'; + $sql = 'SELECT a.rowid, a.fk_societe, a.label, a.nom, a.address, a.datec as date_creation'; + $sql .= ', a.tms as date_update'; $sql .= ', a.cp,a.ville, a.note, a.fk_pays, a.tel, a.fax'; $sql .= ', p.code as pays_code, p.libelle as pays'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_adresse_livraison as a'; @@ -366,17 +364,15 @@ class AdresseLivraison $this->id = $obj->rowid; $this->socid = $obj->fk_societe; - $this->date_update = $obj->date_update; - $this->date_creation = $obj->date_creation; + $this->date_update = $this->db->jdate($obj->date_update); + $this->date_creation = $this->db->jdate($obj->date_creation); - $this->label = stripslashes($obj->label); - $this->nom = stripslashes($obj->nom); - $this->adresse = stripslashes($obj->address); // TODO obsolete - $this->address = stripslashes($obj->address); + $this->label = $obj->label; + $this->nom = $obj->nom; + $this->adresse = $obj->address; // TODO obsolete + $this->address = $obj->address; $this->cp = $obj->cp; - $this->ville = stripslashes($obj->ville); - $this->adresse_full = stripslashes($obj->address) . "\n". $obj->cp . ' '. stripslashes($obj->ville); - $this->full_address = stripslashes($obj->address) . "\n". $obj->cp . ' '. stripslashes($obj->ville); //TODO obsolete + $this->ville = $obj->ville; $this->pays_id = $obj->fk_pays; $this->pays_code = $obj->fk_pays?$obj->pays_code:''; @@ -487,7 +483,6 @@ class AdresseLivraisonLigne var $adresse; var $cp; var $ville; - var $adresse_full; var $pays_id; var $pays_code; var $pays; diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php index 880fc04918b..8f5d6274f32 100644 --- a/htdocs/includes/modules/commande/pdf_edison.modules.php +++ b/htdocs/includes/modules/commande/pdf_edison.modules.php @@ -415,7 +415,7 @@ class pdf_edison extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } } diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 016cc1b4f44..2f8a38679f5 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -501,7 +501,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } } diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 79f3a628750..4ce09d49e37 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -643,7 +643,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } } diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index 586d41aed36..87f4aaa2a62 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -554,7 +554,7 @@ class pdf_oursin extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } } diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 7d35af0988d..5e0feb985f3 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -521,7 +521,7 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } } diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php index 46c3f3476f8..2897048cd98 100644 --- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -405,7 +405,7 @@ class pdf_propale_jaune extends ModelePDFPropales $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } } diff --git a/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php index 51a41e4dbb1..1c17e598c20 100644 --- a/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php @@ -81,6 +81,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc */ function get_substitutionarray_mysoc($mysoc) { +var_dump($mysoc);exit; return array( 'mycompany_logo'=>$mysoc->logo, 'mycompany_name'=>$mysoc->name, @@ -95,10 +96,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc 'mycompany_juridicalstatus'=>$mysoc->forme_juridique, 'mycompany_capital'=>$mysoc->capital, 'mycompany_barcode'=>$mysoc->gencode, - 'mycompany_idprof1'=>$mysoc->profid1, - 'mycompany_idprof2'=>$mysoc->profid2, - 'mycompany_idprof3'=>$mysoc->profid3, - 'mycompany_idprof4'=>$mysoc->profid4, + 'mycompany_idprof1'=>$mysoc->idprof1, + 'mycompany_idprof2'=>$mysoc->idprof2, + 'mycompany_idprof3'=>$mysoc->idprof3, + 'mycompany_idprof4'=>$mysoc->idprof4, 'mycompany_vatnumber'=>$mysoc->tva_intra, 'mycompany_note'=>$mysoc->note ); diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 9713a498f83..427940b4c92 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -213,35 +213,35 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie); } // Prof Id 1 - if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2)) + if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2)) { $field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid1); + $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 - if ($fromcompany->profid2) + if ($fromcompany->idprof2) { $field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid2); + $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof2); } // Second line of company infos $ligne2=""; // Prof Id 3 - if ($fromcompany->profid3) + if ($fromcompany->idprof3) { $field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid3); + $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 - if ($fromcompany->profid4) + if ($fromcompany->idprof4) { $field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid4); + $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 2c1de700d92..d97dc26accc 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -380,16 +380,14 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC')) $mysoc->ape=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; $mysoc->rcs=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS; // Id prof generiques - $mysoc->profid1=empty($conf->global->MAIN_INFO_SIREN)?'':$conf->global->MAIN_INFO_SIREN; - $mysoc->profid2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET; - $mysoc->profid3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; - $mysoc->profid4=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS; + $mysoc->idprof1=empty($conf->global->MAIN_INFO_SIREN)?'':$conf->global->MAIN_INFO_SIREN; + $mysoc->idprof2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET; + $mysoc->idprof3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; + $mysoc->idprof4=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS; $mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA. $mysoc->capital=$conf->global->MAIN_INFO_CAPITAL; $mysoc->forme_juridique_code=$conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE; $mysoc->email=$conf->global->MAIN_INFO_SOCIETE_MAIL; - $mysoc->adresse_full=$mysoc->adresse."\n".$mysoc->cp." ".$mysoc->ville; // TODO obsolete - $mysoc->full_address=$mysoc->adresse."\n".$mysoc->cp." ".$mysoc->ville; $mysoc->logo=$conf->global->MAIN_INFO_SOCIETE_LOGO; $mysoc->logo_small=$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; diff --git a/htdocs/paybox/paybox.lib.php b/htdocs/paybox/paybox.lib.php index 76bd636656f..c3af69cb18c 100644 --- a/htdocs/paybox/paybox.lib.php +++ b/htdocs/paybox/paybox.lib.php @@ -247,35 +247,35 @@ function html_print_footer($fromcompany,$langs) $ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie); } // Prof Id 1 - if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2)) + if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2)) { $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid1); + $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 - if ($fromcompany->profid2) + if ($fromcompany->idprof2) { $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid2); + $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2); } // Second line of company infos $ligne2=""; // Prof Id 3 - if ($fromcompany->profid3) + if ($fromcompany->idprof3) { $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid3); + $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 - if ($fromcompany->profid4) + if ($fromcompany->idprof4) { $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; - $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid4); + $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2ccdf3e4980..94fcb35f002 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2003 Brian Fraval * Copyright (C) 2006 Andre Cianfarani @@ -615,8 +615,6 @@ class Societe extends CommonObject $this->zip = $obj->cp; $this->ville = $obj->ville;// TODO obsolete $this->town = $obj->ville; - $this->adresse_full = $obj->address . "\n". $obj->cp . ' '. $obj->ville; // TODO obsolete - $this->full_address = $obj->address . "\n". $obj->cp . ' '. $obj->ville; $this->pays_id = $obj->fk_pays; $this->pays_code = $obj->fk_pays?$obj->pays_code:''; @@ -1360,6 +1358,18 @@ class Societe extends CommonObject } + /** + * \brief Return full address of a third party (TODO in format of its country) + * \return string Full address string + */ + function getFullAddress() + { + $ret=''; + $ret.=($this->address?$this->address."\n":''); + $ret.=trim($this->zip.' '.$this->town); + return $ret; + } + /** * \brief Renvoie la liste des contacts emails existant pour la societe