Kian Posted February 11, 2014 Share Posted February 11, 2014 (edited) Hi I think that i've found a bug in the official Fixed Invoice Data addon. I can see that the hook stores customfields 3 times in 3 different format and 2 different columns. 1. In mod_invoicedata.clientsdetails in string format 2. In mod_invoicedata.clientsdetails in array format [customfields1] => 111 [customfields] => Array ( [0] => Array ( [id] => 1 [value] => 111 ) [1] => Array ( [id] => 2 [value] => FFF ) [2] => Array ( [id] => 23 [value] => 444 ) ) [customfields2] => XXX [customfields3] => 444 3. In mod_invoicedata.customfields in array format Array ( [0] => Array ( [id] => 23 [fieldname] => Tax ID [value] => 444 ) ) There's also another bug. The hook should stores in mod_invoicedata only customfields with the option "Show on invoice" set tu true. In the examples above only customfields 23 (Tax ID) is marked as true. Customfields with ID 1, 2 and 3 seems to appear even if there're all "Admin Only" fields. Lastly it seems that there's also something strange with the IDs of customfields. I don't get the reason why WHMCS should store [customfields3] => 444. It's the customfield 23. To make it short customfields inside clientsdetails column in my opinion should be removed. p.s. I'm already fixing it by my side creating my own hook and removing yours. Edited February 11, 2014 by Kian Link to comment Share on other sites More sharing options...
nimonogi Posted February 11, 2014 Share Posted February 11, 2014 Can anyone from WHMCS confirm this bug? Link to comment Share on other sites More sharing options...
Kian Posted February 11, 2014 Author Share Posted February 11, 2014 Let me clear out that this bug (not confirmed yet anyway) does not affect any user because even if WHMCS saves 3 times customfields, only one set of them is used to fix data on invoices (mod_invoicedata.clientsdetails in string format). Said that, personally i have a problem with it. I'm developing a module named "Invoice Editor" that allows you to edit on the fly already fixed invoice data instead of openig PHPMyAdmin and play with serialize/unserialize. The problem in this case is that, while in "editing mode", you will find 2 useless set of data. Link to comment Share on other sites More sharing options...
Kian Posted February 11, 2014 Author Share Posted February 11, 2014 Ok got it. More than a bug is probably an unwanted result. Those customfields directly come from getclientdetails function. I wonder what's the point since there's a dedicated column in mod_invoicedata for customfields. I've rebuilded the hook so that i have clientsdetails inside mod_invoicedata.clientsdetails and customfields inside mod_invoicedata.customfields. I think that it's more logical to work with this. Link to comment Share on other sites More sharing options...
WHMCS Nate Posted February 11, 2014 Share Posted February 11, 2014 Kian, As you noted in your comments, this is a place that could be improved internally, but is not a bug per say. I opened case 4060 in this case so our development team could discuss it and look at possible ways to improve the extensibility. Thanks for the report, have a great day. Nate C Link to comment Share on other sites More sharing options...
WHMCS Nate Posted February 18, 2014 Share Posted February 18, 2014 Kian, In our triage meeting I reviewed this with the development team. The reason we save the information twice is to allow for access in the custom templates the enumerated arrays IDs or via the descriptive names. We have seen customers that use both methods and to make sure this addon works with both of them we record the information twice. As such we are not planning on changing the schema at this time. Have a great day. Nate C Link to comment Share on other sites More sharing options...
Recommended Posts