From c9faf58401618557a95b841edb8c20427c658faa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Aug 2005 19:22:23 +0000 Subject: [PATCH] Le code des identifiants professionnel depend du pays emetteur et non de la langue --- .../modules/facture/pdf_crabe.modules.php | 26 +++++++++-------- .../propale/pdf_propale_azur.modules.php | 28 +++++++++---------- htdocs/langs/fr_FR/companies.lang | 4 +-- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index aafc79606a7..a3088eacd92 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -43,7 +43,7 @@ class pdf_crabe extends ModelePDFFactures */ function pdf_crabe($db) { - global $langs; + global $conf,$langs; $this->db = $db; $this->name = "crabe"; @@ -59,14 +59,14 @@ class pdf_crabe extends ModelePDFFactures if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') $this->franchise=1; - // Recupere code pays - $this->code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation + // Recupere code pays de l'emmetteur + $this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; - $sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; + $sql .= " WHERE rowid = '".$conf->global->MAIN_INFO_SOCIETE_PAYS."'"; $result=$this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - if ($obj->code) $this->code_pays=$obj->code; + if ($obj->code) $this->emetteur->code_pays=$obj->code; } else { dolibarr_print_error($this->db); @@ -645,10 +645,12 @@ class pdf_crabe extends ModelePDFFactures // Logo if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) { - if (file_exists(FAC_PDF_LOGO)) { + if (file_exists(FAC_PDF_LOGO)) + { $pdf->Image(FAC_PDF_LOGO, 10, 5, 0, 24); } - else { + else + { $pdf->SetTextColor(200,0,0); $pdf->SetFont('Arial','B',8); $pdf->MultiCell(80, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); @@ -786,15 +788,15 @@ class pdf_crabe extends ModelePDFFactures } if ($conf->global->MAIN_INFO_SIRET) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->code_pays).": ".$conf->global->MAIN_INFO_SIRET; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; } - elseif ($conf->global->MAIN_INFO_SIREN) + if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->code_pays).": ".$conf->global->MAIN_INFO_SIREN; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; } if ($conf->global->MAIN_INFO_APE) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->code_pays).": ".MAIN_INFO_APE; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; } if ($ligne) @@ -807,7 +809,7 @@ class pdf_crabe extends ModelePDFFactures $ligne=""; if ($conf->global->MAIN_INFO_RCS) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->code_pays).": ".$conf->global->MAIN_INFO_RCS; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; } if ($conf->global->MAIN_INFO_TVAINTRA != '') { diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 9ea337984a0..5ffcf5cf840 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -44,7 +44,7 @@ class pdf_propale_azur extends ModelePDFPropales */ function pdf_propale_azur($db) { - global $langs; + global $conf,$langs; $this->db = $db; $this->name = "azur"; @@ -60,14 +60,14 @@ class pdf_propale_azur extends ModelePDFPropales if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') $this->franchise=1; - // Recupere code pays - $this->code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation + // Recupere code pays de l'emmetteur + $this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; - $sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; + $sql .= " WHERE rowid = '".$conf->global->MAIN_INFO_SOCIETE_PAYS."'"; $result=$this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - if ($obj->code) $this->code_pays=$obj->code; + if ($obj->code) $this->emetteur->code_pays=$obj->code; } else { dolibarr_print_error($this->db); @@ -379,7 +379,7 @@ class pdf_propale_azur extends ModelePDFPropales /* * \brief Affiche le total à payer * \param pdf Objet PDF - * \param fac Objet propale + * \param prop Objet propale * \param deja_regle Montant deja regle * \return y Position pour suite */ @@ -676,7 +676,7 @@ class pdf_propale_azur extends ModelePDFPropales /* * \brief Affiche le pied de page de la propale * \param pdf objet PDF - * \param fac objet propale + * \param prop objet propale */ function _pagefoot(&$pdf, $prop) { @@ -707,15 +707,15 @@ class pdf_propale_azur extends ModelePDFPropales } if ($conf->global->MAIN_INFO_SIRET) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->code_pays).": ".$conf->global->MAIN_INFO_SIRET; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; } - elseif ($conf->global->MAIN_INFO_SIREN) + if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->code_pays).": ".$conf->global->MAIN_INFO_SIREN; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; } if ($conf->global->MAIN_INFO_APE) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->code_pays).": ".MAIN_INFO_APE; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; } if ($ligne) @@ -728,7 +728,7 @@ class pdf_propale_azur extends ModelePDFPropales $ligne=""; if ($conf->global->MAIN_INFO_RCS) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->code_pays).": ".$conf->global->MAIN_INFO_RCS; + $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; } if ($conf->global->MAIN_INFO_TVAINTRA != '') { @@ -738,8 +738,8 @@ class pdf_propale_azur extends ModelePDFPropales if ($ligne) { $footy-=3; - $pdf->SetxY(8,-$footy); - $pdf->MultiCell(200, 2, $ligne , 0, 'C'); + $pdf->SetXY(8,-$footy); + $pdf->MultiCell(200, 2, $ligne , 0, 'C', 0); } $pdf->SetXY(-20,-$footy); diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 3c253f70f7b..c1f11f28a08 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -42,8 +42,8 @@ ProfId2BE=- ProfId3BE=- ProfId4BE=- ProfId1PT=NIPC -ProfId2PT=Social security number -ProfId3PT=Commercial Record number +ProfId2PT=Numéro de sécurité social +ProfId3PT=Numéro enregistrement commercial ProfId4PT=Conservatory TVAIntra=Numéro de TVA Intracommunautaire VATIntraShort=N° TVA Intra-communautaire