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);
}
if (class_exists('TCPDF')) // Create empty PDF
{ $pdf=pdf_getInstance();
$pdf->setPrintHeader(false); if (class_exists('TCPDF'))
$pdf->setPrintFooter(false); {
} $pdf->setPrintHeader(false);
//$pdf->SetFont(pdf_getPDFFont($outputlangs)); $pdf->setPrintFooter(false);
}
$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,33 +1,33 @@
<?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.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
require_once('FilterASCII85.php'); require_once('FilterASCII85.php');
class FilterASCII85_FPDI extends FilterASCII85 { class FilterASCII85_FPDI extends FilterASCII85 {
var $fpdi; var $fpdi;
function FilterASCII85_FPDI(&$fpdi) { function FilterASCII85_FPDI(&$fpdi) {
$this->fpdi =& $fpdi; $this->fpdi =& $fpdi;
} }
function error($msg) { function error($msg) {
$this->fpdi->error($msg); $this->fpdi->error($msg);
} }
} }

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,33 +1,33 @@
<?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.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
require_once('FilterLZW.php'); require_once('FilterLZW.php');
class FilterLZW_FPDI extends FilterLZW { class FilterLZW_FPDI extends FilterLZW {
var $fpdi; var $fpdi;
function FilterLZW_FPDI(&$fpdi) { function FilterLZW_FPDI(&$fpdi) {
$this->fpdi =& $fpdi; $this->fpdi =& $fpdi;
} }
function error($msg) { function error($msg) {
$this->fpdi->error($msg); $this->fpdi->error($msg);
} }
} }

View File

@ -1,415 +1,449 @@
<?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
// //
// 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.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
class FPDF_TPL extends FPDF { class FPDF_TPL extends FPDF {
/** /**
* Array of Tpl-Data * Array of Tpl-Data
* @var array * @var array
*/ */
var $tpls = array(); var $tpls = array();
/** /**
* Current Template-ID * Current Template-ID
* @var int * @var int
*/ */
var $tpl = 0; var $tpl = 0;
/** /**
* "In Template"-Flag * "In Template"-Flag
* @var boolean * @var boolean
*/ */
var $_intpl = false; var $_intpl = false;
/** /**
* Nameprefix of Templates used in Resources-Dictonary * Nameprefix of Templates used in Resources-Dictonary
* @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an / * @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
*/ */
var $tplprefix = "/TPL"; var $tplprefix = "/TPL";
/** /**
* Resources used By Templates and Pages * Resources used By Templates and Pages
* @var array * @var array
*/ */
var $_res = array(); var $_res = array();
/** /**
* Last used Template data * Last used Template data
* *
* @var array * @var array
*/ */
var $lastUsedTemplateData = array(); var $lastUsedTemplateData = array();
/** /**
* Start a Template * Start a Template
* *
* This method starts a template. You can give own coordinates to build an own sized * This method starts a template. You can give own coordinates to build an own sized
* Template. Pay attention, that the margins are adapted to the new templatesize. * Template. Pay attention, that the margins are adapted to the new templatesize.
* If you want to write outside the template, for example to build a clipped Template, * If you want to write outside the template, for example to build a clipped Template,
* you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call. * you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
* *
* If no parameter is given, the template uses the current page-size. * If no parameter is given, the template uses the current page-size.
* The Method returns an ID of the current Template. This ID is used later for using this template. * The Method returns an ID of the current Template. This ID is used later for using this template.
* Warning: A created Template is used in PDF at all events. Still if you don't use it after creation! * Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
* *
* @param int $x The x-coordinate given in user-unit * @param int $x The x-coordinate given in user-unit
* @param int $y The y-coordinate given in user-unit * @param int $y The y-coordinate given in user-unit
* @param int $w The width given in user-unit * @param int $w The width given in user-unit
* @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 ($this->page <= 0) if (is_subclass_of($this, 'TCPDF')) {
$this->error("You have to add a page to fpdf first!"); $this->Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
return;
if ($x == null) }
$x = 0;
if ($y == null) if ($this->page <= 0)
$y = 0; $this->error("You have to add a page to fpdf first!");
if ($w == null)
$w = $this->w; if ($x == null)
if ($h == null) $x = 0;
$h = $this->h; if ($y == null)
$y = 0;
// Save settings if ($w == null)
$this->tpl++; $w = $this->w;
$tpl =& $this->tpls[$this->tpl]; if ($h == null)
$tpl = array( $h = $this->h;
'o_x' => $this->x,
'o_y' => $this->y, // Save settings
'o_AutoPageBreak' => $this->AutoPageBreak, $this->tpl++;
'o_bMargin' => $this->bMargin, $tpl =& $this->tpls[$this->tpl];
'o_tMargin' => $this->tMargin, $tpl = array(
'o_lMargin' => $this->lMargin, 'o_x' => $this->x,
'o_rMargin' => $this->rMargin, 'o_y' => $this->y,
'o_h' => $this->h, 'o_AutoPageBreak' => $this->AutoPageBreak,
'o_w' => $this->w, 'o_bMargin' => $this->bMargin,
'buffer' => '', 'o_tMargin' => $this->tMargin,
'x' => $x, 'o_lMargin' => $this->lMargin,
'y' => $y, 'o_rMargin' => $this->rMargin,
'w' => $w, 'o_h' => $this->h,
'h' => $h 'o_w' => $this->w,
); 'buffer' => '',
'x' => $x,
$this->SetAutoPageBreak(false); 'y' => $y,
'w' => $w,
// Define own high and width to calculate possitions correct 'h' => $h
$this->h = $h; );
$this->w = $w;
$this->SetAutoPageBreak(false);
$this->_intpl = true;
$this->SetXY($x+$this->lMargin, $y+$this->tMargin); // Define own high and width to calculate possitions correct
$this->SetRightMargin($this->w-$w+$this->rMargin); $this->h = $h;
$this->w = $w;
return $this->tpl;
} $this->_intpl = true;
$this->SetXY($x + $this->lMargin, $y + $this->tMargin);
/** $this->SetRightMargin($this->w - $w + $this->rMargin);
* End Template
* return $this->tpl;
* This method ends a template and reset initiated variables on beginTemplate. }
*
* @return mixed If a template is opened, the ID is returned. If not a false is returned. /**
*/ * End Template
function endTemplate() { *
if ($this->_intpl) { * This method ends a template and reset initiated variables on beginTemplate.
$this->_intpl = false; *
$tpl =& $this->tpls[$this->tpl]; * @return mixed If a template is opened, the ID is returned. If not a false is returned.
$this->SetXY($tpl['o_x'], $tpl['o_y']); */
$this->tMargin = $tpl['o_tMargin']; function endTemplate() {
$this->lMargin = $tpl['o_lMargin']; if (is_subclass_of($this, 'TCPDF')) {
$this->rMargin = $tpl['o_rMargin']; $args = func_get_args();
$this->h = $tpl['o_h']; return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
$this->w = $tpl['o_w']; }
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
if ($this->_intpl) {
return $this->tpl; $this->_intpl = false;
} else { $tpl =& $this->tpls[$this->tpl];
return false; $this->SetXY($tpl['o_x'], $tpl['o_y']);
} $this->tMargin = $tpl['o_tMargin'];
} $this->lMargin = $tpl['o_lMargin'];
$this->rMargin = $tpl['o_rMargin'];
/** $this->h = $tpl['o_h'];
* Use a Template in current Page or other Template $this->w = $tpl['o_w'];
* $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
* You can use a template in a page or in another template.
* You can give the used template a new size like you use the Image()-method. return $this->tpl;
* All parameters are optional. The width or height is calculated automaticaly } else {
* if one is given. If no parameter is given the origin size as defined in return false;
* beginTemplate() is used. }
* The calculated or used width and height are returned as an array. }
*
* @param int $tplidx A valid template-Id /**
* @param int $_x The x-position * Use a Template in current Page or other Template
* @param int $_y The y-position *
* @param int $_w The new width of the template * You can use a template in a page or in another template.
* @param int $_h The new height of the template * You can give the used template a new size like you use the Image()-method.
* @retrun array The height and width of the template * All parameters are optional. The width or height is calculated automaticaly
*/ * if one is given. If no parameter is given the origin size as defined in
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) { * beginTemplate() is used.
if ($this->page <= 0) * The calculated or used width and height are returned as an array.
$this->error("You have to add a page to fpdf first!"); *
* @param int $tplidx A valid template-Id
if (!isset($this->tpls[$tplidx])) * @param int $_x The x-position
$this->error("Template does not exist!"); * @param int $_y The y-position
* @param int $_w The new width of the template
if ($this->_intpl) { * @param int $_h The new height of the template
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; * @retrun array The height and width of the template
} */
function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) {
$tpl =& $this->tpls[$tplidx]; if ($this->page <= 0)
$w = $tpl['w']; $this->error('You have to add a page first!');
$h = $tpl['h'];
if (!isset($this->tpls[$tplidx]))
if ($_x == null) $this->error('Template does not exist!');
$_x = 0;
if ($_y == null) if ($this->_intpl) {
$_y = 0; $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
}
$_x += $tpl['x'];
$_y += $tpl['y']; $tpl =& $this->tpls[$tplidx];
$w = $tpl['w'];
$wh = $this->getTemplateSize($tplidx, $_w, $_h); $h = $tpl['h'];
$_w = $wh['w'];
$_h = $wh['h']; if ($_x == null)
$_x = 0;
$tData = array( if ($_y == null)
'x' => $this->x, $_y = 0;
'y' => $this->y,
'w' => $_w, $_x += $tpl['x'];
'h' => $_h, $_y += $tpl['y'];
'scaleX' => ($_w/$w),
'scaleY' => ($_h/$h), $wh = $this->getTemplateSize($tplidx, $_w, $_h);
'tx' => $_x, $_w = $wh['w'];
'ty' => ($this->h-$_y-$_h), $_h = $wh['h'];
'lty' => ($this->h-$_y-$_h) - ($this->h-$h) * ($_h/$h)
); $tData = array(
'x' => $this->x,
$this->_out(sprintf("q %.4F 0 0 %.4F %.4F %.4F cm", $tData['scaleX'], $tData['scaleY'], $tData['tx']*$this->k, $tData['ty']*$this->k)); // Translate 'y' => $this->y,
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); 'w' => $_w,
'h' => $_h,
$this->lastUsedTemplateData = $tData; 'scaleX' => ($_w / $w),
'scaleY' => ($_h / $h),
return array("w" => $_w, "h" => $_h); 'tx' => $_x,
} 'ty' => ($this->h - $_y - $_h),
'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h)
/** );
* Get The calculated Size of a Template
* $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate
* If one size is given, this method calculates the other one. $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
*
* @param int $tplidx A valid template-Id // reset font in the outer graphic state
* @param int $_w The width of the template if ($this->FontFamily) {
* @param int $_h The height of the template $family = $this->FontFamily;
* @return array The height and width of the template $this->FontFamily = '';
*/ $this->SetFont($family);
function getTemplateSize($tplidx, $_w=0, $_h=0) { }
if (!$this->tpls[$tplidx])
return false; $this->lastUsedTemplateData = $tData;
$tpl =& $this->tpls[$tplidx]; return array('w' => $_w, 'h' => $_h);
$w = $tpl['w']; }
$h = $tpl['h'];
/**
if ($_w == 0 and $_h == 0) { * Get The calculated Size of a Template
$_w = $w; *
$_h = $h; * If one size is given, this method calculates the other one.
} *
* @param int $tplidx A valid template-Id
if($_w==0) * @param int $_w The width of the template
$_w = $_h*$w/$h; * @param int $_h The height of the template
if($_h==0) * @return array The height and width of the template
$_h = $_w*$h/$w; */
function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
return array("w" => $_w, "h" => $_h); if (!$this->tpls[$tplidx])
} return false;
/** $tpl =& $this->tpls[$tplidx];
* See FPDF/TCPDF-Documentation ;-) $w = $tpl['w'];
*/ $h = $tpl['h'];
function SetFont($family, $style='', $size=0, $fontfile='') {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 3) { if ($_w == 0 and $_h == 0) {
$this->Error('More than 3 arguments for the SetFont method are only available in TCPDF.'); $_w = $w;
} $_h = $h;
/** }
* force the resetting of font changes in a template
*/ if($_w == 0)
if ($this->_intpl) $_w = $_h * $w / $h;
$this->FontFamily = ''; if($_h == 0)
$_h = $_w * $h / $w;
parent::SetFont($family, $style, $size, $fontfile);
return array("w" => $_w, "h" => $_h);
$fontkey = $this->FontFamily.$this->FontStyle; }
if ($this->_intpl) { /**
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; * See FPDF/TCPDF-Documentation ;-)
} else { */
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; public function SetFont($family, $style = '', $size = 0) {
} if (is_subclass_of($this, 'TCPDF')) {
} $args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
/** }
* 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) { * force the resetting of font changes in a template
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) { */
$this->Error('More than 7 arguments for the Image method are only available in TCPDF.'); if ($this->_intpl)
} $this->FontFamily = '';
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $ismask, $imgmask, $border, $fitbox, $hidden, $fitonpage); parent::SetFont($family, $style, $size);
if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; $fontkey = $this->FontFamily . $this->FontStyle;
} else {
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; if ($this->_intpl) {
} $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} else {
return $ret; $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} }
}
/**
* See FPDF-Documentation ;-) /**
* * See FPDF/TCPDF-Documentation ;-)
* AddPage is not available when you're "in" a template. */
*/ function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') {
function AddPage($orientation='', $format='', $keepmargins=false) { if (is_subclass_of($this, 'TCPDF')) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 2) { $args = func_get_args();
$this->Error('More than 2 arguments for the AddPage method are only available in TCPDF.'); return call_user_func_array(array($this, 'TCPDF::Image'), $args);
} }
if ($this->_intpl) $ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
$this->Error('Adding pages in templates isn\'t possible!'); if ($this->_intpl) {
parent::AddPage($orientation, $format, $keepmargins); $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} } else {
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
/** }
* Preserve adding Links in Templates ...won't work
*/ return $ret;
function Link($x, $y, $w, $h, $link, $spaces=0) { }
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 5) {
$this->Error('More than 5 arguments for the Image method are only available in TCPDF.'); /**
} * See FPDF-Documentation ;-)
*
if ($this->_intpl) * AddPage is not available when you're "in" a template.
$this->Error('Using links in templates aren\'t possible!'); */
parent::Link($x, $y, $w, $h, $link, $spaces); function AddPage($orientation = '', $format = '') {
} if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
function AddLink() { return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
if ($this->_intpl) }
$this->Error('Adding links in templates aren\'t possible!');
return parent::AddLink(); if ($this->_intpl)
} $this->Error('Adding pages in templates isn\'t possible!');
function SetLink($link, $y=0, $page=-1) { parent::AddPage($orientation, $format);
if ($this->_intpl) }
$this->Error('Setting links in templates aren\'t possible!');
parent::SetLink($link, $y, $page); /**
} * Preserve adding Links in Templates ...won't work
*/
/** function Link($x, $y, $w, $h, $link) {
* Private Method that writes the form xobjects if (is_subclass_of($this, 'TCPDF')) {
*/ $args = func_get_args();
function _putformxobjects() { return call_user_func_array(array($this, 'TCPDF::Link'), $args);
$filter=($this->compress) ? '/Filter /FlateDecode ' : ''; }
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) { if ($this->_intpl)
$this->Error('Using links in templates aren\'t possible!');
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj(); parent::Link($x, $y, $w, $h, $link);
$this->tpls[$tplidx]['n'] = $this->n; }
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form'); function AddLink() {
$this->_out('/FormType 1'); if (is_subclass_of($this, 'TCPDF')) {
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', $args = func_get_args();
// llx return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
$tpl['x']*$this->k, }
// lly
-$tpl['y']*$this->k, if ($this->_intpl)
// urx $this->Error('Adding links in templates aren\'t possible!');
($tpl['w']+$tpl['x'])*$this->k, return parent::AddLink();
// ury }
($tpl['h']-$tpl['y'])*$this->k
)); function SetLink($link, $y = 0, $page = -1) {
if (is_subclass_of($this, 'TCPDF')) {
if ($tpl['x'] != 0 || $tpl['y'] != 0) { $args = func_get_args();
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]', return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
-$tpl['x']*$this->k*2, $tpl['y']*$this->k*2 }
));
} if ($this->_intpl)
$this->Error('Setting links in templates aren\'t possible!');
$this->_out('/Resources '); parent::SetLink($link, $y, $page);
}
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { /**
$this->_out('/Font <<'); * Private Method that writes the form xobjects
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) */
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); function _putformxobjects() {
$this->_out('>>'); $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
} reset($this->tpls);
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || foreach($this->tpls AS $tplidx => $tpl) {
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
{ $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_out('/XObject <<'); $this->_newobj();
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { $this->tpls[$tplidx]['n'] = $this->n;
foreach($this->_res['tpl'][$tplidx]['images'] as $image) $this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); $this->_out('/Subtype /Form');
} $this->_out('/FormType 1');
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) // llx
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); $tpl['x'] * $this->k,
} // lly
$this->_out('>>'); -$tpl['y'] * $this->k,
} // urx
$this->_out('>>'); ($tpl['w'] + $tpl['x']) * $this->k,
// ury
$this->_out('/Length '.strlen($p).' >>'); ($tpl['h'] - $tpl['y']) * $this->k
$this->_putstream($p); ));
$this->_out('endobj');
} if ($tpl['x'] != 0 || $tpl['y'] != 0) {
} $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
-$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
/** ));
* Overwritten to add _putformxobjects() after _putimages() }
*
*/ $this->_out('/Resources ');
function _putimages() {
parent::_putimages(); $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
$this->_putformxobjects(); if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
} $this->_out('/Font <<');
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
function _putxobjectdict() { $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
parent::_putxobjectdict(); $this->_out('>>');
}
if (count($this->tpls)) { if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
foreach($this->tpls as $tplidx => $tpl) { isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n'])); {
} $this->_out('/XObject <<');
} if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
} foreach($this->_res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
/** }
* Private Method if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
*/ foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
function _out($s) { $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
if ($this->state==2 && $this->_intpl) { }
$this->tpls[$this->tpl]['buffer'] .= $s."\n"; $this->_out('>>');
} else { }
parent::_out($s); $this->_out('>>');
}
} $this->_out('/Length ' . strlen($p) . ' >>');
} $this->_putstream($p);
$this->_out('endobj');
}
}
/**
* Overwritten to add _putformxobjects() after _putimages()
*
*/
function _putimages() {
parent::_putimages();
$this->_putformxobjects();
}
function _putxobjectdict() {
parent::_putxobjectdict();
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl) {
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
}
}
}
/**
* Private Method
*/
function _out($s) {
if ($this->state == 2 && $this->_intpl) {
$this->tpls[$this->tpl]['buffer'] .= $s . "\n";
} else {
parent::_out($s);
}
}
}

File diff suppressed because it is too large Load Diff

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) { function _putstream($s) {
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) {
$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,398 +1,409 @@
<?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.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
require_once('pdf_parser.php'); require_once('pdf_parser.php');
class fpdi_pdf_parser extends pdf_parser { class fpdi_pdf_parser extends pdf_parser {
/** /**
* Pages * Pages
* Index beginns at 0 * Index beginns at 0
* *
* @var array * @var array
*/ */
var $pages; var $pages;
/** /**
* Page count * Page count
* @var integer * @var integer
*/ */
var $page_count; var $page_count;
/** /**
* actual page number * actual page number
* @var integer * @var integer
*/ */
var $pageno; var $pageno;
/** /**
* PDF Version of imported Document * PDF Version of imported Document
* @var string * @var string
*/ */
var $pdfVersion; var $pdfVersion;
/** /**
* FPDI Reference * FPDI Reference
* @var object * @var object
*/ */
var $fpdi; var $fpdi;
/** /**
* Available BoxTypes * Available BoxTypes
* *
* @var array * @var array
*/ */
var $availableBoxes = array('/MediaBox', '/CropBox', '/BleedBox', '/TrimBox', '/ArtBox'); var $availableBoxes = array('/MediaBox', '/CropBox', '/BleedBox', '/TrimBox', '/ArtBox');
/** /**
* Constructor * Constructor
* *
* @param string $filename Source-Filename * @param string $filename Source-Filename
* @param object $fpdi Object of type fpdi * @param object $fpdi Object of type fpdi
*/ */
function fpdi_pdf_parser($filename, &$fpdi) { function fpdi_pdf_parser($filename, &$fpdi) {
$this->fpdi =& $fpdi; $this->fpdi =& $fpdi;
parent::pdf_parser($filename); parent::pdf_parser($filename);
// resolve Pages-Dictonary // resolve Pages-Dictonary
$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']); $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
// Read pages // Read pages
$this->read_pages($this->c, $pages, $this->pages); $this->read_pages($this->c, $pages, $this->pages);
// count pages; // count pages;
$this->page_count = count($this->pages); $this->page_count = count($this->pages);
} }
/** /**
* Overwrite parent::error() * Overwrite parent::error()
* *
* @param string $msg Error-Message * @param string $msg Error-Message
*/ */
function error($msg) { function error($msg) {
$this->fpdi->error($msg); $this->fpdi->error($msg);
} }
/** /**
* Get pagecount from sourcefile * Get pagecount from sourcefile
* *
* @return int * @return int
*/ */
function getPageCount() { function getPageCount() {
return $this->page_count; return $this->page_count;
} }
/** /**
* Set pageno * Set pageno
* *
* @param int $pageno Pagenumber to use * @param int $pageno Pagenumber to use
*/ */
function setPageno($pageno) { function setPageno($pageno) {
$pageno = ((int) $pageno) - 1; $pageno = ((int) $pageno) - 1;
if ($pageno < 0 || $pageno >= $this->getPageCount()) { if ($pageno < 0 || $pageno >= $this->getPageCount()) {
$this->fpdi->error('Pagenumber is wrong!'); $this->fpdi->error('Pagenumber is wrong!');
} }
$this->pageno = $pageno; $this->pageno = $pageno;
} }
/** /**
* Get page-resources from current page * Get page-resources from current page
* *
* @return array * @return array
*/ */
function getPageResources() { function getPageResources() {
return $this->_getPageResources($this->pages[$this->pageno]); return $this->_getPageResources($this->pages[$this->pageno]);
} }
/** /**
* Get page-resources from /Page * Get page-resources from /Page
* *
* @param array $obj Array of pdf-data * @param array $obj Array of pdf-data
*/ */
function _getPageResources ($obj) { // $obj = /Page function _getPageResources ($obj) { // $obj = /Page
$obj = $this->pdf_resolve_object($this->c, $obj); $obj = $this->pdf_resolve_object($this->c, $obj);
// If the current object has a resources // If the current object has a resources
// dictionary associated with it, we use // dictionary associated with it, we use
// it. Otherwise, we move back to its // it. Otherwise, we move back to its
// parent object. // parent object.
if (isset ($obj[1][1]['/Resources'])) { if (isset ($obj[1][1]['/Resources'])) {
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']); $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
if ($res[0] == PDF_TYPE_OBJECT) if ($res[0] == PDF_TYPE_OBJECT)
return $res[1]; return $res[1];
return $res; return $res;
} else { } else {
if (!isset ($obj[1][1]['/Parent'])) { if (!isset ($obj[1][1]['/Parent'])) {
return false; return false;
} else { } else {
$res = $this->_getPageResources($obj[1][1]['/Parent']); $res = $this->_getPageResources($obj[1][1]['/Parent']);
if ($res[0] == PDF_TYPE_OBJECT) if ($res[0] == PDF_TYPE_OBJECT)
return $res[1]; return $res[1];
return $res; return $res;
} }
} }
} }
/** /**
* Get content of current page * Get content of current page
* *
* If more /Contents is an array, the streams are concated * If more /Contents is an array, the streams are concated
* *
* @return string * @return string
*/ */
function getContent() { function getContent() {
$buffer = ''; $buffer = '';
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) . ' ';
} }
} }
return $buffer; return $buffer;
} }
/** /**
* Resolve all content-objects * Resolve all content-objects
* *
* @param array $content_ref * @param array $content_ref
* @return array * @return array
*/ */
function _getPageContent($content_ref) { function _getPageContent($content_ref) {
$contents = array(); $contents = array();
if ($content_ref[0] == PDF_TYPE_OBJREF) { if ($content_ref[0] == PDF_TYPE_OBJREF) {
$content = $this->pdf_resolve_object($this->c, $content_ref); $content = $this->pdf_resolve_object($this->c, $content_ref);
if ($content[1][0] == PDF_TYPE_ARRAY) { if ($content[1][0] == PDF_TYPE_ARRAY) {
$contents = $this->_getPageContent($content[1]); $contents = $this->_getPageContent($content[1]);
} else { } else {
$contents[] = $content; $contents[] = $content;
} }
} else if ($content_ref[0] == PDF_TYPE_ARRAY) { } else if ($content_ref[0] == PDF_TYPE_ARRAY) {
foreach ($content_ref[1] AS $tmp_content_ref) { foreach ($content_ref[1] AS $tmp_content_ref) {
$contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref));
} }
} }
return $contents; return $contents;
} }
/** /**
* Rebuild content-streams * Rebuild content-streams
* *
* @param array $obj * @param array $obj
* @return string * @return string
*/ */
function _rebuildContentStream($obj) { function _rebuildContentStream($obj) {
$filters = array(); $filters = array();
if (isset($obj[1][1]['/Filter'])) { if (isset($obj[1][1]['/Filter'])) {
$_filter = $obj[1][1]['/Filter']; $_filter = $obj[1][1]['/Filter'];
if ($_filter[0] == PDF_TYPE_OBJREF) { if ($_filter[0] == PDF_TYPE_OBJREF) {
$tmpFilter = $this->pdf_resolve_object($this->c, $_filter); $tmpFilter = $this->pdf_resolve_object($this->c, $_filter);
$_filter = $tmpFilter[1]; $_filter = $tmpFilter[1];
} }
if ($_filter[0] == PDF_TYPE_TOKEN) { if ($_filter[0] == PDF_TYPE_TOKEN) {
$filters[] = $_filter; $filters[] = $_filter;
} else if ($_filter[0] == PDF_TYPE_ARRAY) { } else if ($_filter[0] == PDF_TYPE_ARRAY) {
$filters = $_filter[1]; $filters = $_filter[1];
} }
} }
$stream = $obj[2][1]; $stream = $obj[2][1];
foreach ($filters AS $_filter) { foreach ($filters AS $_filter) {
switch ($_filter[1]) { switch ($_filter[1]) {
case '/FlateDecode': case '/FlateDecode':
// $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work case '/Fl':
if (function_exists('gzuncompress')) { // $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work
$stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; // $stream .= "\x0A";
} else { // $stream .= "\x0D";
$this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1])); if (function_exists('gzuncompress')) {
} $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';
} else {
if ($stream === false) { $this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1]));
$this->error('Error while decompressing stream.'); }
}
break; if ($stream === false) {
case '/LZWDecode': $this->error('Error while decompressing stream.');
include_once('filters/FilterLZW_FPDI.php'); }
$decoder = new FilterLZW_FPDI($this->fpdi); break;
$stream = $decoder->decode($stream); case '/LZWDecode':
break; include_once('filters/FilterLZW_FPDI.php');
case '/ASCII85Decode': $decoder = new FilterLZW_FPDI($this->fpdi);
include_once('filters/FilterASCII85_FPDI.php'); $stream = $decoder->decode($stream);
$decoder = new FilterASCII85_FPDI($this->fpdi); break;
$stream = $decoder->decode($stream); case '/ASCII85Decode':
break; include_once('filters/FilterASCII85_FPDI.php');
case null: $decoder = new FilterASCII85_FPDI($this->fpdi);
$stream = $stream; $stream = $decoder->decode($stream);
break; break;
default: case null:
$this->error(sprintf('Unsupported Filter: %s',$_filter[1])); $stream = $stream;
} break;
} default:
$this->error(sprintf('Unsupported Filter: %s',$_filter[1]));
return $stream; }
} }
return $stream;
/** }
* Get a Box from a page
* Arrayformat is same as used by fpdf_tpl
* /**
* @param array $page a /Page * Get a Box from a page
* @param string $box_index Type of Box @see $availableBoxes * Arrayformat is same as used by fpdf_tpl
* @return array *
*/ * @param array $page a /Page
function getPageBox($page, $box_index) { * @param string $box_index Type of Box @see $availableBoxes
$page = $this->pdf_resolve_object($this->c,$page); * @param float Scale factor from user space units to points
$box = null; * @return array
if (isset($page[1][1][$box_index])) */
$box =& $page[1][1][$box_index]; function getPageBox($page, $box_index, $k) {
$page = $this->pdf_resolve_object($this->c, $page);
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { $box = null;
$tmp_box = $this->pdf_resolve_object($this->c,$box); if (isset($page[1][1][$box_index]))
$box = $tmp_box[1]; $box =& $page[1][1][$box_index];
}
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { $tmp_box = $this->pdf_resolve_object($this->c, $box);
$b =& $box[1]; $box = $tmp_box[1];
return array('x' => $b[0][1]/$this->fpdi->k, }
'y' => $b[1][1]/$this->fpdi->k,
'w' => abs($b[0][1]-$b[2][1])/$this->fpdi->k, if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
'h' => abs($b[1][1]-$b[3][1])/$this->fpdi->k, $b =& $box[1];
'llx' => min($b[0][1], $b[2][1])/$this->fpdi->k, return array('x' => $b[0][1]/$k,
'lly' => min($b[1][1], $b[3][1])/$this->fpdi->k, 'y' => $b[1][1]/$k,
'urx' => max($b[0][1], $b[2][1])/$this->fpdi->k, 'w' => abs($b[0][1]-$b[2][1])/$k,
'ury' => max($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])/$k,
} else if (!isset ($page[1][1]['/Parent'])) { 'lly' => min($b[1][1], $b[3][1])/$k,
return false; 'urx' => max($b[0][1], $b[2][1])/$k,
} else { 'ury' => max($b[1][1], $b[3][1])/$k,
return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index); );
} } else if (!isset ($page[1][1]['/Parent'])) {
} return false;
} else {
function getPageBoxes($pageno) { return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k);
return $this->_getPageBoxes($this->pages[$pageno-1]); }
} }
/** /**
* Get all Boxes from /Page * Get all page boxes by page no
* *
* @param array a /Page * @param int The page number
* @return array * @param float Scale factor from user space units to points
*/ * @return array
function _getPageBoxes($page) { */
$boxes = array(); function getPageBoxes($pageno, $k) {
return $this->_getPageBoxes($this->pages[$pageno-1], $k);
foreach($this->availableBoxes AS $box) { }
if ($_box = $this->getPageBox($page,$box)) {
$boxes[$box] = $_box; /**
} * Get all boxes from /Page
} *
* @param array a /Page
return $boxes; * @return array
} */
function _getPageBoxes($page, $k) {
/** $boxes = array();
* Get the page rotation by pageno
* foreach($this->availableBoxes AS $box) {
* @param integer $pageno if ($_box = $this->getPageBox($page, $box, $k)) {
* @return array $boxes[$box] = $_box;
*/ }
function getPageRotation($pageno) { }
return $this->_getPageRotation($this->pages[$pageno-1]);
} return $boxes;
}
function _getPageRotation ($obj) { // $obj = /Page
$obj = $this->pdf_resolve_object($this->c, $obj); /**
if (isset ($obj[1][1]['/Rotate'])) { * Get the page rotation by pageno
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']); *
if ($res[0] == PDF_TYPE_OBJECT) * @param integer $pageno
return $res[1]; * @return array
return $res; */
} else { function getPageRotation($pageno) {
if (!isset ($obj[1][1]['/Parent'])) { return $this->_getPageRotation($this->pages[$pageno-1]);
return false; }
} else {
$res = $this->_getPageRotation($obj[1][1]['/Parent']); function _getPageRotation($obj) { // $obj = /Page
if ($res[0] == PDF_TYPE_OBJECT) $obj = $this->pdf_resolve_object($this->c, $obj);
return $res[1]; if (isset ($obj[1][1]['/Rotate'])) {
return $res; $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
} if ($res[0] == PDF_TYPE_OBJECT)
} return $res[1];
} return $res;
} else {
/** if (!isset ($obj[1][1]['/Parent'])) {
* Read all /Page(es) return false;
* } else {
* @param object pdf_context $res = $this->_getPageRotation($obj[1][1]['/Parent']);
* @param array /Pages if ($res[0] == PDF_TYPE_OBJECT)
* @param array the result-array return $res[1];
*/ return $res;
function read_pages (&$c, &$pages, &$result) { }
// Get the kids dictionary }
$_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); }
if (!is_array($_kids)) /**
$this->error('Cannot find /Kids in current /Page-Dictionary'); * Read all /Page(es)
*
if ($_kids[1][0] == PDF_TYPE_ARRAY) { * @param object pdf_context
$kids = $_kids[1][1]; * @param array /Pages
} else { * @param array the result-array
$kids = $_kids[1]; */
} function read_pages(&$c, &$pages, &$result) {
// Get the kids dictionary
foreach ($kids as $v) { $_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
$pg = $this->pdf_resolve_object ($c, $v);
if ($pg[1][1]['/Type'][1] === '/Pages') { if (!is_array($_kids))
// If one of the kids is an embedded $this->error('Cannot find /Kids in current /Page-Dictionary');
// /Pages array, resolve it as well.
$this->read_pages ($c, $pg, $result); if ($_kids[1][0] == PDF_TYPE_ARRAY) {
} else { $kids = $_kids[1][1];
$result[] = $pg; } else {
} $kids = $_kids[1];
} }
}
foreach ($kids as $v) {
$pg = $this->pdf_resolve_object ($c, $v);
if ($pg[1][1]['/Type'][1] === '/Pages') {
/** // If one of the kids is an embedded
* Get PDF-Version // /Pages array, resolve it as well.
* $this->read_pages($c, $pg, $result);
* And reset the PDF Version used in FPDI if needed } else {
*/ $result[] = $pg;
function getPDFVersion() { }
parent::getPDFVersion(); }
$this->fpdi->PDFVersion = max($this->fpdi->PDFVersion, $this->pdfVersion); }
}
/**
* Get PDF-Version
*
* And reset the PDF Version used in FPDI if needed
*/
function getPDFVersion() {
parent::getPDFVersion();
$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,103 +1,104 @@
<?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.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// 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 {
/**
/** * Modi
* Modi *
* * @var integer 0 = file | 1 = string
* @var integer 0 = file | 1 = string */
*/ var $_mode = 0;
var $_mode = 0;
var $file;
var $file; var $buffer;
var $buffer; var $offset;
var $offset; var $length;
var $length;
var $stack;
var $stack;
// Constructor
// Constructor
function pdf_context(&$f) {
function pdf_context(&$f) { $this->file =& $f;
$this->file =& $f; if (is_string($this->file))
if (is_string($this->file)) $this->_mode = 1;
$this->_mode = 1; $this->reset();
$this->reset(); }
}
// Optionally move the file
// Optionally move the file // pointer to a new location
// pointer to a new location // and reset the buffered data
// and reset the buffered data
function reset($pos = null, $l = 100) {
function reset($pos = null, $l = 100) { if ($this->_mode == 0) {
if ($this->_mode == 0) { if (!is_null ($pos)) {
if (!is_null ($pos)) { fseek ($this->file, $pos);
fseek ($this->file, $pos); }
}
$this->buffer = $l > 0 ? fread($this->file, $l) : '';
$this->buffer = $l > 0 ? fread($this->file, $l) : ''; $this->length = strlen($this->buffer);
$this->length = strlen($this->buffer); if ($this->length < $l)
if ($this->length < $l) $this->increase_length($l - $this->length);
$this->increase_length($l - $this->length); } else {
} else { $this->buffer = $this->file;
$this->buffer = $this->file; $this->length = strlen($this->buffer);
$this->length = strlen($this->buffer); }
} $this->offset = 0;
$this->offset = 0; $this->stack = array();
$this->stack = array(); }
}
// Make sure that there is at least one
// Make sure that there is at least one // character beyond the current offset in
// character beyond the current offset in // the buffer to prevent the tokenizer
// the buffer to prevent the tokenizer // from attempting to access data that does
// from attempting to access data that does // not exist
// not exist
function ensure_content() {
function ensure_content() { if ($this->offset >= $this->length - 1) {
if ($this->offset >= $this->length - 1) { return $this->increase_length();
return $this->increase_length(); } else {
} else { return true;
return true; }
} }
}
// 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 { $toRead = $totalLength - $this->length;
$this->buffer .= fread($this->file, $totalLength-$this->length); if ($toRead < 1)
} while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); break;
return true; $this->buffer .= fread($this->file, $toRead);
} else { } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
return false;
} return true;
} } else {
} return false;
} }
}
unset($__tmp); }
}

File diff suppressed because it is too large Load Diff

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");
@ -588,10 +588,10 @@ class pdf_einstein extends ModelePDFCommandes
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey > 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl=''; $tvacompl='';
if (preg_match('/\*/',$tvakey)) if (preg_match('/\*/',$tvakey))
{ {
@ -601,7 +601,7 @@ class pdf_einstein extends ModelePDFCommandes
$totalvat =$outputlangs->transnoentities("TotalVAT").' '; $totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
@ -611,10 +611,10 @@ class pdf_einstein extends ModelePDFCommandes
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
// Total LocalTax1 // Total LocalTax1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0) if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
{ {
@ -624,7 +624,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
} }
// Total LocalTax2 // Total LocalTax2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0) if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
{ {
@ -645,10 +645,10 @@ class pdf_einstein extends ModelePDFCommandes
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0
{ {
//$this->atleastoneratenotnull++; //$this->atleastoneratenotnull++;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl=''; $tvacompl='';
if (preg_match('/\*/',$tvakey)) if (preg_match('/\*/',$tvakey))
{ {
@ -658,13 +658,13 @@ class pdf_einstein extends ModelePDFCommandes
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; $totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
} }
} }
//Local tax 2 //Local tax 2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{ {
@ -673,10 +673,10 @@ class pdf_einstein extends ModelePDFCommandes
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0
{ {
//$this->atleastoneratenotnull++; //$this->atleastoneratenotnull++;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl=''; $tvacompl='';
if (preg_match('/\*/',$tvakey)) if (preg_match('/\*/',$tvakey))
{ {
@ -686,7 +686,7 @@ class pdf_einstein extends ModelePDFCommandes
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
@ -703,7 +703,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
} }

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");
@ -325,7 +325,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
function _pagehead(&$pdf, $object, $outputlangs) function _pagehead(&$pdf, $object, $outputlangs)
{ {
global $conf, $langs; global $conf, $langs;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
@ -384,9 +384,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true); //$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
// Add list of linked elements // Add list of linked elements
// TODO possibility to use with other elements (business module,...) // TODO possibility to use with other elements (business module,...)
//$object->load_object_linked(); //$object->load_object_linked();
$origin = $object->origin; $origin = $object->origin;
$origin_id = $object->origin_id; $origin_id = $object->origin_id;
@ -394,7 +394,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
if ($conf->$origin->enabled) if ($conf->$origin->enabled)
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
$classname = ucfirst($origin); $classname = ucfirst($origin);
$linkedobject = new $classname($this->db); $linkedobject = new $classname($this->db);
$result=$linkedobject->fetch($origin_id); $result=$linkedobject->fetch($origin_id);
@ -451,7 +451,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY($blSocX-80,$blSocY+23); $pdf->SetXY($blSocX-80,$blSocY+23);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
if (! empty($object->tracking_number)) if (! empty($object->tracking_number))
{ {
$object->GetUrlTrackingStatus($object->tracking_number); $object->GetUrlTrackingStatus($object->tracking_number);

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";
@ -65,7 +65,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
// Recupere emmetteur // Recupere emmetteur
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default if not defined if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default if not defined
// Defini position des colonnes // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxqtyordered=120; $this->posxqtyordered=120;
@ -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");
@ -159,11 +159,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$tab_top = 90; $tab_top = 90;
$tab_height = 170; $tab_height = 170;
if (! empty($object->note_public) || ! empty($object->tracking_number)) if (! empty($object->note_public) || ! empty($object->tracking_number))
{ {
$tab_top = 88; $tab_top = 88;
// Tracking number // Tracking number
if (! empty($object->tracking_number)) if (! empty($object->tracking_number))
{ {
@ -189,14 +189,14 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetXY ($this->posxdesc-1, $tab_top); $pdf->SetXY ($this->posxdesc-1, $tab_top);
$pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($object->note_public), 0, 'L'); $pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($object->note_public), 0, 'L');
} }
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$height_note=$nexY-$tab_top; $height_note=$nexY-$tab_top;
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192); $pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note; $tab_height = $tab_height - $height_note;
$tab_top = $nexY+6; $tab_top = $nexY+6;
} }
@ -204,7 +204,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
{ {
$height_note=0; $height_note=0;
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$nexY = $tab_top + 7; $nexY = $tab_top + 7;
@ -257,7 +257,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$this->error=$langs->transnoentities("ErrorUnknown"); $this->error=$langs->transnoentities("ErrorUnknown");
return 0; // Erreur par defaut return 0; // Erreur par defaut
} }
/** /**
* Build table * Build table
* @param pdf objet PDF * @param pdf objet PDF
@ -265,7 +265,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
{ {
global $conf; global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@ -280,11 +280,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetXY ($this->posxdesc-1, $tab_top+1); $pdf->SetXY ($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108, 2, $outputlangs->trans("Description"), '', 'L'); $pdf->MultiCell(108, 2, $outputlangs->trans("Description"), '', 'L');
$pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height); $pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxqtyordered-1, $tab_top+1); $pdf->SetXY ($this->posxqtyordered-1, $tab_top+1);
$pdf->MultiCell(40,2, $outputlangs->transnoentities("QtyOrdered"),'','C'); $pdf->MultiCell(40,2, $outputlangs->transnoentities("QtyOrdered"),'','C');
$pdf->line($this->posxqtytoship-1, $tab_top, $this->posxqtytoship-1, $tab_top + $tab_height); $pdf->line($this->posxqtytoship-1, $tab_top, $this->posxqtytoship-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxqtytoship-1, $tab_top+1); $pdf->SetXY ($this->posxqtytoship-1, $tab_top+1);
$pdf->MultiCell(40,2, $outputlangs->transnoentities("QtyToShip"),'','C'); $pdf->MultiCell(40,2, $outputlangs->transnoentities("QtyToShip"),'','C');
@ -405,7 +405,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
// Add list of linked orders // Add list of linked orders
// TODO possibility to use with other document (business module,...) // TODO possibility to use with other document (business module,...)
//$object->load_object_linked(); //$object->load_object_linked();
$origin = $object->origin; $origin = $object->origin;
$origin_id = $object->origin_id; $origin_id = $object->origin_id;
@ -413,7 +413,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
if ($conf->$origin->enabled) if ($conf->$origin->enabled)
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
$classname = ucfirst($origin); $classname = ucfirst($origin);
$linkedobject = new $classname($this->db); $linkedobject = new $classname($this->db);
$result=$linkedobject->fetch($origin_id); $result=$linkedobject->fetch($origin_id);
@ -430,7 +430,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"%d %b %Y",false,$outputlangs,true), 0, 'R'); $pdf->MultiCell(60, 2, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"%d %b %Y",false,$outputlangs,true), 0, 'R');
} }
} }
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties

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");
@ -667,7 +667,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$text=$this->emetteur->name; $text=$this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
$pdf->SetFont('','B',$default_font_size + 3); $pdf->SetFont('','B',$default_font_size + 3);
$pdf->SetXY(100,$posy); $pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);

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");