From: <te...@us...> - 2015-06-11 08:13:33
|
Revision: 7318 http://sourceforge.net/p/web-erp/reponame/7318 Author: tehonu Date: 2015-06-11 08:13:31 +0000 (Thu, 11 Jun 2015) Log Message: ----------- Set the DB-Txn_begin() at correct place to take care of all the items in the Transfer and simplify redundant code conditions Modified Paths: -------------- trunk/StockLocTransferReceive.php Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2015-06-05 03:28:26 UTC (rev 7317) +++ trunk/StockLocTransferReceive.php 2015-06-11 08:13:31 UTC (rev 7318) @@ -64,9 +64,10 @@ if(!$InputError) { /*All inputs must be sensible so make the stock movement records and update the locations stocks */ + $Result = DB_Txn_Begin(); // The Txn should affect the full transfer + foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) { - if($TrfLine->Quantity >=0) { - $Result = DB_Txn_Begin(); + if($TrfLine->Quantity >0) { /* Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT locstock.quantity @@ -197,10 +198,8 @@ $QtyOnHandPrior = 0; } -// COMMENT: "if($TrfLine->Quantity !=0) {}" should be as a general condition to avoid transactions in zero. - // Insert outgoing inventory GL transaction if any of the locations has a GL account code: - if(($_SESSION['Transfer']->StockLocationFromAccount !='' or $_SESSION['Transfer']->StockLocationToAccount !='') and $TrfLine->Quantity !=0) { + if(($_SESSION['Transfer']->StockLocationFromAccount !='' or $_SESSION['Transfer']->StockLocationToAccount !='')) { // Get the account code: if($_SESSION['Transfer']->StockLocationFromAccount !='') { $AccountCode = $_SESSION['Transfer']->StockLocationFromAccount; @@ -353,7 +352,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); // Insert incoming inventory GL transaction if any of the locations has a GL account code: - if(($_SESSION['Transfer']->StockLocationFromAccount !='' or $_SESSION['Transfer']->StockLocationToAccount !='') and $TrfLine->Quantity !=0) { + if(($_SESSION['Transfer']->StockLocationFromAccount !='' or $_SESSION['Transfer']->StockLocationToAccount !='')) { // Get the account code: if($_SESSION['Transfer']->StockLocationToAccount !='') { $AccountCode = $_SESSION['Transfer']->StockLocationToAccount; |