Hello,
Here is my configuration : Joomla 2.5.16, Template Shop and Buy, Virtuemart 2.0.26 last version.
Installed the last tcpdf library.
I've the following message when I try to generate an invoice from an order : "Fatal error: Call to undefined method VmVendorPDF::convertHTMLColorToDec() in /.../components/com_virtuemart/helpers/vmpdf.php on line 112"
I found some forum posted answers but nothing really to explain a solution.
Somebody has an explanation?
Thanks for your help.
seb
sorry no clue
It appears that the TCPDF developers thought it was a good idea to change their API and factor some functions out of the TCPDF class into some dedicated helper classes (TCPDF_COLOR in this case)...
http://www.tcpdf.org/doc/code/classTCPDF__COLORS.html#a6fe7c8360e8226aea52fd44068f1b6b9
The changelog on the TCPDF homepage says:
6.0.000 (2013-03-17)
- IMPORTANT: PHP4 support has been removed starting from this version.
- Several TCPDF methods and vars were moved to new class files: tcpdf_static.php, tcpdf_colors.php, tcpdf_images.php, tcpdf_font_data.php, tcpdf_fonts.php.
- Files htmlcolors.php, spotcolors.php, unicode_data.php and ecodings_maps.php were removed.
So, you can either use a TCPDF version <6.0 with VirtueMart, or you can install the latest TCPDF version, but need to modify that line 112 of vmpdf.php to use the TCPDF_COLORS::convertHTMLColorToDec function instead of $this->convertHTMLColorToDec.
Unfortunately, VirtueMart cannot be changed to support versions <6.0 and versions >6.0 of TCPDF at the same time... (did I mention that I hate API changes...)
Reinhold
But we can use for vm2.2 the new API, right?
Sure, we can update our included copy of TCPDF to a version >=6.0.
I have, however, not tried it out at all. I just searched for that function that triggered the error and found that they have a new release... Maybe there are more API-incompatibilities.
Also, in VM we have to make sure somehow that our included copy is preferred over any joomla-wide installed copy. AFAIK, some other extensions also ship their own copy of TCPDF, so the wrong version (from a different extension) might be loaded in that case... But that's the same problem whether we upgrade to version 6.0 or not.
Somehow reminds me of Windows DLL hell.
Reinhold
Will this issue be solved in an upcoming release?
Right now I just diabled PDf invoicing but this is not a real solution.
Quote from: reinhold on December 26, 2013, 22:08:30 PM
So, you can either use a TCPDF version <6.0 with VirtueMart, or you can install the latest TCPDF version, but need to modify that line 112 of vmpdf.php to use the TCPDF_COLORS::convertHTMLColorToDec function instead of $this->convertHTMLColorToDec.
Unfortunately, VirtueMart cannot be changed to support versions <6.0 and versions >6.0 of TCPDF at the same time... (did I mention that I hate API changes...)
Reinhold
Why not using a check, if the new file is there, if the file is there use TCPDF_COLORS::, else $this->
I do not know what to check and when you make changes to core Virtuemart files you'll have to check this with every update?
No chaldama, i mean a check, which I write one time in it, so that people like you dont have to care about.
I feel really stupid but I just don't understand what I should do to solve this issue permanently.
Try this file in \components\com_virtuemart\helpers, replace the vmpdf.php
just for people intersted, the code
$tcpdf6 = JFile::exists(JPATH_VM_LIBRARIES.DS.'tcpdf'.DS.'include'.DS.'tcpdf_color.php');
if($tcpdf6){
$vlfooterlcolor = TCPDF_COLORS::convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color);
} else {
$vlfooterlcolor = $this->convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color);
}
$this->setHeaderData(($this->vendor->vendor_letter_header_image?$this->vendorImage:''),
($this->vendor->vendor_letter_header_image?$this->vendor->vendor_letter_header_imagesize:0),
'', $this->vendor->vendor_letter_header_html, array(0,0,0),$vlfooterlcolor );
[attachment cleanup by admin]