Sfoglia il codice sorgente

added MK_Rewiry to Przypomnij StorageAcl, fixed bug in tables to update

Piotr Labudda 8 anni fa
parent
commit
ee6e64c7a6
1 ha cambiato i file con 29 aggiunte e 2 eliminazioni
  1. 29 2
      SE/se-lib/Schema/PrzypomnijStorageAcl.php

+ 29 - 2
SE/se-lib/Schema/PrzypomnijStorageAcl.php

@@ -123,7 +123,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 		$tablesList[] = 'CRM_PROCES';
 		$tablesList[] = 'PROBLEMS';
 		$tablesList[] = 'CRM_LISTA_ZASOBOW';
-		// $tablesList[] = 'MK_Rewiry';
+		$tablesList[] = 'MK_Rewiry';
 		// $tablesList[] = 'BUILDINGS';
 		// $tablesList[] = 'QUALITY_NOTICES';
 		// $tablesList[] = 'BADANIA_W_TERENIE';
@@ -171,7 +171,7 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 		$tablesToUpdate = array_keys(
 			array_filter($tablesUpdateDates, function ($value) { return $value; })
 		);
-		$tablesToUpdate = array_keys($tablesToUpdate, function ($tableName) { return ( '_PRZYPOMNIJ_' !== substr($tableName, 0, strlen('_PRZYPOMNIJ_')) ); });
+		$tablesToUpdate = array_filter($tablesToUpdate, function ($tableName) { return ( '_PRZYPOMNIJ_' !== substr($tableName, 0, strlen('_PRZYPOMNIJ_')) ); });
 		DBG::log($tablesToUpdate, 'array', "DBG::Przypomnij: \$tablesToUpdate");
 		foreach ($tablesToUpdate as $tableName) self::_updateForTable($tableName);
 
@@ -326,6 +326,33 @@ class Schema_PrzypomnijStorageAcl extends Core_AclSimpleSchemaBase {
 				':table_name' => $tableName,
 			]);
 		}
+		else if ('MK_Rewiry' === $tableName)  { // TODO: getUpdateConfigForTable($tableName);
+			// TODO: 'A_PROBLEM_DESC' => htmlspecialchars($row['A_PROBLEM_DESC']),
+			DB::getPDO()->execSql(" DELETE from `_PRZYPOMNIJ_ITEMS` where `namespace` = :namespace ", [ ':namespace' => $namespace ]);
+			DB::getPDO()->execSql("
+				insert into `_PRZYPOMNIJ_ITEMS` (
+					`feature_id`, `namespace`, `primaryKey`
+					, `A_STATUS`, `featureType`, `featureDesc`
+					, `L_APPOITMENT_USER`, `A_ADM_COMPANY`, `A_CLASSIFIED`
+					, `L_APPOITMENT_DATE`, `L_APPOITMENT_INFO`
+					, `PROJECT__ID`
+				)
+				select concat( :table_name , '.', t.ID) as `feature_id`, :namespace as `namespace`, t.ID as `primaryKey`
+					, t.`A_STATUS`
+					, '' as `featureType`
+					, t.`L_APPOITMENT_INFO` as `featureDesc`
+					, t.`L_APPOITMENT_USER`, t.`A_ADM_COMPANY`, t.`A_CLASSIFIED`
+					, t.`L_APPOITMENT_DATE`, t.`L_APPOITMENT_INFO`
+					, t.`ID_PROJECT` as PROJECT__ID
+				from `MK_Rewiry` as t
+				where t.`A_STATUS` not in ('OFF_HARD', 'DELETED')
+					and t.`L_APPOITMENT_DATE` != ''
+					and t.`L_APPOITMENT_USER` != ''
+			", [
+				':namespace' => $namespace,
+				':table_name' => $tableName,
+			]);
+		}
 		else if ('_PRZYPOMNIJ_ITEMS' === $tableName) {}
 		else if ('_PRZYPOMNIJ_PROJECT_TREE' === $tableName) {}
 		else {