Plausichecks: added run method to IssueProducer_Controller for producing plausicheck issues

This commit is contained in:
KarpAlex
2022-09-18 23:02:55 +02:00
parent d5eff7d615
commit 40d8edebef
7 changed files with 156 additions and 64 deletions
+1 -1
View File
@@ -17,5 +17,5 @@ interface IIssueExistsChecker
* @param array $params parameters needed for issue detection
* @return object with success(true) if issue exists, success(false) otherwise
*/
public function produceIssue($person_id, $oe_kurzbz, $paramsForProducing);
//public function produceIssue($person_id, $oe_kurzbz, $paramsForProducing);
}
+38 -34
View File
@@ -23,49 +23,53 @@ abstract class IssueProducer_Controller extends JOB_Controller
/**
* Initializes issue production.
*/
public function produceIssue($fehler_kurzbz, $person_id, $oe_kurzbz, $paramsForChecking, $paramsForProduction)
{
// get libname from fehler_kurzbz
$libName = $this->_fehlerLibMappings[$fehler_kurzbz];
//public function produceIssue($fehler_kurzbz, $person_id, $oe_kurzbz, $paramsForChecking, $paramsForProduction)
//{
//// get libname from fehler_kurzbz
//$libName = $this->_fehlerLibMappings[$fehler_kurzbz];
// if called from extension (extension name set), path includes extension names, otherwise it is the core library folder
$libRootPath = isset($this->_extensionName) ? 'extensions/' . $this->_extensionName . '/' : '';
$issuesLibPath = $libRootPath . self::ISSUES_FOLDER . '/';
$issuesLibFilePath = DOC_ROOT . 'application/' . $libRootPath . 'libraries/' . self::ISSUES_FOLDER . '/' . $libName . '.php';
//// if called from extension (extension name set), path includes extension names, otherwise it is the core library folder
//$libRootPath = isset($this->_extensionName) ? 'extensions/' . $this->_extensionName . '/' : '';
//$issuesLibPath = $libRootPath . self::ISSUES_FOLDER . '/';
//$issuesLibFilePath = DOC_ROOT . 'application/' . $libRootPath . 'libraries/' . self::ISSUES_FOLDER . '/' . $libName . '.php';
// check if library file exists
if (!file_exists($issuesLibFilePath)) return error("Issue library file " . $issuesLibFilePath . " does not exist");
//// check if library file exists
//if (!file_exists($issuesLibFilePath)) return error("Issue library file " . $issuesLibFilePath . " does not exist");
// load library connected to fehler_kurzbz
$this->load->library($issuesLibPath . $libName);
//// load library connected to fehler_kurzbz
//$this->load->library($issuesLibPath . $libName);
$lowercaseLibName = mb_strtolower($libName);
//$lowercaseLibName = mb_strtolower($libName);
// check if method is defined in library class
if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_EXISTS_METHOD_NAME)))
return error("Method " . self::CHECK_ISSUE_EXISTS_METHOD_NAME . " is not defined in library $lowercaseLibName");
//// check if method is defined in library class
//if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_EXISTS_METHOD_NAME)))
//return error("Method " . self::CHECK_ISSUE_EXISTS_METHOD_NAME . " is not defined in library $lowercaseLibName");
// call the function for checking for issue resolution
$issueExistsRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_EXISTS_METHOD_NAME}($paramsForChecking);
//// call the function for checking for issue resolution
//$issueExistsRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_EXISTS_METHOD_NAME}($paramsForChecking);
if (isError($issueExistsRes)) return $issueExistsRes;
//if (isError($issueExistsRes)) return $issueExistsRes;
$issueExistsData = getData($issueExistsRes);
//$issueExistsData = getData($issueExistsRes);
if ($issueExistsData === true)
{
// write issue if it was detected
$produceRes = $this->{$lowercaseLibName}->{self::PRODUCE_ISSUE_METHOD_NAME}(
$fehler_kurzbz,
isset($params['person_id']) ? $params['person_id'] : null,
isset($params['oe_kurzbz']) ? $params['oe_kurzbz'] : null,
$paramsForProduction
);
//if ($issueExistsData === true)
//{
//// write issue if it was detected
////$produceRes = $this->{$lowercaseLibName}->{self::PRODUCE_ISSUE_METHOD_NAME}(
////$fehler_kurzbz,
////isset($params['person_id']) ? $params['person_id'] : null,
////isset($params['oe_kurzbz']) ? $params['oe_kurzbz'] : null,
////$paramsForProduction
////);
if (isError($produceRes))
return $produceRes;
////if (isError($produceRes))
////return $produceRes;
return success("Issue " . $issue->issue_id . " successfully written");
}
}
//$addIssueres = $this->IssuesLib->addFhcIssue($fehler_kurzbz, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params);
//if (isError())
//return success("Issue " . $issue->issue_id . " successfully written");
//}
//}
}
@@ -43,7 +43,6 @@ abstract class IssueResolver_Controller extends JOB_Controller
}
else
{
$openIssues = getData($openIssuesRes);
foreach ($openIssues as $issue)