Fix: Task 8618
This commit is contained in:
parent
1c8a46d929
commit
e50c375a8f
@ -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;
|
||||
}
|
||||
|
||||
@ -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'])
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user