Issue system: adapted to work with multiple apps per fehler

This commit is contained in:
Alexei Karpenko
2026-02-03 15:39:11 +01:00
parent 2de6278603
commit 10d52caa98
13 changed files with 226 additions and 108 deletions
@@ -12,4 +12,41 @@ class Fehler_model extends DB_Model
$this->pk = array('fehlercode');
$this->hasSequence = false;
}
/**
* Gets all fehler for particular apps.
* @param $apps string of one app or array with multiple
* @return object success or error
*/
public function getByApps($apps)
{
if (is_string($apps)) $apps = [$apps];
$params = [];
$qry = "
SELECT
fehlercode, fehler_kurzbz, fehlercode_extern, fehlertext, fehlertyp_kurzbz
FROM
system.tbl_fehler fe";
if (!isEmptyArray($apps))
{
$qry .= "
WHERE EXISTS (
SELECT 1
FROM
system.tbl_fehler_app
WHERE
fehlercode = fe.fehlercode
AND app IN ?
)";
$params[] = $apps;
}
$qry .= " ORDER BY fehlercode;";
return $this->execReadOnlyQuery($qry, $params);
}
}