diff --git a/htdocs/compta/export/ComptaJournalPdf.class.php b/htdocs/compta/export/ComptaJournalPdf.class.php
index 7d561d2a7c5..e4935e03d92 100644
--- a/htdocs/compta/export/ComptaJournalPdf.class.php
+++ b/htdocs/compta/export/ComptaJournalPdf.class.php
@@ -19,13 +19,14 @@
* $Id$
*/
-/**
+/**
\file htdocs/compta/export/ComptaJournalPdf.php
\ingroup compta
\brief Fichier de la classe export compta journal
\version $Revision$
*/
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
@@ -34,14 +35,14 @@ require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
\brief Classe export compta journal
*/
class ComptaJournalPdf extends FPDF {
-
+
function Footer()
{
$this->SetY(-10);
//Police Arial italique 8
$this->SetFont('Arial','I',8);
-
- $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+
+ $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
diff --git a/htdocs/includes/modules/action/rapport.pdf.php b/htdocs/includes/modules/action/rapport.pdf.php
index 657c25e4960..731e47bd93f 100644
--- a/htdocs/includes/modules/action/rapport.pdf.php
+++ b/htdocs/includes/modules/action/rapport.pdf.php
@@ -25,7 +25,8 @@
\version $Id$
*/
-require_once(FPDFI_PATH.'fpdi_protection.php');
+require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/**
diff --git a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
index 20783c62657..9a5581477b3 100644
--- a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
+++ b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
@@ -24,7 +24,7 @@
\version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@@ -67,7 +67,7 @@ class BordereauChequeBlochet extends FPDF
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
-
+
// Defini position des colonnes
$this->line_height = 5;
$this->line_per_page = 25;
@@ -88,7 +88,7 @@ class BordereauChequeBlochet extends FPDF
if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output='ISO-8859-1';
-
+
$outputlangs->load("main");
$outputlangs->load("companies");
$outputlangs->load("bills");
@@ -116,7 +116,6 @@ class BordereauChequeBlochet extends FPDF
// Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION)
{
- require_once(FPDFI_PATH.'fpdi_protection.php');
$pdf = new FPDI_Protection('P','mm','A4');
$pdfrights = array('print'); // Ne permet que l'impression du document
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
@@ -125,7 +124,6 @@ class BordereauChequeBlochet extends FPDF
}
else
{
- require_once(FPDFI_PATH.'fpdi.php');
$pdf=new FPDI('P','mm',$this->format);
}
@@ -154,12 +152,12 @@ class BordereauChequeBlochet extends FPDF
$pdf->Output($_file);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
-
+
$langs->setPhpLang(); // On restaure langue session
return 1; // Pas d'erreur
}
-
+
/**
* \brief Renvoi le dernier message d'erreur de création de propale
*/
@@ -167,7 +165,7 @@ class BordereauChequeBlochet extends FPDF
{
return $this->error;
}
-
+
/**
* \brief Generate Header
* \param pdf pdf object
@@ -180,7 +178,7 @@ class BordereauChequeBlochet extends FPDF
$outputlangs->load("compta");
$outputlangs->load("banks");
-
+
$title = $outputlangs->transnoentities("CheckReceipt");
$pdf->SetFont('Arial','B',10);
$pdf->Text(10, 10, $title);
@@ -214,7 +212,7 @@ class BordereauChequeBlochet extends FPDF
$pdf->Text(104, 43, $this->account->cle_rib);
$pdf->SetFont('Arial','',10);
- $pdf->Text(114, 19, $outputlangs->transnoentities("Sign"));
+ $pdf->Text(114, 19, $outputlangs->transnoentities("Signature"));
$pdf->Rect(9, 47, 192, 7);
$pdf->line(55, 47, 55, 54);
@@ -280,20 +278,20 @@ class BordereauChequeBlochet extends FPDF
$pdf->SetXY (10, $this->tab_top + 10 + $yp);
$pdf->MultiCell(20, $this->line_height, $this->lines[$j]->num_chq?$this->lines[$j]->num_chq:'', 0, 'J', 0);
-
+
$pdf->SetXY (30, $this->tab_top + 10 + $yp);
$pdf->MultiCell(70, $this->line_height, dolibarr_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq),44), 0, 'J', 0);
-
+
$pdf->SetXY (100, $this->tab_top + 10 + $yp);
$pdf->MultiCell(80, $this->line_height, dolibarr_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq),50), 0, 'J', 0);
-
+
$pdf->SetXY (180, $this->tab_top + 10 + $yp);
$pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0);
$yp = $yp + $this->line_height;
}
}
-
+
}
?>
diff --git a/htdocs/includes/modules/commande/modules_commande.php b/htdocs/includes/modules/commande/modules_commande.php
index e531bd3bf62..33909442d7c 100644
--- a/htdocs/includes/modules/commande/modules_commande.php
+++ b/htdocs/includes/modules/commande/modules_commande.php
@@ -28,7 +28,7 @@
\version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // requis car utilise par les classes qui heritent
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
@@ -153,7 +153,7 @@ class ModeleNumRefCommandes
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
if ($this->version == 'dolibarr') return DOL_VERSION;
return $langs->trans("NotAvailable");
- }
+ }
}
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index 54b8c6cddb8..af0d104ab06 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -238,51 +238,12 @@ class pdf_einstein extends ModelePDFCommandes
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1);
- if ($com->lignes[$i]->desc && $com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
- if ($com->lignes[$i]->desc == '(CREDIT_NOTE)' && $com->lignes[$i]->fk_remise_except)
- {
- $discount=new DiscountAbsolute($this->db);
- $discount->fetch($com->lignes[$i]->fk_remise_except);
- $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
- }
- else
- {
- $libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1);
- }
- }
- // Si ligne associ�e � un code produit
- if ($com->lignes[$i]->fk_product)
- {
- $prodser = new Product($this->db);
- $prodser->fetch($com->lignes[$i]->fk_product);
-
- // On ajoute la ref
- if ($prodser->ref)
- {
- $prefix_prodserv = "";
- if($prodser->isservice())
- $prefix_prodserv = $outputlangs->transnoentities("Service")." ";
- else
- $prefix_prodserv = $outputlangs->transnoentities("Product")." ";
-
- $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
- }
-
- }
-
- if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
- {
- // Affichage duree si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
+ $libelleproduitservice=pdf_getlinedesc($com->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
// Description
- $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
+ $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par d�faut
diff --git a/htdocs/includes/modules/dons/modules_don.php b/htdocs/includes/modules/dons/modules_don.php
index 51361fbe9ac..743f620338f 100644
--- a/htdocs/includes/modules/dons/modules_don.php
+++ b/htdocs/includes/modules/dons/modules_don.php
@@ -27,7 +27,7 @@
\version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
@@ -46,7 +46,7 @@ class ModeleDon extends FPDF
return $this->error;
}
- /**
+ /**
* \brief Renvoi la liste des modèles actifs
* \param db Handler de base
*/
@@ -57,7 +57,7 @@ class ModeleDon extends FPDF
$sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
-
+
$resql = $db->query($sql);
if ($resql)
{
@@ -133,7 +133,7 @@ class ModeleNumRefDons
global $langs;
return $langs->trans("NotAvailable");
}
-
+
/** \brief Renvoi version du module numerotation
* \return string Valeur
*/
@@ -146,7 +146,7 @@ class ModeleNumRefDons
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
if ($this->version == 'dolibarr') return DOL_VERSION;
return $langs->trans("NotAvailable");
- }
+ }
}
@@ -187,11 +187,11 @@ function don_create($db, $id, $message, $modele, $outputlangs)
$classname = $modele;
require_once($dir.$file);
-
+
$obj = new $classname($db);
-
+
$obj->message = $message;
-
+
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
@@ -201,7 +201,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
don_meta_create($db, $id);
// et on supprime l'image correspondant au preview
don_delete_preview($db, $id);
-
+
$outputlangs->charset_output=$sav_charset_output;
return 1;
}
@@ -229,10 +229,10 @@ function don_create($db, $id, $message, $modele, $outputlangs)
function don_meta_create($db, $donid, $message="")
{
global $langs,$conf;
-
+
$don = new Don($db);
$don->id=$donid;
- $don->fetch($donid);
+ $don->fetch($donid);
}
@@ -247,7 +247,7 @@ function don_delete_preview($db, $donid)
$don = new Don($db);
$don->id=$donid;
- $don->fetch($donid);
+ $don->fetch($donid);
}
?>
diff --git a/htdocs/includes/modules/expedition/methode_expedition.modules.php b/htdocs/includes/modules/expedition/methode_expedition.modules.php
index 05a051e5961..c88434e99ba 100644
--- a/htdocs/includes/modules/expedition/methode_expedition.modules.php
+++ b/htdocs/includes/modules/expedition/methode_expedition.modules.php
@@ -26,6 +26,7 @@
* \version $Id$
*/
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
@@ -43,7 +44,7 @@ class methode_expedition
$this->description = "ERROR IN MODULE DESCRIPTION";
}
-
+
/**
* \brief Renvoi la liste des mod�les actifs
* \param db Handler de base
@@ -75,7 +76,7 @@ class methode_expedition
}
return $liste;
}
-
+
}
?>
diff --git a/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php b/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php
index dfc4e1fe651..ef1709a4071 100644
--- a/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php
+++ b/htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php
@@ -26,7 +26,7 @@
* \version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
@@ -40,7 +40,7 @@ class ModelePdfExpedition extends FPDF
var $error='';
- /**
+ /**
\brief Renvoi le dernier message d'erreur de cr�ation de PDF de commande
*/
function pdferror()
@@ -49,7 +49,7 @@ class ModelePdfExpedition extends FPDF
}
- /**
+ /**
* \brief Renvoi la liste des mod�les actifs
* \return array Tableau des modeles (cle=id, valeur=libelle)
*/
@@ -60,7 +60,7 @@ class ModelePdfExpedition extends FPDF
$sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
-
+
$resql = $db->query($sql);
if ($resql)
{
@@ -80,7 +80,7 @@ class ModelePdfExpedition extends FPDF
}
return $liste;
}
-
+
}
@@ -95,7 +95,7 @@ function expedition_pdf_create($db, $id, $modele, $outputlangs)
{
global $conf,$langs;
$langs->load("sendings");
-
+
$dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/";
$modelisok=0;
@@ -103,7 +103,7 @@ function expedition_pdf_create($db, $id, $modele, $outputlangs)
$file = "pdf_expedition_".$modele.".modules.php";
if ($modele && file_exists($dir.$file)) $modelisok=1;
- // Si model pas encore bon
+ // Si model pas encore bon
if (! $modelisok)
{
if ($conf->global->EXPEDITION_ADDON_PDF) $modele = $conf->global->EXPEDITION_ADDON_PDF;
@@ -111,7 +111,7 @@ function expedition_pdf_create($db, $id, $modele, $outputlangs)
if (file_exists($dir.$file)) $modelisok=1;
}
- // Si model pas encore bon
+ // Si model pas encore bon
if (! $modelisok)
{
$liste=array();
@@ -121,19 +121,19 @@ function expedition_pdf_create($db, $id, $modele, $outputlangs)
$file = "pdf_expedition_".$modele.".modules.php";
if (file_exists($dir.$file)) $modelisok=1;
}
-
+
// Charge le modele
if ($modelisok)
{
$classname = "pdf_expedition_".$modele;
require_once($dir.$file);
-
+
$obj = new $classname($db);
$expedition = new Expedition($db);
$result=$expedition->fetch($id);
$result=$expedition->fetch_object($expedition->origin);
-
+
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php
index d5a19c9b3c8..b84af6c40ce 100644
--- a/htdocs/includes/modules/facture/modules_facture.php
+++ b/htdocs/includes/modules/facture/modules_facture.php
@@ -28,10 +28,10 @@
\version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
-require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis� dans les classes qui h�ritent
+require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilise dans les classes qui heritent
/**
@@ -206,7 +206,7 @@ function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
facture_meta_create($db, $id);
// et on supprime l'image correspondant au preview
facture_delete_preview($db, $id);
-
+
$outputlangs->charset_output=$sav_charset_output;
return 1;
}
@@ -274,9 +274,9 @@ ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($fac->lignes[$i]->
$fp = fopen ($file,"w");
fputs($fp,$meta);
fclose($fp);
- if (! empty($conf->global->MAIN_UMASK))
+ if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
-
+
}
}
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index 5e4b9fe019e..d14a64d47b2 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -240,63 +240,7 @@ class pdf_crabe extends ModelePDFFactures
$curY = $nexY;
// Description of product line
- $libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
- if ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc != $fac->lignes[$i]->libelle)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
-
- if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except)
- {
- $discount=new DiscountAbsolute($this->db);
- $discount->fetch($fac->lignes[$i]->fk_remise_except);
- $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
- }
- else
- {
- if ($fac->lignes[$i]->produit_id)
- {
- $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
- }
- else
- {
- //$fac->lignes[$i]->desc='�zaaaa';
- //print dol_string_is_good_iso($fac->lignes[$i]->desc);
- //print dol_htmlentitiesbr($fac->lignes[$i]->desc);
- //print exit;
- $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
- }
- }
- }
-
- // Si ligne associee a un code produit
- if ($fac->lignes[$i]->produit_id)
- {
- $prodser = new Product($this->db);
- $prodser->fetch($fac->lignes[$i]->produit_id);
- // On ajoute la ref
- if ($prodser->ref)
- {
- $prefix_prodserv = "";
- if($prodser->isservice())
- {
- $prefix_prodserv = $outputlangs->transnoentities("Service")." ";
- }
- else
- {
- $prefix_prodserv = $outputlangs->transnoentities("Product")." ";
- }
-
- $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
- }
-
- }
-
- if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
- {
- // Affichage duree si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
- //if ($i==0) { print $libelleproduitservice; exit; }
+ $libelleproduitservice=pdf_getlinedesc($fac->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
diff --git a/htdocs/includes/modules/facture/pdf_huitre.modules.php b/htdocs/includes/modules/facture/pdf_huitre.modules.php
deleted file mode 100644
index 215b12f393e..00000000000
--- a/htdocs/includes/modules/facture/pdf_huitre.modules.php
+++ /dev/null
@@ -1,603 +0,0 @@
-
- * Copyright (C) 2004-2008 Laurent Destailleur
- * Copyright (C) 2008 Raphael Bertrand (Resultic)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * or see http://www.gnu.org/
- */
-
-/**
- * \file htdocs/includes/modules/facture/pdf_huitre.modules.php
- * \ingroup facture
- * \brief Fichier de la classe permettant de g�n�rer les factures au mod�le Huitre
- * \author Laurent Destailleur
- * \version $Id$
- */
-
-require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
-require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
-
-
-/**
- * \class pdf_huitre
- * \brief Classe permettant de g�n�rer les factures au mod�le Huitre
- */
-class pdf_huitre extends ModelePDFFactures
-{
- var $emetteur; // Objet societe qui emet
-
-
- /** \brief Constructeur
- * \param db handler acc�s base de donn�e
- */
- function pdf_huitre($db)
- {
- global $conf,$langs,$mysoc;
-
- $langs->load("main");
- $langs->load("bills");
- $langs->load("products");
-
-
- $this->db = $db;
- $this->name = "huitre";
- $this->description = $langs->transnoentities('PDFHuitreDescription');
-
- // Dimension page pour format A4
- $this->type = 'pdf';
- $this->page_largeur = 210;
- $this->page_hauteur = 297;
- $this->format = array($this->page_largeur,$this->page_hauteur);
- $this->marge_gauche=10;
- $this->marge_droite=10;
- $this->marge_haute=10;
- $this->marge_basse=10;
-
- $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
- $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
- $this->option_modereg = 0; // Gere choix mode reglement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
- $this->option_condreg = 1; // Affiche conditions reglement
- $this->option_codeproduitservice = 0; // Affiche code produit-service
- $this->option_multilang = 1; // Dispo en plusieurs langues
- $this->option_escompte = 0; // Affiche si il y a eu escompte
- $this->option_credit_note = 0; // Gere les avoirs
- $this->option_draft_watermark = 1; //Support add of a watermark on drafts
-
- // Recupere emmetteur
- $this->emetteur=$mysoc;
- if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'�tait pas d�fini
- }
-
-
- /**
- * \brief Fonction g�n�rant la facture sur le disque
- * \param fac Objet facture � g�n�rer (ou id si ancienne methode)
- * \param outputlangs Lang object for output language
- * \return int 1=ok, 0=ko
- */
- function write_file($fac,$outputlangs)
- {
- global $user,$langs,$conf;
-
- if (! is_object($outputlangs)) $outputlangs=$langs;
- // Force output charset to ISO, because, FPDF expect text encoded in ISO
- $outputlangs->charset_output='ISO-8859-1';
-
- $outputlangs->load("main");
- $outputlangs->load("companies");
- $outputlangs->load("bills");
- $outputlangs->load("products");
-
- $outputlangs->setPhpLang();
-
- if ($conf->facture->dir_output)
- {
- // D�finition de l'objet $fac (pour compatibilite ascendante)
- if (! is_object($fac))
- {
- $id = $fac;
- $fac = new Facture($this->db,"",$id);
- $ret=$fac->fetch($id);
- }
-
- // D�finition de $dir et $file
- if ($fac->specimen)
- {
- $dir = $conf->facture->dir_output;
- $file = $dir . "/SPECIMEN.pdf";
- }
- else
- {
- $facref = sanitizeFileName($fac->ref);
- $dir = $conf->facture->dir_output . "/" . $facref;
- $file = $dir . "/" . $facref . ".pdf";
- }
-
- if (! file_exists($dir))
- {
- if (create_exdir($dir) < 0)
- {
- $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
- $langs->setPhpLang(); // On restaure langue session
- return 0;
- }
- }
-
- if (file_exists($dir))
- {
- // Protection et encryption du pdf
- if ($conf->global->PDF_SECURITY_ENCRYPTION)
- {
- $pdf=new FPDI_Protection('P','mm','A4');
- $pdfrights = array('print'); // Ne permet que l'impression du document
- $pdfuserpass = ''; // Mot de passe pour l'utilisateur final
- $pdfownerpass = NULL; // Mot de passe du propri�taire, cr�� al�atoirement si pas d�fini
- $pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
- }
- else
- {
- $pdf=new FPDI('P','mm',$this->format);
- }
-
- $pdf->Open();
- $pdf->AddPage();
-
- $this->_pagehead($pdf, $fac, $outputlangs);
-
- $pdf->SetTitle($outputlangs->convToOutputCharset($fac->ref));
- $pdf->SetSubject($outputlangs->transnoentities("Invoice"));
- $pdf->SetCreator("Dolibarr ".DOL_VERSION);
- $pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($fac->ref)." ".$outputlangs->transnoentities("Invoice"));
- if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
-
- $pdf->SetMargins(10, 10, 10);
- $pdf->SetAutoPageBreak(1,0);
- $tab_top = 100;
- $tab_height = 110;
-
- $pdf->SetFillColor(242,239,119);
-
- $pdf->SetFont('Arial','', 9);
-
- $pdf->SetXY (10, $tab_top + 10 );
-
- $iniY = $pdf->GetY();
- $curY = $pdf->GetY();
- $nexY = $pdf->GetY();
- $nblignes = sizeof($fac->lignes);
-
- // Boucle sur les lignes de factures
- for ($i = 0 ; $i < $nblignes ; $i++)
- {
- $curY = $nexY;
-
- $pdf->SetXY (11, $curY );
- $pdf->MultiCell(118, 5, $outputlangs->convToOutputCharset($fac->lignes[$i]->desc), 0, 'J');
-
- $nexY = $pdf->GetY();
-
- $pdf->SetXY (133, $curY);
- $pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_tx, 0, 'C');
-
- $pdf->SetXY (145, $curY);
- $pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
-
- $pdf->SetXY (156, $curY);
- $pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0);
-
- $pdf->SetXY (174, $curY);
- $total = price($fac->lignes[$i]->total_ht);
- $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
-
- if ($nexY > 200 && $i < $nblignes - 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $pdf->AddPage();
- $nexY = $iniY;
- $this->_pagehead($pdf, $fac, $outputlangs);
- $pdf->SetTextColor(0,0,0);
- $pdf->SetFont('Arial','', 10);
- }
-
- }
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
-
- $this->_tableau_tot($pdf, $fac, $outputlangs);
-
- $this->_tableau_compl($pdf, $fac, $outputlangs);
-
- /*
- *
- */
- if (defined("FACTURE_RIB_NUMBER"))
- {
- if (FACTURE_RIB_NUMBER > 0)
- {
- $account = new Account($this->db);
- $account->fetch(FACTURE_RIB_NUMBER);
-
- $curx=10;
- $cury=40;
-
- $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account);
- }
- }
-
- /*
- *
- *
- */
-
- if (! empty($fac->note_public))
- {
- $pdf->SetFont('Arial','',7);
- $pdf->SetXY(10, 211);
- $note = $outputlangs->transnoentities("Note").' : '.$outputlangs->convToOutputCharset($fac->note_public);
- $pdf->MultiCell(110, 3, $note, 0, 'J');
- }
-
- $pdf->SetXY(10, 225);
-
- // Show payments conditions
- if ($fac->type != 2 && ($fac->cond_reglement_code || $fac->cond_reglement))
- {
- $titre = $outputlangs->transnoentities("PaymentConditions").' : ';
- $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code):$outputlangs->convToOutputCharset($fac->cond_reglement);
- $titre.=$lib_condition_paiement;
- $pdf->MultiCell(190, 5, $titre, 0, 'J');
- }
-
- $this->_pagefoot($pdf, $fac, $outputlangs);
- $pdf->AliasNbPages();
- //----
- $pdf->SetTextColor(0,0,0);
- $pdf->SetFillColor(242,239,119);
-
- $pdf->SetLineWidth(0.5);
-
-
- $pdf->Close();
-
- $pdf->Output($file);
- if (! empty($conf->global->MAIN_UMASK))
- @chmod($file, octdec($conf->global->MAIN_UMASK));
-
- $langs->setPhpLang(); // On restaure langue session
- return 1; // Pas d'erreur
- }
- else
- {
- $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
- $langs->setPhpLang(); // On restaure langue session
- return 0;
- }
- }
- else
- {
- $this->error=$langs->transnoentities("ErrorConstantNotDefined","FAC_OUTPUTDIR");
- $langs->setPhpLang(); // On restaure langue session
- return 0;
- }
- $this->error=$langs->transnoentities("ErrorUnknown");
- $langs->setPhpLang(); // On restaure langue session
- return 0; // Erreur par defaut
- }
-
-
- /*
- *
- *
- *
- */
- function RoundedRect($x, $y, $w, $h,$r, $style = '')
- {
- $k = $this->k;
- $hp = $this->h;
- if($style=='F')
- $op='f';
- elseif($style=='FD' or $style=='DF')
- $op='B';
- else
- $op='S';
- $MyArc = 4/3 * (sqrt(2) - 1);
- $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k ));
- $xc = $x+$w-$r ;
- $yc = $y+$r;
- $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k ));
-
- $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
- $xc = $x+$w-$r ;
- $yc = $y+$h-$r;
- $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k));
- $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
- $xc = $x+$r ;
- $yc = $y+$h-$r;
- $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k));
- $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
- $xc = $x+$r ;
- $yc = $y+$r;
- $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k ));
- $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
- $this->_out($op);
- }
-
- function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
- {
- $h = $this->h;
- $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k,
- $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
- }
-
- function _tableau_compl(&$pdf, $fac, $outputlangs)
- {
- global $langs;
- $langs->load("main");
- $langs->load("bills");
-
- $tab3_top = 240;
- $tab3_height = 18;
- $tab3_width = 60;
-
- $pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height);
-
- $pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 );
- $pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 );
-
- $pdf->line(40, $tab3_top, 40, $tab3_top + $tab3_height );
-
- $pdf->SetFont('Arial','',8);
- $pdf->SetXY (10, $tab3_top - 6);
- $pdf->MultiCell(60, 6, $outputlangs->transnoentities("ExtraInfos"), 0, 'L', 0);
- $pdf->SetXY (10, $tab3_top );
- $pdf->MultiCell(20, 6, $outputlangs->transnoentities("RegulatedOn"), 0, 'L', 0);
- $pdf->SetXY (10, $tab3_top + 6);
- $pdf->MultiCell(60, 6, $outputlangs->transnoentities("ChequeOrTransferNumber"), 0, 'L', 0);
- $pdf->SetXY (10, $tab3_top + 12);
- $pdf->MultiCell(20, 6, $outputlangs->transnoentities("Bank"), 0, 'L', 0);
- }
-
- /*
- * \brief Affiche le total � payer
- * \param pdf objet PDF
- * \param fac objet facture
- */
- function _tableau_tot(&$pdf, $fac, $outputlangs)
- {
- global $langs;
- $langs->load("main");
- $langs->load("bills");
-
- $tab2_top = 212;
- $tab2_hl = 5;
- $tab2_height = $tab2_hl * 4;
- $pdf->SetFont('Arial','', 9);
-
- // $pdf->Rect(132, $tab2_top, 68, $tab2_height);
- // $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
-
- // $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 );
- // $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 );
- // $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 );
-
- $pdf->SetXY (132, $tab2_top + 0);
- $pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'R', 0);
-
- $pdf->SetXY (174, $tab2_top + 0);
- $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
-
- $index = 1;
-
- $pdf->SetXY (132, $tab2_top + $tab2_hl * $index);
- $pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'R', 0);
-
- $pdf->SetXY (174, $tab2_top + $tab2_hl * $index);
- $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
-
- $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1));
- $pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), 0, 'R', 1);
-
- $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1));
- $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
-
- $deja_regle = $fac->getSommePaiement();
-
- if ($deja_regle > 0)
- {
- $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+2));
- $pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("AlreadyPayed"), 0, 'R', 0);
-
- $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+2));
- $pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
-
- $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+3));
- $pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), 0, 'R', 1);
-
- $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+3));
- $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1);
- }
- }
- /*
- * \brief Affiche la grille des lignes de factures
- * \param pdf objet PDF
- */
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
- {
- global $langs;
- $langs->load("main");
- $langs->load("bills");
-
- $pdf->SetFont('Arial','',10);
-
- $pdf->Text(11,$tab_top + 5,$outputlangs->transnoentities("Designation"));
-
- $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
- $pdf->Text(134,$tab_top + 5,$outputlangs->transnoentities("VAT"));
-
- $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
- $pdf->Text(147,$tab_top + 5,$outputlangs->transnoentities("Qty"));
-
- $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
- $pdf->Text(160,$tab_top + 5,$outputlangs->transnoentities("PriceU"));
-
- $pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
- $pdf->Text(187,$tab_top + 5,$outputlangs->transnoentities("Total"));
-
- $pdf->Rect(10, $tab_top, 190, $tab_height);
- $pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
- }
-
- /*
- * \brief Affiche en-t�te facture
- * \param pdf objet PDF
- * \param fac objet facture
- */
- function _pagehead(&$pdf, $fac, $outputlangs)
- {
- global $conf;
-
- $outputlangs->load("main");
- $outputlangs->load("bills");
- $outputlangs->load("propal");
- $outputlangs->load("companies");
-
- $tab4_top = 60;
- $tab4_hl = 6;
- $tab4_sl = 4;
- $ligne = 2;
-
- //Affiche le filigrane brouillon - Print Draft Watermark
- if($fac->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
- {
- $watermark_angle=atan($this->page_hauteur/$this->page_largeur);
- $watermark_x=5;
- $watermark_y=$this->page_hauteur-50;
- $watermark_width=$this->page_hauteur;
- $pdf->SetFont('Arial','B',50);
- $pdf->SetTextColor(255,192,203);
- //rotate
- $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$pdf->k,($pdf->h-$watermark_y)*$pdf->k,-$watermark_x*$pdf->k,-($pdf->h-$watermark_y)*$pdf->k));
- //print watermark
- $pdf->SetXY($watermark_x,$watermark_y);
- $pdf->Cell($watermark_width,25,$outputlangs->convToOutputCharset($conf->global->FACTURE_DRAFT_WATERMARK),0,2,"C",0);
- //antirotate
- $pdf->_out('Q');
- }
- //Print content
- $pdf->SetXY(10,5);
- $posy=5;
-
- // Logo
- $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
- if ($this->emetteur->logo)
- {
- if (is_readable($logo))
- {
- $pdf->Image($logo, $this->marge_gauche, $posy, 0, 24);
- }
- else
- {
- $pdf->SetTextColor(200,0,0);
- $pdf->SetFont('Arial','B',8);
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
- }
- }
- else if (defined("FAC_PDF_INTITULE"))
- {
- $pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L');
- }
-
- $pdf->SetTextColor(0,0,0);
- $pdf->SetDrawColor(192,192,192);
- $pdf->line(9, 5, 200, 5 );
- $pdf->line(9, 30, 200, 30 );
-
- // Caracteristiques emetteur
- $carac_emetteur = '';
- $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->adresse);
- $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->cp).' '.$outputlangs->convToOutputCharset($this->emetteur->ville);
- $carac_emetteur .= "\n";
- // Tel
- if ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($this->emetteur->tel);
- // Fax
- if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($this->emetteur->fax);
- // EMail
- if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($this->emetteur->email);
- // Web
- if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($this->emetteur->url);
-
- $pdf->SetFont('Arial','',9);
- $pdf->SetXY($tab4_top+28,$tab4_hl);
- $pdf->MultiCell(110,3, $carac_emetteur);
-
-
-
- /*
- * Definition du document
- */
- $pdf->SetXY(150,16);
- $pdf->SetFont('Arial','B',16);
- $pdf->SetTextColor(0,0,200);
- $pdf->MultiCell(50, 2, strtoupper($outputlangs->transnoentities("Invoice")), '' , 'C');
-
- /*
- * Adresse Client
- */
- $pdf->SetTextColor(0,0,0);
- $pdf->SetFillColor(242,239,119);
-
- // $this->RoundedRect(100, 40, 100, 40, 3, 'F');
- $pdf->rect(100, 40, 100, 40, 'F');
- $pdf->SetFont('Arial','B',12);
- $fac->fetch_client();
- $pdf->SetXY(102,42);
- $pdf->MultiCell(96,5, $outputlangs->convToOutputCharset($fac->client->nom), 0, 'C');
- $pdf->SetFont('Arial','B',11);
- $pdf->SetXY(102,$pdf->GetY()+3);
- $pdf->MultiCell(96,5, $outputlangs->convToOutputCharset($fac->client->adresse) . "\n\n" . $outputlangs->convToOutputCharset($fac->client->cp) . " " . $outputlangs->convToOutputCharset($fac->client->ville), 0, 'C');
-
-
-
-
- $pdf->SetTextColor(200,0,0);
- $pdf->SetFont('Arial','B',14);
- $pdf->Text(11, 88, $outputlangs->transnoentities('Date'));
- $pdf->Text(35, 88, ": " . dolibarr_print_date($fac->date,'day',false,$outputlangs));
- $pdf->Text(11, 94, $outputlangs->transnoentities('Invoice'));
- $pdf->Text(35, 94, ": ".$fac->ref);
-
- // Montants exprimes en euros
- $pdf->SetTextColor(0,0,0);
- $pdf->SetFont('Arial','',10);
- $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie));
- $pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
-
- }
-
- /**
- * \brief Affiche le pied de page de la facture
- * \param pdf object PDF
- * \param fac object invoice
- * \param outputlangs object langs
- */
- function _pagefoot(&$pdf, $fac, $outputlangs)
- {
- return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
- }
-
-}
-?>
diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php
index 94d223ec263..f982af8127b 100644
--- a/htdocs/includes/modules/facture/pdf_oursin.modules.php
+++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php
@@ -84,6 +84,18 @@ class pdf_oursin extends ModelePDFFactures
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'�tait pas d�fini
+
+ // Defini position des colonnes
+ $this->posxdesc=$this->marge_gauche+1;
+ $this->posxtva=113;
+ $this->posxup=126;
+ $this->posxqty=145;
+ $this->posxdiscount=162;
+ $this->postotalht=174;
+
+ $this->tva=array();
+ $this->atleastoneratenotnull=0;
+ $this->atleastonediscount=0;
}
@@ -195,63 +207,7 @@ class pdf_oursin extends ModelePDFFactures
$curY = $nexY;
// Description of product line
- $libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
- if ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc != $fac->lignes[$i]->libelle)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
-
- if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except)
- {
- $discount=new DiscountAbsolute($this->db);
- $discount->fetch($fac->lignes[$i]->fk_remise_except);
- $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
- }
- else
- {
- if ($fac->lignes[$i]->produit_id)
- {
- $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
- }
- else
- {
- //$fac->lignes[$i]->desc='�zaaaa';
- //print dol_string_is_good_iso($fac->lignes[$i]->desc);
- //print dol_htmlentitiesbr($fac->lignes[$i]->desc);
- //print exit;
- $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
- }
- }
- }
-
- // Si ligne associee a un code produit
- if ($fac->lignes[$i]->produit_id)
- {
- $prodser = new Product($this->db);
- $prodser->fetch($fac->lignes[$i]->produit_id);
- // On ajoute la ref
- if ($prodser->ref)
- {
- $prefix_prodserv = "";
- if($prodser->isservice())
- {
- $prefix_prodserv = $outputlangs->transnoentities("Service")." ";
- }
- else
- {
- $prefix_prodserv = $outputlangs->transnoentities("Product")." ";
- }
-
- $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
- }
-
- }
-
- if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
- {
- // Affichage duree si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
- //if ($i==0) { print $libelleproduitservice; exit; }
+ $libelleproduitservice=pdf_getlinedesc($fac->lignes[$i],$outputlangs);
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
diff --git a/htdocs/includes/modules/fichinter/modules_fichinter.php b/htdocs/includes/modules/fichinter/modules_fichinter.php
index b8dcca22c35..1fa8b6cf7d8 100644
--- a/htdocs/includes/modules/fichinter/modules_fichinter.php
+++ b/htdocs/includes/modules/fichinter/modules_fichinter.php
@@ -26,7 +26,7 @@
\version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
@@ -237,7 +237,7 @@ function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
$fichinter->fetch($fichinterid);
$fichinterref = $fichinter->ref;
}
-
+
if ($conf->fichinter->dir_output)
{
$fichinterref = sanitizeFileName($fichinterref);
diff --git a/htdocs/includes/modules/livraison/modules_livraison.php b/htdocs/includes/modules/livraison/modules_livraison.php
index cd39194e984..cf877d6dc74 100644
--- a/htdocs/includes/modules/livraison/modules_livraison.php
+++ b/htdocs/includes/modules/livraison/modules_livraison.php
@@ -28,7 +28,7 @@
* \version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
@@ -199,7 +199,7 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
{
// on supprime l'image correspondant au preview
delivery_order_delete_preview($db, $deliveryid);
-
+
$outputlangs->charset_output=$sav_charset_output;
return 1;
}
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
index 29c3054960c..aedb2ef6dce 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
@@ -48,6 +48,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$langs->load("main");
$langs->load("bills");
+ $langs->load("sendings");
$this->db = $db;
$this->name = "sirocco";
@@ -98,6 +99,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("deliveries");
+ $outputlangs->load("sendings");
$outputlangs->setPhpLang();
@@ -179,41 +181,11 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentitiesbr($delivery->lignes[$i]->label,1);
- if ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
- $libelleproduitservice.=dol_htmlentitiesbr($delivery->lignes[$i]->description,1);
- }
- // Si ligne associee a un code produit
- if ($delivery->lignes[$i]->fk_product)
- {
- $prodser = new Product($this->db);
- $prodser->fetch($delivery->lignes[$i]->fk_product);
- if ($prodser->ref)
- {
- $prefix_prodserv = "";
- if($prodser->isservice())
- {
- // Un service peur aussi etre livre
- $prefix_prodserv = $outputlangs->transnoentities("Service")." ";
- }
- else
- {
- $prefix_prodserv = $outputlangs->transnoentities("Product")." ";
- }
- $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
- }
- }
- if ($delivery->lignes[$i]->date_start && $delivery->lignes[$i]->date_end)
- {
- // Affichage duree si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
+ $libelleproduitservice=pdf_getlinedesc($delivery->lignes[$i],$outputlangs);
$pdf->SetXY (30, $curY );
- $pdf->MultiCell(100, 5, $libelleproduitservice, 0, 'J', 0);
+ $pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
$nexY = $pdf->GetY();
@@ -272,19 +244,15 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
{
- global $langs,$conf;
- $langs->load("main");
- $langs->load("bills");
-
$pdf->SetFont('Arial','',11);
- $pdf->Text(30,$tab_top + 5,$langs->transnoentities("Designation"));
+ $pdf->Text(30,$tab_top + 5,$outputlangs->transnoentities("Designation"));
// $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
// $pdf->Text(134,$tab_top + 5,$langs->transnoentities("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
- $pdf->Text(147,$tab_top + 5,$langs->transnoentities("QtyShipped"));
+ $pdf->Text(147,$tab_top + 5,$outputlangs->transnoentities("QtyShipped"));
// $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
// $pdf->Text(160,$tab_top + 5,$langs->transnoentities("PriceU"));
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
index 2a80d1e5aa4..0081296c2b6 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
@@ -52,6 +52,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$langs->load("main");
$langs->load("bills");
+ $langs->load("sendings");
$this->db = $db;
$this->name = "typhon";
@@ -122,6 +123,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("deliveries");
+ $outputlangs->load("sendings");
$outputlangs->setPhpLang();
@@ -213,41 +215,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentitiesbr($delivery->lignes[$i]->label,1);
- if ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
- $libelleproduitservice.=dol_htmlentitiesbr($delivery->lignes[$i]->description,1);
- }
- // Si ligne associee a un code produit
- if ($delivery->lignes[$i]->fk_product)
- {
- $prodser = new Product($this->db);
- $prodser->fetch($delivery->lignes[$i]->fk_product);
- if ($prodser->ref)
- {
- $prefix_prodserv = "";
- if($prodser->isservice())
- {
- // Un service peur aussi etre livre
- $prefix_prodserv = $outputlangs->transnoentities("Service")." ";
- }
- else
- {
- $prefix_prodserv = $outputlangs->transnoentities("Product")." ";
- }
- $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
- }
- }
- if ($delivery->lignes[$i]->date_start && $delivery->lignes[$i]->date_end)
- {
- // Affichage duree si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
+ $libelleproduitservice=pdf_getlinedesc($delivery->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
- $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
+ $pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
diff --git a/htdocs/includes/modules/member/PDF_card.class.php b/htdocs/includes/modules/member/PDF_card.class.php
index a98f5378903..b35aa4d6311 100644
--- a/htdocs/includes/modules/member/PDF_card.class.php
+++ b/htdocs/includes/modules/member/PDF_card.class.php
@@ -64,7 +64,8 @@
\version $Id$
*/
-require_once(FPDFI_PATH.'fpdi_protection.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
/**
@@ -100,107 +101,107 @@ class PDF_card extends FPDF {
'marginLeft'=>1.762,
'marginTop'=>10.7,
'NX'=>3,
- 'NY'=>10,
- 'SpaceX'=>3.175,
- 'SpaceY'=>0,
- 'width'=>66.675,
- 'height'=>25.4,
+ 'NY'=>10,
+ 'SpaceX'=>3.175,
+ 'SpaceY'=>0,
+ 'width'=>66.675,
+ 'height'=>25.4,
'font-size'=>8),
- '5161'=>array('name'=>'5161',
- 'paper-size'=>'letter',
- 'metric'=>'mm',
- 'marginLeft'=>0.967,
- 'marginTop'=>10.7,
- 'NX'=>2,
- 'NY'=>10,
- 'SpaceX'=>3.967,
- 'SpaceY'=>0,
- 'width'=>101.6,
- 'height'=>25.4,
- 'font-size'=>8),
- '5162'=>array('name'=>'5162',
- 'paper-size'=>'letter',
- 'metric'=>'mm',
- 'marginLeft'=>0.97,
- 'marginTop'=>20.224,
- 'NX'=>2,
- 'NY'=>7,
- 'SpaceX'=>4.762,
- 'SpaceY'=>0,
- 'width'=>100.807,
- 'height'=>35.72,
- 'font-size'=>8),
- '5163'=>array('name'=>'5163',
- 'paper-size'=>'letter',
- 'metric'=>'mm',
- 'marginLeft'=>1.762,
- 'marginTop'=>10.7,
- 'NX'=>2,
- 'NY'=>5,
- 'SpaceX'=>3.175,
- 'SpaceY'=>0,
- 'width'=>101.6,
- 'height'=>50.8,
- 'font-size'=>8),
- '5164'=>array('name'=>'5164',
- 'paper-size'=>'letter',
- 'metric'=>'in',
- 'marginLeft'=>0.148,
- 'marginTop'=>0.5,
- 'NX'=>2,
- 'NY'=>3,
- 'SpaceX'=>0.2031,
- 'SpaceY'=>0,
- 'width'=>4.0,
- 'height'=>3.33,
- 'font-size'=>12),
- '8600'=>array('name'=>'8600',
- 'paper-size'=>'letter',
- 'metric'=>'mm',
- 'marginLeft'=>7.1,
- 'marginTop'=>19,
- 'NX'=>3,
- 'NY'=>10,
- 'SpaceX'=>9.5,
- 'SpaceY'=>3.1,
- 'width'=>66.6,
- 'height'=>25.4,
- 'font-size'=>8),
- 'L7163'=>array('name'=>'L7163',
- 'paper-size'=>'A4',
- 'metric'=>'mm',
- 'marginLeft'=>5,
- 'marginTop'=>15,
- 'NX'=>2,
- 'NY'=>7,
- 'SpaceX'=>25,
- 'SpaceY'=>0,
- 'width'=>99.1,
- 'height'=>38.1,
- 'font-size'=>10),
- 'FREELUG'=>array('name'=>'FREELUG',
- 'paper-size'=>'A4',
- 'metric'=>'mm',
- 'marginLeft'=>0,
- 'marginTop'=>0,
- 'NX'=>2,
- 'NY'=>8,
- 'SpaceX'=>0,
- 'SpaceY'=>0,
- 'width'=>105,
- 'height'=>38,
- 'font-size'=>10),
- 'CARD'=>array('name'=>'CARD',
- 'paper-size'=>'A4',
+ '5161'=>array('name'=>'5161',
+ 'paper-size'=>'letter',
'metric'=>'mm',
- 'marginLeft'=>15,
- 'marginTop'=>15,
- 'NX'=>2,
- 'NY'=>5,
- 'SpaceX'=>0,
- 'SpaceY'=>0,
- 'width'=>85,
- 'height'=>54,
+ 'marginLeft'=>0.967,
+ 'marginTop'=>10.7,
+ 'NX'=>2,
+ 'NY'=>10,
+ 'SpaceX'=>3.967,
+ 'SpaceY'=>0,
+ 'width'=>101.6,
+ 'height'=>25.4,
+ 'font-size'=>8),
+ '5162'=>array('name'=>'5162',
+ 'paper-size'=>'letter',
+ 'metric'=>'mm',
+ 'marginLeft'=>0.97,
+ 'marginTop'=>20.224,
+ 'NX'=>2,
+ 'NY'=>7,
+ 'SpaceX'=>4.762,
+ 'SpaceY'=>0,
+ 'width'=>100.807,
+ 'height'=>35.72,
+ 'font-size'=>8),
+ '5163'=>array('name'=>'5163',
+ 'paper-size'=>'letter',
+ 'metric'=>'mm',
+ 'marginLeft'=>1.762,
+ 'marginTop'=>10.7,
+ 'NX'=>2,
+ 'NY'=>5,
+ 'SpaceX'=>3.175,
+ 'SpaceY'=>0,
+ 'width'=>101.6,
+ 'height'=>50.8,
+ 'font-size'=>8),
+ '5164'=>array('name'=>'5164',
+ 'paper-size'=>'letter',
+ 'metric'=>'in',
+ 'marginLeft'=>0.148,
+ 'marginTop'=>0.5,
+ 'NX'=>2,
+ 'NY'=>3,
+ 'SpaceX'=>0.2031,
+ 'SpaceY'=>0,
+ 'width'=>4.0,
+ 'height'=>3.33,
+ 'font-size'=>12),
+ '8600'=>array('name'=>'8600',
+ 'paper-size'=>'letter',
+ 'metric'=>'mm',
+ 'marginLeft'=>7.1,
+ 'marginTop'=>19,
+ 'NX'=>3,
+ 'NY'=>10,
+ 'SpaceX'=>9.5,
+ 'SpaceY'=>3.1,
+ 'width'=>66.6,
+ 'height'=>25.4,
+ 'font-size'=>8),
+ 'L7163'=>array('name'=>'L7163',
+ 'paper-size'=>'A4',
+ 'metric'=>'mm',
+ 'marginLeft'=>5,
+ 'marginTop'=>15,
+ 'NX'=>2,
+ 'NY'=>7,
+ 'SpaceX'=>25,
+ 'SpaceY'=>0,
+ 'width'=>99.1,
+ 'height'=>38.1,
+ 'font-size'=>10),
+ 'FREELUG'=>array('name'=>'FREELUG',
+ 'paper-size'=>'A4',
+ 'metric'=>'mm',
+ 'marginLeft'=>0,
+ 'marginTop'=>0,
+ 'NX'=>2,
+ 'NY'=>8,
+ 'SpaceX'=>0,
+ 'SpaceY'=>0,
+ 'width'=>105,
+ 'height'=>38,
+ 'font-size'=>10),
+ 'CARD'=>array('name'=>'CARD',
+ 'paper-size'=>'A4',
+ 'metric'=>'mm',
+ 'marginLeft'=>15,
+ 'marginTop'=>15,
+ 'NX'=>2,
+ 'NY'=>5,
+ 'SpaceX'=>0,
+ 'SpaceY'=>0,
+ 'width'=>85,
+ 'height'=>54,
'font-size'=>10,
'logo1'=>'logo1.jpg',
'logo2'=>'logo2.jpg',
@@ -255,21 +256,21 @@ class PDF_card extends FPDF {
// On imprime une étiqette
- function Add_PDF_card($texte,$header='',$footer='',$outputlangs)
+ function Add_PDF_card($texte,$header='',$footer='',$outputlangs)
{
global $langs;
-
+
if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output='ISO-8859-1';
-
+
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("members");
-
+
// $outputlangs->setPhpLang();
-
+
// We are in a new page, then we must add a page
if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) {
$this->AddPage();
@@ -321,7 +322,7 @@ class PDF_card extends FPDF {
$this->_COUNTX=0;
$this->_COUNTY=0;
}
-
+
// $langs->setPhpLang(); // On restaure langue session
}
diff --git a/htdocs/includes/modules/propale/modules_propale.php b/htdocs/includes/modules/propale/modules_propale.php
index 220db03958c..30272f2e4a6 100644
--- a/htdocs/includes/modules/propale/modules_propale.php
+++ b/htdocs/includes/modules/propale/modules_propale.php
@@ -26,7 +26,7 @@
\version $Id$
*/
-require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilisé dans les classes qui héritent
@@ -172,7 +172,7 @@ function propale_pdf_create($db, $id, $modele, $outputlangs)
$file = "pdf_propale_".$modele.".modules.php";
if ($modele && file_exists($dir.$file)) $modelisok=1;
- // Si model pas encore bon
+ // Si model pas encore bon
if (! $modelisok)
{
if ($conf->global->PROPALE_ADDON_PDF) $modele = $conf->global->PROPALE_ADDON_PDF;
@@ -180,7 +180,7 @@ function propale_pdf_create($db, $id, $modele, $outputlangs)
if (file_exists($dir.$file)) $modelisok=1;
}
- // Si model pas encore bon
+ // Si model pas encore bon
if (! $modelisok)
{
$liste=array();
@@ -190,7 +190,7 @@ function propale_pdf_create($db, $id, $modele, $outputlangs)
$file = "pdf_propale_".$modele.".modules.php";
if (file_exists($dir.$file)) $modelisok=1;
}
-
+
// Charge le modele
if ($modelisok)
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index 6e7f1c3940f..401860a7845 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -241,51 +241,12 @@ class pdf_propale_azur extends ModelePDFPropales
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentitiesbr($propale->lignes[$i]->libelle,1);
- if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
-
- if ($propale->lignes[$i]->desc == '(CREDIT_NOTE)' && $propale->lignes[$i]->fk_remise_except)
- {
- $discount=new DiscountAbsolute($this->db);
- $discount->fetch($propale->lignes[$i]->fk_remise_except);
- $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
- }
- else
- {
- $libelleproduitservice.=dol_htmlentitiesbr($propale->lignes[$i]->desc,1);
- }
- }
- // Si ligne associée à un code produit
- if ($propale->lignes[$i]->fk_product)
- {
- $prodser = new Product($this->db);
- $prodser->fetch($propale->lignes[$i]->fk_product);
-
- // On ajoute la ref
- if ($prodser->ref)
- {
- $prefix_prodserv = "";
- if($prodser->isservice())
- $prefix_prodserv = $outputlangs->transnoentities("Service")." ";
- else
- $prefix_prodserv = $outputlangs->transnoentities("Product")." ";
-
- $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
- }
-
- }
- if ($propale->lignes[$i]->date_start && $propale->lignes[$i]->date_end)
- {
- // Affichage durée si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
+ $libelleproduitservice=pdf_getlinedesc($propale->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
// Description
- $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
+ $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY();
diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
index 48a1ac5887e..6b0451d2df0 100644
--- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
@@ -197,31 +197,10 @@ class pdf_propale_jaune extends ModelePDFPropales
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentitiesbr($propale->lignes[$i]->libelle,1);
- if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
-
- if ($propale->lignes[$i]->desc == '(CREDIT_NOTE)' && $propale->lignes[$i]->fk_remise_except)
- {
- $discount=new DiscountAbsolute($this->db);
- $discount->fetch($propale->lignes[$i]->fk_remise_except);
- $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
- }
- else
- {
- $libelleproduitservice.=dol_htmlentitiesbr($propale->lignes[$i]->desc,1);
- }
- }
- if ($propale->lignes[$i]->date_start && $propale->lignes[$i]->date_end)
- {
- // Affichage durée si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
-
+ $libelleproduitservice=pdf_getlinedesc($propale->lignes[$i],$outputlangs);
$pdf->SetXY (30, $curY );
- $pdf->MultiCell(102, 5, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
+ $pdf->writeHTMLCell(102, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
$nexY = $pdf->GetY();
diff --git a/htdocs/includes/modules/rapport/pdf_paiement.class.php b/htdocs/includes/modules/rapport/pdf_paiement.class.php
index 93cbd6d1d4f..37861d29244 100644
--- a/htdocs/includes/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/includes/modules/rapport/pdf_paiement.class.php
@@ -24,28 +24,29 @@
* \brief Fichier de la classe permettant de g�n�rer les rapports de paiement
* \version $Id$
*/
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
-/**
+/**
* \class pdf_paiement
* \brief Classe permettant de generer les rapports de paiement
*/
class pdf_paiement extends FPDF
{
- /**
+ /**
* \brief Constructeur
* \param db handler acces base de donnee
*/
function pdf_paiement($db)
- {
+ {
global $langs;
$langs->load("bills");
-
+
$this->db = $db;
$this->description = $langs->transnoentities("ListOfCustomerPayments");
-
+
// Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210;
@@ -55,16 +56,16 @@ class pdf_paiement extends FPDF
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
-
+
$this->tab_top = 30;
-
+
$this->line_height = 5;
$this->line_per_page = 25;
$this->tab_height = 230; //$this->line_height * $this->line_per_page;
-
+
}
-
-
+
+
/**
* \brief Fonction generant le rapport sur le disque
* \param _dir repertoire
@@ -81,26 +82,26 @@ class pdf_paiement extends FPDF
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->setPhpLang();
-
+
$this->month=$month;
$this->year=$year;
-
+
$dir=$_dir.'/'.$year;
-
+
if (! is_dir($dir))
{
$result=create_exdir($dir);
if ($result < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
- return -1;
+ return -1;
}
}
-
+
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
$_file = $dir . "/payments-".$month."-".$year.".pdf";
-
+
// Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION)
{
@@ -116,7 +117,7 @@ class pdf_paiement extends FPDF
}
$pdf->Open();
-
+
$sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql .= ", c.code as paiement_code, p.num_paiement";
@@ -125,7 +126,7 @@ class pdf_paiement extends FPDF
$sql .= ", p.rowid as prowid";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f, ";
$sql .= MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
- $sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
+ $sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
$sql .= " AND p.fk_paiement = c.id ";
$sql .= " AND date_format(p.datep, '%Y%m') = " . sprintf("%04d%02d",$year,$month);
$sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
@@ -137,12 +138,12 @@ class pdf_paiement extends FPDF
$lignes = $this->db->num_rows($result);
$i = 0;
$var=True;
-
+
while ($i < $lignes)
{
$objp = $this->db->fetch_object($result);
$var=!$var;
-
+
$lines[$i][0] = $objp->facnumber;
$lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y",false,$outputlangs);
//$lines[$i][2] = $objp->paiement_type ;
@@ -159,14 +160,14 @@ class pdf_paiement extends FPDF
{
dolibarr_print_error($this->db);
}
-
+
$pages = intval($lignes / $this->line_per_page);
-
+
if (($lignes % $this->line_per_page)>0)
{
$pages++;
}
-
+
if ($pages == 0)
{
// force to build at least one page if report has no line
@@ -180,60 +181,60 @@ class pdf_paiement extends FPDF
$this->Body($pdf, $i+1, $lines, $outputlangs);
}
*/
-
+
$pdf->AddPage();
-
+
$this->Header($pdf, 1, $pages, $outputlangs);
-
+
$this->Body($pdf, 1, $lines, $outputlangs);
-
+
$pdf->Output($_file);
- if (! empty($conf->global->MAIN_UMASK))
+ if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->setPhpLang(); // On restaure langue session
return 1;
- }
+ }
- /**
+ /**
* \brief Generate Header
* \param pdf pdf object
* \param page current page number
* \param pages number of pages
- */
+ */
function Header(&$pdf, $page, $pages, $outputlangs)
{
global $langs;
-
+
$title=$outputlangs->transnoentities("ListOfCustomerPayments");
$title.=' - '.dolibarr_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y",false,$outputlangs);
$pdf->SetFont('Arial','B',12);
$pdf->Text(76, 10, $title);
-
+
$pdf->SetFont('Arial','B',12);
$pdf->Text(11, 16, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date(time(),"day",false,$outputlangs));
-
+
$pdf->SetFont('Arial','',12);
$pdf->Text(11, 22, $outputlangs->transnoentities("Page")." : ".$page);
-
+
$pdf->SetFont('Arial','',12);
-
+
$pdf->Text(11,$this->tab_top + 6,'Date');
-
+
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
$pdf->Text(42, $this->tab_top + 6, $outputlangs->transnoentities("PaymentMode"));
-
+
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
$pdf->Text(82, $this->tab_top + 6, $outputlangs->transnoentities("Invoice"));
-
+
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
$pdf->Text(122, $this->tab_top + 6, $outputlangs->transnoentities("AmountInvoice"));
-
+
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
-
+
$pdf->SetXY (160, $this->tab_top);
$pdf->MultiCell(40, 10, $outputlangs->transnoentities("AmountPayment"), 0, 'R');
-
+
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
@@ -241,7 +242,7 @@ class pdf_paiement extends FPDF
/**
- *
+ *
*/
function Body(&$pdf, $page, $lines, $outputlangs)
{
@@ -262,38 +263,38 @@ class pdf_paiement extends FPDF
$pdf->SetFont('Arial','', 9);
$yp = 0;
}
-
+
$pdf->SetXY (10, $this->tab_top + 10 + $yp);
$pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'J', 1);
-
+
$pdf->SetXY (40, $this->tab_top + 10 + $yp);
$pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'J', 1);
-
+
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1);
-
+
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1);
$yp = $yp + 5;
}
-
+
$pdf->SetXY (80, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0);
-
+
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0);
-
+
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0);
$yp = $yp + 5;
-
+
if ($oldprowid <> $lines[$j][7])
{
$oldprowid = $lines[$j][7];
- }
+ }
}
}
-
+
}
?>
diff --git a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
index 90ccb90e4d0..9630dfa0048 100644
--- a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
+++ b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
@@ -27,6 +27,7 @@
* and parent class for supplier orders numbering models
* \version $Id$
*/
+require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 3a8463386c1..d8de497bf4e 100644
--- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -241,26 +241,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1);
- if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
- {
- if ($libelleproduitservice) $libelleproduitservice.="
";
- $libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1);
- }
- // Si ligne associ�e � un code produit
- if ($com->lignes[$i]->fk_product)
- {
- $libelleproduitservice=$outputlangs->transnoentities("Product")." ".$outputlangs->convToOutputCharset($com->lignes[$i]->ref_fourn)." - ".$libelleproduitservice;
- }
- if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
- {
- // Affichage dur�e si il y en a une
- $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end,'',false,$outputlangs).")",1);
- }
+ $libelleproduitservice=pdf_getlinedesc($com->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour g�rer multi-page
- $pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
+ $pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par d�faut
@@ -268,27 +253,27 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// TVA
$pdf->SetXY ($this->posxtva, $curY);
- $pdf->MultiCell(10, 4, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
+ $pdf->MultiCell(10, 3, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
// Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY);
- $pdf->MultiCell(18, 4, price($com->lignes[$i]->subprice), 0, 'R', 0);
+ $pdf->MultiCell(18, 3, price($com->lignes[$i]->subprice), 0, 'R', 0);
// Quantit�
$pdf->SetXY ($this->posxqty, $curY);
- $pdf->MultiCell(10, 4, $com->lignes[$i]->qty, 0, 'R');
+ $pdf->MultiCell(10, 3, $com->lignes[$i]->qty, 0, 'R');
// Remise sur ligne
$pdf->SetXY ($this->posxdiscount, $curY);
if ($com->lignes[$i]->remise_percent)
{
- $pdf->MultiCell(14, 4, $com->lignes[$i]->remise_percent."%", 0, 'R');
+ $pdf->MultiCell(14, 3, $com->lignes[$i]->remise_percent."%", 0, 'R');
}
// Total HT ligne
$pdf->SetXY ($this->postotalht, $curY);
$total = price($com->lignes[$i]->total_ht);
- $pdf->MultiCell(23, 4, $total, 0, 'R', 0);
+ $pdf->MultiCell(23, 3, $total, 0, 'R', 0);
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$tvaligne=$com->lignes[$i]->total_tva;
diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php
index 3329b8c39f5..37ccc6f71f0 100644
--- a/htdocs/lib/company.lib.php
+++ b/htdocs/lib/company.lib.php
@@ -664,167 +664,4 @@ function show_actions_done($conf,$langs,$db,$objsoc,$objcon='')
print "
\n";
}
-
-/**
- * \brief Show bank informations for PDF generation
- */
-function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account)
-{
- $pdf->SetXY ($curx, $cury);
- $pdf->SetFont('Arial','B',8);
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
- $cury+=4;
-
- $usedetailedbban=$account->useDetailedBBAN();
-
- if ($usedetailedbban)
- {
- $pdf->SetFont('Arial','B',6);
- $pdf->line($curx+1, $cury, $curx+1, $cury+10 );
- $pdf->SetXY ($curx, $cury);
- $pdf->MultiCell(18, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
- $pdf->line($curx+18, $cury, $curx+18, $cury+10 );
- $pdf->SetXY ($curx+18, $cury);
- $pdf->MultiCell(18, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
- $pdf->line($curx+36, $cury, $curx+36, $cury+10 );
- $pdf->SetXY ($curx+36, $cury);
- $pdf->MultiCell(24, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
- $pdf->line($curx+60, $cury, $curx+60, $cury+10 );
- $pdf->SetXY ($curx+60, $cury);
- $pdf->MultiCell(13, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
- $pdf->line($curx+73, $cury, $curx+73, $cury+10 );
-
- $pdf->SetFont('Arial','',8);
- $pdf->SetXY ($curx, $cury+6);
- $pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
- $pdf->SetXY ($curx+18, $cury+6);
- $pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
- $pdf->SetXY ($curx+36, $cury+6);
- $pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
- $pdf->SetXY ($curx+60, $cury+6);
- $pdf->MultiCell(13, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
- }
- else
- {
- $pdf->SetFont('Arial','B',6);
- $pdf->SetXY ($curx, $cury);
- $pdf->MultiCell(90, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
- $cury-=9;
- }
-
- $pdf->SetXY ($curx, $cury+12);
- $pdf->MultiCell(90, 3, $outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation), 0, 'L', 0);
- $pdf->SetXY ($curx, $cury+22);
- $pdf->MultiCell(90, 3, $outputlangs->transnoentities("IBANNumber").': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
- $pdf->SetXY ($curx, $cury+25);
- $pdf->MultiCell(90, 3, $outputlangs->transnoentities("BICNumber").': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
-
- return $pdf->getY();
-}
-
-
-/**
- * \brief Show footer of page for PDF generation
- * \param pdf Object PDF
- * \param outputlang Object lang for output
- * \param paramfreetext Constant name of free text
- * \param fromcompany Object company
- * \param marge_basse
- * \param marge_gauche
- * \param page_hauteur
- */
-function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur)
-{
- global $conf;
-
- $outputlangs->load("dict");
-
- // Line of free text
- $ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
-
- // First line of company infos
-
- // Juridical status
- $ligne1="";
- if ($fromcompany->forme_juridique_code)
- {
- $ligne1.=($ligne1?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
- }
- // Capital
- if ($fromcompany->capital)
- {
- $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
- }
- // Prof Id 1
- if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2))
- {
- $field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
- if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
- $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid1);
- }
- // Prof Id 2
- if ($fromcompany->profid2)
- {
- $field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
- if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
- $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid2);
- }
-
- // Second line of company infos
- $ligne2="";
- // Prof Id 3
- if ($fromcompany->profid3)
- {
- $field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
- if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
- $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid3);
- }
- // Prof Id 4
- if ($fromcompany->profid4)
- {
- $field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
- if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
- $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid4);
- }
- // IntraCommunautary VAT
- if ($fromcompany->tva_intra != '')
- {
- $ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
- }
-
- $pdf->SetFont('Arial','',7);
- $pdf->SetDrawColor(224,224,224);
-
- // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
- $nbofligne=dol_nboflines($ligne);
- //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit;
- $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0);
-
- if ($ligne)
- {
- $pdf->SetXY($marge_gauche,-$posy);
- $pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
- $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell
- }
-
- $pdf->SetY(-$posy);
- $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
- $posy--;
-
- if ($ligne1)
- {
- $pdf->SetXY($marge_gauche,-$posy);
- $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
- }
-
- if ($ligne2)
- {
- $posy-=3;
- $pdf->SetXY($marge_gauche,-$posy);
- $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
- }
-
- $pdf->SetXY(-20,-$posy);
- $pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
-}
?>
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index ca207514a2b..51a411ce273 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -368,7 +368,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='')
}
/**
- * \brief Output date in a string format according to language $conf->language
+ * \brief Output date in a string format according to outputlang (or lang if not defined)
* \param time GM Timestamps date (or 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' in server TZ)
* \param format Output date format
* "%d %b %Y",
@@ -2456,7 +2456,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0)
}
/**
- * \brief This function is called to encode a string into a HTML string
+ * \brief This function is called to encode a string into a HTML string. All entities except <> are converted.
* \param stringtoencode String to encode
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
* \remarks For PDF usage, you can show text by 2 ways:
@@ -2469,17 +2469,19 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
{
if (dol_textishtml($stringtoencode))
{
- // Replace "
" by "
". It's same and avoid pb with FPDF.
- $stringtoencode=eregi_replace('
','
',$newstring); // Replace "
" by "
". It's same and avoid pb with FPDF.
+ $newstring=strtr($newstring,array('__lt__'=>'<','__gt__'=>'>'));
}
else {
- // We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
+ // We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8;
$newstring=dol_nl2br(@htmlentities($stringtoencode,ENT_COMPAT,$pagecodefrom),$nl2brmode);
// Other substitutions that htmlentities does not do
- $newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80
- return $newstring;
}
+ $newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80. Not in html entity table.
+ return $newstring;
}
/**
diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php
new file mode 100644
index 00000000000..5c28eb14693
--- /dev/null
+++ b/htdocs/lib/pdf.lib.php
@@ -0,0 +1,267 @@
+
+ * Copyright (C) 2006 Rodolphe Quiedeville
+ * Copyright (C) 2007 Patrick Raguin
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/lib/company.lib.php
+ * \brief Ensemble de fonctions de base pour le module societe
+ * \ingroup societe
+ * \version $Id$
+ */
+
+/**
+ * \brief Show bank informations for PDF generation
+ */
+function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account)
+{
+ $pdf->SetXY ($curx, $cury);
+ $pdf->SetFont('Arial','B',8);
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
+ $cury+=4;
+
+ $usedetailedbban=$account->useDetailedBBAN();
+
+ if ($usedetailedbban)
+ {
+ $pdf->SetFont('Arial','B',6);
+ $pdf->line($curx+1, $cury, $curx+1, $cury+10 );
+ $pdf->SetXY ($curx, $cury);
+ $pdf->MultiCell(18, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
+ $pdf->line($curx+18, $cury, $curx+18, $cury+10 );
+ $pdf->SetXY ($curx+18, $cury);
+ $pdf->MultiCell(18, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
+ $pdf->line($curx+36, $cury, $curx+36, $cury+10 );
+ $pdf->SetXY ($curx+36, $cury);
+ $pdf->MultiCell(24, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
+ $pdf->line($curx+60, $cury, $curx+60, $cury+10 );
+ $pdf->SetXY ($curx+60, $cury);
+ $pdf->MultiCell(13, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
+ $pdf->line($curx+73, $cury, $curx+73, $cury+10 );
+
+ $pdf->SetFont('Arial','',8);
+ $pdf->SetXY ($curx, $cury+6);
+ $pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
+ $pdf->SetXY ($curx+18, $cury+6);
+ $pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
+ $pdf->SetXY ($curx+36, $cury+6);
+ $pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
+ $pdf->SetXY ($curx+60, $cury+6);
+ $pdf->MultiCell(13, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
+ }
+ else
+ {
+ $pdf->SetFont('Arial','B',6);
+ $pdf->SetXY ($curx, $cury);
+ $pdf->MultiCell(90, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
+ $cury-=9;
+ }
+
+ $pdf->SetXY ($curx, $cury+12);
+ $pdf->MultiCell(90, 3, $outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation), 0, 'L', 0);
+ $pdf->SetXY ($curx, $cury+22);
+ $pdf->MultiCell(90, 3, $outputlangs->transnoentities("IBANNumber").': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
+ $pdf->SetXY ($curx, $cury+25);
+ $pdf->MultiCell(90, 3, $outputlangs->transnoentities("BICNumber").': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
+
+ return $pdf->getY();
+}
+
+
+/**
+ * \brief Show footer of page for PDF generation
+ * \param pdf Object PDF
+ * \param outputlang Object lang for output
+ * \param paramfreetext Constant name of free text
+ * \param fromcompany Object company
+ * \param marge_basse
+ * \param marge_gauche
+ * \param page_hauteur
+ */
+function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur)
+{
+ global $conf;
+
+ $outputlangs->load("dict");
+
+ // Line of free text
+ $ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
+
+ // First line of company infos
+
+ // Juridical status
+ $ligne1="";
+ if ($fromcompany->forme_juridique_code)
+ {
+ $ligne1.=($ligne1?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
+ }
+ // Capital
+ if ($fromcompany->capital)
+ {
+ $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
+ }
+ // Prof Id 1
+ if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2))
+ {
+ $field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
+ if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
+ $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid1);
+ }
+ // Prof Id 2
+ if ($fromcompany->profid2)
+ {
+ $field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
+ if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
+ $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid2);
+ }
+
+ // Second line of company infos
+ $ligne2="";
+ // Prof Id 3
+ if ($fromcompany->profid3)
+ {
+ $field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
+ if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
+ $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid3);
+ }
+ // Prof Id 4
+ if ($fromcompany->profid4)
+ {
+ $field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
+ if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
+ $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid4);
+ }
+ // IntraCommunautary VAT
+ if ($fromcompany->tva_intra != '')
+ {
+ $ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
+ }
+
+ $pdf->SetFont('Arial','',7);
+ $pdf->SetDrawColor(224,224,224);
+
+ // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
+ $nbofligne=dol_nboflines($ligne);
+ //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit;
+ $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0);
+
+ if ($ligne)
+ {
+ $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
+ $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell
+ }
+
+ $pdf->SetY(-$posy);
+ $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
+ $posy--;
+
+ if ($ligne1)
+ {
+ $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
+ }
+
+ if ($ligne2)
+ {
+ $posy-=3;
+ $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
+ }
+
+ $pdf->SetXY(-20,-$posy);
+ $pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
+}
+
+
+/**
+ * \brief Return line description translated in outputlangs but encoded in UTF8
+ * \param line Line to format
+ * \param outputlang Object lang for output
+ */
+function pdf_getlinedesc($line,$outputlangs)
+{
+ global $db;
+
+ if (empty($line->libelle)) $line->libelle=$line->label;
+ if (empty($line->desc)) $line->desc=$line->description;
+ if (empty($line->produit_id)) $line->produit_id=$line->fk_product;
+
+ // Description of product line
+ $libelleproduitservice=$line->libelle;
+ if ($line->desc && $line->desc != $line->libelle)
+ {
+ if ($libelleproduitservice) $libelleproduitservice.="
";
+
+ if ($line->desc == '(CREDIT_NOTE)' && $line->fk_remise_except)
+ {
+ $discount=new DiscountAbsolute($this->db);
+ $discount->fetch($line->fk_remise_except);
+ $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromCreditNote",$discount->ref_facture_source);
+ }
+ else
+ {
+ if ($line->produit_id)
+ {
+ $libelleproduitservice.=$line->desc;
+ }
+ else
+ {
+ $libelleproduitservice.=$line->desc;
+ }
+ }
+ }
+
+ // Si ligne associee a un code produit
+ if ($line->produit_id)
+ {
+ $prodser = new Product($db);
+ $prodser->fetch($line->produit_id);
+ // On ajoute la ref
+ if ($prodser->ref)
+ {
+ $prefix_prodserv = "";
+ if($prodser->isservice())
+ {
+ $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
+ }
+ else
+ {
+ $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
+ }
+
+ $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
+ }
+
+ }
+ $libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice);
+
+ if ($line->date_start || $line->date_end)
+ {
+ // Affichage duree si il y en a une
+ $period="(";
+ if ($line->date_start) $period.=$outputlangs->transnoentitiesnoconv("From")." ".dolibarr_print_date($line->date_start,'',false);
+ if ($period) $period.=" ";
+ if ($line->date_end) $period.=$outputlangs->transnoentitiesnoconv("to")." ".dolibarr_print_date($line->date_end,'',false);
+ $period.=")";
+ $libelleproduitservice.="
".dol_htmlentitiesbr($period,1);
+ }
+ return $libelleproduitservice;
+}
+?>
\ No newline at end of file