Ver Fonte

fixed missing view Proces and Zasob for current table (object)

Piotr Labudda há 8 anos atrás
pai
commit
7aea489049
1 ficheiros alterados com 29 adições e 5 exclusões
  1. 29 5
      SE/se-lib/ProcesMenu.php

+ 29 - 5
SE/se-lib/ProcesMenu.php

@@ -411,12 +411,36 @@ jQuery(document).ready(function() {
 		$lastProcesyFiltrIds = $treeProcesyFilter->get_arg('filtr_id');
 		$lastProcesyFiltrIds = $treeProcesyFilter->get_arg('filtr_id');
 
 
 		$menuProcesViewedTblId = 0;
 		$menuProcesViewedTblId = 0;
-		if ('VIEWTABLE_AJAX' == V::get('MENU_INIT', '', $_REQUEST)) {
-			$menuProcesViewedTblId = V::get('ZASOB_ID', 0, $_REQUEST, 'int');
+		if ('ViewTableAjax' == V::get('_route', '', $_REQUEST)) {
+			$namespace = V::get('namespace', '', $_REQUEST, 'word');
+			if (!$namespace) {
+				$typeName = V::get('typeName', '', $_REQUEST, 'word');
+				if ($typeName) {
+					$namespace = str_replace(['__x3A__', ':'], '/', $typeName);
+				}
+			}
+			if ($namespace) {
+				$zasobTableName = (
+					'default_db/' === substr($namespace, 0, strlen('default_db/'))
+					&& false === strpos(substr($namespace, strlen('default_db/')), '/')
+				)
+				? substr($namespace, strlen('default_db/'))
+				: $namespace;
+				if ($zasobTableName) {
+					$dbID = DB::getPDO()->getZasobId();
+					$menuProcesViewedTblId = DB::getPDO()->fetchValue("
+						select z.ID
+						from CRM_LISTA_ZASOBOW z
+						where z.`DESC` = '{$zasobTableName}'
+							and z.A_STATUS not in ('DELETED')
+							and z.`TYPE` = 'TABELA'
+							and z.PARENT_ID = '{$dbID}'
+					");
+				}
+			}
 		}
 		}
-		else if ('ViewTableAjax' == V::get('_route', '', $_REQUEST)) {
-			$typeName = V::get('typeName', '', $_REQUEST, 'word');
-			if (array_key_exists($typeName, $typeNameToIdZasob)) $menuProcesViewedTblId = $typeNameToIdZasob[$typeName];
+		else if ('VIEWTABLE_AJAX' == V::get('MENU_INIT', '', $_REQUEST)) {
+			$menuProcesViewedTblId = V::get('ZASOB_ID', 0, $_REQUEST, 'int');
 		}
 		}
 
 
 		?>
 		?>