From: <ex...@us...> - 2016-07-08 10:08:48
|
Revision: 7568 http://sourceforge.net/p/web-erp/reponame/7568 Author: exsonqu Date: 2016-07-08 10:08:45 +0000 (Fri, 08 Jul 2016) Log Message: ----------- 08/07/16 Exson: Fixed the transaction atomicity failure bug by change table lock to row lock in SQL_CommonFunctions.inc. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/SQL_CommonFunctions.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-08 08:17:10 UTC (rev 7567) +++ trunk/doc/Change.log 2016-07-08 10:08:45 UTC (rev 7568) @@ -1,5 +1,6 @@ webERP Change Log +08/07/16 Exson: Fixed the transaction atomicity bug by change table lock to row lock in SQL_CommonFunctions.inc. 08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. 07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. 29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. Modified: trunk/includes/SQL_CommonFunctions.inc =================================================================== --- trunk/includes/SQL_CommonFunctions.inc 2016-07-08 08:17:10 UTC (rev 7567) +++ trunk/includes/SQL_CommonFunctions.inc 2016-07-08 10:08:45 UTC (rev 7568) @@ -16,25 +16,18 @@ etc * */ - - DB_query("LOCK TABLES systypes WRITE"); - - $SQL = "SELECT typeno FROM systypes WHERE typeid = '" . $TransType . "'"; - + DB_query("SELECT typeno FROM systypes WHERE typeid='" . $TransType ."' FOR UPDATE"); + $SQL = "UPDATE systypes SET typeno = typeno + 1 WHERE typeid = '" . $TransType . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The transaction number could not be incremented'); + $DbgMsg = _('The following SQL to increment the transaction number was used'); + $UpdTransNoResult = DB_query($SQL,$ErrMsg,$DbgMsg); + $SQL = "SELECT typeno FROM systypes WHERE typeid= '" . $TransType . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': <BR>' . _('The next transaction number could not be retrieved from the database because'); $DbgMsg = _('The following SQL to retrieve the transaction number was used'); $GetTransNoResult = DB_query($SQL,$ErrMsg,$DbgMsg); - $myrow = DB_fetch_row($GetTransNoResult); - - $SQL = "UPDATE systypes SET typeno = '" . ($myrow[0] + 1) . "' WHERE typeid = '" . $TransType . "'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The transaction number could not be incremented'); - $DbgMsg = _('The following SQL to increment the transaction number was used'); - $UpdTransNoResult = DB_query($SQL,$ErrMsg,$DbgMsg); - - DB_query("UNLOCK TABLES"); - - return $myrow[0] + 1; + return $myrow[0]; + } @@ -512,4 +505,4 @@ } //$myrow[0]>0 } -?> \ No newline at end of file +?> |