webERP Forum

Full Version: Error changing category in Stocks.php (v 4.06.6)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi:
Attempting to change the stock category for one item gave us the following error:

Database Error : The stock cost journal could not be inserted because
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 14
Database SQL Failure : The SQL that was used to create the stock cost journal and failed was
INSERT INTO gltrans (type, typeno, trandate, periodno, account, narrative, amount) VALUES ( 0, '925', '2012-01-30', '34', '', 'BSPE12 Change stock category', '0'

Even if the error was displayed, It DID change the stock category.

Stock category has all GL accounts properly set, so I can't understand why the SQL insert has an empty account.

NO record was inserted to gltrans table.
Would be worth checking that the old category and the new category have the same GL stock account - this journal is meant to keep the stock value in the GL the same as the the category GL report. Overall it would not be a biggie as all the stock accounts combined should be ok.

I will try to knock over this, the price issue and the PO lines issue this weekend.
I fixed missing ')' in insert SQLs not too long ago. There were many of them in this file.
On line 418 of Stocks.php

'" . $NewStockAccount . "'

should be:

'" . $NewStockAct . "'

will apply to svn later

Ricard, you may well have an out of balance TB as a result of this... check Z_index.php for out of balance GL trans - you will need to either delete the one legged entry and repost or add the other leg and repost.
Thanks Phil: I checked gltrans just after the error and no records were added to gltrans, so should be OK.