Ver Fonte

fixed DBG in UrlAction

Piotr Labudda há 9 anos atrás
pai
commit
ebd299d974
1 ficheiros alterados com 10 adições e 15 exclusões
  1. 10 15
      SE/se-lib/Route/UrlAction.php

+ 10 - 15
SE/se-lib/Route/UrlAction.php

@@ -90,7 +90,8 @@ class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
 				22324  PARAM_IN ID_PROJECT
 	 */
 	public static function fetchTableFunctions($idTbl, $idRecord) {
-		$sth = DB::getPDO()->prepare("
+		$sqlIdZasob = DB::getPDO()->quote($idTbl, PDO::PARAM_STR);
+		return DB::getPDO()->fetchAll("
 			select z.ID as ID
 				, z.`DESC_PL` as fun_label
 				, za.`DESC` as fun_name
@@ -100,16 +101,15 @@ class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
 				join CRM_LISTA_ZASOBOW za on(za.ID = z.ALIAS_ID)
 				left join CRM_LISTA_ZASOBOW zp on(zp.PARENT_ID = z.ID and zp.`TYPE` = 'PARAM_IN')
 				left join CRM_LISTA_ZASOBOW zpa on(zpa.ID = zp.ALIAS_ID and zpa.`TYPE` = 'PARAM_IN' and zpa.`DESC` = zp.`DESC`)
-			where z.PARENT_ID = :id_zasob
+			where z.PARENT_ID = {$sqlIdZasob}
 				and z.`TYPE` = 'URL_ACTION'
 		");
-		$sth->bindValue(':id_zasob', $idTbl, PDO::PARAM_STR);
-		$sth->execute();
-		return $sth->fetchAll();
 	}
 
 	public static function fetchTableFunctionsForUser($idTbl, $idRecord, $usrLogin) {
-		$sth = DB::getPDO()->prepare("
+		$sqlIdZasob = DB::getPDO()->quote($idTbl, PDO::PARAM_STR);
+		$sqlUserLogin = DB::getPDO()->quote($usrLogin, PDO::PARAM_STR);
+		return DB::getPDO()->fetchAll("
 			select z.ID as ID
 				, z.`DESC_PL` as fun_label
 				, za.`DESC` as fun_name
@@ -125,16 +125,11 @@ class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
 		--		join CRM_PROCES p on(p.ID = w.ID_PROCES)
 				join CRM_PROCES_idx_USER_to_PROCES_VIEW upv on(upv.ID_PROCES = w.ID_PROCES)
 				left join CRM_LISTA_ZASOBOW param on(param.PARENT_ID = z.ID and param.`TYPE` = 'DANE')
-			where z.PARENT_ID = :id_zasob
+			where z.PARENT_ID = {$sqlIdZasob}
 				and z.`TYPE` = 'URL_ACTION'
-				and upv.ADM_ACCOUNT = :usr_login
+				and upv.ADM_ACCOUNT = {$sqlUserLogin}
 		--	group by z.ID
 		");
-		$sth->bindValue(':id_zasob', $idTbl, PDO::PARAM_STR);
-		$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) {
@@ -144,7 +139,7 @@ class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
 		} else {
 			$rows = self::fetchTableFunctions($idTbl, $idRecord);
 		}
-		DBG::_('DBG', '>1', 'rows', $rows, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::log($rows);
 		$functions = array();
 		foreach ($rows as $row) {
 			// TODO: Router::getRoute("UrlAction_{$row['fun_name']}")->isRecordAllowed($idTbl, $idRecord, $tblName);
@@ -172,7 +167,7 @@ class Route_UrlAction extends RouteBase {// TODO: UrlActionBase
 				unset($functions[ $row['ID'] ]['link_target']);
 			}
 		}
-		DBG::_('DBG', '>1', 'functions', $functions, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::log($functions);
 		return $functions;
 	}