|
|
@@ -201,6 +201,7 @@ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">wsk: ';pr
|
|
|
* @param $stanowiska_id - array of integer
|
|
|
*/
|
|
|
public static function get_procesy_by_stanowiska( $stanowiska_id = array() ) {
|
|
|
+ $db = DB::getDB();
|
|
|
$ret = array();
|
|
|
if (empty($stanowiska_id)) {
|
|
|
return $ret;
|
|
|
@@ -237,8 +238,8 @@ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">wsk: ';pr
|
|
|
and z.`ID` in (" . implode(",", $sql_stanowiska_id) . ")
|
|
|
order by p.`TEST_SORT_PRIO` DESC, p.`ID` ASC
|
|
|
";
|
|
|
- $res = DB::query($sql);
|
|
|
- while ($r = DB::fetch($res)) {
|
|
|
+ $res = $db->query($sql);
|
|
|
+ while ($r = $db->fetch($res)) {
|
|
|
$ret []= $r;
|
|
|
}
|
|
|
return $ret;
|
|
|
@@ -418,6 +419,28 @@ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">wsk: ';pr
|
|
|
return DB::get_by_id('CRM_PROCES', $next_id);
|
|
|
}
|
|
|
|
|
|
+ public static function get_proces_init_by_zasob_id($id_zasob) {
|
|
|
+ $db = DB::getDB();
|
|
|
+ $sqlFilter = " cw.ID_ZASOB={$id_zasob}";
|
|
|
+ if (is_array($id_zasob)) {
|
|
|
+ $sqlFilter = " cw.ID_ZASOB in ".implode(',', $id_zasob);
|
|
|
+ }
|
|
|
+ $sql = "select
|
|
|
+ cps.ID_PROCES_INIT
|
|
|
+ , cw.ID_PROCES
|
|
|
+ from CRM_WSKAZNIK as cw
|
|
|
+ left join _CRM_PROCES_STATS_proc_wiev as cps on(cps.ID = cw.ID_PROCES)
|
|
|
+ where cw.A_STATUS in('NORMAL', 'WAITING')
|
|
|
+ and cps.ID_PROCES_INIT > 0 and
|
|
|
+ {$sqlFilter}
|
|
|
+ ";
|
|
|
+ $res = $db->query($sql);
|
|
|
+ while ($h = $db->fetch($res)) {
|
|
|
+ $ret[] = $h->ID_PROCES_INIT;
|
|
|
+ }
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
+
|
|
|
public static function getZasobTableInfo($zasobID) {
|
|
|
$zasobObj = null;
|
|
|
$db = DB::getDB();
|
|
|
@@ -435,6 +458,24 @@ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">wsk: ';pr
|
|
|
return $zasobObj;
|
|
|
}
|
|
|
|
|
|
+ public static function getZasobInfo($zasobID) {
|
|
|
+ $zasobObj = null;
|
|
|
+ $db = DB::getDB();
|
|
|
+ $sql = "select z.`ID`, z.`DESC`, z.`DESC_PL`, z.`OPIS`, z.`TYPE`
|
|
|
+ , zp.`ID` as P__ID
|
|
|
+ , zp.`DESC` as P__DESC
|
|
|
+ , zp.`TYPE` as P__TYPE
|
|
|
+ from `CRM_LISTA_ZASOBOW` as z
|
|
|
+ left join `CRM_LISTA_ZASOBOW` as zp on(zp.`ID`=z.`PARENT_ID`)
|
|
|
+ where z.`ID`='{$zasobID}'
|
|
|
+ ";
|
|
|
+ $res = $db->query($sql);
|
|
|
+ if ($res) {
|
|
|
+ $zasobObj = $db->fetch($res);
|
|
|
+ }
|
|
|
+ return $zasobObj;
|
|
|
+ }
|
|
|
+
|
|
|
public static function getZasobTableID($tblName) {
|
|
|
$zasobID = 0;
|
|
|
$db = DB::getDB();
|