webERP Forum
SQL bug in Item Maintenance re. stock category - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (http://www.weberp.org/forum/forumdisplay.php?fid=8)
+--- Thread: SQL bug in Item Maintenance re. stock category (/showthread.php?tid=1013)



SQL bug in Item Maintenance re. stock category - tomglare - 09-03-2013

Have found that changing stock category causes an SQL error due to the syntax of the inserts into
gltrans - the generated SQL is missing the closing parenthesis, has quotes around numeric columns, and has a mis-spelt variable ($NewStockAccount - should be $NewStockAct). My corrected version is as follows (the other 3 gltrans inserts are modified similarly) :

$SQL = "INSERT INTO gltrans (type,
typeno,
trandate,
periodno,
account,
narrative,
amount)
VALUES ( 0,
" . $JournalNo . ",
'" . Date('Y-m-d') . "',
" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . ",
" . $NewStockAct . ",
'" . $StockID . ' ' . _('Change stock category') . "',
" . ($UnitCost* $StockQtyRow[0]) . ")";

As an aside, I always use "heredoc" syntax for statements like this, as it makes it so much easier
to embed quotes. Hope this helps.


RE: SQL bug in Item Maintenance re. stock category - phil - 09-04-2013

Thanks tomglare - looks like this is already fixed in the latest code.


RE: SQL bug in Item Maintenance re. stock category - fernando_stm - 09-04-2013

(09-04-2013, 06:47 AM)phil Wrote: Thanks tomglare - looks like this is already fixed in the latest code.

Good afternoon,
Thanks for sending information about my problem. This is to prevent these errors, but once you have entered the information, as I do to correct the huge variations in Balance Sheet?. Would you please indicate which table stores individual transactions account.

Beforehand grateful.
Note: I deleted manually via phpmyadmin wrong income, but my mind over and Adjustment Inventory Inventory remains with billions of difference.



RE: SQL bug in Item Maintenance re. stock category - phil - 09-04-2013

Did you post to the correct thread here?
It sounds as though you have incorrect set up of GL accounts - I'd say you really need some professional support and your issues are not specific enough to be able to diagnose on the forum.
Don't be frightened to ask for paid support if you need someone to login and spend an hour sorting out a problem for you there is a list of support people at - this is a good way to give back to the people who make this software possible for everyone.
http://www.weberp.org/Support.html

You can delete general ledger transactions from the gltrans table and rerun the posting from Z_RePostGLFromPeriod.php However, you will end up with inconsistent transactions elsewhere and stock movements orphaned etc - ongoing problems will recurr. Deleting gltrans really needs professional support or deep knowledge of the system