Fix: Mutualize pdf code to fix TCPDF compatibility errors in one change.
This commit is contained in:
parent
2a5a1b316a
commit
4e53e95aa0
@ -29,7 +29,7 @@ if (defined('DOL_URL_ROOT')) define ("K_PATH_URL_CACHE", DOL_URL_ROOT."/document
|
|||||||
/* End DOLCHANGE Added by Regis */
|
/* End DOLCHANGE Added by Regis */
|
||||||
|
|
||||||
// DOLCHANGE LDR
|
// DOLCHANGE LDR
|
||||||
if (empty($conf->global->MAIN_USE_TCPDF)) require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdf/fpdf.php');
|
if (! empty($conf->global->MAIN_USE_FPDF)) require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdf/fpdf.php');
|
||||||
else require_once(DOL_DOCUMENT_ROOT.'/includes/tcpdf/tcpdf.php');
|
else require_once(DOL_DOCUMENT_ROOT.'/includes/tcpdf/tcpdf.php');
|
||||||
//require_once(DOL_DOCUMENT_ROOT.'/includes/tcpdf/tcpdf.php');
|
//require_once(DOL_DOCUMENT_ROOT.'/includes/tcpdf/tcpdf.php');
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,7 @@ class CommActionRapport
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -118,6 +118,8 @@ class CommActionRapport
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -114,18 +114,20 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
|
|||||||
$_file = $dir . "/bordereau-".$number.".pdf";
|
$_file = $dir . "/bordereau-".$number.".pdf";
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf = new FPDI_Protection('P','mm','A4');
|
$pdf = new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||||
$pdfownerpass = NULL; // Mot de passe du propri<EFBFBD>taire, cr<63><72> al<61>atoirement si pas d<>fini
|
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
||||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class pdf_edison extends ModelePDFCommandes
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -146,6 +146,8 @@ class pdf_edison extends ModelePDFCommandes
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -155,7 +155,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
$nblignes = sizeof($object->lines);
|
$nblignes = sizeof($object->lines);
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -167,6 +167,8 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -142,7 +142,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('l','mm',$this->format);
|
$pdf=new FPDI_Protection('l','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -154,6 +154,8 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('l','mm',$this->format);
|
$pdf=new FPDI('l','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format,'mm','l');
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -263,7 +263,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -275,6 +275,8 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -159,10 +159,12 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$nblignes = sizeof($object->lines);
|
$nblignes = sizeof($object->lines);
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
if ($conf->global->MAIN_USE_FPDF) $pdf = new FPDI_Protection('P','mm',$this->format);
|
||||||
|
else $pdf = new FPDI('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
|
if (empty($conf->global->MAIN_USE_FPDF)) $pdfrights[]='assemble';
|
||||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||||
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
||||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||||
@ -170,8 +172,9 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
//$pdf=new TCPDF('P','mm','A4');
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -155,7 +155,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -167,6 +167,8 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -139,6 +139,8 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -117,7 +117,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -129,6 +129,8 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -152,6 +152,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -399,7 +399,7 @@ class pdf_standard {
|
|||||||
|
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P',$this->Tformat['metric'],$this->format);
|
$pdf=new FPDI_Protection('P',$this->Tformat['metric'],$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -411,6 +411,8 @@ class pdf_standard {
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P',$this->Tformat['metric'],$this->format);
|
$pdf=new FPDI('P',$this->Tformat['metric'],$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -378,7 +378,7 @@ class pdf_standardlabel {
|
|||||||
|
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P',$this->Tformat['metric'],$this->format);
|
$pdf=new FPDI_Protection('P',$this->Tformat['metric'],$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -390,6 +390,8 @@ class pdf_standardlabel {
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P',$this->Tformat['metric'],$this->format);
|
$pdf=new FPDI('P',$this->Tformat['metric'],$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -124,7 +124,7 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -136,6 +136,8 @@ class pdf_baleine extends ModelePDFProjects
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -155,7 +155,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$nblignes = sizeof($object->lines);
|
$nblignes = sizeof($object->lines);
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -167,6 +167,8 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,7 +128,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -140,6 +140,8 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -104,9 +104,10 @@ class pdf_paiement
|
|||||||
$file = $dir . "/payments-".$year."-".$month.".pdf";
|
$file = $dir . "/payments-".$year."-".$month.".pdf";
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf = new FPDI_Protection('P','mm','A4');
|
if ($conf->global->MAIN_USE_FPDF) $pdf = new FPDI_Protection('P','mm',$this->format);
|
||||||
|
else $pdf = new FPDI('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||||
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
||||||
@ -116,6 +117,8 @@ class pdf_paiement
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
@ -237,7 +240,7 @@ class pdf_paiement
|
|||||||
$pdf->SetXY(10,10);
|
$pdf->SetXY(10,10);
|
||||||
$pdf->MultiCell(200, 2, $title, 0, 'C');
|
$pdf->MultiCell(200, 2, $title, 0, 'C');
|
||||||
|
|
||||||
$pdf->SetFont('','',12);
|
$pdf->SetFont('','',10);
|
||||||
|
|
||||||
$pdf->SetXY (11, 16);
|
$pdf->SetXY (11, 16);
|
||||||
$pdf->MultiCell(80, 2, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true), 0, 'L');
|
$pdf->MultiCell(80, 2, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true), 0, 'L');
|
||||||
@ -247,24 +250,23 @@ class pdf_paiement
|
|||||||
|
|
||||||
// Title line
|
// Title line
|
||||||
|
|
||||||
$pdf->SetXY (11, $this->tab_top+1);
|
$pdf->SetXY (11, $this->tab_top+2);
|
||||||
$pdf->MultiCell(30, 2, 'Date');
|
$pdf->MultiCell(30, 2, 'Date');
|
||||||
|
|
||||||
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
|
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
|
||||||
$pdf->SetXY (42, $this->tab_top+1);
|
$pdf->SetXY (42, $this->tab_top+2);
|
||||||
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L');
|
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L');
|
||||||
|
|
||||||
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
|
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
|
||||||
$pdf->SetXY (82, $this->tab_top+1);
|
$pdf->SetXY (82, $this->tab_top+2);
|
||||||
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("Invoice"), 0, 'L');
|
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("Invoice"), 0, 'L');
|
||||||
|
|
||||||
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
|
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
|
||||||
$pdf->SetXY (122, $this->tab_top+1);
|
$pdf->SetXY (122, $this->tab_top+2);
|
||||||
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'L');
|
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'L');
|
||||||
|
|
||||||
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
|
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
|
||||||
|
$pdf->SetXY (162, $this->tab_top+2);
|
||||||
$pdf->SetXY (162, $this->tab_top+1);
|
|
||||||
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'L');
|
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'L');
|
||||||
|
|
||||||
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
|
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
|
||||||
|
|||||||
@ -144,7 +144,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
$nblignes = sizeof($object->lines);
|
$nblignes = sizeof($object->lines);
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -156,6 +156,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -145,7 +145,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||||||
$nblignes = sizeof($object->lines);
|
$nblignes = sizeof($object->lines);
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
/* if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
@ -157,6 +157,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||||||
{
|
{
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
$pdf=pdf_getInstance($this->format);
|
||||||
|
|
||||||
if (class_exists('TCPDF'))
|
if (class_exists('TCPDF'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,6 +29,46 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a PDF instance object. We create a FPDI instance that instanciate TCPDF (or FPDF if MAIN_USE_FPDF is on)
|
||||||
|
* @param format Array(width,height)
|
||||||
|
* @param metric Unit of format ('mm')
|
||||||
|
* @param pagetype 'P' or 'l'
|
||||||
|
* @return PDF object
|
||||||
|
*/
|
||||||
|
function pdf_getInstance($format,$metric='mm',$pagetype='P')
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
// Protection et encryption du pdf
|
||||||
|
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
|
{
|
||||||
|
/* Permission supported by TCPDF
|
||||||
|
- print : Print the document;
|
||||||
|
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
|
||||||
|
- copy : Copy or otherwise extract text and graphics from the document;
|
||||||
|
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
|
||||||
|
- fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
|
||||||
|
- extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
|
||||||
|
- assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
|
||||||
|
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
|
||||||
|
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
|
||||||
|
*/
|
||||||
|
if ($conf->global->MAIN_USE_FPDF) $pdf = new FPDI_Protection($pagetype,$metric,$format);
|
||||||
|
else $pdf = new FPDI($pagetype,$metric,$format);
|
||||||
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
|
if (empty($conf->global->MAIN_USE_FPDF)) $pdfrights[]='assemble';
|
||||||
|
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||||
|
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
||||||
|
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pdf=new FPDI($pagetype,$metric,$format);
|
||||||
|
}
|
||||||
|
return $pdf;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return font name to use for PDF generation
|
* Return font name to use for PDF generation
|
||||||
* @param outputlangs Output langs object
|
* @param outputlangs Output langs object
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user