Remove deprecated properties and use a method instead to get the full address string.

This commit is contained in:
Laurent Destailleur
2010-05-09 14:47:02 +00:00
parent 7823267380
commit fe8a652fe0
12 changed files with 53 additions and 49 deletions

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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
);

View File

@@ -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 != '')

View File

@@ -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;

View File

@@ -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 != '')

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@@ -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