mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
added UHSTAT issue resolvers, bugfix getuhstatdata: check for empty array
This commit is contained in:
@@ -48,7 +48,9 @@ class IssueResolver extends IssueResolver_Controller
|
||||
'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_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
|
||||
|
||||
@@ -13,7 +13,7 @@ class PlausicheckResolverLib
|
||||
private $_ci; // ci instance
|
||||
private $_extensionName; // name of extension
|
||||
private $_codeLibMappings = []; // mappings for issues which explicitly defined resolver
|
||||
private $_codeProducerLibMappings = []; // mappings for issues which are resolved as produced
|
||||
private $_codeProducerLibMappings = []; // mappings for issues which are resolved with the same check as they are produced
|
||||
|
||||
public function __construct($params = null)
|
||||
{
|
||||
@@ -99,10 +99,11 @@ class PlausicheckResolverLib
|
||||
$issueResolved = getData($issueResolvedRes) === true;
|
||||
}
|
||||
}
|
||||
elseif (isset($this->_codeProducerLibMappings[$issue->fehlercode]))
|
||||
elseif (isset($this->_codeProducerLibMappings[$issue->fehlercode])) // check if it is an issue without explicit resolver, "self-resolving"
|
||||
{
|
||||
$libName = $this->_codeProducerLibMappings[$issue->fehlercode];
|
||||
|
||||
// execute same check as used for issue production
|
||||
$issueResolvedRes = $this->_ci->plausicheckproducerlib->producePlausicheckIssue(
|
||||
$libName,
|
||||
$issue->fehler_kurzbz,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Geburtsnation missing
|
||||
*/
|
||||
class CORE_PERSON_0005 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
|
||||
return error('Person Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
// load geburtsnation for the given person
|
||||
$this->_ci->PersonModel->addSelect('geburtsnation');
|
||||
$personRes = $this->_ci->PersonModel->load($params['issue_person_id']);
|
||||
|
||||
if (isError($personRes)) return $personRes;
|
||||
|
||||
if (hasData($personRes))
|
||||
{
|
||||
// get person data
|
||||
$personData = getData($personRes)[0];
|
||||
|
||||
// if geburtsnation present, issue is resolved
|
||||
return success(!isEmptyString($personData->geburtsnation));
|
||||
}
|
||||
else
|
||||
return success(false); // if no person found, not resolved
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Geburtsnation missing
|
||||
*/
|
||||
class CORE_PERSON_0006 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
|
||||
return error('Person Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Uhstat1daten_model', 'UhstatModel');
|
||||
|
||||
$personRes = $this->_ci->UhstatModel->getUHSTAT1PersonData([$params['issue_person_id']]);
|
||||
|
||||
if (isError($personRes)) return $personRes;
|
||||
|
||||
if (hasData($personRes))
|
||||
{
|
||||
// get person data
|
||||
$personData = getData($personRes)[0];
|
||||
|
||||
// if person identification data present, issue is resolved
|
||||
return success(
|
||||
!isEmptyString($personData->ersatzkennzeichen)
|
||||
|| (!isEmptyString($personData->vbpkAs) && !isEmptyString($personData->vbpkBf))
|
||||
);
|
||||
}
|
||||
else
|
||||
return success(false); // if no person found, not resolved
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ class Uhstat1daten_model extends DB_Model
|
||||
*/
|
||||
public function getUHSTAT1PersonData($person_id_arr)
|
||||
{
|
||||
if (!isset($person_id_arr) || isEmptyArray($person_id_arr)) return success([]);
|
||||
|
||||
$params = array($person_id_arr);
|
||||
|
||||
$prstQry = "SELECT
|
||||
|
||||
@@ -324,6 +324,22 @@ $fehlerArr = array(
|
||||
'fehlertext' => 'Es sind mehrere oder keine Zustelladressen eingetragen',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core'
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0005',
|
||||
'fehler_kurzbz' => 'geburtsnationFehlt',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Geburtsnation nicht vorhanden',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core'
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0006',
|
||||
'fehler_kurzbz' => 'uhstatPersonkennungFehlt',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Personkennung fehlt (vBpk AS, vBpk BF oder Ersatzkennzeichen fehlt)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core'
|
||||
)
|
||||
/** Plausichecks end **/
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user