Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQL bug in Item Maintenance re. stock category
09-03-2013, 11:01 PM
Post: #1
SQL bug in Item Maintenance re. stock category
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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
SQL bug in Item Maintenance re. stock category - tomglare - 09-03-2013 11:01 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)