diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index 157e81546e7..7055df9e0ce 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -130,6 +130,7 @@ $dir = "../includes/modules/propale/"; $handle = opendir($dir); if ($handle) { + $var=false; while (($file = readdir($handle))!==false) { if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php') @@ -140,11 +141,8 @@ if ($handle) $modPropale = new $file; - if($pair == "pair") - $pair = "impair"; - else - $pair = "pair"; - print "\n ".$file.""; + $var=!$var; + print "\n ".$file.""; print "\n ".$modPropale->info()."\n"; print "\n ".$modPropale->getExample()."\n"; @@ -206,6 +204,7 @@ clearstatcache(); $handle=opendir($dir); +$var=false; while (($file = readdir($handle))!==false) { if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_') @@ -213,15 +212,12 @@ while (($file = readdir($handle))!==false) $name = substr($file, 12, strlen($file) - 24); $classname = substr($file, 0, strlen($file) -12); - if($pair == "pair") - $pair = "impair"; - else - $pair = "pair"; - print "\n "; + $var=!$var; + print "\n "; print "$name"; print "\n \n"; require_once($dir.$file); - $obj = new $classname(); + $obj = new $classname($db); print $obj->description; diff --git a/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php b/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php index fe5e22ac651..0e3c8bfdf98 100644 --- a/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php @@ -337,14 +337,6 @@ class pdf_propale_adytek extends ModelePDFPropales } $pdf->SetTextColor(70,70,170); - if (defined("FAC_PDF_INTITULE2")) - { - $pdf->SetXY(10,30); - $pdf->SetFont('Arial','',7); - $pdf->SetTextColor(0,0,200); - $pdf->MultiCell(45, 5, FAC_PDF_INTITULE2, '' , 'C'); - } - /* * Definition du document */ diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 28ef2e1acac..59bb68b0715 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -38,12 +38,14 @@ class pdf_propale_azur extends ModelePDFPropales { - /** \brief Constructeur + /** + \brief Constructeur \param db handler accès base de donnée */ function pdf_propale_azur($db=0) { $this->db = $db; + $this->name = "azur"; $this->description = "Modèle de propositions commerciales complet (logo...)"; $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION @@ -51,6 +53,22 @@ class pdf_propale_azur extends ModelePDFPropales $this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE $this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA $this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL + 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 + $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; + $sql .= " WHERE rowid = ".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; + } + else { + dolibarr_print_error($this->db); + } + $this->db->free($result); } @@ -67,18 +85,19 @@ class pdf_propale_azur extends ModelePDFPropales \param facid id de la propale à générer \return int 1=ok, 0=ko \remarks Variables utilisées + \remarks MAIN_INFO_SOCIETE_NOM + \remarks MAIN_INFO_SIRET + \remarks MAIN_INFO_SIREN + \remarks MAIN_INFO_RCS + \remarks MAIN_INFO_CAPITAL + \remarks MAIN_INFO_TVAINTRA \remarks FAC_PDF_LOGO \remarks FACTURE_CODEPRODUITSERVICE \remarks FACTURE_CHQ_NUMBER \remarks FACTURE_RIB_NUMBER \remarks FAC_PDF_INTITULE - \remarks FAC_PDF_INTITULE2 \remarks FAC_PDF_TEL \remarks FAC_PDF_ADRESSE - \remarks MAIN_INFO_SIRET - \remarks MAIN_INFO_SIREN - \remarks MAIN_INFO_CAPITAL - \remarks MAIN_INFO_TVAINTRA */ function write_pdf_file($id) { @@ -350,7 +369,8 @@ class pdf_propale_azur extends ModelePDFPropales // Affiche la mention TVA non applicable selon option $pdf->SetXY (10, $tab2_top + 0); - if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') { + if ($this->franchise==1) + { $pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0); } @@ -464,12 +484,15 @@ class pdf_propale_azur extends ModelePDFPropales global $langs; $langs->load("main"); $langs->load("bills"); + $langs->load("propal"); + $langs->load("companies"); $pdf->SetTextColor(0,0,60); $pdf->SetFont('Arial','B',13); $pdf->SetXY(10,6); + // Logo if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) { if (file_exists(FAC_PDF_LOGO)) { @@ -513,32 +536,48 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetXY(10,$posy+4); - if (defined("FAC_PDF_INTITULE2")) + // Nom emetteur + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('Arial','B',11); + if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) // Prioritaire sur MAIN_INFO_SOCIETE_NOM { - $pdf->SetTextColor(0,0,60); - $pdf->SetFont('Arial','B',10); - $pdf->MultiCell(70, 4, FAC_PDF_INTITULE2, 0, 'L'); + $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); + } + else // Par defaut + { + $pdf->MultiCell(80, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L'); } + + // Caractéristiques emetteur + $pdf->SetFont('Arial','',9); if (defined("FAC_PDF_ADRESSE")) { - $pdf->SetFont('Arial','',10); $pdf->MultiCell(80, 4, FAC_PDF_ADRESSE); } if (defined("FAC_PDF_TEL")) { - $pdf->SetFont('Arial','',10); - $pdf->MultiCell(40, 4, "Tél : ".FAC_PDF_TEL); + $pdf->MultiCell(80, 4, $langs->trans("Phone").": ".FAC_PDF_TEL); + } + if (defined("FAC_PDF_FAX")) + { + $pdf->MultiCell(80, 4, $langs->trans("Fax").": ".FAC_PDF_FAX); + } + if (defined("FAC_PDF_MEL")) + { + $pdf->MultiCell(80, 4, $langs->trans("Email").": ".FAC_PDF_MEL); + } + if (defined("FAC_PDF_WWW")) + { + $pdf->MultiCell(80, 4, $langs->trans("Web").": ".FAC_PDF_WWW); } - if (defined("MAIN_INFO_SIREN")) + if (defined("MAIN_INFO_SIREN") && MAIN_INFO_SIREN) { - $pdf->SetFont('Arial','',10); - $pdf->MultiCell(60, 4, "SIREN : ".MAIN_INFO_SIREN); + $pdf->MultiCell(80, 4, $langs->transcountry("ProfId1",$this->code_pays).": ".MAIN_INFO_SIREN); } - elseif (defined("MAIN_INFO_SIRET")) + elseif (defined("MAIN_INFO_SIRET") && MAIN_INFO_SIRET) { - $pdf->SetFont('Arial','',10); - $pdf->MultiCell(60, 4, "SIRET : ".MAIN_INFO_SIRET); + $pdf->MultiCell(80, 4, $langs->transcountry("ProfId2",$this->code_pays).": ".MAIN_INFO_SIRET); } @@ -550,11 +589,14 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetFont('Arial','',8); $pdf->SetXY(102,$posy-5); $pdf->MultiCell(80,5, $langs->trans("BillTo").":"); - $pdf->SetFont('Arial','B',11); - $prop->fetch_client(); + $prop->fetch_client(); + // Nom client $pdf->SetXY(102,$posy+4); + $pdf->SetFont('Arial','B',11); $pdf->MultiCell(86,4, $prop->client->nom, 0, 'L'); - $pdf->SetFont('Arial','B',10); + + // Caractéristiques client + $pdf->SetFont('Arial','B',9); $pdf->SetXY(102,$posy+12); $pdf->MultiCell(86,4, $prop->client->adresse . "\n" . $prop->client->cp . " " . $prop->client->ville); $pdf->rect(100, $posy, 100, 34); @@ -586,9 +628,16 @@ class pdf_propale_azur extends ModelePDFPropales $footy=13; $pdf->SetFont('Arial','',8); - if (MAIN_INFO_CAPITAL) { + if (defined(MAIN_INFO_CAPITAL)) { $pdf->SetY(-$footy); - $pdf->MultiCell(190, 3,"SARL au Capital de " . MAIN_INFO_CAPITAL." ".$conf->monnaie." - " . MAIN_INFO_RCS." - Identifiant professionnel: " . MAIN_INFO_SIREN , 0, 'C'); + $ligne="SARL au Capital de " . MAIN_INFO_CAPITAL." ".$conf->monnaie; + if (defined(MAIN_INFO_SIREN) && MAIN_INFO_SIREN) { + $ligne.=" - ".$langs->transcountry("ProfId2",$this->code_pays).": ".MAIN_INFO_SIREN; + } + if (defined(MAIN_INFO_RCS) && MAIN_INFO_RCS) { + $ligne.=" - ".$langs->transcountry("ProfId3",$this->code_pays).": ".MAIN_INFO_RCS; + } + $pdf->MultiCell(190, 3, $ligne, 0, 'C'); $footy-=3; } diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php index 26fdcbff89c..8e2d63549ea 100644 --- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -42,7 +42,7 @@ class pdf_propale_jaune extends ModelePDFPropales function pdf_propale_jaune($db=0) { $this->db = $db; - $this->name = "Jaune"; + $this->name = "jaune"; $this->description = "Modèle de proposition Jaune"; $this->error = ""; }