From e50c375a8fece5ca86598ac9331e0d2f822df150 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Nov 2010 00:59:31 +0000 Subject: [PATCH] Fix: Task 8618 --- htdocs/core/class/commonobject.class.php | 17 ++++++---- htdocs/fourn/facture/fiche.php | 4 +-- .../modules/facture/pdf_crabe.modules.php | 10 +++--- .../modules_facturefournisseur.php | 2 +- .../pdf/pdf_canelle.modules.php | 34 ++++++++++--------- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6cf2417139b..416c9146864 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -447,8 +447,8 @@ class CommonObject } /** - * \brief Load the third party of object from id $this->socid into this->client - * \return int <0 if KO, >0 if OK + * Load the third party of object from id $this->socid into this->thirdpary + * @return int <0 if KO, >0 if OK */ function fetch_thirdparty() { @@ -456,12 +456,17 @@ class CommonObject if (empty($this->socid)) return 0; - $client = new Societe($this->db); - $result=$client->fetch($this->socid); - $this->client = $client; + $thirdparty = new Societe($this->db); + $result=$thirdparty->fetch($this->socid); + $this->client = $thirdparty; // deprecated + $this->thirdparty = $thirdparty; // Use first price level if level not defined for third party - if ($conf->global->PRODUIT_MULTIPRICES && empty($this->client->price_level)) $this->client->price_level=1; + if ($conf->global->PRODUIT_MULTIPRICES && empty($this->thirdparty->price_level)) + { + $this->client->price_level=1; // deprecated + $this->thirdparty->price_level=1; + } return $result; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 107bf2cc18e..5a03b028cd5 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -696,8 +696,8 @@ if ($_REQUEST['action'] == 'builddoc') * definit dans /includes/modules/supplier_invoice/modules_facturefournisseur.php */ - // Sauvegarde le dernier module choisi pour generer un document - $facture= new FactureFournisseur($db); + // Save modele used + $facture=new FactureFournisseur($db); $facture->fetch($_REQUEST['facid']); if ($_REQUEST['model']) { diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index c70f50c2bc0..02c43bcb32d 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -82,7 +82,7 @@ class pdf_crabe extends ModelePDFFactures $this->franchise=!$mysoc->tva_assuj; - // Recupere emmetteur + // Get source company $this->emetteur=$mysoc; if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined @@ -103,10 +103,10 @@ class pdf_crabe extends ModelePDFFactures /** - * \brief Fonction generant la facture sur le disque - * \param object Object invoice to build (or id if old method) - * \param outputlangs Lang object for output language - * \return int 1=ok, 0=ko + * Write the invoice to disk + * @param object Object invoice to build (or id if old method) + * @param outputlangs Lang object for output language + * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs) { diff --git a/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php index 499cb0e525a..8f5ecca3acd 100755 --- a/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php @@ -92,7 +92,7 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs) $classname = "pdf_".$model; require_once($dir.$file); - $obj = new $classname($db); + $obj = new $classname($db,$object); // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 6024c98797a..f00e05d0b1c 100755 --- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -42,7 +42,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * \brief Constructor * \param db Handler access data base */ - function pdf_canelle($db) + function pdf_canelle($db,$object) { global $conf,$langs,$mysoc; @@ -72,11 +72,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->franchise=!$mysoc->tva_assuj; - // Recupere emmetteur - $this->emetteur=$mysoc; - if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini + // Get source company + $object->fetch_thirdparty(); + $this->emetteur=$object->thirdparty; + if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined - // Defini position des colonnes + // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; $this->posxtva=121; $this->posxup=132; @@ -91,14 +92,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** - * \brief Write the invoice to disk - * \param id Id invoice to write - * \param outputlangs Lang output object - * \return int 1=ok, 0=ko + * Write the invoice to disk + * @param object Object invoice to build (or id if old method) + * @param outputlangs Lang object for output language + * @return int 1=OK, 0=KO */ function write_file($object,$outputlangs='') { - global $user,$langs,$conf; + global $user,$langs,$conf,$mysoc; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO @@ -112,7 +113,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($conf->fournisseur->dir_output.'/facture') { - $object->fetch_thirdparty(); $deja_regle = $object->getSommePaiement(); // Definition de $dir et $file @@ -322,8 +322,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } /* - * Mode de reglement + * Payment mode */ + /* Hidden for supplier invoices if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) { $pdf->SetXY ($this->marge_gauche, 228); @@ -332,7 +333,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0); $pdf->SetTextColor(0,0,0); - } + }*/ /* * Pied de page @@ -547,7 +548,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell(23,2, $outputlangs->transnoentities("TotalHTShort"),'','C'); } - + /** * \brief Show payments table * \param pdf Object PDF @@ -651,6 +652,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($this->marge_gauche,$posy); // Logo + /* $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; if ($mysoc->logo) { @@ -667,10 +669,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } } else - { + {*/ $text=$this->emetteur->nom; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); - } + //} $pdf->SetFont('','B',13); $pdf->SetXY(100,$posy);