mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
fehler/issue monitoring: enabled resolving/producing by app only, improved error messages, code layout, removed error: fehler to produce is not defined in config
This commit is contained in:
@@ -243,7 +243,7 @@ class IssuesLib
|
||||
$inhalt_extern = null
|
||||
) {
|
||||
if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
|
||||
return error("Person_id or oe_kurzbz must be set.");
|
||||
return error("Person_id or oe_kurzbz must be set, fehlercode: $fehlercode");
|
||||
|
||||
// get fehlertextVorlage and replace it with params
|
||||
$fehlerRes = $this->_ci->FehlerModel->loadWhere(['fehlercode' => $fehlercode]);
|
||||
@@ -256,7 +256,7 @@ class IssuesLib
|
||||
if (!isEmptyArray($fehlertext_params))
|
||||
{
|
||||
if (count($fehlertext_params) != substr_count($fehlertextVorlage, '%s'))
|
||||
return error('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehlercode);
|
||||
return error('Wrong number of parameters for Fehlertext, fehlercode ' . $fehlercode);
|
||||
|
||||
$fehlertext = vsprintf($fehlertextVorlage, $fehlertext_params);
|
||||
}
|
||||
|
||||
@@ -61,14 +61,10 @@ class PlausicheckProducerLib
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_ci->FehlerModel->addSelect('fehler_kurzbz');
|
||||
if (!isEmptyArray($this->_apps)) $this->_ci->FehlerModel->db->where_in('app', $this->_apps);
|
||||
$fehlerRes = $this->_ci->FehlerModel->load();
|
||||
// get fehler by apps
|
||||
$fehlerRes = $this->_ci->FehlerModel->getByApps($this->_apps);
|
||||
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$this->_fehlerKurzbz = array_column(getData($fehlerRes), 'fehler_kurzbz');
|
||||
}
|
||||
if (hasData($fehlerRes)) $this->_fehlerKurzbz = array_column(getData($fehlerRes), 'fehler_kurzbz');
|
||||
}
|
||||
|
||||
// get producer file paths for the fehler
|
||||
@@ -151,10 +147,10 @@ class PlausicheckProducerLib
|
||||
$mappingFehlerKurbz = array_keys($this->_fehlerLibMappings);
|
||||
|
||||
// check if all issues to produce could be found in database
|
||||
$notFoundFehlerKurzbz = array_diff($this->_fehlerKurzbz, $mappingFehlerKurbz);
|
||||
//~ $notFoundFehlerKurzbz = array_diff($this->_fehlerKurzbz, $mappingFehlerKurbz);
|
||||
|
||||
if (!isEmptyArray($notFoundFehlerKurzbz))
|
||||
$result->errors[] = error('Fehler to produce not defined in config: '.implode(', ', $notFoundFehlerKurzbz));
|
||||
//~ if (!isEmptyArray($notFoundFehlerKurzbz))
|
||||
//~ $result->errors[] = error('Fehler to produce not defined in config: '.implode(', ', $notFoundFehlerKurzbz));
|
||||
|
||||
foreach ($mappingFehlerKurbz as $fehler_kurzbz)
|
||||
{
|
||||
|
||||
@@ -20,18 +20,36 @@ class PlausicheckResolverLib
|
||||
private $_ci; // ci instance
|
||||
private $_extensionName; // name of extension
|
||||
private $_fehlercodes = []; // name of extension
|
||||
private $_apps = []; // apps for which issues should be resolved
|
||||
private $_codeLibMappings = []; // mappings for issues which explicitly defined resolver
|
||||
private $_defaultIssueParams = ['issue_id' => 'issue_id', 'issue_person_id' => 'person_id', 'issue_oe_kurzbz' => 'oe_kurzbz'];
|
||||
|
||||
public function __construct($params = null)
|
||||
{
|
||||
// set application(s))
|
||||
if (isset($params['apps']))
|
||||
{
|
||||
if (is_string($params['apps'])) $params['apps'] = [$params['apps']];
|
||||
if (is_array($params['apps'])) $this->_apps = $params['apps'];
|
||||
}
|
||||
|
||||
$this->_ci =& get_instance(); // get ci instance
|
||||
|
||||
// get all fehler to be produced (by kurzbz array or app)
|
||||
if (isset($params['fehlercodes']) && !isEmptyArray($params['fehlercodes']))
|
||||
{
|
||||
$this->_fehlercodes = $params['fehlercodes'];
|
||||
}
|
||||
elseif (isset($params['apps']) && !isEmptyArray($params['apps']))
|
||||
{
|
||||
$this->_ci->load->model('system/Fehler_model', 'FehlerModel');
|
||||
$fehlerRes = $this->_ci->FehlerModel->getByApps($this->_apps);
|
||||
|
||||
$this->_ci =& get_instance(); // get ci instance
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$this->_fehlercodes = array_column(getData($fehlerRes), 'fehlercode');
|
||||
}
|
||||
}
|
||||
|
||||
$this->_ci->load->library('IssuesLib');
|
||||
$this->_ci->load->library('ExtensionsLib');
|
||||
@@ -144,11 +162,11 @@ class PlausicheckResolverLib
|
||||
$result->infos = [];
|
||||
|
||||
// check if all issues to resolve could be found in database
|
||||
$mappingFehlerCodes = array_keys($this->_codeLibMappings);
|
||||
$notFoundFehlerCodes = array_diff($this->_fehlercodes, $mappingFehlerCodes);
|
||||
//~ $mappingFehlerCodes = array_keys($this->_codeLibMappings);
|
||||
//~ $notFoundFehlerCodes = array_diff($this->_fehlercodes, $mappingFehlerCodes);
|
||||
|
||||
if (!isEmptyArray($notFoundFehlerCodes))
|
||||
$result->errors[] = error('Fehler to resolve not defined in config: '.implode(', ', $notFoundFehlerCodes));
|
||||
//~ if (!isEmptyArray($notFoundFehlerCodes))
|
||||
//~ $result->errors[] = error('Fehler to resolve not defined in config: '.implode(', ', $notFoundFehlerCodes));
|
||||
|
||||
foreach ($openIssues as $issue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user