UTF-8 support

This commit is contained in:
Laurent Destailleur 2008-11-06 19:40:34 +00:00
parent 2702eee3da
commit d14ea97a09
3 changed files with 57 additions and 59 deletions

View File

@ -585,9 +585,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
/* // If France, show VAT mention if not applicable
* If France, show VAT mention if not applicable
*/
if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1) if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1)
{ {
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
@ -597,9 +595,7 @@ class pdf_crabe extends ModelePDFFactures
$posy=$pdf->GetY()+4; $posy=$pdf->GetY()+4;
} }
/* // Show payments conditions
* Conditions de reglements
*/
if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement))
{ {
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
@ -609,7 +605,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY(50, $posy); $pdf->SetXY(50, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$object->cond_reglement; $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement);
$pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L');
$posy=$pdf->GetY()+3; $posy=$pdf->GetY()+3;
@ -618,9 +614,7 @@ class pdf_crabe extends ModelePDFFactures
if ($object->type != 2) if ($object->type != 2)
{ {
/* // Check a payment mode is defined
* Check si absence mode reglement
*/
if (empty($object->mode_reglement_code) if (empty($object->mode_reglement_code)
&& ! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_CHQ_NUMBER
&& ! $conf->global->FACTURE_RIB_NUMBER) && ! $conf->global->FACTURE_RIB_NUMBER)
@ -646,7 +640,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY(50, $posy); $pdf->SetXY(50, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentMode".$object->mode_reglement_code)!=('PaymentMode'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentMode".$object->mode_reglement_code):$object->mode_reglement; $lib_mode_reg=$outputlangs->transnoentities("PaymentMode".$object->mode_reglement_code)!=('PaymentMode'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentMode".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L');
$posy=$pdf->GetY()+2; $posy=$pdf->GetY()+2;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -20,11 +20,11 @@
*/ */
/** /**
\file htdocs/includes/modules/facture/pdf_huitre.modules.php * \file htdocs/includes/modules/facture/pdf_huitre.modules.php
\ingroup facture * \ingroup facture
\brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>le Huitre * \brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>le Huitre
\author Laurent Destailleur * \author Laurent Destailleur
\version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@ -32,17 +32,16 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/** /**
\class pdf_huitre * \class pdf_huitre
\brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>le Huitre * \brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>le Huitre
*/ */
class pdf_huitre extends ModelePDFFactures class pdf_huitre extends ModelePDFFactures
{ {
var $emetteur; // Objet societe qui emet var $emetteur; // Objet societe qui emet
/** \brief Constructeur /** \brief Constructeur
\param db handler acc<EFBFBD>s base de donn<EFBFBD>e * \param db handler acc<EFBFBD>s base de donn<EFBFBD>e
*/ */
function pdf_huitre($db) function pdf_huitre($db)
{ {
@ -69,12 +68,12 @@ class pdf_huitre extends ModelePDFFactures
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 0; // Gere choix mode r<EFBFBD>glement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER $this->option_modereg = 0; // Gere choix mode reglement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_condreg = 1; // Affiche conditions r<EFBFBD>glement $this->option_condreg = 1; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service $this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues $this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte $this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // G<EFBFBD>re les avoirs $this->option_credit_note = 0; // Gere les avoirs
$this->option_draft_watermark = 1; //Support add of a watermark on drafts $this->option_draft_watermark = 1; //Support add of a watermark on drafts
// Recupere emmetteur // Recupere emmetteur
@ -343,7 +342,7 @@ class pdf_huitre extends ModelePDFFactures
$x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k)); $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
} }
function _tableau_compl(&$pdf, $fac) function _tableau_compl(&$pdf, $fac, $outputlangs)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
@ -362,13 +361,13 @@ class pdf_huitre extends ModelePDFFactures
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY (10, $tab3_top - 6); $pdf->SetXY (10, $tab3_top - 6);
$pdf->MultiCell(60, 6, $langs->transnoentities("ExtraInfos"), 0, 'L', 0); $pdf->MultiCell(60, 6, $outputlangs->transnoentities("ExtraInfos"), 0, 'L', 0);
$pdf->SetXY (10, $tab3_top ); $pdf->SetXY (10, $tab3_top );
$pdf->MultiCell(20, 6, $langs->transnoentities("RegulatedOn"), 0, 'L', 0); $pdf->MultiCell(20, 6, $outputlangs->transnoentities("RegulatedOn"), 0, 'L', 0);
$pdf->SetXY (10, $tab3_top + 6); $pdf->SetXY (10, $tab3_top + 6);
$pdf->MultiCell(60, 6, $langs->transnoentities("ChequeOrTransferNumber"), 0, 'L', 0); $pdf->MultiCell(60, 6, $outputlangs->transnoentities("ChequeOrTransferNumber"), 0, 'L', 0);
$pdf->SetXY (10, $tab3_top + 12); $pdf->SetXY (10, $tab3_top + 12);
$pdf->MultiCell(20, 6, $langs->transnoentities("Bank"), 0, 'L', 0); $pdf->MultiCell(20, 6, $outputlangs->transnoentities("Bank"), 0, 'L', 0);
} }
/* /*

View File

@ -241,7 +241,7 @@ class pdf_oursin extends ModelePDFFactures
if ($nexY > 200 && $i < $nblignes - 1) if ($nexY > 200 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac); $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac, $outputlangs);
$pdf->AddPage(); $pdf->AddPage();
$nexY = $iniY; $nexY = $iniY;
$this->_pagehead($pdf, $fac, $outputlangs); $this->_pagehead($pdf, $fac, $outputlangs);
@ -250,9 +250,9 @@ class pdf_oursin extends ModelePDFFactures
} }
} }
$posy=$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac); $posy=$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac, $outputlangs);
$posy=$this->_tableau_tot($pdf, $fac, $deja_regle); $posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $outputlangs);
// Affiche zone versements // Affiche zone versements
if ($deja_regle || $amount_credit_not_included) if ($deja_regle || $amount_credit_not_included)
@ -519,7 +519,7 @@ class pdf_oursin extends ModelePDFFactures
* \param fac objet facture * \param fac objet facture
* \param deja_regle montant deja regle * \param deja_regle montant deja regle
*/ */
function _tableau_tot(&$pdf, $fac, $deja_regle) function _tableau_tot(&$pdf, $fac, $deja_regle, $outputlangs)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
@ -537,13 +537,13 @@ class pdf_oursin extends ModelePDFFactures
*/ */
if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1) if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1)
{ {
$pdf->MultiCell(100, $tab2_hl, $langs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); $pdf->MultiCell(100, $tab2_hl, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
} }
// Tableau total // Tableau total
$col1x=$this->marges['g']+110; $col2x=$this->marges['g']+164; $col1x=$this->marges['g']+110; $col2x=$this->marges['g']+164;
$pdf->SetXY ($col1x, $tab2_top + 0); $pdf->SetXY ($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->transnoentities("TotalHT"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + 0); $pdf->SetXY ($col2x, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
@ -551,7 +551,7 @@ class pdf_oursin extends ModelePDFFactures
$index = 1; $index = 1;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->transnoentities("TotalVAT"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
@ -559,7 +559,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+1)); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+1));
$pdf->SetTextColor(22,137,210); $pdf->SetTextColor(22,137,210);
$pdf->SetFont('Arial','B', 11); $pdf->SetFont('Arial','B', 11);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->transnoentities("TotalTTC"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+1)); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 0);
@ -568,7 +568,7 @@ class pdf_oursin extends ModelePDFFactures
if ($deja_regle > 0) if ($deja_regle > 0)
{ {
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+2)); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+2));
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->transnoentities("AlreadyPayed"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPayed"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+2)); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+2));
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
@ -576,7 +576,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+3)); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * ($index+3));
$pdf->SetTextColor(22,137,210); $pdf->SetTextColor(22,137,210);
$pdf->SetFont('Arial','B', 11); $pdf->SetFont('Arial','B', 11);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->transnoentities("RemainderToPay"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+3)); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * ($index+3));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 0);
@ -588,7 +588,7 @@ class pdf_oursin extends ModelePDFFactures
* \brief Affiche la grille des lignes de factures * \brief Affiche la grille des lignes de factures
* \param pdf objet PDF * \param pdf objet PDF
*/ */
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $fac) function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $fac, $outputlangs)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
@ -599,10 +599,10 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','B',10);
$pdf->Text($this->marges['g']+2,$tab_top + 5, $langs->transnoentities("Designation")); $pdf->Text($this->marges['g']+2,$tab_top + 5, $outputlangs->transnoentities("Designation"));
if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $langs->transnoentities("VAT")); if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $outputlangs->transnoentities("VAT"));
$pdf->Text($this->marges['g']+135, $tab_top + 5,$langs->transnoentities("PriceUHT")); $pdf->Text($this->marges['g']+135, $tab_top + 5,$outputlangs->transnoentities("PriceUHT"));
$pdf->Text($this->marges['g']+153, $tab_top + 5, $langs->transnoentities("Qty")); $pdf->Text($this->marges['g']+153, $tab_top + 5, $outputlangs->transnoentities("Qty"));
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
$rem=0; $rem=0;
@ -613,9 +613,9 @@ class pdf_oursin extends ModelePDFFactures
} }
if ($rem==1) if ($rem==1)
{ {
$pdf->Text($this->marges['g']+163, $tab_top + 5,'Rem.'); $pdf->Text($this->marges['g']+163, $tab_top + 5,$outputlangs->transnoentities("Note"));
} }
$pdf->Text($this->marges['g']+175, $tab_top + 5, $langs->transnoentities("TotalHT")); $pdf->Text($this->marges['g']+175, $tab_top + 5, $outputlangs->transnoentities("TotalHT"));
} }
/* /*
@ -741,11 +741,11 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','B',13); $pdf->SetFont('Arial','B',13);
$pdf->SetXY($this->marges['g'],$posy); $pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->MultiCell(100, 10, $langs->transnoentities("Bill").' '.$langs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y",false,$outputlangs), '' , 'L'); $pdf->MultiCell(100, 10, $outputlangs->transnoentities("Bill").' '.$outputlangs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y",false,$outputlangs), '' , 'L');
$pdf->SetFont('Arial','B',11); $pdf->SetFont('Arial','B',11);
$pdf->SetXY($this->marges['g'],$posy+6); $pdf->SetXY($this->marges['g'],$posy+6);
$pdf->SetTextColor(22,137,210); $pdf->SetTextColor(22,137,210);
$pdf->MultiCell(100, 10, $langs->transnoentities("RefBill")." : " . $fac->ref, '', 'L'); $pdf->MultiCell(100, 10, $outputlangs->transnoentities("RefBill")." : " . $fac->ref, '', 'L');
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
/* /*
@ -756,12 +756,16 @@ class pdf_oursin extends ModelePDFFactures
$projet = New Project($fac->db); $projet = New Project($fac->db);
$projet->fetch($fac->projetid); $projet->fetch($fac->projetid);
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->MultiCell(60, 4, $langs->transnoentities("Project")." : ".$projet->title); $pdf->MultiCell(60, 4, $outputlangs->transnoentities("Project")." : ".$projet->title);
} }
/* /*
* ref propal * ref propal
*/ */
if ($conf->propal->enabled)
{
$outputlangs->load('propal');
$sql = "SELECT ".$fac->db->pdate("p.datep")." as dp, p.ref, p.rowid as propalid"; $sql = "SELECT ".$fac->db->pdate("p.datep")." as dp, p.ref, p.rowid as propalid";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $fac->id"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $fac->id";
$result = $fac->db->query($sql); $result = $fac->db->query($sql);
@ -769,7 +773,8 @@ class pdf_oursin extends ModelePDFFactures
{ {
$objp = $fac->db->fetch_object(); $objp = $fac->db->fetch_object();
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->MultiCell(60, 4, $langs->transnoentities("RefProposal")." : ".$objp->ref); $pdf->MultiCell(60, 4, $outputlangs->transnoentities("RefProposal")." : ".$objp->ref);
}
} }
/* /*
@ -777,7 +782,7 @@ class pdf_oursin extends ModelePDFFactures
*/ */
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie)); $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentities("Currency".$conf->monnaie));
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre); $pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
/* /*
*/ */