From 5229690a877d5b4a26b566ddf1c921961a707e7d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 14 Aug 2005 01:23:52 +0000
Subject: [PATCH] New: Ajoute code produit sur propal azur si parametre
 PROPALE_CODEPRODUITSERVICE defini.

---
 .../propale/pdf_propale_azur.modules.php      | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index d90806be208..1a94666d20e 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -42,7 +42,7 @@ class pdf_propale_azur extends ModelePDFPropales
 			\brief      Constructeur
     		\param	    db		Handler acc�s base de donn�e
     */
-    function pdf_propale_azur($db=0)
+    function pdf_propale_azur($db)
     {
       	global $langs;
 
@@ -158,29 +158,35 @@ class pdf_propale_azur extends ModelePDFPropales
                 $nexY = $pdf->GetY();
                 $nblignes = sizeof($prop->lignes);
 
-                // Boucle sur les lignes de propales
+                // Boucle sur les lignes
                 for ($i = 0 ; $i < $nblignes ; $i++)
                 {
                     $curY = $nexY;
 
                     // Description produit
-                    $codeproduitservice="";
+                    $libelleproduitservice=$prop->lignes[$i]->libelle;
+                    if ($prop->lignes[$i]->desc&&$prop->lignes[$i]->desc!=$prop->lignes[$i]->libelle)
+                    {
+                        if ($libelleproduitservice) $libelleproduitservice.="\n";
+                        $libelleproduitservice.=$prop->lignes[$i]->desc;
+                    }
                     $pdf->SetXY (11, $curY );
-                    if (defined("PROPALE_CODEPRODUITSERVICE") && PROPALE_CODEPRODUITSERVICE) {
-                        // Affiche code produit si ligne associ�e � un code produit
 
+                    if ($conf->global->PROPALE_CODEPRODUITSERVICE && $fac->lignes[$i]->produit_id)
+                    {
+                        // Affiche code produit si ligne associ�e � un code produit
                         $prodser = new Product($this->db);
 
                         $prodser->fetch($prop->lignes[$i]->produit_id);
                         if ($prodser->ref) {
-                            $codeproduitservice=" - ".$langs->trans("ProductCode")." ".$prodser->ref;
+                            $libelleproduitservice=$langs->trans("ProductCode")." ".$prodser->ref." - ".$libelleproduitservice;
                         }
                     }
                     if ($prop->lignes[$i]->date_start && $prop->lignes[$i]->date_end) {
                         // Affichage dur�e si il y en a une
-                        $codeproduitservice.=" (".$langs->trans("From")." ".dolibarr_print_date($prop->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($prop->lignes[$i]->date_end).")";
+                        $libelleproduitservice.="\n(".$langs->trans("From")." ".dolibarr_print_date($prop->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($prop->lignes[$i]->date_end).")";
                     }
-                    $pdf->MultiCell(108, 5, $prop->lignes[$i]->desc."$codeproduitservice", 0, 'J');
+                    $pdf->MultiCell(108, 5, $libelleproduitservice, 0, 'J');
 
                     $nexY = $pdf->GetY();
 
-- 
GitLab