mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
added Plausicheck CORE_STUDENTSTATUS_0015 for finding persons without Konto Buchungen (charges), Plausichecks GUI: generic plausicheck error text is displayed if not defined erroroccured, instead of success message
This commit is contained in:
@@ -44,6 +44,7 @@ class IssueResolver extends IssueResolver_Controller
|
||||
'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_PERSON_0001' => 'CORE_PERSON_0001',
|
||||
'CORE_PERSON_0002' => 'CORE_PERSON_0002',
|
||||
'CORE_PERSON_0003' => 'CORE_PERSON_0003',
|
||||
|
||||
@@ -4,6 +4,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Plausichecks extends Auth_Controller
|
||||
{
|
||||
const GENERIC_ISSUE_OCCURED_TEXT = 'Issue aufgetreten';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
@@ -78,20 +80,27 @@ class Plausichecks extends Auth_Controller
|
||||
// optionally replace fehler parameters in text, output the fehlertext
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
// use issue fehler text from database if present
|
||||
$fehlerText = getData($fehlerRes)[0]->fehlertext;
|
||||
|
||||
if (!isEmptyArray($fehlertext_params))
|
||||
{
|
||||
// replace placeholder with params, if present
|
||||
if (count($fehlertext_params) != substr_count($fehlerText, '%s'))
|
||||
$this->terminateWithJsonError('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehler_kurzbz);
|
||||
|
||||
$fehlerText = vsprintf($fehlerText, $fehlertext_params);
|
||||
}
|
||||
|
||||
if (isset($person_id)) $fehlerText .= "; person_id: $person_id";
|
||||
if (isset($oe_kurzbz)) $fehlerText .= "; oe_kurzbz: $oe_kurzbz";
|
||||
$issueTexts[$fehler_kurzbz][] = $fehlerText;
|
||||
}
|
||||
else // if no issue text found, use generic text
|
||||
{
|
||||
$fehlerText = self::GENERIC_ISSUE_OCCURED_TEXT;
|
||||
}
|
||||
|
||||
// add generic parameters to issue text
|
||||
if (isset($person_id)) $fehlerText .= "; person_id: $person_id";
|
||||
if (isset($oe_kurzbz)) $fehlerText .= "; oe_kurzbz: $oe_kurzbz";
|
||||
$issueTexts[$fehler_kurzbz][] = $fehlerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -879,6 +879,57 @@ class PlausicheckLib
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Student with active status should have been charged, i.e. have a Kontobuchung with a negative or zero value.
|
||||
* @param studiensemester_kurzbz string if check is to be executed for certain Studiensemester
|
||||
* @param studiengang_kz int if check is to be executed for certain Studiengang
|
||||
* @param prestudent_id int if check is to be executed only for one prestudent
|
||||
* @return success with prestudents or error
|
||||
*/
|
||||
public function getAktiverStudentstatusOhneKontobuchung($studiensemester_kurzbz, $studiengang_kz = null, $prestudent_id = null)
|
||||
{
|
||||
$params = array($studiensemester_kurzbz);
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT ON (pre.prestudent_id)
|
||||
pre.person_id, pre.prestudent_id, stg.oe_kurzbz AS prestudent_stg_oe_kurzbz, status.studiensemester_kurzbz
|
||||
FROM
|
||||
public.tbl_prestudent pre
|
||||
JOIN public.tbl_person pers USING(person_id)
|
||||
JOIN public.tbl_prestudentstatus status USING(prestudent_id)
|
||||
JOIN public.tbl_studiengang stg USING(studiengang_kz)
|
||||
WHERE
|
||||
status.studiensemester_kurzbz = ?
|
||||
AND status.status_kurzbz IN ('Student', 'Incoming')
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM
|
||||
public.tbl_konto
|
||||
WHERE
|
||||
person_id = pers.person_id
|
||||
AND studiensemester_kurzbz = status.studiensemester_kurzbz
|
||||
AND buchungsnr_verweis IS NULL
|
||||
AND betrag <= 0
|
||||
)
|
||||
AND stg.melderelevant
|
||||
AND pre.bismelden";
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$qry .= " AND stg.studiengang_kz = ?";
|
||||
$params[] = $studiengang_kz;
|
||||
}
|
||||
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
$qry .= " AND pre.prestudent_id = ?";
|
||||
$params[] = $prestudent_id;
|
||||
}
|
||||
|
||||
return $this->_db->execReadOnlyQuery($qry, $params);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Person checks
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class PlausicheckProducerLib
|
||||
'AbschlussstatusFehlt' => 'AbschlussstatusFehlt',
|
||||
'AktSemesterNull' => 'AktSemesterNull',
|
||||
'AktiverStudentOhneStatus' => 'AktiverStudentOhneStatus',
|
||||
'AktiverStudentstatusOhneKontobuchung' => 'AktiverStudentstatusOhneKontobuchung',
|
||||
'AusbildungssemPrestudentUngleichAusbildungssemStatus' => 'AusbildungssemPrestudentUngleichAusbildungssemStatus',
|
||||
'BewerberNichtZumRtAngetreten' => 'BewerberNichtZumRtAngetreten',
|
||||
'DatumAbschlusspruefungFehlt' => 'DatumAbschlusspruefungFehlt',
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('PlausiChecker.php');
|
||||
|
||||
/**
|
||||
* Student with active status should have been charged, i.e. have a Kontobuchung with negative or zero value.
|
||||
*/
|
||||
class AktiverStudentstatusOhneKontobuchung extends PlausiChecker
|
||||
{
|
||||
public function executePlausiCheck($params)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// pass parameters needed for plausicheck
|
||||
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
|
||||
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
|
||||
|
||||
// get all students failing the plausicheck
|
||||
$prestudentRes = $this->_ci->plausichecklib->getAktiverStudentstatusOhneKontobuchung($studiensemester_kurzbz, $studiengang_kz);
|
||||
|
||||
if (isError($prestudentRes)) return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudents = getData($prestudentRes);
|
||||
|
||||
// populate results with data necessary for writing issues
|
||||
foreach ($prestudents as $prestudent)
|
||||
{
|
||||
$results[] = array(
|
||||
'person_id' => $prestudent->person_id,
|
||||
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
|
||||
'fehlertext_params' => array(
|
||||
'prestudent_id' => $prestudent->prestudent_id,
|
||||
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
|
||||
),
|
||||
'resolution_params' => array(
|
||||
'prestudent_id' => $prestudent->prestudent_id,
|
||||
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// return the results
|
||||
return success($results);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Student with active status should have been charged, i.e. have a Kontobuchung with negative or zero value.
|
||||
*/
|
||||
class CORE_STUDENTSTATUS_0015 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
|
||||
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
|
||||
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->library('issues/PlausicheckLib');
|
||||
|
||||
// check if issue persists
|
||||
$checkRes = $this->_ci->plausichecklib->getAktiverStudentstatusOhneKontobuchung(
|
||||
$params['studiensemester_kurzbz'],
|
||||
null,
|
||||
$params['prestudent_id']
|
||||
);
|
||||
|
||||
if (isError($checkRes)) return $checkRes;
|
||||
|
||||
if (hasData($checkRes))
|
||||
return success(false); // not resolved if issue is still present
|
||||
else
|
||||
return success(true); // resolved otherwise
|
||||
}
|
||||
}
|
||||
@@ -277,6 +277,14 @@ $fehlerArr = array(
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core'
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_STUDENTSTATUS_0015',
|
||||
'fehler_kurzbz' => 'AktiverStudentstatusOhneKontobuchung',
|
||||
'fehlercode_extern' => null,
|
||||
'fehlertext' => 'Keine Kontobuchung bei aktivem Studentstatus (prestudent_id %s, Studiensemester %s)',
|
||||
'fehlertyp_kurzbz' => 'error',
|
||||
'app' => 'core'
|
||||
),
|
||||
array(
|
||||
'fehlercode' => 'CORE_PERSON_0001',
|
||||
'fehler_kurzbz' => 'GbDatumWeitZurueck',
|
||||
|
||||
Reference in New Issue
Block a user