mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'feature-68834/Fehlermonitoring_Issues_weitere_features' into feature-39602/Fas_Statusbearbeitung_bei_Sperre
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
class IssueChecker extends FHCAPI_Controller
|
||||
{
|
||||
const DEFAULT_PERMISSION = 'system/issues_verwalten:r';
|
||||
|
||||
protected $person_id;
|
||||
protected $_extensionName = null;
|
||||
protected $_fehlercodes = [];
|
||||
protected $_apps = [];
|
||||
|
||||
protected $errors = [];
|
||||
protected $infos = [];
|
||||
|
||||
public function __construct($permissions = [])
|
||||
{
|
||||
$default_permissions = [
|
||||
'checkPerson' => self::DEFAULT_PERMISSION,
|
||||
'countPersonOpenIssues' => self::DEFAULT_PERMISSION
|
||||
];
|
||||
|
||||
if(!is_array($permissions))
|
||||
{
|
||||
$this->terminateWithError("Issue Checker: permissions must be an array");
|
||||
}
|
||||
|
||||
$merged_permissions = array_merge($default_permissions, $permissions);
|
||||
|
||||
parent::__construct($merged_permissions);
|
||||
|
||||
$this->load->model('system/Issue_model', 'IssueModel');
|
||||
$this->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$producerArgs = [];
|
||||
$resolverArgs = [];
|
||||
|
||||
// get fehler kurzbz from fehlercodes, if fehlercodes provided
|
||||
if (!isEmptyArray($this->_fehlercodes))
|
||||
{
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz');
|
||||
$this->FehlerModel->db->where_in('tbl_fehler.fehlercode', $this->_fehlercodes);
|
||||
$fehlerKurzbzRes = $this->FehlerModel->load();
|
||||
|
||||
if (isError($fehlerKurzbzRes)) $this->terminateWithError(getError($fehlerKurzbzRes), self::ERROR_TYPE_GENERAL);
|
||||
if (hasData($fehlerKurzbzRes))
|
||||
{
|
||||
$producerArgs['fehlerKurzbz'] = array_column(getData($fehlerKurzbzRes), 'fehler_kurzbz');
|
||||
$resolverArgs['fehlercode'] = array_column(getData($fehlerKurzbzRes), 'fehlercode');
|
||||
}
|
||||
}
|
||||
elseif (!isEmptyArray($this->_apps)) // if apps are provided
|
||||
{
|
||||
// get fehlercodes for the apps
|
||||
$fehlerRes = $this->FehlerModel->getByApps($this->_apps);
|
||||
if (hasData($fehlerRes)) $this->_fehlercodes = array_column(getData($fehlerRes), 'fehlercode');
|
||||
|
||||
$producerArgs['apps'] = $this->_apps;
|
||||
$resolverArgs['apps'] = $this->_apps;
|
||||
}
|
||||
|
||||
// load producer and checker libraries with fehler kurbz and fehlercode list
|
||||
$this->load->library(
|
||||
'issues/PlausicheckProducerLib',
|
||||
$producerArgs,
|
||||
'PlausicheckProducerLib'
|
||||
);
|
||||
|
||||
$this->load->library(
|
||||
'issues/PlausicheckResolverLib',
|
||||
$resolverArgs,
|
||||
'PlausicheckResolverLib'
|
||||
);
|
||||
|
||||
$this->load->library('PhrasesLib');
|
||||
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'ui'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function checkPerson()
|
||||
{
|
||||
$person_id = $this->input->post('person_id', true);
|
||||
$hauptzustaendig = filter_var($this->input->post('hauptzustaendig', true), FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (!is_numeric($person_id)) $this->terminateWithError($this->p->t('ui', 'error_invalidId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->person_id = intval($person_id);
|
||||
$this->hauptzustaendig = $hauptzustaendig;
|
||||
|
||||
$persRes = $this->PersonModel->load($this->person_id);
|
||||
if (!hasData($persRes)) $this->terminateWithError('Person with id ' . $this->person_id . ' not found.', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->_produceIssues();
|
||||
$this->_resolveIssues();
|
||||
$this->_produceIssues();
|
||||
|
||||
$openIssueCountRes = $this->_countOpenIssues();
|
||||
if (isError($openIssueCountRes)) $this->terminateWithError(getError($openIssueCountRes), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $this->person_id,
|
||||
'openissues' => hasData($openIssueCountRes) ? getData($openIssueCountRes) : 0
|
||||
);
|
||||
|
||||
$this->addMeta('errors', $this->errors);
|
||||
$this->addMeta('infos', $this->infos);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
public function countPersonOpenIssues()
|
||||
{
|
||||
$person_id = $this->input->get('person_id', true);
|
||||
$hauptzustaendig = filter_var($this->input->get('hauptzustaendig', true), FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (!is_numeric($person_id)) $this->terminateWithError($this->p->t('ui', 'error_invalidId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$this->person_id = intval($person_id);
|
||||
$this->hauptzustaendig = $hauptzustaendig;
|
||||
|
||||
$persRes = $this->PersonModel->load($this->person_id);
|
||||
|
||||
if (!hasData($persRes)) $this->terminateWithError('Person with id ' . $this->person_id . ' not found.', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$openIssueCountRes = $this->_countOpenIssues();
|
||||
if (isError($openIssueCountRes)) $this->terminateWithError(getError($openIssueCountRes), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $this->person_id,
|
||||
'openissues' => hasData($openIssueCountRes) ? getData($openIssueCountRes) : 0
|
||||
);
|
||||
|
||||
$this->addMeta('errors', $this->errors);
|
||||
$this->addMeta('infos', $this->infos);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
protected function _countOpenIssues()
|
||||
{
|
||||
if (isEmptyArray($this->_fehlercodes)) return success([]);
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
$this->_fehlercodes,
|
||||
$this->person_id,
|
||||
$oe_kurzbz = null,
|
||||
$fehlercode_extern = null,
|
||||
$this->hauptzustaendig
|
||||
);
|
||||
|
||||
// log error if occured
|
||||
if (isError($openIssuesRes)) return $openIssuesRes;
|
||||
|
||||
$issues = hasData($openIssuesRes) ? getData($openIssuesRes) : [];
|
||||
$issuescount = is_array($issues) || $issues instanceof Countable ? count($issues) : 0;
|
||||
|
||||
return success($issuescount);
|
||||
}
|
||||
|
||||
protected function _produceIssues()
|
||||
{
|
||||
$result = $this->PlausicheckProducerLib->producePlausicheckIssues(
|
||||
array('person_id' => $this->person_id)
|
||||
);
|
||||
|
||||
// log if error, or log info if inserted new issue
|
||||
if (isset($result->errors))
|
||||
$this->errors = array_merge($this->errors, $result->errors);
|
||||
if (isset($result->infos))
|
||||
$this->infos = array_merge($this->infos, $result->infos);
|
||||
}
|
||||
|
||||
protected function _resolveIssues()
|
||||
{
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
$this->_fehlercodes,
|
||||
$this->person_id
|
||||
);
|
||||
|
||||
if (hasData($openIssuesRes))
|
||||
{
|
||||
$openIssues = getData($openIssuesRes);
|
||||
|
||||
$result = $this->PlausicheckResolverLib->resolvePlausicheckIssues($openIssues);
|
||||
|
||||
// log if error, or log info if inserted new issue
|
||||
if (isset($result->errors))
|
||||
$this->errors = array_merge($this->errors, $result->errors);
|
||||
if (isset($result->infos))
|
||||
$this->infos = array_merge($this->infos, $result->infos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
|
||||
class Issues extends FHCAPI_Controller
|
||||
{
|
||||
const DEFAULT_PERMISSION = 'system/issues_verwalten:r';
|
||||
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
'getOpenIssuesByProperties' => Self::DEFAULT_PERMISSION,
|
||||
'getPersonenMitOffenenIssues' => Self::DEFAULT_PERMISSION
|
||||
)
|
||||
);
|
||||
|
||||
// Loads authentication library and starts authenticationfetc
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
$this->load->model('extensions/FHC-Core-Personalverwaltung/Api_model','ApiModel');
|
||||
$this->load->model('person/Person_model','PersonModel');
|
||||
$this->load->model('system/Fehler_model','FehlerModel');
|
||||
$this->load->model('system/Issue_model', 'IssueModel');
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
}
|
||||
|
||||
public function getOpenIssuesByProperties()
|
||||
{
|
||||
$person_id = $this->input->get('person_id', true);
|
||||
$oe_kurzbz = $this->input->get('oe_kurzbz', true);
|
||||
$fehlertyp_kurzbz = $this->input->get('fehlertyp_kurzbz', true);
|
||||
$apps = $this->input->get('apps', true);
|
||||
$behebung_parameter = $this->input->get('behebung_parameter', true);
|
||||
$hauptzustaendig = filter_var($this->input->get('hauptzustaendig', true), FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (isset($person_id) && !is_numeric($person_id))
|
||||
$this->terminateWithError('person id is not numeric!');
|
||||
|
||||
if (isset($behebung_parameter) && !is_array($behebung_parameter))
|
||||
$this->terminateWithError('Behebung parameter invalid');
|
||||
|
||||
$issueRes = $this->IssueModel->getOpenIssuesByProperties(
|
||||
$person_id,
|
||||
$oe_kurzbz,
|
||||
$fehlertyp_kurzbz,
|
||||
$apps,
|
||||
$behebung_parameter,
|
||||
$hauptzustaendig
|
||||
);
|
||||
|
||||
if (isError($issueRes))
|
||||
{
|
||||
$this->terminateWithError(getError($issueRes));
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess(hasData($issueRes) ? getData($issueRes) : []);
|
||||
}
|
||||
|
||||
public function getPersonenMitOffenenIssues()
|
||||
{
|
||||
|
||||
$sql = <<<EOSQL
|
||||
SELECT
|
||||
|
||||
person_id, uid, vorname, nachname, count(*) AS openissues ,
|
||||
(select count(*) anz_aktiv
|
||||
from hr.tbl_dienstverhaeltnis dv
|
||||
where dv.mitarbeiter_uid=uid and dv.von<=now() and
|
||||
(dv.bis is null OR dv.bis>=now())
|
||||
) aktiv
|
||||
FROM
|
||||
system.tbl_issue
|
||||
JOIN
|
||||
system.tbl_fehler USING (fehlercode)
|
||||
JOIN
|
||||
public.tbl_person USING (person_id)
|
||||
JOIN
|
||||
public.tbl_benutzer USING (person_id)
|
||||
JOIN
|
||||
public.tbl_mitarbeiter ON uid = mitarbeiter_uid
|
||||
WHERE
|
||||
app = 'personalverwaltung' AND verarbeitetamum IS NULL
|
||||
GROUP BY
|
||||
person_id, uid, vorname, nachname
|
||||
HAVING
|
||||
count(*) > 0
|
||||
ORDER BY
|
||||
count(*) DESC;
|
||||
|
||||
EOSQL;
|
||||
|
||||
$personenmitissues = $this->IssueModel->execReadOnlyQuery($sql);
|
||||
if( hasData($personenmitissues) )
|
||||
{
|
||||
$this->terminateWithSuccess(getData($personenmitissues));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->terminateWithSuccess(array());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH.'/controllers/api/frontend/v1/issues/IssueChecker.php';
|
||||
|
||||
class StudentIssueChecker extends IssueChecker
|
||||
{
|
||||
protected $_apps = array(
|
||||
'core',
|
||||
'dvuh',
|
||||
'bis'
|
||||
);
|
||||
|
||||
//protected $_fehlercodes = array(
|
||||
//~ 'CORE_AA_0001'
|
||||
//);
|
||||
}
|
||||
@@ -5,64 +5,46 @@
|
||||
*/
|
||||
class IssueResolver extends IssueResolver_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// set fehler codes which can be resolved by the job, with own resolver defined
|
||||
// structure: fehlercode => class (library) name for resolving in "resolvers" folder
|
||||
$this->_codeLibMappings = array(
|
||||
'CORE_ZGV_0001' => 'CORE_ZGV_0001',
|
||||
'CORE_ZGV_0002' => 'CORE_ZGV_0002',
|
||||
'CORE_ZGV_0003' => 'CORE_ZGV_0003',
|
||||
'CORE_ZGV_0004' => 'CORE_ZGV_0004',
|
||||
'CORE_ZGV_0005' => 'CORE_ZGV_0005',
|
||||
'CORE_INOUT_0001' => 'CORE_INOUT_0001',
|
||||
'CORE_INOUT_0002' => 'CORE_INOUT_0002',
|
||||
'CORE_INOUT_0003' => 'CORE_INOUT_0003',
|
||||
'CORE_INOUT_0004' => 'CORE_INOUT_0004',
|
||||
'CORE_INOUT_0005' => 'CORE_INOUT_0005',
|
||||
'CORE_INOUT_0006' => 'CORE_INOUT_0006',
|
||||
'CORE_INOUT_0007' => 'CORE_INOUT_0007',
|
||||
'CORE_INOUT_0008' => 'CORE_INOUT_0008',
|
||||
'CORE_INOUT_0009' => 'CORE_INOUT_0009',
|
||||
'CORE_STG_0001' => 'CORE_STG_0001',
|
||||
'CORE_STG_0002' => 'CORE_STG_0002',
|
||||
'CORE_STG_0003' => 'CORE_STG_0003',
|
||||
'CORE_STG_0004' => 'CORE_STG_0004',
|
||||
'CORE_STUDENTSTATUS_0002' => 'CORE_STUDENTSTATUS_0002',
|
||||
'CORE_STUDENTSTATUS_0003' => 'CORE_STUDENTSTATUS_0003',
|
||||
'CORE_STUDENTSTATUS_0004' => 'CORE_STUDENTSTATUS_0004',
|
||||
'CORE_STUDENTSTATUS_0005' => 'CORE_STUDENTSTATUS_0005',
|
||||
'CORE_STUDENTSTATUS_0006' => 'CORE_STUDENTSTATUS_0006',
|
||||
'CORE_STUDENTSTATUS_0007' => 'CORE_STUDENTSTATUS_0007',
|
||||
'CORE_STUDENTSTATUS_0008' => 'CORE_STUDENTSTATUS_0008',
|
||||
'CORE_STUDENTSTATUS_0009' => 'CORE_STUDENTSTATUS_0009',
|
||||
'CORE_STUDENTSTATUS_0010' => 'CORE_STUDENTSTATUS_0010',
|
||||
'CORE_STUDENTSTATUS_0011' => 'CORE_STUDENTSTATUS_0011',
|
||||
'CORE_STUDENTSTATUS_0012' => 'CORE_STUDENTSTATUS_0012',
|
||||
'CORE_STUDENTSTATUS_0013' => 'CORE_STUDENTSTATUS_0013',
|
||||
'CORE_STUDENTSTATUS_0014' => 'CORE_STUDENTSTATUS_0014',
|
||||
'CORE_STUDENTSTATUS_0015' => 'CORE_STUDENTSTATUS_0015',
|
||||
'CORE_STUDENTSTATUS_0016' => 'CORE_STUDENTSTATUS_0016',
|
||||
'CORE_PERSON_0001' => 'CORE_PERSON_0001',
|
||||
'CORE_PERSON_0002' => 'CORE_PERSON_0002',
|
||||
'CORE_PERSON_0003' => 'CORE_PERSON_0003',
|
||||
'CORE_PERSON_0004' => 'CORE_PERSON_0004',
|
||||
'CORE_PERSON_0005' => 'CORE_PERSON_0005',
|
||||
'CORE_PERSON_0006' => 'CORE_PERSON_0006'
|
||||
);
|
||||
|
||||
// fehler which are resolved by the job the same way as they are produced
|
||||
// structure: fehlercode => class (library) name for resolving in "plausichecks" folder
|
||||
$this->_codeProducerLibMappings = array(
|
||||
'CORE_STUDENTSTATUS_0001' => 'AbbrecherAktiv',
|
||||
'CORE_STUDENTSTATUS_0017' => 'BeginndatumVorBismeldung',
|
||||
'CORE_STUDENTSTATUS_0018' => 'StudentstatusNachDiplomand',
|
||||
'CORE_STUDENTSTATUS_0019' => 'OrgformBewerberUngleichOrgformStudent',
|
||||
'CORE_STUDENTSTATUS_0020' => 'StartsemesterUngleichPersonenkennzeichen',
|
||||
'CORE_STUDENTSTATUS_0021' => 'AbschlusspruefungOderAbsolventFehlt',
|
||||
'CORE_STUDENTSTATUS_0022' => 'FalscheStatusabfolgeVorStudentstatus'
|
||||
);
|
||||
}
|
||||
protected $_fehlercodes = array(
|
||||
'CORE_ZGV_0001',
|
||||
'CORE_ZGV_0002',
|
||||
'CORE_ZGV_0003',
|
||||
'CORE_ZGV_0004',
|
||||
'CORE_ZGV_0005',
|
||||
'CORE_INOUT_0001',
|
||||
'CORE_INOUT_0002',
|
||||
'CORE_INOUT_0003',
|
||||
'CORE_INOUT_0004',
|
||||
'CORE_INOUT_0005',
|
||||
'CORE_INOUT_0006',
|
||||
'CORE_INOUT_0007',
|
||||
'CORE_INOUT_0008',
|
||||
'CORE_INOUT_0009',
|
||||
'CORE_STG_0001',
|
||||
'CORE_STG_0002',
|
||||
'CORE_STG_0003',
|
||||
'CORE_STG_0004',
|
||||
'CORE_STUDENTSTATUS_0001',
|
||||
'CORE_STUDENTSTATUS_0002',
|
||||
'CORE_STUDENTSTATUS_0003',
|
||||
'CORE_STUDENTSTATUS_0004',
|
||||
'CORE_STUDENTSTATUS_0005',
|
||||
'CORE_STUDENTSTATUS_0006',
|
||||
'CORE_STUDENTSTATUS_0007',
|
||||
'CORE_STUDENTSTATUS_0008',
|
||||
'CORE_STUDENTSTATUS_0009',
|
||||
'CORE_STUDENTSTATUS_0010',
|
||||
'CORE_STUDENTSTATUS_0011',
|
||||
'CORE_STUDENTSTATUS_0012',
|
||||
'CORE_STUDENTSTATUS_0013',
|
||||
'CORE_STUDENTSTATUS_0014',
|
||||
'CORE_STUDENTSTATUS_0015',
|
||||
'CORE_STUDENTSTATUS_0016',
|
||||
'CORE_PERSON_0001',
|
||||
'CORE_PERSON_0002',
|
||||
'CORE_PERSON_0003',
|
||||
'CORE_PERSON_0004',
|
||||
'CORE_PERSON_0005',
|
||||
'CORE_PERSON_0006'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
class PlausiIssueProducer extends PlausiIssueProducer_Controller
|
||||
{
|
||||
private $_currentStudiensemester;
|
||||
protected $_app = 'core';
|
||||
protected $_apps = 'core';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -18,12 +18,12 @@ class PlausiIssueProducer extends PlausiIssueProducer_Controller
|
||||
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
// get current Studiensemester
|
||||
$studiensemesterRes = $this->StudiensemesterModel->getAkt();
|
||||
$studiensemesterRes = $this->StudiensemesterModel->getAktOrNextSemester(62);
|
||||
if (hasData($studiensemesterRes)) $this->_currentStudiensemester = getData($studiensemesterRes)[0]->studiensemester_kurzbz;
|
||||
|
||||
// set fehler which can be produced by the job
|
||||
// structure: fehler_kurzbz => class (library) name for resolving
|
||||
$this->_fehlerLibMappings = $this->plausicheckdefinitionlib->getFehlerLibMappings();
|
||||
$this->_fehlerKurzbz = $this->plausicheckdefinitionlib->getFehlerKurzbz();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2024 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class CLI_Manager extends CLI_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('FehlerUpdateLib');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installAll()
|
||||
{
|
||||
$this->fehlerupdatelib->installAll();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFromCore()
|
||||
{
|
||||
$this->fehlerupdatelib->installFromCore();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFrom($extensionName)
|
||||
{
|
||||
$this->fehlerupdatelib->installFrom(urldecode($extensionName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Manager extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'installAll' => 'admin:rw',
|
||||
'installFromCore' => 'admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('FehlerUpdateLib');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installAll()
|
||||
{
|
||||
$this->fehlerupdatelib->installAll();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFromCore()
|
||||
{
|
||||
$this->fehlerupdatelib->installFromCore();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function installFrom($fehlerConfigDirectory)
|
||||
{
|
||||
$this->fehlerupdatelib->installFrom($fehlerConfigDirectory);
|
||||
}
|
||||
}
|
||||
@@ -88,9 +88,11 @@ class IssuesKonfiguration extends Auth_Controller
|
||||
|
||||
// get all Fehler, optionally filtered by app
|
||||
$params = array('fehlercode_extern' => null);
|
||||
$this->FehlerModel->addDistinct();
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertyp_kurzbz, fehlertext');
|
||||
$this->FehlerModel->addJoin('system.tbl_fehler_app', 'fehlercode');
|
||||
$this->FehlerModel->addOrder('fehlercode');
|
||||
if (!isEmptyString($app)) $params['app'] = $app;
|
||||
if (!isEmptyString($app)) $params['tbl_fehler_app.app'] = $app;
|
||||
$fehlerRes = $this->FehlerModel->loadWhere($params);
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerFehlerLaden'));
|
||||
|
||||
@@ -69,10 +69,7 @@ class IssuesZustaendigkeiten extends Auth_Controller
|
||||
{
|
||||
$app = $this->input->get('app');
|
||||
|
||||
$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertext, fehlertyp_kurzbz, app');
|
||||
$this->FehlerModel->addOrder('fehlercode');
|
||||
|
||||
$fehlerRes = isset($app) ? $this->FehlerModel->loadWhere(array('app' => $app)) : $this->FehlerModel->load();
|
||||
$fehlerRes = $this->FehlerModel->getByApps($app);
|
||||
|
||||
$this->outputJson($fehlerRes);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Plausichecks extends Auth_Controller
|
||||
{
|
||||
const GENERIC_ISSUE_OCCURED_TEXT = 'Issue aufgetreten';
|
||||
const APPS = ['core', 'dvuh', 'bis'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -16,8 +17,7 @@ class Plausichecks extends Auth_Controller
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('app' => 'core'));
|
||||
$this->load->library('issues/PlausicheckDefinitionLib');
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('apps' => self::APPS));
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Load models
|
||||
@@ -46,37 +46,31 @@ class Plausichecks extends Auth_Controller
|
||||
|
||||
// issues array for passing issue texts
|
||||
$allIssues = array();
|
||||
// all fehler kurzbz which are going to be checked
|
||||
$fehlerKurzbz = !isEmptyString($fehler_kurzbz) ? array($fehler_kurzbz) : $this->plausicheckdefinitionlib->getFehlerKurzbz();
|
||||
$fehlerLibMappings = $this->plausicheckdefinitionlib->getFehlerLibMappings();
|
||||
|
||||
$fehler_kurzbz_arr = isEmptyString($fehler_kurzbz) ? array_keys($this->plausicheckproducerlib->getFehlerMappings()) : [$fehler_kurzbz];
|
||||
|
||||
$this->FehlerModel->addOrder('fehler_kurzbz, fehlercode');
|
||||
$this->FehlerModel->db->where_in('fehler_kurzbz', $fehler_kurzbz_arr);
|
||||
$fehlerRes = $this->FehlerModel->load();
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError(getError($fehlerRes));
|
||||
if (!hasData($fehlerRes)) return $this->outputJsonSuccess([]);
|
||||
|
||||
// all fehler which are going to be checked
|
||||
$fehlerArr = getData($fehlerRes);
|
||||
|
||||
// set Studiengang to null if not passed
|
||||
if (isEmptyString($studiengang_kz)) $studiengang_kz = null;
|
||||
|
||||
// get the data returned by Plausicheck
|
||||
foreach ($fehlerKurzbz as $fehler_kurzbz)
|
||||
foreach ($fehlerArr as $fehler)
|
||||
{
|
||||
// get Text and fehlercode of the Fehler
|
||||
$this->FehlerModel->addSelect('fehlercode, fehlertext, fehlertyp_kurzbz');
|
||||
$fehlerRes = $this->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
|
||||
|
||||
if (isError($fehlerRes)) $this->terminateWithJsonError(getError($fehlerRes));
|
||||
|
||||
// do not check error if no data
|
||||
if (!hasData($fehlerRes)) continue;
|
||||
|
||||
// get the error data
|
||||
$fehler = getData($fehlerRes)[0];
|
||||
|
||||
// initialize issue array
|
||||
$allIssues[$fehler_kurzbz] = array('fehlercode' => $fehler->fehlercode, 'data' => array());
|
||||
|
||||
// get library name for producing issue
|
||||
$libName = $fehlerLibMappings[$fehler_kurzbz];
|
||||
$allIssues[$fehler->fehler_kurzbz] = array('fehlercode' => $fehler->fehlercode, 'data' => array());
|
||||
|
||||
// execute the check
|
||||
$plausicheckRes = $this->plausicheckproducerlib->producePlausicheckIssue(
|
||||
$libName,
|
||||
$fehler_kurzbz,
|
||||
$fehler->fehler_kurzbz,
|
||||
array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'studiengang_kz' => $studiengang_kz
|
||||
@@ -107,7 +101,7 @@ class Plausichecks extends Auth_Controller
|
||||
{
|
||||
// replace placeholder with params, if present
|
||||
if (count($fehlertext_params) != substr_count($fehlerText, '%s'))
|
||||
$this->terminateWithJsonError('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehler_kurzbz);
|
||||
$this->terminateWithJsonError('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehler->fehler_kurzbz);
|
||||
|
||||
$fehlerText = vsprintf($fehlerText, $fehlertext_params);
|
||||
}
|
||||
@@ -118,7 +112,7 @@ class Plausichecks extends Auth_Controller
|
||||
$issueObj = new StdClass();
|
||||
$issueObj->fehlertext = $fehlerText;
|
||||
$issueObj->type = $fehlerTyp;
|
||||
$allIssues[$fehler_kurzbz]['data'][] = $issueObj;
|
||||
$allIssues[$fehler->fehler_kurzbz]['data'][] = $issueObj;
|
||||
}
|
||||
else // if no issue text found, use generic text
|
||||
{
|
||||
@@ -157,7 +151,7 @@ class Plausichecks extends Auth_Controller
|
||||
|
||||
if (isError($studiengaengeRes)) show_error(getError($studiengaengeRes));
|
||||
|
||||
$fehlerKurzbz = $this->plausicheckdefinitionlib->getFehlerKurzbz();
|
||||
$fehlerKurzbz = array_keys($this->plausicheckproducerlib->getFehlerMappings());
|
||||
|
||||
$db = new DB_Model();
|
||||
|
||||
@@ -168,7 +162,9 @@ class Plausichecks extends Auth_Controller
|
||||
FROM
|
||||
system.tbl_fehler
|
||||
WHERE
|
||||
fehler_kurzbz IN ?',
|
||||
fehler_kurzbz IN ?
|
||||
ORDER BY
|
||||
fehler_kurzbz, fehlercode',
|
||||
array($fehlerKurzbz)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user