|
|
@@ -540,7 +540,7 @@ SQL;
|
|
|
}
|
|
|
|
|
|
public function canExecuteProcesInit($idProcesInit) {
|
|
|
- $canExecuteProcesInit = false;
|
|
|
+ $isAllowed = false;
|
|
|
$idProcesInit = (int)$idProcesInit;
|
|
|
if (!$idProcesInit) return false;
|
|
|
$idUserGroupList = User::getGroupsIds();
|
|
|
@@ -556,10 +556,33 @@ SQL;
|
|
|
$res = $db->query($checkProcesAccessSql);
|
|
|
if ($r = $db->fetch($res)) {
|
|
|
if ($r->cnt > 0) {
|
|
|
- $canExecuteProcesInit = true;
|
|
|
+ $isAllowed = true;
|
|
|
}
|
|
|
}
|
|
|
- return $canExecuteProcesInit;
|
|
|
+ return $isAllowed;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function canViewProces($idProcesInit) {
|
|
|
+ $isAllowed = false;
|
|
|
+ $idProcesInit = (int)$idProcesInit;
|
|
|
+ if (!$idProcesInit) return false;
|
|
|
+ $idUserGroupList = User::getGroupsIds();
|
|
|
+ $sqlIdUserGroupList = implode(",", $idUserGroupList);
|
|
|
+ $checkProcesAccessSql = <<<SQL
|
|
|
+ select count(*) as cnt
|
|
|
+ from `CRM_PROCES_idx_GROUP_to_PROCES` gi
|
|
|
+ join `CRM_PROCES` p on(p.`ID`=gi.`ID_PROCES`)
|
|
|
+ where gi.`ID_GROUP` in({$sqlIdUserGroupList})
|
|
|
+ and gi.`ID_PROCES`='{$idProcesInit}'
|
|
|
+SQL;
|
|
|
+ $db = DB::getDB();
|
|
|
+ $res = $db->query($checkProcesAccessSql);
|
|
|
+ if ($r = $db->fetch($res)) {
|
|
|
+ if ($r->cnt > 0) {
|
|
|
+ $isAllowed = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $isAllowed;
|
|
|
}
|
|
|
|
|
|
}
|