|
From: <dai...@us...> - 2010-12-27 04:58:58
|
Revision: 4451
http://web-erp.svn.sourceforge.net/web-erp/?rev=4451&view=rev
Author: daintree
Date: 2010-12-27 04:58:50 +0000 (Mon, 27 Dec 2010)
Log Message:
-----------
modified Z_ChangeBranchCode.php to defeat foreign key checks when deleting the branch code from custbranch
Modified Paths:
--------------
trunk/Z_ChangeBranchCode.php
trunk/includes/ConnectDB_mysqli.inc
trunk/sql/mysql/upgrade3.11.1-4.00.sql
Modified: trunk/Z_ChangeBranchCode.php
===================================================================
--- trunk/Z_ChangeBranchCode.php 2010-12-26 12:45:46 UTC (rev 4450)
+++ trunk/Z_ChangeBranchCode.php 2010-12-27 04:58:50 UTC (rev 4451)
@@ -11,10 +11,10 @@
/*First check the customer code exists */
$result=DB_query("SELECT debtorno,
- branchcode
- FROM custbranch
- WHERE debtorno='" . $_POST['DebtorNo'] . "'
- AND branchcode='" . $_POST['OldBranchCode'] . "'",$db);
+ branchcode
+ FROM custbranch
+ WHERE debtorno='" . $_POST['DebtorNo'] . "'
+ AND branchcode='" . $_POST['OldBranchCode'] . "'",$db);
if (DB_num_rows($result)==0){
prnMsg (_('The customer branch code') . ': ' . $_POST['DebtorNo'] . ' - ' . $_POST['OldBranchCode'] . ' ' . _('does not currently exist as a customer branch code in the system'),'error');
include('includes/footer.inc');
@@ -189,7 +189,7 @@
AND branchcode='" . $_POST['OldBranchCode'] . "'";
$ErrMsg = _('The SQL to delete the old customer branch record failed because');
- $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true);
+ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true,true);
}
Modified: trunk/includes/ConnectDB_mysqli.inc
===================================================================
--- trunk/includes/ConnectDB_mysqli.inc 2010-12-26 12:45:46 UTC (rev 4450)
+++ trunk/includes/ConnectDB_mysqli.inc 2010-12-27 04:58:50 UTC (rev 4451)
@@ -65,7 +65,8 @@
$ErrorMessage='',
$DebugMessage= '',
$Transaction=false,
- $TrapErrors=true){
+ $TrapErrors=true,
+ $IgnoreForeignKeys=false){
global $debug;
global $PathPrefix;
@@ -74,6 +75,10 @@
20071102 Change from mysql to mysqli;
$result=mysql_query($SQL,$Conn);
*/
+
+ if ($IgnoreForeignKeys) {
+ $SQL = 'SET FOREIGN_KEY_CHECKS=0; ' . $SQL . ' SET FOREIGN_KEY_CHECKS=1;';
+ }
$result=mysqli_query($Conn, $SQL);
$_SESSION['LastInsertId'] = mysqli_insert_id($Conn);
Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql
===================================================================
--- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-26 12:45:46 UTC (rev 4450)
+++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-27 04:58:50 UTC (rev 4451)
@@ -474,6 +474,5 @@
ALTER TABLE purchorderdetails ADD COLUMN assetid int NOT NULL DEFAULT 0;
INSERT INTO `systypes` (`typeid` ,`typename` ,`typeno`) VALUES ('49', 'Import Fixed Assets', '1');
-ALTER TABLE `debtortrans` DROP FOREIGN KEY `debtortrans_ibfk_1`
UPDATE config SET confvalue='4.0-RC2' WHERE confname='VersionName';
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|