Fix: Restore compatibility with FPDF.
This commit is contained in:
parent
9d17b8f96c
commit
624c0fa040
@ -34,16 +34,6 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
|
||||
</IfModule>
|
||||
|
||||
|
||||
# OPTIMIZE: To use gzip compressed files (for Dolibarr already compressed files).
|
||||
# Note that constant MAIN_OPTIMIZE_SPEED must have a value with bit 0 set.
|
||||
#AddType text/javascript .jgz
|
||||
#AddEncoding gzip .jgz
|
||||
|
||||
# OPTIMIZE: To use gzip compression (on the fly).
|
||||
# Note that you must also enable the module mod_deflate.
|
||||
# You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set.
|
||||
#TODO
|
||||
|
||||
# OPTIMIZE: To use cache on static pages (A259200 = 1 month).
|
||||
# Note that you must also enable the module mod_expires.
|
||||
#ExpiresActive On
|
||||
|
||||
@ -161,12 +161,11 @@ $dolibarr_main_authentication='dolibarr';
|
||||
# $dolibarr_main_auth_ldap_filter = ''; # If defined, two previous parameters are not used to find a user into LDAP. Ex: (uid=%1%) or &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com).
|
||||
# $dolibarr_main_auth_ldap_admin_login=''; # Required only if anonymous bind disabled. Ex: cn=admin,dc=example,dc=com
|
||||
# $dolibarr_main_auth_ldap_admin_pass=''; # Required only if anonymous bind disabled. Ex: secret
|
||||
|
||||
# $dolibarr_main_auth_ldap_debug='false';
|
||||
|
||||
|
||||
# dolibarr_main_demo
|
||||
# Login and pass to use in a demo mode
|
||||
# Login and pass to use in a demo mode.
|
||||
# Default value: ''
|
||||
# Examples:
|
||||
# $dolibarr_main_demo='autologin,autopass'
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
Package: dolibarr
|
||||
Version: __VERSION__
|
||||
Architecture: all
|
||||
Maintainer: Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
Installed-Size: 61200
|
||||
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
||||
php5-mysql | php5-mysqli,
|
||||
php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip,
|
||||
libphp-adodb,
|
||||
libnusoap-php,
|
||||
libphp-pclzip,
|
||||
libjs-jquery, libjs-jquery-ui, ckeditor,
|
||||
ttf-dejavu-core,
|
||||
xdg-utils,
|
||||
mysql-server
|
||||
Section: web
|
||||
Priority: optional
|
||||
Homepage: http://www.dolibarr.org
|
||||
Description: Web based software to manage a small company or foundation
|
||||
Dolibarr ERP & CRM is an easy to use open source/free software for small
|
||||
and medium companies, foundations or freelances. It includes different
|
||||
features for Enterprise Resource Planning (ERP) and Customer Relationship
|
||||
Management (CRM) but also for different other activities.
|
||||
It's a web software you can install as a standalone program or on any web
|
||||
hosting provider to use it from anywhere with any web browser.
|
||||
.
|
||||
Dolibarr was designed to be easy to use. Only features you need are
|
||||
visible, depending on which module were activated.
|
||||
Most common used modules are:
|
||||
.
|
||||
Customers, Suppliers or Prospects directory,
|
||||
Contacts directory,
|
||||
Orders management,
|
||||
Commercial proposals management,
|
||||
Invoices management,
|
||||
Products and services catalog,
|
||||
Stock management,
|
||||
Foundations members management,
|
||||
Bank accounts management,
|
||||
Point of Sale,
|
||||
Payments management,
|
||||
Commercial actions management,
|
||||
Contracts management,
|
||||
Standing orders management,
|
||||
Shipping management,
|
||||
Donations management,
|
||||
Bookmarks management,
|
||||
Mass Emailings,
|
||||
Reports,
|
||||
Wizards to export and import data,
|
||||
LDAP connectivity,
|
||||
PDF exports,
|
||||
And a lot of more modules...
|
||||
.
|
||||
You can also add third parties external modules or develop yours.
|
||||
@ -29,13 +29,14 @@ $force_install_lockinstall='444';
|
||||
// If we enable/disable libraries declaration during install, we must also check they are
|
||||
// not removed from package (see in rules file),
|
||||
// declared into dependencies (see in control file)
|
||||
$force_dolibarr_lib_TCPDF_PATH='';
|
||||
$force_dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf';
|
||||
$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
|
||||
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
|
||||
//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
|
||||
$force_dolibarr_lib_GEOIP_PATH='';
|
||||
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
|
||||
$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
|
||||
$force_dolibarr_lib_PHPEXCEL_PATH='';
|
||||
$force_dolibarr_lib_TCPDF_PATH='';
|
||||
$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
|
||||
$force_dolibarr_js_JQUERY='/javascript/jquery';
|
||||
$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
|
||||
|
||||
@ -80,8 +80,10 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
||||
if (! empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->MAIN_DISABLE_FPDI))
|
||||
return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together";
|
||||
|
||||
// We use by default TCPDF
|
||||
// We use by default TCPDF else FPDF
|
||||
if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php';
|
||||
else require_once FPDF_PATH.'fpdf.php';
|
||||
|
||||
// We need to instantiate fpdi object (instead of tcpdf) to use merging features. But we can disable it.
|
||||
if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php';
|
||||
|
||||
@ -90,7 +92,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
||||
//$metric=$arrayformat['unit'];
|
||||
|
||||
// Protection et encryption du pdf
|
||||
if (! empty($conf->global->PDF_SECURITY_ENCRYPTION))
|
||||
if (empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->PDF_SECURITY_ENCRYPTION))
|
||||
{
|
||||
/* Permission supported by TCPDF
|
||||
- print : Print the document;
|
||||
@ -103,20 +105,11 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
||||
- 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 (! empty($conf->global->MAIN_USE_FPDF))
|
||||
{
|
||||
require_once FPDI_PATH.'fpdi_protection.php';
|
||||
$pdf = new FPDI_Protection($pagetype,$metric,$format);
|
||||
// For FPDF, we specify permission we want to open
|
||||
$pdfrights = array('print');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
||||
else $pdf = new TCPDF($pagetype,$metric,$format);
|
||||
// For TCPDF, we specify permission we want to block
|
||||
$pdfrights = array('modify','copy');
|
||||
}
|
||||
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
||||
else $pdf = new TCPDF($pagetype,$metric,$format);
|
||||
// For TCPDF, we specify permission we want to block
|
||||
$pdfrights = array('modify','copy');
|
||||
|
||||
$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);
|
||||
@ -126,9 +119,43 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
||||
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
||||
else $pdf = new TCPDF($pagetype,$metric,$format);
|
||||
}
|
||||
|
||||
// If we use FPDF class, we may need to add method writeHTMLCell
|
||||
if (! empty($conf->global->MAIN_USE_FPDF) && ! method_exists($pdf, 'writeHTMLCell'))
|
||||
{
|
||||
// Declare here a class to overwrite FPDFI to add method writeHTMLCell
|
||||
/**
|
||||
* This class if a enhanced FPDI class that support method writeHTMLCell
|
||||
*/
|
||||
class FPDI_DolExtended extends FPDI
|
||||
{
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if (isset($this->$method)) {
|
||||
$func = $this->$method;
|
||||
$func($args);
|
||||
}
|
||||
}
|
||||
|
||||
public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true)
|
||||
{
|
||||
$this->SetXY($x,$y);
|
||||
$val=str_replace('<br>',"\n",$html);
|
||||
$val=dol_string_nohtmltag($val,false,'ISO-8859-1');
|
||||
//print 'eee'.$val;exit;
|
||||
$this->MultiCell($w,$h,$val,$border,$align,$fill);
|
||||
}
|
||||
}
|
||||
|
||||
$pdf2=new FPDI_DolExtended($pagetype,$metric,$format);
|
||||
unset($pdf);
|
||||
$pdf=$pdf2;
|
||||
}
|
||||
|
||||
return $pdf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return font name to use for PDF generation
|
||||
*
|
||||
@ -722,8 +749,9 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
|
||||
{
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
|
||||
//print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
|
||||
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
|
||||
if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
|
||||
else $pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
}
|
||||
|
||||
return $marginwithfooter;
|
||||
|
||||
@ -207,6 +207,7 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
|
||||
// Path to root libraries
|
||||
if (! defined('ADODB_PATH')) { define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH))?DOL_DOCUMENT_ROOT.'/includes/adodbtime/':(empty($dolibarr_lib_ADODB_PATH)?'':$dolibarr_lib_ADODB_PATH.'/')); }
|
||||
if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', (!isset($dolibarr_lib_TCPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/tcpdf/':(empty($dolibarr_lib_TCPDF_PATH)?'':$dolibarr_lib_TCPDF_PATH.'/')); }
|
||||
if (! defined('FPDF_PATH')) { define('FPDF_PATH', (!isset($dolibarr_lib_FPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdf/':(empty($dolibarr_lib_FPDF_PATH)?'':$dolibarr_lib_FPDF_PATH.'/')); } // Used only for package that can't include tcpdf
|
||||
if (! defined('FPDI_PATH')) { define('FPDI_PATH', (!isset($dolibarr_lib_FPDI_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdfi/':(empty($dolibarr_lib_FPDI_PATH)?'':$dolibarr_lib_FPDI_PATH.'/')); }
|
||||
if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH))?DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/':(empty($dolibarr_lib_NUSOAP_PATH)?'':$dolibarr_lib_NUSOAP_PATH.'/')); }
|
||||
if (! defined('PHPEXCEL_PATH')) { define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH))?DOL_DOCUMENT_ROOT.'/includes/phpexcel/':(empty($dolibarr_lib_PHPEXCEL_PATH)?'':$dolibarr_lib_PHPEXCEL_PATH.'/')); }
|
||||
|
||||
@ -874,6 +874,15 @@ function write_conf_file($conffile)
|
||||
|
||||
// Write params to overwrites default lib path
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_TCPDF_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_TCPDF_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_FPDF_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_FPDF_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_FPDI_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_FPDI_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_ADODB_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_ADODB_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_ADODB_PATH=\''.$force_dolibarr_lib_ADODB_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
@ -883,9 +892,6 @@ function write_conf_file($conffile)
|
||||
if (empty($force_dolibarr_lib_NUSOAP_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_NUSOAP_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_FPDI_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_FPDI_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_PHPEXCEL_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_PHPEXCEL_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_PHPEXCEL_PATH=\''.$force_dolibarr_lib_PHPEXCEL_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
@ -895,9 +901,6 @@ function write_conf_file($conffile)
|
||||
if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) { fputs($fp, '//'); $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP=''; }
|
||||
fputs($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_lib_TCPDF_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_TCPDF_PATH=''; }
|
||||
fputs($fp, '$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.'\';');
|
||||
fputs($fp,"\n");
|
||||
if (empty($force_dolibarr_js_CKEDITOR)) { fputs($fp, '//'); $force_dolibarr_js_CKEDITOR=''; }
|
||||
fputs($fp, '$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.'\';');
|
||||
fputs($fp,"\n");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user