Commit b737242f authored by jcnventura's avatar jcnventura

Remove status report error for older versions of TCPDF (5.9.001<5.9.012).

parent 5ed4152a
...@@ -169,7 +169,7 @@ function print_pdf_requirements($phase) { ...@@ -169,7 +169,7 @@ function print_pdf_requirements($phase) {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT); $print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
if (empty($print_pdf_pdf_tool)) { if (empty($print_pdf_pdf_tool)) {
$requirements['print_pdf_tool'] = array( $requirements['print_pdf_tool'] = array(
'title' => $t('PDF generation library'), 'title' => $t('Printer, email and PDF versions - PDF generation library'),
'value' => $t('No PDF tool selected'), 'value' => $t('No PDF tool selected'),
'description' => $t('Please configure it in the <a href="@url">PDF settings page</a>.', array('@url' => url('admin/config/user-interface/print/pdf'))), 'description' => $t('Please configure it in the <a href="@url">PDF settings page</a>.', array('@url' => url('admin/config/user-interface/print/pdf'))),
'severity' => REQUIREMENT_ERROR, 'severity' => REQUIREMENT_ERROR,
...@@ -178,7 +178,7 @@ function print_pdf_requirements($phase) { ...@@ -178,7 +178,7 @@ function print_pdf_requirements($phase) {
else { else {
if (!is_file($print_pdf_pdf_tool) || !is_readable($print_pdf_pdf_tool)) { if (!is_file($print_pdf_pdf_tool) || !is_readable($print_pdf_pdf_tool)) {
$requirements['print_pdf_tool'] = array( $requirements['print_pdf_tool'] = array(
'title' => $t('PDF generation tool'), 'title' => $t('Printer, email and PDF versions - PDF generation library'),
'value' => $t('File not found'), 'value' => $t('File not found'),
'description' => $t('The currently selected PDF generation library (%file) is no longer accessible.', array('%file' => $print_pdf_pdf_tool)), 'description' => $t('The currently selected PDF generation library (%file) is no longer accessible.', array('%file' => $print_pdf_pdf_tool)),
'severity' => REQUIREMENT_ERROR, 'severity' => REQUIREMENT_ERROR,
...@@ -198,14 +198,20 @@ function print_pdf_requirements($phase) { ...@@ -198,14 +198,20 @@ function print_pdf_requirements($phase) {
elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') { elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') {
$version = _print_pdf_tcpdf_version(); $version = _print_pdf_tcpdf_version();
if (version_compare($version, '5.9.012', '<')) { if (version_compare($version, '5.9.001', '<')) {
$requirements['print_pdf_tool'] = array( $requirements['print_pdf_tool'] = array(
'title' => $t('TCPDF library'), 'title' => $t('Printer, email and PDF versions - PDF generation library'),
'value' => $t('Unsupported version'), 'value' => $t('Unsupported TCPDF version'),
'description' => $t('The currently selected version of TCPDF (@version) is not supported. Please update to a <a href="@url">newer version</a>.', array('@version' => $version, '@url' => url('http://www.tcpdf.org'))), 'description' => $t('The currently selected version of TCPDF (@version) is not supported. Please update to a <a href="@url">newer version</a>.', array('@version' => $version, '@url' => url('http://sourceforge.net/projects/tcpdf/files/latest'))),
'severity' => REQUIREMENT_ERROR, 'severity' => REQUIREMENT_ERROR,
); );
} }
else {
$requirements['print_pdf_tool'] = array(
'title' => $t('Printer, email and PDF versions - PDF generation library'),
'value' => $t('TCPDF') . ' ' . $version,
);
}
foreach (array('cache', 'images') as $dir) { foreach (array('cache', 'images') as $dir) {
$directory = dirname($print_pdf_pdf_tool) . '/' . $dir; $directory = dirname($print_pdf_pdf_tool) . '/' . $dir;
...@@ -232,12 +238,18 @@ function print_pdf_requirements($phase) { ...@@ -232,12 +238,18 @@ function print_pdf_requirements($phase) {
$version = _print_pdf_wkhtmltopdf_version(); $version = _print_pdf_wkhtmltopdf_version();
if (version_compare($version, '0.9.6', '<')) { if (version_compare($version, '0.9.6', '<')) {
$requirements['print_pdf_tool'] = array( $requirements['print_pdf_tool'] = array(
'title' => $t('wkhtmltopdf library'), 'title' => $t('Printer, email and PDF versions - PDF generation library'),
'value' => $t('Unsupported version'), 'value' => $t('Unsupported wkhtmltopdf version'),
'description' => $t('The currently selected version of wkhtmltopdf (@version) is not supported. Please update to a <a href="@url">newer version</a>.', array('@version' => $version, '@url' => url('http://code.google.com/p/wkhtmltopdf/'))), 'description' => $t('The currently selected version of wkhtmltopdf (@version) is not supported. Please update to a <a href="@url">newer version</a>.', array('@version' => $version, '@url' => url('http://code.google.com/p/wkhtmltopdf/'))),
'severity' => REQUIREMENT_ERROR, 'severity' => REQUIREMENT_ERROR,
); );
} }
else {
$requirements['print_pdf_tool'] = array(
'title' => $t('Printer, email and PDF versions - PDF generation library'),
'value' => $t('wkhtmltopdf') . ' ' . $version,
);
}
} }
} }
} }
...@@ -632,6 +644,11 @@ function _print_pdf_tcpdf_version() { ...@@ -632,6 +644,11 @@ function _print_pdf_tcpdf_version() {
if (method_exists($pdf, 'getTCPDFVersion')) { if (method_exists($pdf, 'getTCPDFVersion')) {
return $pdf->getTCPDFVersion(); return $pdf->getTCPDFVersion();
} }
elseif (defined('PDF_PRODUCER')) {
sscanf(PDF_PRODUCER, "TCPDF %s", $version);
return $version;
}
else { else {
return 'unknown'; return 'unknown';
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment