Jelajahi Sumber

added debug for cell to proces in ViewTableAjax

Piotr Labudda 9 tahun lalu
induk
melakukan
3f03f45ceb
2 mengubah file dengan 46 tambahan dan 0 penghapusan
  1. 1 0
      SE/se-lib/Route/UrlAction.php
  2. 45 0
      SE/se-lib/Route/ViewTableAjax.php

+ 1 - 0
SE/se-lib/Route/UrlAction.php

@@ -134,6 +134,7 @@ class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
 		$sth->bindValue(':usr_login', $usrLogin, PDO::PARAM_STR);
 		$sth->execute();
 		return $sth->fetchAll();
+		// TODO: check $idRecord
 	}
 
 	public static function getTableFunctions($idTbl, $idRecord, $tblName = '', $usrLogin = null) {

+ 45 - 0
SE/se-lib/Route/ViewTableAjax.php

@@ -88,6 +88,51 @@ class Route_ViewTableAjax extends RouteBase {
 				foreach ($aclTableRows as $row) {
 					if (!in_array($row['ID_PROCES'], $csvIdProces)) $csvIdProces[] = $row['ID_PROCES'];
 				}
+
+				$tableName = $acl->getName();
+				$databaseName = DB::getPDO()->getDatabaseName();
+				UI::table([
+					'caption' => "Cell to process",
+					'rows' => array_map(
+						function ($row) use ($aclTableRows, $idTable) {
+							$row['proces'] = array();
+							$row['id_zasob'] = 0;
+							$row['PERM_R'] = 0;
+							$row['PERM_W'] = 0;
+							$row['PERM_X'] = 0;
+							$row['PERM_C'] = 0;
+							$row['PERM_S'] = 0;
+							$row['PERM_O'] = 0;
+							$row['PERM_V'] = 0;
+							$row['PERM_E'] = 0;
+							foreach ($aclTableRows as $aclInfo) {
+								if (strtolower($aclInfo['CELL_NAME']) == strtolower($row['COLUMN_NAME'])) {
+									$row['proces'][] = $aclInfo['ID_PROCES'];
+									$row['id_zasob'] = $aclInfo['ID_CELL'];
+									$row['PERM_R'] += $aclInfo['PERM_R'];
+									$row['PERM_W'] += $aclInfo['PERM_W'];
+									$row['PERM_X'] += $aclInfo['PERM_X'];
+									$row['PERM_C'] += $aclInfo['PERM_C'];
+									$row['PERM_S'] += $aclInfo['PERM_S'];
+									$row['PERM_O'] += $aclInfo['PERM_O'];
+									$row['PERM_V'] += $aclInfo['PERM_V'];
+									$row['PERM_E'] += $aclInfo['PERM_E'];
+								}
+							}
+							$row['proces'] = (empty($row['proces']))
+								? "<i style=\"color:red\">Brak</i>"
+								: implode(", ", $row['proces']);
+							if (!$row['id_zasob']) $row['id_zasob'] = DB::getPDO()->fetchValue("select ID from CRM_LISTA_ZASOBOW where `DESC` = '{$row['COLUMN_NAME']}' and PARENT_ID = {$idTable} limit 1");
+							return $row;
+						}, DB::getPDO()->fetchAll("
+							select t.TABLE_NAME, t.COLUMN_NAME, t.DATA_TYPE, t.COLUMN_TYPE
+							from `information_schema`.`COLUMNS` t
+							where t.TABLE_SCHEMA = '{$databaseName}'
+								and t.TABLE_NAME like '{$tableName}'
+						")
+					)
+				]);
+
 				$csvIdProces = implode(",", $csvIdProces);
 				UI::tag('p', null, "DBG csvIdProces({$csvIdProces})");
 				if (!empty($csvIdProces)) {