mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 00:54:27 +00:00
issues: enabled resolving without explicitely creating a resolver (by using producer method), old resolvers are still working. Created example for "self-resolving" issue: AbbrecherAktiv
This commit is contained in:
@@ -5,18 +5,18 @@
|
||||
*/
|
||||
abstract class IssueResolver_Controller extends JOB_Controller
|
||||
{
|
||||
protected $_codeLibMappings;
|
||||
// mappings in form fehlercode -> resolverlibrary name, fehler which have explicit resolver class defined
|
||||
protected $_codeLibMappings = [];
|
||||
|
||||
// mappings in form fehlercode -> producer library name, fehler which are resolved the same way they are produced
|
||||
protected $_codeProducerLibMappings = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// pass extension name if calling from extension
|
||||
$extensionName = isset($this->_extensionName) ? $this->_extensionName : null;
|
||||
|
||||
$this->load->model('system/Issue_model', 'IssueModel');
|
||||
|
||||
$this->load->library('issues/PlausicheckResolverLib', ['extensionName' => $extensionName]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,14 +24,25 @@ abstract class IssueResolver_Controller extends JOB_Controller
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->load->library(
|
||||
'issues/PlausicheckResolverLib',
|
||||
[
|
||||
'extensionName' => $this->_extensionName ?? null,
|
||||
'codeLibMappings' => $this->_codeLibMappings,
|
||||
'codeProducerLibMappings' => $this->_codeProducerLibMappings
|
||||
]
|
||||
);
|
||||
|
||||
$this->logInfo("Issue resolve job started");
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(array_keys($this->_codeLibMappings));
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(
|
||||
array_merge(array_keys($this->_codeLibMappings), array_keys($this->_codeProducerLibMappings))
|
||||
);
|
||||
|
||||
$openIssues = hasData($openIssuesRes) ? getData($openIssuesRes) : [];
|
||||
|
||||
$result = $this->plausicheckresolverlib->resolvePlausicheckIssues($this->_codeLibMappings, $openIssues);
|
||||
$result = $this->plausicheckresolverlib->resolvePlausicheckIssues($openIssues);
|
||||
|
||||
// log if error, or log info if inserted new issue
|
||||
foreach ($result->errors as $error) $this->logError($error);
|
||||
|
||||
Reference in New Issue
Block a user