Topic: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

Version 2.4.7: Purchases - Direct Supplier Invoice, after filling out the form and clicking "Process Tax Invoice" nothing happens, after clicking "Process Tax Invoice" again it looks like it processes, however instead of saying "Direct Purchase Tax Invoice has been entered" on the next screen, it says "Purchase Order has been updated". The transaction is never actually processed. I backed up the SQL right there and restored it into 2.4.6 and it then works fine. This does not affect all product items, some of them process fine and some have this issue, in 2.4.6 all of them process fine.

2 (edited by poncho1234 07/06/2019 03:20:02 pm)

Re: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

@ZS6SHB How many characters did the item desc have for the failed purchase orders?

Turn on debug(level2) in config.php and report errors found

Same issue here, only happens where item desc is longer than 50 characters - see screenshot below: reported in mantis

Is this the  result of changing to STRICT_ALL_TABLES:-
File connect_db_mysql.inc & connect_db_mysqli.inc
Line 13

define('SQL_MODE', 'STRICT_ALL_TABLES'); // prevents SQL injection with silent field content truncation

Before:- although supplier description was var(50) it used to truncate longer item desc.
Now as is strict it rejects it

The solution is to change table purch_data `supplier_description` to tinytext, but you have a db change ban until 2.5?

Post's attachments

Entrada Factura Compra Directa.png 85.1 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.
The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

@joe: Can we not make the field take no more than the field size in the table definition?

4 (edited by poncho1234 07/06/2019 03:18:29 pm)

Re: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

@apmuthu and existing items?

Is an 'ALTER TABLE' really a db change as such? - it shouldn't affect existing data?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

Hello :-)

Thank you so much for your input.

What I did was to increase the char(50) to char(80) which covers the description characters for all items.

I installed a fresh copy of FA and had a look at the tables, they are char(50), making them char(80) fixed it.

I hope this wont cause any issues?

6 (edited by poncho1234 07/09/2019 07:02:02 pm)

Re: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

@apmuthu, @ joe

Based on:- This has been a problem for quite a while

You could assume that:-
Not many users have item desc >50 for purchasing. Those that do have not reported the issue, therefore there is a high likelihood that the purchase order is for internal use only.
So continuing to truncate the supplier_description in the purch_data table would still allow STRICT_ALL_TABLES to be used and most users would see no difference anyway. AND this is no different to what has been happening up to V2.4.6 so far.

So:-

File: \inventory\includes\db\items_purchases_db.inc
21:         .db_escape($supplier_description) . ")";

And

File: \inventory\includes\db\items_purchases_db.inc
32:         supplier_description=" . db_escape($supplier_description) . "

Could be changed to something like (Not tested):-

File: \inventory\includes\db\items_purchases_db.inc
21:         .db_escape(substr($supplier_description, 0, 50)) . ")";

And

File: \inventory\includes\db\items_purchases_db.inc
32:         supplier_description=" . db_escape(substr($supplier_description, 0, 50)) . "

Also two changes to function add_or_update_purchase_data in File: \purchasing\includes\purchasing_db.inc Lines 103 & 112

As stated code not tested, so please check.
It's certainly not the correct solution, but does delay db changes to V2.5

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Version 2.4.7: Purchases - Direct Supplier Invoice not processing

@poncho1234 - Thank you for all your efforts Sir :-)

I increased the 50 to 80 in the tables and that has fixed it, probably the simplest way however I have no idea if this was a bad idea especially later on down the line.

I looked around the SQL tables and find CHAR(200) all over, I assume the CHAR(50) could be in error? if not, then I would assume it is 50 for a some reason?

Anyway, for now it seems to all be working.

Kind Regards,
Steven Brewer