Fix: Task 8618

This commit is contained in:
Laurent Destailleur 2010-11-11 00:59:31 +00:00
parent 1c8a46d929
commit e50c375a8f
5 changed files with 37 additions and 30 deletions

View File

@ -447,8 +447,8 @@ class CommonObject
} }
/** /**
* \brief Load the third party of object from id $this->socid into this->client * Load the third party of object from id $this->socid into this->thirdpary
* \return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_thirdparty() function fetch_thirdparty()
{ {
@ -456,12 +456,17 @@ class CommonObject
if (empty($this->socid)) return 0; if (empty($this->socid)) return 0;
$client = new Societe($this->db); $thirdparty = new Societe($this->db);
$result=$client->fetch($this->socid); $result=$thirdparty->fetch($this->socid);
$this->client = $client; $this->client = $thirdparty; // deprecated
$this->thirdparty = $thirdparty;
// Use first price level if level not defined for third party // 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; return $result;
} }

View File

@ -696,8 +696,8 @@ if ($_REQUEST['action'] == 'builddoc')
* definit dans /includes/modules/supplier_invoice/modules_facturefournisseur.php * definit dans /includes/modules/supplier_invoice/modules_facturefournisseur.php
*/ */
// Sauvegarde le dernier module choisi pour generer un document // Save modele used
$facture= new FactureFournisseur($db); $facture=new FactureFournisseur($db);
$facture->fetch($_REQUEST['facid']); $facture->fetch($_REQUEST['facid']);
if ($_REQUEST['model']) if ($_REQUEST['model'])
{ {

View File

@ -82,7 +82,7 @@ class pdf_crabe extends ModelePDFFactures
$this->franchise=!$mysoc->tva_assuj; $this->franchise=!$mysoc->tva_assuj;
// Recupere emmetteur // Get source company
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined 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 * Write the invoice to disk
* \param object Object invoice to build (or id if old method) * @param object Object invoice to build (or id if old method)
* \param outputlangs Lang object for output language * @param outputlangs Lang object for output language
* \return int 1=ok, 0=ko * @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs) function write_file($object,$outputlangs)
{ {

View File

@ -92,7 +92,7 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
$classname = "pdf_".$model; $classname = "pdf_".$model;
require_once($dir.$file); 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 // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8. // output format that does not support UTF8.

View File

@ -42,7 +42,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* \brief Constructor * \brief Constructor
* \param db Handler access data base * \param db Handler access data base
*/ */
function pdf_canelle($db) function pdf_canelle($db,$object)
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
@ -72,9 +72,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->franchise=!$mysoc->tva_assuj; $this->franchise=!$mysoc->tva_assuj;
// Recupere emmetteur // Get source company
$this->emetteur=$mysoc; $object->fetch_thirdparty();
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini $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->posxdesc=$this->marge_gauche+1;
@ -91,14 +92,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/** /**
* \brief Write the invoice to disk * Write the invoice to disk
* \param id Id invoice to write * @param object Object invoice to build (or id if old method)
* \param outputlangs Lang output object * @param outputlangs Lang object for output language
* \return int 1=ok, 0=ko * @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs='') function write_file($object,$outputlangs='')
{ {
global $user,$langs,$conf; global $user,$langs,$conf,$mysoc;
if (! is_object($outputlangs)) $outputlangs=$langs; 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 // 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') if ($conf->fournisseur->dir_output.'/facture')
{ {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement(); $deja_regle = $object->getSommePaiement();
// Definition de $dir et $file // 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)) if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER))
{ {
$pdf->SetXY ($this->marge_gauche, 228); $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("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }*/
/* /*
* Pied de page * Pied de page
@ -651,6 +652,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
// Logo // Logo
/*
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if ($mysoc->logo) if ($mysoc->logo)
{ {
@ -667,10 +669,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
} }
} }
else else
{ {*/
$text=$this->emetteur->nom; $text=$this->emetteur->nom;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} //}
$pdf->SetFont('','B',13); $pdf->SetFont('','B',13);
$pdf->SetXY(100,$posy); $pdf->SetXY(100,$posy);