Parcourir la source

Merge branch 'master' of ssh://biuro.biall-net.pl:2222/plabudda/se

a.binder il y a 8 ans
Parent
commit
7b8a8b9022
1 fichiers modifiés avec 11 ajouts et 5 suppressions
  1. 11 5
      SE/se-lib/Route/UrlAction/BiAuditGenerate.php

+ 11 - 5
SE/se-lib/Route/UrlAction/BiAuditGenerate.php

@@ -1824,18 +1824,24 @@ SQL;
 			$queries[] = "delete from BI_audit_ALL where BASE = 0";
 			$queries[] = "delete from BI_audit_ALL_ref where BASE = 0";
 
+			$allTables = [];
 			foreach ($refTablesConf as $refTableFrom => $refTableConf) {
-				if ($refTableConf['base']) continue;
+				$allTables[] = $refTableFrom;
+//				if ($refTableConf['base']) continue;
 				foreach ($refTableConf['refTablesTo'] as $refTableTo) {
+					$allTables[] = $refTableTo;
+					if ($refTableConf['base']) continue;
 					$refTable = $this->refTables->getRefTable($refTableFrom, $refTableTo);
-					$queries[] = "delete from `{$refTable}` where `TRANSACTION_ID` = '-1'";
+//					$queries[] = "delete from `{$refTable}` where `TRANSACTION_ID` = '-1'";
 					$queries[] = "update `{$refTable}` set `A_STATUS` = 'WAITNG' where `A_STATUS` = 'NORMAL'";
-					$queries[] = "insert into `{$refTable}` (`PRIMARY_KEY`, `REMOTE_PRIMARY_KEY`, `TRANSACTION_ID`, `A_STATUS`) select `all1`.`ID`, `all2`.`ID`, '-1', 'NORMAL' from `BI_audit_ALL` as `all1` join `BI_audit_ALL_ref` as `ref` on `all1`.`ID` = `ref`.`ID1` join `BI_audit_ALL` as `all2` on `ref`.`ID2` = `all2`.`ID` where `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all2`.`REMOTE_TABLE` = '{$refTableTo}'";
+//					$queries[] = "insert into `{$refTable}` (`PRIMARY_KEY`, `REMOTE_PRIMARY_KEY`, `TRANSACTION_ID`, `A_STATUS`) select `all1`.`ID`, `all2`.`ID`, '-1', 'NORMAL' from `BI_audit_ALL` as `all1` join `BI_audit_ALL_ref` as `ref` on `all1`.`ID` = `ref`.`ID1` join `BI_audit_ALL` as `all2` on `ref`.`ID2` = `all2`.`ID` where `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all2`.`REMOTE_TABLE` = '{$refTableTo}'";
 				}
 			}
 
-			foreach ($extraRefTablesConf as $refTableFrom => $refTableConf) {
-				foreach ($refTableConf['refTablesTo'] as $refTableTo) {
+//			foreach ($extraRefTablesConf as $refTableFrom => $refTableConf) {
+			foreach ($allTables as $refTableFrom) {
+//				foreach ($refTableConf['refTablesTo'] as $refTableTo) {
+				foreach ($allTables as $refTableTo) {
 					if ($refTable = $this->refTables->getRefTable($refTableFrom, $refTableTo)) {
 						$queries[] = "delete from `{$refTable}` where `TRANSACTION_ID` = '-1'";
 						$queries[] = "insert into `{$refTable}` (`PRIMARY_KEY`, `REMOTE_PRIMARY_KEY`, `TRANSACTION_ID`, `A_STATUS`) select `all1`.`ID`, `all2`.`ID`, '-1', 'NORMAL' from `BI_audit_ALL` as `all1` join `BI_audit_ALL_ref` as `ref` on `all1`.`ID` = `ref`.`ID1` join `BI_audit_ALL` as `all2` on `ref`.`ID2` = `all2`.`ID` where `all1`.`REMOTE_TABLE` = '{$refTableFrom}' and `all2`.`REMOTE_TABLE` = '{$refTableTo}'";