Qual: Removed no more used external libraries (fpdi_protection)

Qual: Centralize include of external libray fpdi
Qual: Now use fpdi with no changes
This commit is contained in:
Laurent Destailleur 2011-08-11 12:13:59 +00:00
parent e6088c098b
commit dcd3ab435d
50 changed files with 2488 additions and 2735 deletions

View File

@ -25,7 +25,7 @@
* \file htdocs/admin/fournisseur.php * \file htdocs/admin/fournisseur.php
* \ingroup fournisseur * \ingroup fournisseur
* \brief Page d'administration-configuration du module Fournisseur * \brief Page d'administration-configuration du module Fournisseur
* \version $Id: fournisseur.php,v 1.63 2011/07/31 22:23:21 eldy Exp $ * \version $Id: fournisseur.php,v 1.64 2011/08/11 12:14:02 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -109,10 +109,11 @@ if ($action == 'specimenfacture') // For invoices
// Charge le modele // Charge le modele
$dir = "/includes/modules/supplier_invoice/pdf/"; $dir = "/includes/modules/supplier_invoice/pdf/";
$file = "pdf_".$modele.".modules.php"; $file = "pdf_".$modele.".modules.php";
if (file_exists($dir.$file)) $file = dol_buildpath($dir.$file);
if (file_exists($file))
{ {
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
require_once($dir.$file); require_once($file);
$obj = new $classname($db,$facture); $obj = new $classname($db,$facture);
@ -499,6 +500,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n"; print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n"; print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
@ -617,5 +619,5 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
llxFooter('$Date: 2011/07/31 22:23:21 $ - $Revision: 1.63 $'); llxFooter('$Date: 2011/08/11 12:14:02 $ - $Revision: 1.64 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/compta/facture/impayees.php * \file htdocs/compta/facture/impayees.php
* \ingroup facture * \ingroup facture
* \brief Page to list and build liste of unpaid invoices * \brief Page to list and build liste of unpaid invoices
* \version $Revision: 1.85 $ * \version $Revision: 1.86 $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -30,6 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
$langs->load("bills"); $langs->load("bills");
@ -52,9 +53,6 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
{ {
if (is_array($_POST['toGenerate'])) if (is_array($_POST['toGenerate']))
{ {
require_once(FPDFI_PATH.'fpdi.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ; $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ;
// liste les fichiers // liste les fichiers
@ -68,22 +66,27 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
} }
} }
// Create empty PDF // Define output language (Here it is not used because we do only merging existing PDF)
$pdf=new FPDI('P','mm','A4'); $outputlangs = $langs;
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
// Create empty PDF
$pdf=pdf_getInstance();
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); $pdf->setPrintFooter(false);
} }
//$pdf->SetFont(pdf_getPDFFont($outputlangs)); $pdf->SetFont(pdf_getPDFFont($outputlangs));
//$pdf->Open(); if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
//$pdf->AddPage();
//$title=$langs->trans("BillsCustomersUnpaid");
//if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
//$pdf->MultiCell(100, 3, $title, 0, 'J');
// Add all others // Add all others
foreach($files as $file) foreach($files as $file)
@ -424,5 +427,5 @@ if ($result)
$db->close(); $db->close();
llxFooter('$Date: 2011/08/10 23:21:13 $ - $Revision: 1.85 $'); llxFooter('$Date: 2011/08/11 12:14:03 $ - $Revision: 1.86 $');
?> ?>

View File

@ -1,5 +1,4 @@
This directory contains all FPDFI librairies: This directory contains all FPDFI librairies:
- FPDI - FPDI
- FPDI_TPL - FPDI_TPL
- FPDI_Protection
Found on http://www.setasign.de/products/pdf-php-solutions/fpdi/ Found on http://www.setasign.de/products/pdf-php-solutions/fpdi/

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -26,8 +26,7 @@ if (!defined('ORD_u'))
if (!defined('ORD_tilde')) if (!defined('ORD_tilde'))
define('ORD_tilde', ord('~')); define('ORD_tilde', ord('~'));
$__tmp = version_compare(phpversion(), "5") == -1 ? array('FilterASCII85') : array('FilterASCII85', false); if (!class_exists('FilterASCII85', false)) {
if (!call_user_func_array('class_exists', $__tmp)) {
class FilterASCII85 { class FilterASCII85 {
@ -100,5 +99,3 @@ if (!call_user_func_array('class_exists', $__tmp)) {
} }
} }
} }
unset($__tmp);

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -17,8 +17,7 @@
// limitations under the License. // limitations under the License.
// //
$__tmp = version_compare(phpversion(), "5") == -1 ? array('FilterLZW') : array('FilterLZW', false); if (!class_exists('FilterLZW', false)) {
if (!call_user_func_array('class_exists', $__tmp)) {
class FilterLZW { class FilterLZW {
@ -156,5 +155,3 @@ if (!call_user_func_array('class_exists', $__tmp)) {
} }
} }
} }
unset($__tmp);

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDF_TPL - Version 1.1.5 // FPDF_TPL - Version 1.2
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2010 Setasign - Jan Slabon
// //
@ -73,7 +73,12 @@ class FPDF_TPL extends FPDF {
* @param int $h The height given in user-unit * @param int $h The height given in user-unit
* @return int The ID of new created Template * @return int The ID of new created Template
*/ */
function beginTemplate($x=null, $y=null, $w=null, $h=null) { function beginTemplate($x = null, $y = null, $w = null, $h = null) {
if (is_subclass_of($this, 'TCPDF')) {
$this->Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
return;
}
if ($this->page <= 0) if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!"); $this->error("You have to add a page to fpdf first!");
@ -113,8 +118,8 @@ class FPDF_TPL extends FPDF {
$this->w = $w; $this->w = $w;
$this->_intpl = true; $this->_intpl = true;
$this->SetXY($x+$this->lMargin, $y+$this->tMargin); $this->SetXY($x + $this->lMargin, $y + $this->tMargin);
$this->SetRightMargin($this->w-$w+$this->rMargin); $this->SetRightMargin($this->w - $w + $this->rMargin);
return $this->tpl; return $this->tpl;
} }
@ -127,6 +132,11 @@ class FPDF_TPL extends FPDF {
* @return mixed If a template is opened, the ID is returned. If not a false is returned. * @return mixed If a template is opened, the ID is returned. If not a false is returned.
*/ */
function endTemplate() { function endTemplate() {
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
}
if ($this->_intpl) { if ($this->_intpl) {
$this->_intpl = false; $this->_intpl = false;
$tpl =& $this->tpls[$this->tpl]; $tpl =& $this->tpls[$this->tpl];
@ -161,12 +171,12 @@ class FPDF_TPL extends FPDF {
* @param int $_h The new height of the template * @param int $_h The new height of the template
* @retrun array The height and width of the template * @retrun array The height and width of the template
*/ */
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) { function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) {
if ($this->page <= 0) if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!"); $this->error('You have to add a page first!');
if (!isset($this->tpls[$tplidx])) if (!isset($this->tpls[$tplidx]))
$this->error("Template does not exist!"); $this->error('Template does not exist!');
if ($this->_intpl) { if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
@ -193,19 +203,26 @@ class FPDF_TPL extends FPDF {
'y' => $this->y, 'y' => $this->y,
'w' => $_w, 'w' => $_w,
'h' => $_h, 'h' => $_h,
'scaleX' => ($_w/$w), 'scaleX' => ($_w / $w),
'scaleY' => ($_h/$h), 'scaleY' => ($_h / $h),
'tx' => $_x, 'tx' => $_x,
'ty' => ($this->h-$_y-$_h), 'ty' => ($this->h - $_y - $_h),
'lty' => ($this->h-$_y-$_h) - ($this->h-$h) * ($_h/$h) 'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h)
); );
$this->_out(sprintf("q %.4F 0 0 %.4F %.4F %.4F cm", $tData['scaleX'], $tData['scaleY'], $tData['tx']*$this->k, $tData['ty']*$this->k)); // Translate $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
// reset font in the outer graphic state
if ($this->FontFamily) {
$family = $this->FontFamily;
$this->FontFamily = '';
$this->SetFont($family);
}
$this->lastUsedTemplateData = $tData; $this->lastUsedTemplateData = $tData;
return array("w" => $_w, "h" => $_h); return array('w' => $_w, 'h' => $_h);
} }
/** /**
@ -218,7 +235,7 @@ class FPDF_TPL extends FPDF {
* @param int $_h The height of the template * @param int $_h The height of the template
* @return array The height and width of the template * @return array The height and width of the template
*/ */
function getTemplateSize($tplidx, $_w=0, $_h=0) { function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
if (!$this->tpls[$tplidx]) if (!$this->tpls[$tplidx])
return false; return false;
@ -231,10 +248,10 @@ class FPDF_TPL extends FPDF {
$_h = $h; $_h = $h;
} }
if($_w==0) if($_w == 0)
$_w = $_h*$w/$h; $_w = $_h * $w / $h;
if($_h==0) if($_h == 0)
$_h = $_w*$h/$w; $_h = $_w * $h / $w;
return array("w" => $_w, "h" => $_h); return array("w" => $_w, "h" => $_h);
} }
@ -242,19 +259,21 @@ class FPDF_TPL extends FPDF {
/** /**
* See FPDF/TCPDF-Documentation ;-) * See FPDF/TCPDF-Documentation ;-)
*/ */
function SetFont($family, $style='', $size=0, $fontfile='') { public function SetFont($family, $style = '', $size = 0) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 3) { if (is_subclass_of($this, 'TCPDF')) {
$this->Error('More than 3 arguments for the SetFont method are only available in TCPDF.'); $args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
} }
/** /**
* force the resetting of font changes in a template * force the resetting of font changes in a template
*/ */
if ($this->_intpl) if ($this->_intpl)
$this->FontFamily = ''; $this->FontFamily = '';
parent::SetFont($family, $style, $size, $fontfile); parent::SetFont($family, $style, $size);
$fontkey = $this->FontFamily.$this->FontStyle; $fontkey = $this->FontFamily . $this->FontStyle;
if ($this->_intpl) { if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
@ -266,12 +285,13 @@ class FPDF_TPL extends FPDF {
/** /**
* See FPDF/TCPDF-Documentation ;-) * See FPDF/TCPDF-Documentation ;-)
*/ */
function Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false) { function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) { if (is_subclass_of($this, 'TCPDF')) {
$this->Error('More than 7 arguments for the Image method are only available in TCPDF.'); $args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::Image'), $args);
} }
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $ismask, $imgmask, $border, $fitbox, $hidden, $fitonpage); $ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
if ($this->_intpl) { if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} else { } else {
@ -286,36 +306,50 @@ class FPDF_TPL extends FPDF {
* *
* AddPage is not available when you're "in" a template. * AddPage is not available when you're "in" a template.
*/ */
function AddPage($orientation='', $format='', $keepmargins=false) { function AddPage($orientation = '', $format = '') {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 2) { if (is_subclass_of($this, 'TCPDF')) {
$this->Error('More than 2 arguments for the AddPage method are only available in TCPDF.'); $args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
} }
if ($this->_intpl) if ($this->_intpl)
$this->Error('Adding pages in templates isn\'t possible!'); $this->Error('Adding pages in templates isn\'t possible!');
parent::AddPage($orientation, $format, $keepmargins);
parent::AddPage($orientation, $format);
} }
/** /**
* Preserve adding Links in Templates ...won't work * Preserve adding Links in Templates ...won't work
*/ */
function Link($x, $y, $w, $h, $link, $spaces=0) { function Link($x, $y, $w, $h, $link) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 5) { if (is_subclass_of($this, 'TCPDF')) {
$this->Error('More than 5 arguments for the Image method are only available in TCPDF.'); $args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::Link'), $args);
} }
if ($this->_intpl) if ($this->_intpl)
$this->Error('Using links in templates aren\'t possible!'); $this->Error('Using links in templates aren\'t possible!');
parent::Link($x, $y, $w, $h, $link, $spaces);
parent::Link($x, $y, $w, $h, $link);
} }
function AddLink() { function AddLink() {
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
}
if ($this->_intpl) if ($this->_intpl)
$this->Error('Adding links in templates aren\'t possible!'); $this->Error('Adding links in templates aren\'t possible!');
return parent::AddLink(); return parent::AddLink();
} }
function SetLink($link, $y=0, $page=-1) { function SetLink($link, $y = 0, $page = -1) {
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
}
if ($this->_intpl) if ($this->_intpl)
$this->Error('Setting links in templates aren\'t possible!'); $this->Error('Setting links in templates aren\'t possible!');
parent::SetLink($link, $y, $page); parent::SetLink($link, $y, $page);
@ -337,18 +371,18 @@ class FPDF_TPL extends FPDF {
$this->_out('/FormType 1'); $this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
// llx // llx
$tpl['x']*$this->k, $tpl['x'] * $this->k,
// lly // lly
-$tpl['y']*$this->k, -$tpl['y'] * $this->k,
// urx // urx
($tpl['w']+$tpl['x'])*$this->k, ($tpl['w'] + $tpl['x']) * $this->k,
// ury // ury
($tpl['h']-$tpl['y'])*$this->k ($tpl['h'] - $tpl['y']) * $this->k
)); ));
if ($tpl['x'] != 0 || $tpl['y'] != 0) { if ($tpl['x'] != 0 || $tpl['y'] != 0) {
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]', $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
-$tpl['x']*$this->k*2, $tpl['y']*$this->k*2 -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
)); ));
} }
@ -358,7 +392,7 @@ class FPDF_TPL extends FPDF {
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<'); $this->_out('/Font <<');
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
$this->_out('>>'); $this->_out('>>');
} }
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
@ -367,17 +401,17 @@ class FPDF_TPL extends FPDF {
$this->_out('/XObject <<'); $this->_out('/XObject <<');
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
foreach($this->_res['tpl'][$tplidx]['images'] as $image) foreach($this->_res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
} }
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
} }
$this->_out('>>'); $this->_out('>>');
} }
$this->_out('>>'); $this->_out('>>');
$this->_out('/Length '.strlen($p).' >>'); $this->_out('/Length ' . strlen($p) . ' >>');
$this->_putstream($p); $this->_putstream($p);
$this->_out('endobj'); $this->_out('endobj');
} }
@ -406,8 +440,8 @@ class FPDF_TPL extends FPDF {
* Private Method * Private Method
*/ */
function _out($s) { function _out($s) {
if ($this->state==2 && $this->_intpl) { if ($this->state == 2 && $this->_intpl) {
$this->tpls[$this->tpl]['buffer'] .= $s."\n"; $this->tpls[$this->tpl]['buffer'] .= $s . "\n";
} else { } else {
parent::_out($s); parent::_out($s);
} }

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -17,29 +17,12 @@
// limitations under the License. // limitations under the License.
// //
define('FPDI_VERSION','1.3.4'); define('FPDI_VERSION', '1.4.1');
/* Begin DOLCHANGE Added by Regis */
// height of cell repect font height
define("K_CELL_HEIGHT_RATIO", 1.25);
// Repertoire des documents de fckeditor
if (! empty($conf->fckeditor->dir_output)) define ("K_PATH_CACHE", $conf->fckeditor->dir_output);
// url qui sera substituer par le K_PATH_CACHE lorsqu'une image sera integree au pdf
if (defined('DOL_URL_ROOT')) define ("K_PATH_URL_CACHE", DOL_URL_ROOT."/document.php?modulepart=editor&amp;file=");
/* End DOLCHANGE Added by Regis */
// DOLCHANGE LDR
if (! empty($conf->global->MAIN_USE_FPDF)) require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdf/fpdf.php');
else require_once(DOL_DOCUMENT_ROOT.'/includes/tcpdf/tcpdf.php');
//require_once(DOL_DOCUMENT_ROOT.'/includes/tcpdf/tcpdf.php');
// Check for TCPDF and remap TCPDF to FPDF // Check for TCPDF and remap TCPDF to FPDF
$__tmp = version_compare(phpversion(), "5") == -1 ? array('TCPDF') : array('TCPDF', false); if (class_exists('TCPDF', false)) {
if (call_user_func_array('class_exists', $__tmp)) {
require_once('fpdi2tcpdf_bridge.php'); require_once('fpdi2tcpdf_bridge.php');
} }
unset($__tmp);
require_once('fpdf_tpl.php'); require_once('fpdf_tpl.php');
require_once('fpdi_pdf_parser.php'); require_once('fpdi_pdf_parser.php');
@ -102,13 +85,40 @@ class FPDI extends FPDF_TPL {
*/ */
function setSourceFile($filename) { function setSourceFile($filename) {
$this->current_filename = $filename; $this->current_filename = $filename;
$fn = $this->current_filename;
if (!isset($this->parsers[$fn])) if (!isset($this->parsers[$filename]))
$this->parsers[$fn] = new fpdi_pdf_parser($fn, $this); $this->parsers[$filename] = $this->_getPdfParser($filename);
$this->current_parser =& $this->parsers[$fn]; $this->current_parser =& $this->parsers[$filename];
return $this->parsers[$fn]->getPageCount(); return $this->parsers[$filename]->getPageCount();
}
/**
* Returns a PDF parser object
*
* @param string $filename
* @return fpdi_pdf_parser
*/
function _getPdfParser($filename) {
return new fpdi_pdf_parser($filename, $this);
}
/**
* Get the current PDF version
*
* @return string
*/
function getPDFVersion() {
return $this->PDFVersion;
}
/**
* Set the PDF version
*
* @return string
*/
function setPDFVersion($version = '1.3') {
$this->PDFVersion = $version;
} }
/** /**
@ -117,7 +127,7 @@ class FPDI extends FPDF_TPL {
* @param int $pageno pagenumber * @param int $pageno pagenumber
* @return int Index of imported page - to use with fpdf_tpl::useTemplate() * @return int Index of imported page - to use with fpdf_tpl::useTemplate()
*/ */
function importPage($pageno, $boxName='/CropBox') { function importPage($pageno, $boxName = '/CropBox') {
if ($this->_intpl) { if ($this->_intpl) {
return $this->error('Please import the desired pages before creating a new template.'); return $this->error('Please import the desired pages before creating a new template.');
} }
@ -125,7 +135,7 @@ class FPDI extends FPDF_TPL {
$fn = $this->current_filename; $fn = $this->current_filename;
// check if page already imported // check if page already imported
$pageKey = $fn.((int)$pageno).$boxName; $pageKey = $fn . '-' . ((int)$pageno) . $boxName;
if (isset($this->_importedPages[$pageKey])) if (isset($this->_importedPages[$pageKey]))
return $this->_importedPages[$pageKey]; return $this->_importedPages[$pageKey];
@ -134,7 +144,7 @@ class FPDI extends FPDF_TPL {
if (!in_array($boxName, $parser->availableBoxes)) if (!in_array($boxName, $parser->availableBoxes))
return $this->Error(sprintf('Unknown box: %s', $boxName)); return $this->Error(sprintf('Unknown box: %s', $boxName));
$pageboxes = $parser->getPageBoxes($pageno); $pageboxes = $parser->getPageBoxes($pageno, $this->k);
/** /**
* MediaBox * MediaBox
@ -180,7 +190,10 @@ class FPDI extends FPDF_TPL {
$tpl['w'] = $steps % 2 == 0 ? $_w : $_h; $tpl['w'] = $steps % 2 == 0 ? $_w : $_h;
$tpl['h'] = $steps % 2 == 0 ? $_h : $_w; $tpl['h'] = $steps % 2 == 0 ? $_h : $_w;
$tpl['_rotationAngle'] = $angle*-1; if ($angle < 0)
$angle += 360;
$tpl['_rotationAngle'] = $angle * -1;
} }
$this->_importedPages[$pageKey] = $this->tpl; $this->_importedPages[$pageKey] = $this->tpl;
@ -192,29 +205,29 @@ class FPDI extends FPDF_TPL {
return $this->lastUsedPageBox; return $this->lastUsedPageBox;
} }
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0, $adjustPageSize=false) { function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) {
if ($adjustPageSize == true && is_null($_x) && is_null($_y)) { if ($adjustPageSize == true && is_null($_x) && is_null($_y)) {
$size = $this->getTemplateSize($tplidx, $_w, $_h); $size = $this->getTemplateSize($tplidx, $_w, $_h);
$format = array($size['w'], $size['h']); $format = array($size['w'], $size['h']);
if (!is_subclass_of($this, 'TCPDF')) { if (is_subclass_of($this, 'TCPDF')) {
$this->setPageFormat($format, $format[0] > $format[1] ? 'L' : 'P');
} else {
if ($format[0] != $this->CurPageFormat[0] || $format[1] != $this->CurPageFormat[1]) { if ($format[0] != $this->CurPageFormat[0] || $format[1] != $this->CurPageFormat[1]) {
$this->w = $format[0]; $this->w = $format[0];
$this->h = $format[1]; $this->h = $format[1];
$this->wPt = $this->w*$this->k; $this->wPt = $this->w * $this->k;
$this->hPt = $this->h*$this->k; $this->hPt = $this->h * $this->k;
$this->PageBreakTrigger = $this->h-$this->bMargin; $this->PageBreakTrigger = $this->h - $this->bMargin;
$this->CurPageFormat = $format; $this->CurPageFormat = $format;
$this->PageSizes[$this->page] = array($this->wPt, $this->hPt); $this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
} }
} else {
$this->setPageFormat($format, $format[0] > $format[1] ? 'L' : 'P');
} }
} }
$this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values
$s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h); $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
$this->_out('Q'); $this->_out('Q');
return $s; return $s;
} }
@ -227,14 +240,14 @@ class FPDI extends FPDF_TPL {
$this->current_parser =& $this->parsers[$filename]; $this->current_parser =& $this->parsers[$filename];
if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) {
while(($n = key($this->_obj_stack[$filename])) !== null) { while(($n = key($this->_obj_stack[$filename])) !== null) {
$nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->_obj_stack[$filename][$n][1]); $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c, $this->_obj_stack[$filename][$n][1]);
$this->_newobj($this->_obj_stack[$filename][$n][0]); $this->_newobj($this->_obj_stack[$filename][$n][0]);
if ($nObj[0] == PDF_TYPE_STREAM) { if ($nObj[0] == PDF_TYPE_STREAM) {
$this->pdf_write_value ($nObj); $this->pdf_write_value($nObj);
} else { } else {
$this->pdf_write_value ($nObj[1]); $this->pdf_write_value($nObj[1]);
} }
$this->_out('endobj'); $this->_out('endobj');
@ -260,15 +273,15 @@ class FPDI extends FPDF_TPL {
$cN = $this->n; // TCPDF/Protection: rem current "n" $cN = $this->n; // TCPDF/Protection: rem current "n"
$this->tpls[$tplidx]['n'] = $this->n; $this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject'); $this->_out('<<' . $filter . '/Type /XObject');
$this->_out('/Subtype /Form'); $this->_out('/Subtype /Form');
$this->_out('/FormType 1'); $this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
(isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x'])*$this->k, (isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k,
(isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y'])*$this->k, (isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k,
(isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x'])*$this->k, (isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k,
(isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h']-$tpl['y'])*$this->k (isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h'] - $tpl['y']) * $this->k
)); ));
$c = 1; $c = 1;
@ -324,7 +337,7 @@ class FPDI extends FPDF_TPL {
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<'); $this->_out('/Font <<');
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
$this->_out('>>'); $this->_out('>>');
} }
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
@ -333,11 +346,11 @@ class FPDI extends FPDF_TPL {
$this->_out('/XObject <<'); $this->_out('/XObject <<');
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
foreach($this->_res['tpl'][$tplidx]['images'] as $image) foreach($this->_res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
} }
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
} }
$this->_out('>>'); $this->_out('>>');
} }
@ -346,7 +359,7 @@ class FPDI extends FPDF_TPL {
$nN = $this->n; // TCPDF: rem new "n" $nN = $this->n; // TCPDF: rem new "n"
$this->n = $cN; // TCPDF: reset to current "n" $this->n = $cN; // TCPDF: reset to current "n"
$this->_out('/Length '.strlen($p).' >>'); $this->_out('/Length ' . strlen($p) . ' >>');
$this->_putstream($p); $this->_putstream($p);
$this->_out('endobj'); $this->_out('endobj');
$this->n = $nN; // TCPDF: reset to new "n" $this->n = $nN; // TCPDF: reset to new "n"
@ -358,7 +371,7 @@ class FPDI extends FPDF_TPL {
/** /**
* Rewritten to handle existing own defined objects * Rewritten to handle existing own defined objects
*/ */
function _newobj($obj_id=false,$onlynewobj=false) { function _newobj($obj_id = false, $onlynewobj = false) {
if (!$obj_id) { if (!$obj_id) {
$obj_id = ++$this->n; $obj_id = ++$this->n;
} }
@ -366,9 +379,10 @@ class FPDI extends FPDF_TPL {
//Begin a new object //Begin a new object
if (!$onlynewobj) { if (!$onlynewobj) {
$this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer); $this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer);
$this->_out($obj_id.' 0 obj'); $this->_out($obj_id . ' 0 obj');
$this->_current_obj_id = $obj_id; // for later use with encryption $this->_current_obj_id = $obj_id; // for later use with encryption
} }
return $obj_id; return $obj_id;
} }
@ -386,19 +400,19 @@ class FPDI extends FPDF_TPL {
switch ($value[0]) { switch ($value[0]) {
case PDF_TYPE_TOKEN : case PDF_TYPE_TOKEN:
$this->_straightOut($value[1] . ' '); $this->_straightOut($value[1] . ' ');
break; break;
case PDF_TYPE_NUMERIC : case PDF_TYPE_NUMERIC:
case PDF_TYPE_REAL : case PDF_TYPE_REAL:
if (is_float($value[1]) && $value[1] != 0) { if (is_float($value[1]) && $value[1] != 0) {
$this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') .' '); $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' ');
} else { } else {
$this->_straightOut($value[1] . ' '); $this->_straightOut($value[1] . ' ');
} }
break; break;
case PDF_TYPE_ARRAY : case PDF_TYPE_ARRAY:
// An array. Output the proper // An array. Output the proper
// structure and move on. // structure and move on.
@ -411,7 +425,7 @@ class FPDI extends FPDF_TPL {
$this->_out(']'); $this->_out(']');
break; break;
case PDF_TYPE_DICTIONARY : case PDF_TYPE_DICTIONARY:
// A dictionary. // A dictionary.
$this->_straightOut('<<'); $this->_straightOut('<<');
@ -426,30 +440,30 @@ class FPDI extends FPDF_TPL {
$this->_straightOut('>>'); $this->_straightOut('>>');
break; break;
case PDF_TYPE_OBJREF : case PDF_TYPE_OBJREF:
// An indirect object reference // An indirect object reference
// Fill the object stack if needed // Fill the object stack if needed
$cpfn =& $this->current_parser->filename; $cpfn =& $this->current_parser->filename;
if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
$this->_newobj(false,true); $this->_newobj(false, true);
$this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value); $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
$this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!! $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!!
} }
$objid = $this->_don_obj_stack[$cpfn][$value[1]][0]; $objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
$this->_out($objid.' 0 R'); $this->_out($objid . ' 0 R');
break; break;
case PDF_TYPE_STRING : case PDF_TYPE_STRING:
// A string. // A string.
$this->_straightOut('('.$value[1].')'); $this->_straightOut('(' . $value[1] . ')');
break; break;
case PDF_TYPE_STREAM : case PDF_TYPE_STREAM:
// A stream. First, output the // A stream. First, output the
// stream dictionary, then the // stream dictionary, then the
@ -459,15 +473,16 @@ class FPDI extends FPDF_TPL {
$this->_out($value[2][1]); $this->_out($value[2][1]);
$this->_out('endstream'); $this->_out('endstream');
break; break;
case PDF_TYPE_HEX :
$this->_straightOut('<'.$value[1].'>'); case PDF_TYPE_HEX:
$this->_straightOut('<' . $value[1] . '>');
break; break;
case PDF_TYPE_BOOLEAN : case PDF_TYPE_BOOLEAN:
$this->_straightOut($value[1] ? 'true ' : 'false '); $this->_straightOut($value[1] ? 'true ' : 'false ');
break; break;
case PDF_TYPE_NULL : case PDF_TYPE_NULL:
// The null object. // The null object.
$this->_straightOut('null '); $this->_straightOut('null ');
@ -491,7 +506,7 @@ class FPDI extends FPDF_TPL {
// puts data before page footer // puts data before page footer
$page = substr($this->getPageBuffer($this->page), 0, -$this->footerlen[$this->page]); $page = substr($this->getPageBuffer($this->page), 0, -$this->footerlen[$this->page]);
$footer = substr($this->getPageBuffer($this->page), -$this->footerlen[$this->page]); $footer = substr($this->getPageBuffer($this->page), -$this->footerlen[$this->page]);
$this->setPageBuffer($this->page, $page.' '.$s."\n".$footer); $this->setPageBuffer($this->page, $page . ' ' . $s . "\n" . $footer);
} else { } else {
$this->setPageBuffer($this->page, $s, true); $this->setPageBuffer($this->page, $s, true);
} }

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -28,35 +28,11 @@
*/ */
class FPDF extends TCPDF { class FPDF extends TCPDF {
function __get($name) {
switch ($name) {
case 'PDFVersion':
return $this->PDFVersion;
case 'k':
return $this->k;
default:
// Error handling
$this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name);
}
}
function __set($name, $value) {
switch ($name) {
case 'PDFVersion':
$this->PDFVersion = $value;
break;
default:
// Error handling
$this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name);
}
}
function _putstream($s) { function _putstream($s) {
$this->_out($this->_getstream($s)); $this->_out($this->_getstream($s));
} }
function _getxobjectdict() { function _getxobjectdict() {
$out = parent::_getxobjectdict(); $out = parent::_getxobjectdict();
if (count($this->tpls)) { if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl) { foreach($this->tpls as $tplidx => $tpl) {
@ -74,7 +50,7 @@ class FPDF extends TCPDF {
*/ */
function pdf_write_value(&$value) { function pdf_write_value(&$value) {
switch ($value[0]) { switch ($value[0]) {
case PDF_TYPE_STRING : case PDF_TYPE_STRING:
if ($this->encrypted) { if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]); $value[1] = $this->_unescape($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); $value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
@ -82,13 +58,13 @@ class FPDF extends TCPDF {
} }
break; break;
case PDF_TYPE_STREAM : case PDF_TYPE_STREAM:
if ($this->encrypted) { if ($this->encrypted) {
$value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]); $value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]);
} }
break; break;
case PDF_TYPE_HEX : case PDF_TYPE_HEX:
if ($this->encrypted) { if ($this->encrypted) {
$value[1] = $this->hex2str($value[1]); $value[1] = $this->hex2str($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); $value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -167,7 +167,7 @@ class fpdi_pdf_parser extends pdf_parser {
if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { if (isset($this->pages[$this->pageno][1][1]['/Contents'])) {
$contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
foreach($contents AS $tmp_content) { foreach($contents AS $tmp_content) {
$buffer .= $this->_rebuildContentStream($tmp_content).' '; $buffer .= $this->_rebuildContentStream($tmp_content) . ' ';
} }
} }
@ -230,7 +230,10 @@ class fpdi_pdf_parser extends pdf_parser {
foreach ($filters AS $_filter) { foreach ($filters AS $_filter) {
switch ($_filter[1]) { switch ($_filter[1]) {
case '/FlateDecode': case '/FlateDecode':
case '/Fl':
// $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work // $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work
// $stream .= "\x0A";
// $stream .= "\x0D";
if (function_exists('gzuncompress')) { if (function_exists('gzuncompress')) {
$stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';
} else { } else {
@ -269,52 +272,60 @@ class fpdi_pdf_parser extends pdf_parser {
* *
* @param array $page a /Page * @param array $page a /Page
* @param string $box_index Type of Box @see $availableBoxes * @param string $box_index Type of Box @see $availableBoxes
* @param float Scale factor from user space units to points
* @return array * @return array
*/ */
function getPageBox($page, $box_index) { function getPageBox($page, $box_index, $k) {
$page = $this->pdf_resolve_object($this->c,$page); $page = $this->pdf_resolve_object($this->c, $page);
$box = null; $box = null;
if (isset($page[1][1][$box_index])) if (isset($page[1][1][$box_index]))
$box =& $page[1][1][$box_index]; $box =& $page[1][1][$box_index];
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
$tmp_box = $this->pdf_resolve_object($this->c,$box); $tmp_box = $this->pdf_resolve_object($this->c, $box);
$box = $tmp_box[1]; $box = $tmp_box[1];
} }
if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
$b =& $box[1]; $b =& $box[1];
return array('x' => $b[0][1]/$this->fpdi->k, return array('x' => $b[0][1]/$k,
'y' => $b[1][1]/$this->fpdi->k, 'y' => $b[1][1]/$k,
'w' => abs($b[0][1]-$b[2][1])/$this->fpdi->k, 'w' => abs($b[0][1]-$b[2][1])/$k,
'h' => abs($b[1][1]-$b[3][1])/$this->fpdi->k, 'h' => abs($b[1][1]-$b[3][1])/$k,
'llx' => min($b[0][1], $b[2][1])/$this->fpdi->k, 'llx' => min($b[0][1], $b[2][1])/$k,
'lly' => min($b[1][1], $b[3][1])/$this->fpdi->k, 'lly' => min($b[1][1], $b[3][1])/$k,
'urx' => max($b[0][1], $b[2][1])/$this->fpdi->k, 'urx' => max($b[0][1], $b[2][1])/$k,
'ury' => max($b[1][1], $b[3][1])/$this->fpdi->k, 'ury' => max($b[1][1], $b[3][1])/$k,
); );
} else if (!isset ($page[1][1]['/Parent'])) { } else if (!isset ($page[1][1]['/Parent'])) {
return false; return false;
} else { } else {
return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index); return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k);
} }
} }
function getPageBoxes($pageno) {
return $this->_getPageBoxes($this->pages[$pageno-1]);
}
/** /**
* Get all Boxes from /Page * Get all page boxes by page no
*
* @param int The page number
* @param float Scale factor from user space units to points
* @return array
*/
function getPageBoxes($pageno, $k) {
return $this->_getPageBoxes($this->pages[$pageno-1], $k);
}
/**
* Get all boxes from /Page
* *
* @param array a /Page * @param array a /Page
* @return array * @return array
*/ */
function _getPageBoxes($page) { function _getPageBoxes($page, $k) {
$boxes = array(); $boxes = array();
foreach($this->availableBoxes AS $box) { foreach($this->availableBoxes AS $box) {
if ($_box = $this->getPageBox($page,$box)) { if ($_box = $this->getPageBox($page, $box, $k)) {
$boxes[$box] = $_box; $boxes[$box] = $_box;
} }
} }
@ -332,7 +343,7 @@ class fpdi_pdf_parser extends pdf_parser {
return $this->_getPageRotation($this->pages[$pageno-1]); return $this->_getPageRotation($this->pages[$pageno-1]);
} }
function _getPageRotation ($obj) { // $obj = /Page function _getPageRotation($obj) { // $obj = /Page
$obj = $this->pdf_resolve_object($this->c, $obj); $obj = $this->pdf_resolve_object($this->c, $obj);
if (isset ($obj[1][1]['/Rotate'])) { if (isset ($obj[1][1]['/Rotate'])) {
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']); $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
@ -358,7 +369,7 @@ class fpdi_pdf_parser extends pdf_parser {
* @param array /Pages * @param array /Pages
* @param array the result-array * @param array the result-array
*/ */
function read_pages (&$c, &$pages, &$result) { function read_pages(&$c, &$pages, &$result) {
// Get the kids dictionary // Get the kids dictionary
$_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); $_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
@ -376,7 +387,7 @@ class fpdi_pdf_parser extends pdf_parser {
if ($pg[1][1]['/Type'][1] === '/Pages') { if ($pg[1][1]['/Type'][1] === '/Pages') {
// If one of the kids is an embedded // If one of the kids is an embedded
// /Pages array, resolve it as well. // /Pages array, resolve it as well.
$this->read_pages ($c, $pg, $result); $this->read_pages($c, $pg, $result);
} else { } else {
$result[] = $pg; $result[] = $pg;
} }
@ -392,7 +403,7 @@ class fpdi_pdf_parser extends pdf_parser {
*/ */
function getPDFVersion() { function getPDFVersion() {
parent::getPDFVersion(); parent::getPDFVersion();
$this->fpdi->PDFVersion = max($this->fpdi->PDFVersion, $this->pdfVersion); $this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion));
} }
} }

View File

@ -1,305 +0,0 @@
<?php
/****************************************************************************
* Software: FPDI_Protection *
* Version: 1.0.3 *
* Date: 2009/03/06 *
* Author: Klemen VODOPIVEC, Jan Slabon *
* License: Freeware *
* *
* You may use and modify this software as you wish as stated in original *
* FPDF package. *
* *
* Infos (by Jan Slabon): *
* This class extends the FPDI-class available at http://www.setasign.de *
* so that you can import pages and create new protected pdf files. *
* *
* This release is dedicated to my son Fin Frederik (*2005/06/04) *
* *
****************************************************************************/
require_once('fpdi.php');
class FPDI_Protection extends FPDI {
var $encrypted = false; //whether document is protected
var $Uvalue; //U entry in pdf document
var $Ovalue; //O entry in pdf document
var $Pvalue; //P entry in pdf document
var $enc_obj_id; //encryption object id
var $last_rc4_key = ''; //last RC4 key encrypted (cached for optimisation)
var $last_rc4_key_c; //last RC4 computed key
var $padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
/**
* Function to set permissions as well as user and owner passwords
*
* - permissions is an array with values taken from the following list:
* 40bit: copy, print, modify, annot-forms
* 128bit: fill-in, screenreaders, assemble, degraded-print
* If a value is present it means that the permission is granted
* - If a user password is set, user will be prompted before document is opened
* - If an owner password is set, document can be opened in privilege mode with no
* restriction if that password is entered
*/
function SetProtection($permissions=array(), $user_pass='', $owner_pass=null) {
$options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 );
$protection = 192;
foreach($permissions as $permission){
if (!isset($options[$permission]))
$this->Error('Incorrect permission: '.$permission);
$protection += $options[$permission];
}
if ($owner_pass === null)
$owner_pass = uniqid(rand());
$this->encrypted = true;
$this->_generateencryptionkey($user_pass, $owner_pass, $protection);
}
function _putstream($s) {
if ($this->encrypted) {
$s = $this->_RC4($this->_objectkey($this->_current_obj_id), $s);
}
parent::_putstream($s);
}
function _textstring($s) {
if ($this->encrypted) {
$s = $this->_RC4($this->_objectkey($this->_current_obj_id), $s);
}
return parent::_textstring($s);
}
/**
* Compute key depending on object number where the encrypted data is stored
*/
function _objectkey($n) {
return substr($this->_md5_16($this->encryption_key.pack('VXxx', $n)), 0, 10);
}
/**
* Escape special characters
*/
function _escape($s) {
return str_replace(
array('\\',')','(',"\r", "\n", "\t"),
array('\\\\','\\)','\\(','\\r', '\\n', '\\t'),$s);
}
function _putresources() {
parent::_putresources();
if ($this->encrypted) {
$this->_newobj();
$this->enc_obj_id = $this->_current_obj_id;
$this->_out('<<');
$this->_putencryption();
$this->_out('>>');
}
}
function _putencryption() {
$this->_out('/Filter /Standard');
$this->_out('/V 1');
$this->_out('/R 2');
$this->_out('/O ('.$this->_escape($this->Ovalue).')');
$this->_out('/U ('.$this->_escape($this->Uvalue).')');
$this->_out('/P '.$this->Pvalue);
}
function _puttrailer() {
parent::_puttrailer();
if ($this->encrypted) {
$this->_out('/Encrypt '.$this->enc_obj_id.' 0 R');
$this->_out('/ID [()()]');
}
}
/**
* RC4 is the standard encryption algorithm used in PDF format
*/
function _RC4($key, $text) {
if ($this->last_rc4_key != $key) {
$k = str_repeat($key, 256/strlen($key)+1);
$rc4 = range(0,255);
$j = 0;
for ($i=0; $i<256; $i++){
$t = $rc4[$i];
$j = ($j + $t + ord($k{$i})) % 256;
$rc4[$i] = $rc4[$j];
$rc4[$j] = $t;
}
$this->last_rc4_key = $key;
$this->last_rc4_key_c = $rc4;
} else {
$rc4 = $this->last_rc4_key_c;
}
$len = strlen($text);
$a = 0;
$b = 0;
$out = '';
for ($i=0; $i<$len; $i++){
$a = ($a+1)%256;
$t= $rc4[$a];
$b = ($b+$t)%256;
$rc4[$a] = $rc4[$b];
$rc4[$b] = $t;
$k = $rc4[($rc4[$a]+$rc4[$b])%256];
$out.=chr(ord($text{$i}) ^ $k);
}
return $out;
}
/**
* Get MD5 as binary string
*/
function _md5_16($string) {
return pack('H*',md5($string));
}
/**
* Compute O value
*/
function _Ovalue($user_pass, $owner_pass) {
$tmp = $this->_md5_16($owner_pass);
$owner_RC4_key = substr($tmp,0,5);
return $this->_RC4($owner_RC4_key, $user_pass);
}
/**
* Compute U value
*/
function _Uvalue() {
return $this->_RC4($this->encryption_key, $this->padding);
}
/**
* Compute encryption key
*/
function _generateencryptionkey($user_pass, $owner_pass, $protection) {
// Pad passwords
$user_pass = substr($user_pass.$this->padding,0,32);
$owner_pass = substr($owner_pass.$this->padding,0,32);
// Compute O value
$this->Ovalue = $this->_Ovalue($user_pass,$owner_pass);
// Compute encyption key
$tmp = $this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF");
$this->encryption_key = substr($tmp,0,5);
// Compute U value
$this->Uvalue = $this->_Uvalue();
// Compute P value
$this->Pvalue = -(($protection^255)+1);
}
function pdf_write_value(&$value) {
switch ($value[0]) {
case PDF_TYPE_STRING :
if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
$value[1] = $this->_escape($value[1]);
}
break;
case PDF_TYPE_STREAM :
if ($this->encrypted) {
$value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]);
}
break;
case PDF_TYPE_HEX :
if ($this->encrypted) {
$value[1] = $this->hex2str($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
// remake hexstring of encrypted string
$value[1] = $this->str2hex($value[1]);
}
break;
}
parent::pdf_write_value($value);
}
function hex2str($hex) {
return pack('H*', str_replace(array("\r","\n",' '),'', $hex));
}
function str2hex($str) {
return current(unpack('H*',$str));
}
/**
* Deescape special characters
*/
function _unescape($s) {
$out = '';
for ($count = 0, $n = strlen($s); $count < $n; $count++) {
if ($s[$count] != '\\' || $count == $n-1) {
$out .= $s[$count];
} else {
switch ($s[++$count]) {
case ')':
case '(':
case '\\':
$out .= $s[$count];
break;
case 'f':
$out .= chr(0x0C);
break;
case 'b':
$out .= chr(0x08);
break;
case 't':
$out .= chr(0x09);
break;
case 'r':
$out .= chr(0x0D);
break;
case 'n':
$out .= chr(0x0A);
break;
case "\r":
if ($count != $n-1 && $s[$count+1] == "\n")
$count++;
break;
case "\n":
break;
default:
// Octal-Values
if (ord($s[$count]) >= ord('0') &&
ord($s[$count]) <= ord('9')) {
$oct = ''. $s[$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
}
}
$out .= chr(octdec($oct));
} else {
$out .= $s[$count];
}
}
}
}
return $out;
}
}

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -17,8 +17,7 @@
// limitations under the License. // limitations under the License.
// //
$__tmp = version_compare(phpversion(), "5") == -1 ? array('pdf_context') : array('pdf_context', false); if (!class_exists('pdf_context', false)) {
if (!call_user_func_array('class_exists', $__tmp)) {
class pdf_context { class pdf_context {
@ -83,13 +82,17 @@ if (!call_user_func_array('class_exists', $__tmp)) {
// Forcefully read more data into the buffer // Forcefully read more data into the buffer
function increase_length($l=100) { function increase_length($l = 100) {
if ($this->_mode == 0 && feof($this->file)) { if ($this->_mode == 0 && feof($this->file)) {
return false; return false;
} else if ($this->_mode == 0) { } else if ($this->_mode == 0) {
$totalLength = $this->length + $l; $totalLength = $this->length + $l;
do { do {
$this->buffer .= fread($this->file, $totalLength-$this->length); $toRead = $totalLength - $this->length;
if ($toRead < 1)
break;
$this->buffer .= fread($this->file, $toRead);
} while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
return true; return true;
@ -99,5 +102,3 @@ if (!call_user_func_array('class_exists', $__tmp)) {
} }
} }
} }
unset($__tmp);

View File

@ -1,8 +1,8 @@
<?php <?php
// //
// FPDI - Version 1.3.4 // FPDI - Version 1.4.1
// //
// Copyright 2004-2010 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -46,8 +46,7 @@ if (!defined ('PDF_TYPE_REAL'))
require_once('pdf_context.php'); require_once('pdf_context.php');
$__tmp = version_compare(phpversion(), "5") == -1 ? array('pdf_parser') : array('pdf_parser', false); if (!class_exists('pdf_parser', false)) {
if (!call_user_func_array('class_exists', $__tmp)) {
class pdf_parser { class pdf_parser {
@ -718,5 +717,3 @@ if (!call_user_func_array('class_exists', $__tmp)) {
} }
} }
} }
unset($__tmp);

View File

@ -22,10 +22,9 @@
* \file htdocs/includes/modules/action/rapport.pdf.php * \file htdocs/includes/modules/action/rapport.pdf.php
* \ingroup commercial * \ingroup commercial
* \brief File to build PDF with events * \brief File to build PDF with events
* \version $Id: rapport.pdf.php,v 1.36 2011/08/10 23:21:13 eldy Exp $ * \version $Id: rapport.pdf.php,v 1.37 2011/08/11 12:14:04 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/date.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/date.lib.php');
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@ -83,7 +82,7 @@ class CommActionRapport
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -23,10 +23,9 @@
* \file htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php * \file htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php
* \ingroup facture * \ingroup facture
* \brief File with parent class of check receipt document generators * \brief File with parent class of check receipt document generators
* \version $Id: modules_chequereceipts.php,v 1.6 2011/08/10 23:21:12 eldy Exp $ * \version $Id: modules_chequereceipts.php,v 1.7 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Requis car utilise dans les classes qui heritent require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Requis car utilise dans les classes qui heritent

View File

@ -21,10 +21,9 @@
* \file htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php * \file htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
* \ingroup banque * \ingroup banque
* \brief File to build cheque deposit receipts * \brief File to build cheque deposit receipts
* \version $Id: pdf_blochet.class.php,v 1.42 2011/08/10 23:21:12 eldy Exp $ * \version $Id: pdf_blochet.class.php,v 1.43 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/cheque/pdf/modules_chequereceipts.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/cheque/pdf/modules_chequereceipts.php");
@ -89,7 +88,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -25,10 +25,9 @@
* \ingroup commande * \ingroup commande
* \brief Fichier contenant la classe mere de generation des commandes en PDF * \brief Fichier contenant la classe mere de generation des commandes en PDF
* et la classe mere de numerotation des commandes * et la classe mere de numerotation des commandes
* \version $Id: modules_commande.php,v 1.50 2011/08/10 23:21:09 eldy Exp $ * \version $Id: modules_commande.php,v 1.51 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // requis car utilise par les classes qui heritent require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // requis car utilise par les classes qui heritent
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php');

View File

@ -23,7 +23,7 @@
* \file htdocs/includes/modules/commande/pdf_edison.modules.php * \file htdocs/includes/modules/commande/pdf_edison.modules.php
* \ingroup commande * \ingroup commande
* \brief Fichier de la classe permettant de generer les commandes au modele Edison * \brief Fichier de la classe permettant de generer les commandes au modele Edison
* \version $Id: pdf_edison.modules.php,v 1.90 2011/08/10 17:40:45 hregis Exp $ * \version $Id: pdf_edison.modules.php,v 1.91 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
@ -101,7 +101,7 @@ class pdf_edison extends ModelePDFCommandes
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -24,7 +24,7 @@
* \ingroup commande * \ingroup commande
* \brief Fichier de la classe permettant de generer les commandes au modele Einstein * \brief Fichier de la classe permettant de generer les commandes au modele Einstein
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id: pdf_einstein.modules.php,v 1.164 2011/08/10 17:40:45 hregis Exp $ * \version $Id: pdf_einstein.modules.php,v 1.165 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
@ -117,7 +117,7 @@ class pdf_einstein extends ModelePDFCommandes
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -23,9 +23,8 @@
* \file htdocs/includes/modules/dons/modules_don.php * \file htdocs/includes/modules/dons/modules_don.php
* \ingroup don * \ingroup don
* \brief File of class to manage donation document generation * \brief File of class to manage donation document generation
* \version $Id: modules_don.php,v 1.22 2011/08/10 23:21:12 eldy Exp $ * \version $Id: modules_don.php,v 1.23 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php");
@ -84,7 +83,7 @@ class ModeleNumRefDons
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
/** \brief Renvoi un exemple de num<EFBFBD>rotation /** \brief Renvoi un exemple de numerotation
* \return string Example * \return string Example
*/ */
function getExample() function getExample()
@ -94,8 +93,8 @@ class ModeleNumRefDons
return $langs->trans("NoExample"); return $langs->trans("NoExample");
} }
/** \brief Test si les num<EFBFBD>ros d<EFBFBD>j<EFBFBD> en vigueur dans la base ne provoquent pas d /** \brief Test si les numeros deja en vigueur dans la base ne provoquent pas d
* de conflits qui empechera cette num<EFBFBD>rotation de fonctionner. * de conflits qui empechera cette numerotation de fonctionner.
* \return boolean false si conflit, true si ok * \return boolean false si conflit, true si ok
*/ */
function canBeActivated() function canBeActivated()
@ -103,7 +102,7 @@ class ModeleNumRefDons
return true; return true;
} }
/** \brief Renvoi prochaine valeur attribu<EFBFBD>e /** \brief Renvoi prochaine valeur attribuee
* \return string Valeur * \return string Valeur
*/ */
function getNextValue() function getNextValue()
@ -129,13 +128,13 @@ class ModeleNumRefDons
/** /**
\brief Cr<EFBFBD>e un don sur disque en fonction du mod<EFBFBD>le de DON_ADDON_PDF * \brief Cree un don sur disque en fonction du modele de DON_ADDON_PDF
\param db objet base de donn<EFBFBD>e * \param db objet base de donnee
\param id id du don <EFBFBD> cr<EFBFBD>er * \param id id du don e creer
\param message message * \param message message
\param modele force le modele <EFBFBD> utiliser ('' par defaut) * \param modele force le modele a utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction * \param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK * \return int 0 si KO, 1 si OK
*/ */
function don_create($db, $id, $message, $modele, $outputlangs) function don_create($db, $id, $message, $modele, $outputlangs)
{ {
@ -175,7 +174,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($id,$outputlangs) > 0) if ($obj->write_file($id,$outputlangs) > 0)
{ {
// Succ<EFBFBD>s de la cr<63>ation de la facture. On g<>n<EFBFBD>re le fichier meta // Success. We build meta file
don_meta_create($db, $id); don_meta_create($db, $id);
// et on supprime l'image correspondant au preview // et on supprime l'image correspondant au preview
don_delete_preview($db, $id); don_delete_preview($db, $id);
@ -199,10 +198,10 @@ function don_create($db, $id, $message, $modele, $outputlangs)
} }
/** /**
\brief Cr<EFBFBD><EFBFBD> un meta fichier <EFBFBD> c<EFBFBD>t<EFBFBD> de la facture sur le disque pour faciliter les recherches en texte plein. Pourquoi ? tout simplement parcequ'en fin d'exercice quand je suis avec mon comptable je n'ai pas de connexion internet "rapide" pour retrouver en 2 secondes une facture non pay<61>e ou compliqu<71>e <20> g<>rer ... avec un rgrep c'est vite fait bien fait [eric seigne * \brief Cree un meta fichier a cote de la facture sur le disque pour faciliter les recherches en texte plein. Pourquoi ? tout simplement parcequ'en fin d'exercice quand je suis avec mon comptable je n'ai pas de connexion internet "rapide" pour retrouver en 2 secondes une facture non pay<61>e ou compliqu<71>e <20> g<>rer ... avec un rgrep c'est vite fait bien fait [eric seigne
\param db Objet base de donn<EFBFBD>e * \param db Objet base de donnee
\param donid Id du don <EFBFBD> cr<EFBFBD>er * \param donid Id du don a creer
\param message Message * \param message Message
*/ */
function don_meta_create($db, $donid, $message="") function don_meta_create($db, $donid, $message="")
{ {
@ -215,9 +214,9 @@ function don_meta_create($db, $donid, $message="")
/** /**
\brief Supprime l'image de pr<EFBFBD>visualitation, pour le cas de r<EFBFBD>g<EFBFBD>n<EFBFBD>ration de facture * \brief Supprime l'image de previsualitation, pour le cas de r<EFBFBD>g<EFBFBD>n<EFBFBD>ration de facture
\param db Objet base de donn<EFBFBD>e * \param db Objet base de donnee
\param donid Id du don * \param donid Id du don
*/ */
function don_delete_preview($db, $donid) function don_delete_preview($db, $donid)
{ {

View File

@ -22,9 +22,8 @@
* \ingroup expedition * \ingroup expedition
* \brief Fichier contenant la classe mere de generation de bon de livraison en PDF * \brief Fichier contenant la classe mere de generation de bon de livraison en PDF
* et la classe mere de numerotation des bons de livraisons * et la classe mere de numerotation des bons de livraisons
* \version $Id: methode_expedition.modules.php,v 1.11 2011/08/10 23:21:12 eldy Exp $ * \version $Id: methode_expedition.modules.php,v 1.12 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');

View File

@ -22,10 +22,9 @@
* \file htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php * \file htdocs/includes/modules/expedition/pdf/ModelePdfExpedition.class.php
* \ingroup shipping * \ingroup shipping
* \brief Fichier contenant la classe mere de generation des expeditions * \brief Fichier contenant la classe mere de generation des expeditions
* \version $Id: ModelePdfExpedition.class.php,v 1.17 2011/08/10 23:20:55 eldy Exp $ * \version $Id: ModelePdfExpedition.class.php,v 1.18 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');

View File

@ -22,7 +22,7 @@
* \file htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php * \file htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
* \ingroup expedition * \ingroup expedition
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou * \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
* \version $Id: pdf_expedition_merou.modules.php,v 1.85 2011/07/31 23:28:13 eldy Exp $ * \version $Id: pdf_expedition_merou.modules.php,v 1.86 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php"; require_once DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php";
@ -81,7 +81,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -22,7 +22,7 @@
* \file htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php * \file htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
* \ingroup expedition * \ingroup expedition
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget * \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
* \version $Id: pdf_expedition_rouget.modules.php,v 1.60 2011/07/31 23:28:13 eldy Exp $ * \version $Id: pdf_expedition_rouget.modules.php,v 1.61 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php"; require_once DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php";
@ -87,7 +87,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -24,7 +24,7 @@
* \ingroup facture * \ingroup facture
* \brief File of class to generate invoices from crab model * \brief File of class to generate invoices from crab model
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id: pdf_crabe.modules.php,v 1.13 2011/08/10 17:56:11 hregis Exp $ * \version $Id: pdf_crabe.modules.php,v 1.14 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@ -121,7 +121,7 @@ class pdf_crabe extends ModelePDFFactures
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -25,7 +25,7 @@
* \ingroup facture * \ingroup facture
* \brief Fichier de la classe permettant de generer les factures au modele oursin * \brief Fichier de la classe permettant de generer les factures au modele oursin
* \author Sylvain SCATTOLINI base sur un modele de Laurent Destailleur * \author Sylvain SCATTOLINI base sur un modele de Laurent Destailleur
* \version $Id: pdf_oursin.modules.php,v 1.12 2011/08/10 17:56:10 hregis Exp $ * \version $Id: pdf_oursin.modules.php,v 1.13 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -120,7 +120,7 @@ class pdf_oursin extends ModelePDFFactures
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -24,11 +24,9 @@
* \ingroup facture * \ingroup facture
* \brief Fichier contenant la classe mere de generation des factures en PDF * \brief Fichier contenant la classe mere de generation des factures en PDF
* et la classe mere de numerotation des factures * et la classe mere de numerotation des factures
* \version $Id: modules_facture.php,v 1.95 2011/08/10 23:21:13 eldy Exp $ * \version $Id: modules_facture.php,v 1.96 2011/08/11 12:14:04 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Requis car utilise dans les classes qui heritent require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Requis car utilise dans les classes qui heritent
require_once(DOL_DOCUMENT_ROOT."/core/class/commondocgenerator.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commondocgenerator.class.php");

View File

@ -23,10 +23,9 @@
* \ingroup ficheinter * \ingroup ficheinter
* \brief Fichier contenant la classe mere de generation des fiches interventions en PDF * \brief Fichier contenant la classe mere de generation des fiches interventions en PDF
* et la classe mere de numerotation des fiches interventions * et la classe mere de numerotation des fiches interventions
* \version $Id: modules_fichinter.php,v 1.43 2011/08/10 23:21:13 eldy Exp $ * \version $Id: modules_fichinter.php,v 1.44 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');

View File

@ -22,7 +22,7 @@
* \file htdocs/includes/modules/fichinter/pdf_soleil.modules.php * \file htdocs/includes/modules/fichinter/pdf_soleil.modules.php
* \ingroup ficheinter * \ingroup ficheinter
* \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil * \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil
* \version $Id: pdf_soleil.modules.php,v 1.102 2011/07/31 23:28:15 eldy Exp $ * \version $Id: pdf_soleil.modules.php,v 1.103 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/fichinter/modules_fichinter.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/fichinter/modules_fichinter.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@ -87,7 +87,7 @@ class pdf_soleil extends ModelePDFFicheinter
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -24,10 +24,9 @@
* \ingroup expedition * \ingroup expedition
* \brief Fichier contenant la classe mere de generation de bon de livraison en PDF * \brief Fichier contenant la classe mere de generation de bon de livraison en PDF
* et la classe mere de numerotation des bons de livraisons * et la classe mere de numerotation des bons de livraisons
* \version $Id: modules_livraison.php,v 1.19 2011/08/10 23:21:12 eldy Exp $ * \version $Id: modules_livraison.php,v 1.20 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');

View File

@ -23,7 +23,7 @@
* \file htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php * \file htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
* \ingroup livraison * \ingroup livraison
* \brief File of class to manage receving receipts with template Sirocco * \brief File of class to manage receving receipts with template Sirocco
* \version $Id: pdf_sirocco.modules.php,v 1.78 2011/08/08 16:07:48 eldy Exp $ * \version $Id: pdf_sirocco.modules.php,v 1.79 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/livraison/modules_livraison.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/livraison/modules_livraison.php");
@ -85,7 +85,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -24,7 +24,7 @@
* \ingroup livraison * \ingroup livraison
* \brief File of class to manage receving receipts with template Typhon * \brief File of class to manage receving receipts with template Typhon
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id: pdf_typhon.modules.php,v 1.87 2011/08/08 16:07:48 eldy Exp $ * \version $Id: pdf_typhon.modules.php,v 1.88 2011/08/11 12:14:02 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/livraison/modules_livraison.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/livraison/modules_livraison.php");
@ -107,7 +107,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -23,10 +23,9 @@
* \file htdocs/includes/modules/member/cards/modules_cards.php * \file htdocs/includes/modules/member/cards/modules_cards.php
* \ingroup member * \ingroup member
* \brief File of parent class of document generator for members cards. * \brief File of parent class of document generator for members cards.
* \version $Id: modules_cards.php,v 1.12 2011/08/10 23:20:55 eldy Exp $ * \version $Id: modules_cards.php,v 1.13 2011/08/11 12:13:59 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");

View File

@ -60,10 +60,9 @@
* \author Laurent Passebecq * \author Laurent Passebecq
* \author Rodolphe Quiedville * \author Rodolphe Quiedville
* \author Jean Louis Bergamo. * \author Jean Louis Bergamo.
* \version $Id: pdf_standard.class.php,v 1.23 2011/08/10 23:20:55 eldy Exp $ * \version $Id: pdf_standard.class.php,v 1.24 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/format_cards.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/format_cards.lib.php');
@ -375,7 +374,7 @@ class pdf_standard {
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -23,10 +23,9 @@
* \file htdocs/includes/modules/member/labels/modules_labels.php * \file htdocs/includes/modules/member/labels/modules_labels.php
* \ingroup member * \ingroup member
* \brief File of parent class of document generator for members labels sheets. * \brief File of parent class of document generator for members labels sheets.
* \version $Id: modules_labels.php,v 1.3 2011/08/10 23:21:11 eldy Exp $ * \version $Id: modules_labels.php,v 1.4 2011/08/11 12:14:01 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");

View File

@ -60,10 +60,9 @@
* \author Laurent Passebecq * \author Laurent Passebecq
* \author Rodolphe Quiedville * \author Rodolphe Quiedville
* \author Jean Louis Bergamo. * \author Jean Louis Bergamo.
* \version $Id: pdf_standardlabel.class.php,v 1.14 2011/08/10 23:21:11 eldy Exp $ * \version $Id: pdf_standardlabel.class.php,v 1.15 2011/08/11 12:14:01 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/format_cards.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/format_cards.lib.php');
@ -354,7 +353,7 @@ class pdf_standardlabel {
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -21,9 +21,8 @@
* \ingroup project * \ingroup project
* \brief File that contain parent class for projects models * \brief File that contain parent class for projects models
* and parent class for projects numbering models * and parent class for projects numbering models
* \version $Id: modules_project.php,v 1.13 2011/08/10 23:21:09 eldy Exp $ * \version $Id: modules_project.php,v 1.14 2011/08/11 12:14:01 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');

View File

@ -21,7 +21,7 @@
* \ingroup project * \ingroup project
* \brief Fichier de la classe permettant de generer les projets au modele Baleine * \brief Fichier de la classe permettant de generer les projets au modele Baleine
* \author Regis Houssin * \author Regis Houssin
* \version $Id: pdf_baleine.modules.php,v 1.39 2011/07/31 23:28:18 eldy Exp $ * \version $Id: pdf_baleine.modules.php,v 1.40 2011/08/11 12:14:04 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php");
@ -95,7 +95,7 @@ class pdf_baleine extends ModelePDFProjects
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -23,10 +23,9 @@
* \ingroup propale * \ingroup propale
* \brief Fichier contenant la classe mere de generation des propales en PDF * \brief Fichier contenant la classe mere de generation des propales en PDF
* et la classe mere de numerotation des propales * et la classe mere de numerotation des propales
* \version $Id: modules_propale.php,v 1.65 2011/08/10 23:21:13 eldy Exp $ * \version $Id: modules_propale.php,v 1.66 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Requis car utilise dans les classes qui heritent require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Requis car utilise dans les classes qui heritent

View File

@ -24,7 +24,7 @@
* \ingroup propale * \ingroup propale
* \brief Fichier de la classe permettant de generer les propales au modele Azur * \brief Fichier de la classe permettant de generer les propales au modele Azur
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id: pdf_propale_azur.modules.php,v 1.244 2011/08/10 17:40:42 hregis Exp $ * \version $Id: pdf_propale_azur.modules.php,v 1.245 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -117,7 +117,7 @@ class pdf_propale_azur extends ModelePDFPropales
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -23,7 +23,7 @@
* \file htdocs/includes/modules/propale/pdf_propale_jaune.modules.php * \file htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
* \ingroup propale * \ingroup propale
* \brief Fichier de la classe permettant de generer les propales au modele Jaune * \brief Fichier de la classe permettant de generer les propales au modele Jaune
* \version $Id: pdf_propale_jaune.modules.php,v 1.118 2011/08/10 17:40:44 hregis Exp $ * \version $Id: pdf_propale_jaune.modules.php,v 1.119 2011/08/11 12:14:03 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php");
@ -93,7 +93,7 @@ class pdf_propale_jaune extends ModelePDFPropales
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -21,9 +21,8 @@
* \file htdocs/includes/modules/rapport/pdf_paiement.class.php * \file htdocs/includes/modules/rapport/pdf_paiement.class.php
* \ingroup banque * \ingroup banque
* \brief File to build payment reports * \brief File to build payment reports
* \version $Id: pdf_paiement.class.php,v 1.65 2011/08/10 23:21:09 eldy Exp $ * \version $Id: pdf_paiement.class.php,v 1.66 2011/08/11 12:14:01 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@ -81,7 +80,7 @@ class pdf_paiement
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$this->month=$month; $this->month=$month;
$this->year=$year; $this->year=$year;

View File

@ -20,9 +20,8 @@
* \file htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php * \file htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php
* \ingroup facture fourniseur * \ingroup facture fourniseur
* \brief File that contain parent class for supplier invoices models * \brief File that contain parent class for supplier invoices models
* \version $Id: modules_facturefournisseur.php,v 1.10 2011/08/10 23:21:14 eldy Exp $ * \version $Id: modules_facturefournisseur.php,v 1.11 2011/08/11 12:14:04 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');

View File

@ -21,7 +21,7 @@
* \file htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php * \file htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
* \ingroup fournisseur * \ingroup fournisseur
* \brief Class file to generate the supplier invoices with the canelle model * \brief Class file to generate the supplier invoices with the canelle model
* \version $Id: pdf_canelle.modules.php,v 1.35 2011/07/31 23:28:18 eldy Exp $ * \version $Id: pdf_canelle.modules.php,v 1.36 2011/08/11 12:14:01 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/supplier_invoice/modules_facturefournisseur.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/supplier_invoice/modules_facturefournisseur.php");
@ -105,7 +105,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -26,9 +26,8 @@
* \ingroup commande * \ingroup commande
* \brief File that contain parent class for supplier orders models * \brief File that contain parent class for supplier orders models
* and parent class for supplier orders numbering models * and parent class for supplier orders numbering models
* \version $Id: modules_commandefournisseur.php,v 1.23 2011/08/10 23:21:14 eldy Exp $ * \version $Id: modules_commandefournisseur.php,v 1.24 2011/08/11 12:14:04 eldy Exp $
*/ */
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // requis car utilise par les classes qui heritent require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // requis car utilise par les classes qui heritent

View File

@ -23,7 +23,7 @@
* \file htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php * \file htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
* \ingroup fournisseur * \ingroup fournisseur
* \brief Fichier de la classe permettant de generer les commandes fournisseurs au modele Muscadet * \brief Fichier de la classe permettant de generer les commandes fournisseurs au modele Muscadet
* \version $Id: pdf_muscadet.modules.php,v 1.87 2011/07/31 23:28:13 eldy Exp $ * \version $Id: pdf_muscadet.modules.php,v 1.88 2011/08/11 12:14:00 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/supplier_order/modules_commandefournisseur.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/supplier_order/modules_commandefournisseur.php");
@ -106,7 +106,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -24,21 +24,67 @@
* \file htdocs/lib/pdf.lib.php * \file htdocs/lib/pdf.lib.php
* \brief Set of functions used for PDF generation * \brief Set of functions used for PDF generation
* \ingroup core * \ingroup core
* \version $Id: pdf.lib.php,v 1.102 2011/08/10 22:47:35 eldy Exp $ * \version $Id: pdf.lib.php,v 1.103 2011/08/11 12:14:04 eldy Exp $
*/ */
/** /**
* Return a PDF instance object. We create a FPDI instance that instanciate TCPDF (or FPDF if MAIN_USE_FPDF is on) * Return array with format properties of default PDF format
* @param format Array(width,height) * @return array Array('width'=>w,'height'=>h,'unit'=>u);
*/
function pdf_getFormat()
{
global $conf,$db;
// Default value if setup was not done and/or entry into c_paper_format not defined
$width=210; $height=297; $unit='mm';
$pdfformat=$conf->global->MAIN_PDF_FORMAT;
if (empty($pdfformat))
{
include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php');
$pdfformat=dol_getDefaultFormat();
}
$sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format";
$sql.=" WHERE code = '".$pdfformat."'";
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if ($obj)
{
$width=$obj->width;
$height=$obj->height;
$unit=$obj->unit;
}
}
//print "pdfformat=".$pdfformat." width=".$width." height=".$height." unit=".$unit;
return array('width'=>$width,'height'=>$height,'unit'=>$unit);
}
/**
* Return a PDF instance object. We create a FPDI instance that instanciate TCPDF.
* @param format Array(width,height). Keep empty to use default setup.
* @param metric Unit of format ('mm') * @param metric Unit of format ('mm')
* @param pagetype 'P' or 'l' * @param pagetype 'P' or 'l'
* @return PDF object * @return PDF object
*/ */
function pdf_getInstance($format,$metric='mm',$pagetype='P') function pdf_getInstance($format='',$metric='mm',$pagetype='P')
{ {
global $conf; global $conf;
require_once(TCPDF_PATH.'tcpdf.php');
require_once(FPDFI_PATH.'fpdi.php');
//if (! is_array($format) || empty($format) || empty($metric))
//{
$arrayformat=pdf_getFormat();
$format=array($arrayformat['width'],$arrayformat['height']);
$metric=$arrayformat['unit'];
//}
// Protection et encryption du pdf // Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION) if ($conf->global->PDF_SECURITY_ENCRYPTION)
{ {

View File

@ -29,7 +29,7 @@
* \ingroup core * \ingroup core
* \brief File that defines environment for all Dolibarr process (pages or scripts) * \brief File that defines environment for all Dolibarr process (pages or scripts)
* This script reads the conf file, init $lang, $db and and empty $user * This script reads the conf file, init $lang, $db and and empty $user
* \version $Id: master.inc.php,v 1.352 2011/08/01 12:25:14 hregis Exp $ * \version $Id: master.inc.php,v 1.353 2011/08/11 12:14:03 eldy Exp $
*/ */
@ -302,9 +302,9 @@ if (! defined('NOREQUIRETRAN'))
*/ */
// Les path racines // Les path racines
if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); } if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); }
if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/tcpdf/'); }
if (! defined('FPDFI_PATH')) { define('FPDFI_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdfi/'); } if (! defined('FPDFI_PATH')) { define('FPDFI_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdfi/'); }
if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); } if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); }
if (! defined('JPGRAPH_PATH')) { define('JPGRAPH_PATH', DOL_DOCUMENT_ROOT .'/includes/jpgraph/'); }
if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', DOL_DOCUMENT_ROOT .'/includes/nusoap/lib/'); } if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', DOL_DOCUMENT_ROOT .'/includes/nusoap/lib/'); }
if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); } if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); }
if (! defined('PHPEXCELREADER')) { define('PHPEXCELREADER', DOL_DOCUMENT_ROOT .'/includes/phpexcelreader/'); } if (! defined('PHPEXCELREADER')) { define('PHPEXCELREADER', DOL_DOCUMENT_ROOT .'/includes/phpexcelreader/'); }

View File

@ -21,7 +21,7 @@
* \file scripts/invoices/rebuild_merge_pdf.php * \file scripts/invoices/rebuild_merge_pdf.php
* \ingroup facture * \ingroup facture
* \brief Script to rebuild PDF and merge PDF files into one * \brief Script to rebuild PDF and merge PDF files into one
* \version $Id: rebuild_merge_pdf.php,v 1.22 2011/08/10 23:31:05 eldy Exp $ * \version $Id: rebuild_merge_pdf.php,v 1.23 2011/08/11 12:14:22 eldy Exp $
*/ */
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
@ -37,7 +37,6 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
// Include Dolibarr environment // Include Dolibarr environment
require_once($path."../../htdocs/master.inc.php"); require_once($path."../../htdocs/master.inc.php");
// After this $db is an opened handler to database. We close it at end of file. // After this $db is an opened handler to database. We close it at end of file.
require_once(FPDFI_PATH.'fpdi_protection.php');
require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php"); require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@ -48,7 +47,7 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
$langs->load("main"); $langs->load("main");
// Global variables // Global variables
$version='$Revision: 1.22 $'; $version='$Revision: 1.23 $';
$error=0; $error=0;
@ -290,10 +289,7 @@ if ( $resql=$db->query($sql) )
//--------------------------------------------------------- //---------------------------------------------------------
// Create empty PDF // Create empty PDF
$pdf=new FPDI('P','mm','A4'); $pdf=pdf_getInstance();
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
//$pdf->SetCompression(false);
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
@ -301,6 +297,10 @@ if ( $resql=$db->query($sql) )
} }
$pdf->SetFont(pdf_getPDFFont($outputlangs)); $pdf->SetFont(pdf_getPDFFont($outputlangs));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
//$pdf->SetCompression(false);
//$pdf->Open(); //$pdf->Open();
//$pdf->AddPage(); //$pdf->AddPage();
//$title=$langs->trans("BillsCustomersUnpaid"); //$title=$langs->trans("BillsCustomersUnpaid");