From: <dai...@us...> - 2014-10-27 07:30:22
|
Revision: 6946 http://sourceforge.net/p/web-erp/reponame/6946 Author: daintree Date: 2014-10-27 07:30:11 +0000 (Mon, 27 Oct 2014) Log Message: ----------- removed all $db from DB_Maintenance($db) calls Modified Paths: -------------- trunk/AccountGroups.php trunk/UpgradeDatabase.php trunk/Z_ChangeBranchCode.php trunk/Z_ChangeCustomerCode.php trunk/Z_ChangeGLAccountCode.php trunk/Z_ChangeLocationCode.php trunk/Z_ChangeStockCode.php trunk/api/api_login.php trunk/doc/Change.log trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/ConnectDB_postgres.inc trunk/includes/UserLogin.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/AccountGroups.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -143,7 +143,7 @@ /*SelectedAccountGroup could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ if ($_POST['SelectedAccountGroup']!==$_POST['GroupName']) { - DB_IgnoreForeignKeys($db); + DB_IgnoreForeignKeys(); $sql = "UPDATE chartmaster SET group_='" . $_POST['GroupName'] . "' @@ -159,7 +159,7 @@ $result = DB_query($sql, $ErrMsg, $DbgMsg); - DB_ReinstateForeignKeys($db); + DB_ReinstateForeignKeys(); } $sql = "UPDATE accountgroups SET groupname='" . $_POST['GroupName'] . "', Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/UpgradeDatabase.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -191,7 +191,7 @@ prnMsg(_('Only mysql upgrades are performed seamlessly at this time. Your database will need to be manually updated'),'info'); } - $result = DB_IgnoreForeignKeys($db); + $result = DB_IgnoreForeignKeys(); foreach ($SQLScripts AS $SQLScriptFile) { @@ -269,7 +269,7 @@ } //end of for loop around the lines of the sql script echo '</table>'; } //end of loop around SQLScripts apply - $result =DB_ReinstateForeignKeys($db); + $result =DB_ReinstateForeignKeys(); /*Now get the modified VersionNumber and script pagesecurities */ $ForceConfigReload=true; include('includes/GetConfig.php'); Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/Z_ChangeBranchCode.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -180,7 +180,7 @@ $result = DB_Txn_Commit(); - $result = DB_IgnoreForeignKeys($db); + $result = DB_IgnoreForeignKeys(); prnMsg(_('Deleting the old customer branch record'),'info'); $sql = "DELETE FROM custbranch WHERE debtorno='" . $_POST['DebtorNo'] . "' @@ -188,7 +188,7 @@ $ErrMsg = _('The SQL to delete the old customer branch record failed because'); $result = DB_query($sql,$ErrMsg,$DbgMsg,true,true); - $result = DB_ReinstateForeignKeys($db); + $result = DB_ReinstateForeignKeys(); } Modified: trunk/Z_ChangeCustomerCode.php =================================================================== --- trunk/Z_ChangeCustomerCode.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/Z_ChangeCustomerCode.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -203,7 +203,7 @@ $ErrMsg = _('The SQL to update contract header records failed'); $result = DB_query($sql,$ErrMsg,$DbgMsg,true); - $result = DB_IgnoreForeignKeys($db); + $result = DB_IgnoreForeignKeys(); prnMsg(_('Deleting the old customer branch records from the CustBranch table'),'info'); $sql = "DELETE FROM custbranch WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; @@ -219,7 +219,7 @@ $result = DB_Txn_Commit(); - $result = DB_ReinstateForeignKeys($db); + $result = DB_ReinstateForeignKeys(); } Modified: trunk/Z_ChangeGLAccountCode.php =================================================================== --- trunk/Z_ChangeGLAccountCode.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/Z_ChangeGLAccountCode.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -57,7 +57,7 @@ $result = DB_query($sql,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - DB_IgnoreForeignKeys($db); + DB_IgnoreForeignKeys(); ChangeFieldInTable("bankaccounts", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); @@ -110,7 +110,7 @@ ChangeFieldInTable("workcentres", "overheadrecoveryact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - DB_ReinstateForeignKeys($db); + DB_ReinstateForeignKeys(); $result = DB_Txn_Commit(); Modified: trunk/Z_ChangeLocationCode.php =================================================================== --- trunk/Z_ChangeLocationCode.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/Z_ChangeLocationCode.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -49,7 +49,7 @@ if ($InputError ==0){ // no input errors $result = DB_Txn_Begin(); - DB_IgnoreForeignKeys($db); + DB_IgnoreForeignKeys(); echo '<br />' . _('Adding the new location record'); $sql = "INSERT INTO locations (loccode, @@ -223,7 +223,7 @@ $result = DB_query($sql,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - DB_ReinstateForeignKeys($db); + DB_ReinstateForeignKeys(); $result = DB_Txn_Commit(); Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/Z_ChangeStockCode.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -51,7 +51,7 @@ if ($InputError ==0){ // no input errors - DB_IgnoreForeignKeys($db); + DB_IgnoreForeignKeys(); $result = DB_Txn_Begin(); echo '<br />' . _('Adding the new stock master record'); $sql = "INSERT INTO stockmaster (stockid, @@ -177,7 +177,7 @@ ChangeFieldInTable("offers", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); ChangeFieldInTable("tenderitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - DB_ReinstateForeignKeys($db); + DB_ReinstateForeignKeys(); $result = DB_Txn_Commit(); Modified: trunk/api/api_login.php =================================================================== --- trunk/api/api_login.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/api/api_login.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -114,7 +114,7 @@ ,'d') > $_SESSION['DB_Maintenance']){ /*Do the DB maintenance routing for the DB_type selected */ - DB_Maintenance($db); + DB_Maintenance(); //purge the audit trail if necessary if (isset($_SESSION['MonthsAuditTrail'])){ $sql = "DELETE FROM audittrail Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/doc/Change.log 2014-10-27 07:30:11 UTC (rev 6946) @@ -1,5 +1,7 @@ webERP Change Log +27/10/14 Phil: Removed the $db parameter from all DB_Txn_Begin($db) DB_Txn_Commit($db) DB_Txn_Rollback($db)calls - $db is now global +27/10/14 Phil: Removed the $db parameter from all DB_Maintenance($db) calls - $db is now global 27/10/14 Phil: Removed the $db parameter from all DB_error_msg($db) calls - $db is now global 27/10/14 Phil: Removed the $db parameter from all DB_error_no($db) calls - $db is now global 27/10/14 Phil: Removed all $db in DB_query() calls as now a global Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/includes/ConnectDB_mysql.inc 2014-10-27 07:30:11 UTC (rev 6946) @@ -184,7 +184,7 @@ return "\n".'interval ' . $val . ' '. $Inter."\n"; } -function DB_Maintenance($Conn=''){ +function DB_Maintenance(){ prnMsg(_('The system has just run the regular database administration and optimisation routine.'),'info'); $TablesResult = DB_query('SHOW TABLES'); @@ -198,25 +198,25 @@ } -function DB_Txn_Begin($Conn=''){ - mysql_query("SET autocommit=0"); - mysql_query("START TRANSACTION"); +function DB_Txn_Begin(){ + mysql_query("SET autocommit=0",$db); + mysql_query("START TRANSACTION",$db); } -function DB_Txn_Commit($Conn=''){ - mysql_query("COMMIT"); - mysql_query("SET autocommit=1"); +function DB_Txn_Commit(){ + mysql_query("COMMIT",$db); + mysql_query("SET autocommit=1",$db); } -function DB_Txn_Rollback($Conn=''){ - mysql_query("ROLLBACK"); +function DB_Txn_Rollback(){ + mysql_query("ROLLBACK",$db); } -function DB_IgnoreForeignKeys($Conn=''){ - mysql_query("SET FOREIGN_KEY_CHECKS=0"); +function DB_IgnoreForeignKeys(){ + mysql_query("SET FOREIGN_KEY_CHECKS=0",$db); } -function DB_ReinstateForeignKeys($Conn=''){ - mysql_query("SET FOREIGN_KEY_CHECKS=1"); +function DB_ReinstateForeignKeys(){ + mysql_query("SET FOREIGN_KEY_CHECKS=1",$db); } -?> +?> \ No newline at end of file Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/includes/ConnectDB_mysqli.inc 2014-10-27 07:30:11 UTC (rev 6946) @@ -196,7 +196,7 @@ return "\n".'interval ' . $val . ' '. $Inter."\n"; } -function DB_Maintenance($Conn=''){ +function DB_Maintenance(){ prnMsg(_('The system has just run the regular database administration and optimisation routine.'),'info'); @@ -210,27 +210,27 @@ WHERE confname='DB_Maintenance_LastRun'"); } -function DB_Txn_Begin($Conn=''){ +function DB_Txn_Begin(){ global $db; mysqli_query($db,'SET autocommit=0'); mysqli_query($db,'START TRANSACTION'); } -function DB_Txn_Commit($Conn=''){ +function DB_Txn_Commit(){ global $db; mysqli_query($db,'COMMIT'); mysqli_query($db,'SET autocommit=1'); } -function DB_Txn_Rollback($Conn=''){ +function DB_Txn_Rollback(){ global $db; mysqli_query($db,'ROLLBACK'); } -function DB_IgnoreForeignKeys($Conn=''){ +function DB_IgnoreForeignKeys(){ global $db; mysqli_query($db,'SET FOREIGN_KEY_CHECKS=0'); } -function DB_ReinstateForeignKeys($Conn=''){ +function DB_ReinstateForeignKeys(){ global $db; mysqli_query($db, 'SET FOREIGN_KEY_CHECKS=1'); } Modified: trunk/includes/ConnectDB_postgres.inc =================================================================== --- trunk/includes/ConnectDB_postgres.inc 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/includes/ConnectDB_postgres.inc 2014-10-27 07:30:11 UTC (rev 6946) @@ -139,7 +139,7 @@ Return $Result; } } -function DB_Maintenance($Conn){ +function DB_Maintenance(){ prnMsg(_('The system has just run the regular database administration and optimisation routine'),'info'); Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2014-10-27 07:20:48 UTC (rev 6945) +++ trunk/includes/UserLogin.php 2014-10-27 07:30:11 UTC (rev 6946) @@ -158,7 +158,7 @@ ,'d') >= $_SESSION['DB_Maintenance']){ /*Do the DB maintenance routing for the DB_type selected */ - DB_Maintenance($db); + DB_Maintenance(); $_SESSION['DB_Maintenance_LastRun'] = Date('Y-m-d'); /* Audit trail purge only runs if DB_Maintenance is enabled */ |