mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
issues: changed logic to read producable issues from config file
This commit is contained in:
@@ -7,8 +7,7 @@ class IssueChecker extends FHCAPI_Controller
|
||||
|
||||
protected $person_id;
|
||||
protected $_extensionName = null;
|
||||
protected $_codeLibMappings = [];
|
||||
protected $_codeProducerLibMappings = [];
|
||||
protected $_fehlercodes = [];
|
||||
protected $_app = null;
|
||||
|
||||
protected $errors = [];
|
||||
@@ -25,13 +24,40 @@ class IssueChecker extends FHCAPI_Controller
|
||||
{
|
||||
$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');
|
||||
|
||||
// get fehler kurzbz from fehlercodes
|
||||
$this->FehlerModel->addSelect('fehler_kurzbz');
|
||||
if (!isEmptyArray($this->_fehlercodes))$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);
|
||||
|
||||
$fehlerKurzbz = hasData($fehlerKurzbzRes) ? array_column(getData($fehlerKurzbzRes), 'fehler_kurzbz') : [];
|
||||
|
||||
// load producer and checker libraries with fehler kurbz and fehlercode list
|
||||
$this->load->library(
|
||||
'issues/PlausicheckProducerLib',
|
||||
array(
|
||||
'fehlerKurzbz' => $fehlerKurzbz
|
||||
),
|
||||
'PlausicheckProducerLib'
|
||||
);
|
||||
|
||||
$this->load->library(
|
||||
'issues/PlausicheckResolverLib',
|
||||
array(
|
||||
'fehlercodes' => $this->_fehlercodes
|
||||
),
|
||||
'PlausicheckResolverLib'
|
||||
);
|
||||
}
|
||||
|
||||
public function checkPerson()
|
||||
@@ -47,32 +73,11 @@ class IssueChecker extends FHCAPI_Controller
|
||||
$persRes = $this->PersonModel->load($this->person_id);
|
||||
if (!hasData($persRes)) $this->terminateWithError('Person with id ' . $this->person_id . ' not found.', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$allCodeLibMappings = array_merge($this->_codeLibMappings, $this->_codeProducerLibMappings);
|
||||
|
||||
$this->load->library(
|
||||
'issues/PlausicheckProducerLib',
|
||||
array(
|
||||
'extensionName' => $this->_extensionName,
|
||||
'codeLibMappings' => $allCodeLibMappings
|
||||
),
|
||||
'PlausicheckProducerLib'
|
||||
);
|
||||
|
||||
$this->load->library(
|
||||
'issues/PlausicheckResolverLib',
|
||||
array(
|
||||
'extensionName' => $this->_extensionName,
|
||||
'codeLibMappings' => $this->_codeLibMappings,
|
||||
'codeProducerLibMappings' => $this->_codeProducerLibMappings
|
||||
),
|
||||
'PlausicheckResolverLib'
|
||||
);
|
||||
|
||||
$this->_produceIssues();
|
||||
$this->_resolveIssues();
|
||||
$this->_produceIssues();
|
||||
|
||||
$openIssueCountRes = $this->_countOpenIssues(array_keys($allCodeLibMappings));
|
||||
$openIssueCountRes = $this->_countOpenIssues();
|
||||
if (isError($openIssueCountRes)) $this->terminateWithError(getError($openIssueCountRes), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$data = array(
|
||||
@@ -100,7 +105,7 @@ class IssueChecker extends FHCAPI_Controller
|
||||
|
||||
if (!hasData($persRes)) $this->terminateWithError('Person with id ' . $this->person_id . ' not found.', self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$openIssueCountRes = $this->_countOpenIssues(array_keys(array_merge($this->_codeLibMappings, $this->_codeProducerLibMappings)));
|
||||
$openIssueCountRes = $this->_countOpenIssues();
|
||||
if (isError($openIssueCountRes)) $this->terminateWithError(getError($openIssueCountRes), self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$data = array(
|
||||
@@ -114,13 +119,13 @@ class IssueChecker extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
protected function _countOpenIssues($fehlercodes)
|
||||
protected function _countOpenIssues()
|
||||
{
|
||||
if (isEmptyArray($fehlercodes)) return success([]);
|
||||
if (isEmptyArray($this->_fehlercodes)) return success([]);
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
$fehlercodes,
|
||||
$this->_fehlercodes,
|
||||
$this->person_id,
|
||||
$oe_kurzbz = null,
|
||||
$fehlercode_extern = null,
|
||||
@@ -138,10 +143,6 @@ class IssueChecker extends FHCAPI_Controller
|
||||
|
||||
protected function _produceIssues()
|
||||
{
|
||||
if (isEmptyArray($this->_codeLibMappings) && isEmptyArray($this->_codeProducerLibMappings)) return success([]);
|
||||
|
||||
$allCodeLibMappings = array_merge($this->_codeLibMappings, $this->_codeProducerLibMappings);
|
||||
|
||||
$result = $this->PlausicheckProducerLib->producePlausicheckIssues(
|
||||
array('person_id' => $this->person_id)
|
||||
);
|
||||
@@ -157,7 +158,7 @@ class IssueChecker extends FHCAPI_Controller
|
||||
{
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
array_keys(array_merge($this->_codeLibMappings, $this->_codeProducerLibMappings)),
|
||||
$this->_fehlercodes,
|
||||
$this->person_id
|
||||
);
|
||||
|
||||
|
||||
@@ -5,58 +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',
|
||||
);
|
||||
}
|
||||
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()
|
||||
{
|
||||
@@ -23,7 +23,7 @@ class PlausiIssueProducer extends PlausiIssueProducer_Controller
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ class Plausichecks extends Auth_Controller
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('app' => 'core'));
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('apps' => 'core'));
|
||||
$this->load->library('issues/PlausicheckDefinitionLib');
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
@@ -46,9 +46,10 @@ 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();
|
||||
|
||||
// set Studiengang to null if not passed
|
||||
if (isEmptyString($studiengang_kz)) $studiengang_kz = null;
|
||||
|
||||
@@ -70,12 +71,8 @@ class Plausichecks extends Auth_Controller
|
||||
// initialize issue array
|
||||
$allIssues[$fehler_kurzbz] = array('fehlercode' => $fehler->fehlercode, 'data' => array());
|
||||
|
||||
// get library name for producing issue
|
||||
$libName = $fehlerLibMappings[$fehler_kurzbz];
|
||||
|
||||
// execute the check
|
||||
$plausicheckRes = $this->plausicheckproducerlib->producePlausicheckIssue(
|
||||
$libName,
|
||||
$fehler_kurzbz,
|
||||
array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
|
||||
Reference in New Issue
Block a user