mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 00:42:15 +00:00
Merge branch 'master' into feature-6237/Phrases_system_MkIII
This commit is contained in:
@@ -89,6 +89,7 @@ class AnrechnungLib
|
||||
$antrag_data->vorname = $person->vorname;
|
||||
$antrag_data->nachname = $person->nachname;
|
||||
$antrag_data->matrikelnr = $student->matrikelnr;
|
||||
$antrag_data->studiengang_kz = $studiengang->studiengang_kz;
|
||||
$antrag_data->stg_bezeichnung = $studiengang->bezeichnung;
|
||||
$antrag_data->lektoren = $lv_lektoren_arr;
|
||||
$antrag_data->zgv = $latest_zgv_bezeichnung;
|
||||
|
||||
@@ -62,17 +62,17 @@ class IssuesLib
|
||||
* @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler
|
||||
* @return object success or error
|
||||
*/
|
||||
public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null)
|
||||
public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null)
|
||||
{
|
||||
$fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
|
||||
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$fehlercode = getData($fehlerRes)[0]->fehlercode;
|
||||
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params);
|
||||
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params);
|
||||
}
|
||||
else
|
||||
return error("Fehler $fehler_kurzbz nicht gefunden");
|
||||
return error("Error $fehler_kurzbz not found");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,13 +82,13 @@ class IssuesLib
|
||||
* @param int $person_id
|
||||
* @param int $oe_kurzbz
|
||||
* @param array $fehlertext_params params for replacement of parts of error text
|
||||
* @param bool $force_predefined if true, only predefined external issues are added
|
||||
* @param bool $force_predefined if true, only predefined (with entry in fehler table) external issues are added
|
||||
* @return object success or error
|
||||
*/
|
||||
public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $force_predefined = false)
|
||||
public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null)
|
||||
{
|
||||
if (isEmptyString($fehlercode_extern))
|
||||
return error("fehlercode_extern fehlt");
|
||||
return error("fehlercode_extern missing");
|
||||
|
||||
// get external fehlercode (unique for each app)
|
||||
$this->_ci->FehlerModel->addSelect('fehlercode');
|
||||
@@ -102,19 +102,13 @@ class IssuesLib
|
||||
if (isError($fehlerRes))
|
||||
return $fehlerRes;
|
||||
|
||||
$fehlerData = getData($fehlerRes)[0];
|
||||
|
||||
// check if there is a predefined custom error for the external issue
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$fehlerData = getData($fehlerRes)[0];
|
||||
// if found, use the code
|
||||
$fehlercode = $fehlerData->fehlercode;
|
||||
}
|
||||
elseif ($force_predefined === true)
|
||||
{
|
||||
// only added if predefined
|
||||
return success("No definition found - not added");
|
||||
}
|
||||
else
|
||||
{
|
||||
// if predefined error is not found, insert with fallback code
|
||||
@@ -122,20 +116,70 @@ class IssuesLib
|
||||
}
|
||||
|
||||
// add external issue
|
||||
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $fehlercode_extern, $inhalt_extern);
|
||||
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, null, $fehlercode_extern, $inhalt_extern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set issue to resolved.
|
||||
* @param int $issue_id
|
||||
* @param string $user uid of issue resolver
|
||||
* @return object success or error
|
||||
*/
|
||||
public function setBehoben($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_BEHOBEN,
|
||||
'verarbeitetvon' => $user,
|
||||
'verarbeitetamum' => date('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set issue to in progress.
|
||||
* @param int $issue_id
|
||||
* @param string $user uid of issue resovler
|
||||
* @return object success or error
|
||||
*/
|
||||
public function setInBearbeitung($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_IN_BEARBEITUNG,
|
||||
'verarbeitetvon' => $user
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set issue to new.
|
||||
* @param int $issue_id
|
||||
* @param string $user uid of issue resolver
|
||||
* @return object success or error
|
||||
*/
|
||||
public function setNeu($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_NEU,
|
||||
'verarbeitetvon' => null,
|
||||
'verarbeitetamum' => null
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes status of an issue.
|
||||
* @param int $issue_id
|
||||
* @param string $status_kurzbz the new status
|
||||
* @param string $verarbeitetvon uid of person changing the status (needed for in Bearbeitung and behoben)
|
||||
* @param array $sdata the data to save, including status
|
||||
* @param string $user uid of person changing the status (needed for in Bearbeitung and behoben)
|
||||
* @return success or error
|
||||
*/
|
||||
public function changeIssueStatus($issue_id, $status_kurzbz, $verarbeitetvon = null)
|
||||
private function _changeIssueStatus($issue_id, $data, $user)
|
||||
{
|
||||
if (!isset($issue_id) || !is_numeric($issue_id))
|
||||
return error("Issue Id muss korrekt gesetzt sein.");
|
||||
return error("Issue Id must be set correctly.");
|
||||
|
||||
// check if given status is same as existing
|
||||
$this->_ci->IssueModel->addSelect('status_kurzbz');
|
||||
@@ -143,39 +187,14 @@ class IssuesLib
|
||||
|
||||
if (hasData($currStatus))
|
||||
{
|
||||
if (getData($currStatus)[0]->status_kurzbz == $status_kurzbz)
|
||||
return success("Gleicher Status bereits gesetzt");
|
||||
if (getData($currStatus)[0]->status_kurzbz == $data['status_kurzbz'])
|
||||
return success("Same status already set");
|
||||
}
|
||||
else
|
||||
return error("Fehler beim Holen des Status");
|
||||
return error("Error when getting status");
|
||||
|
||||
$data = array(
|
||||
'status_kurzbz' => $status_kurzbz,
|
||||
'updatevon' => $verarbeitetvon,
|
||||
'updateamum' => date('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
if ($status_kurzbz == self::STATUS_NEU)
|
||||
{
|
||||
|
||||
$data['verarbeitetvon'] = null;
|
||||
}
|
||||
|
||||
if ($status_kurzbz == self::STATUS_NEU || $status_kurzbz == self::STATUS_IN_BEARBEITUNG)
|
||||
{
|
||||
$data['verarbeitetamum'] = null;
|
||||
}
|
||||
|
||||
if ($status_kurzbz == self::STATUS_IN_BEARBEITUNG || $status_kurzbz == self::STATUS_BEHOBEN)
|
||||
{
|
||||
if (isset($verarbeitetvon))
|
||||
$data['verarbeitetvon'] = $verarbeitetvon;
|
||||
else
|
||||
return error("Verarbeitetvon nicht gesetzt");
|
||||
}
|
||||
|
||||
if ($status_kurzbz == self::STATUS_BEHOBEN)
|
||||
$data['verarbeitetamum'] = date('Y-m-d H:i:s');
|
||||
$data['updatevon'] = $user;
|
||||
$data['updateamum'] = date('Y-m-d H:i:s');
|
||||
|
||||
return $this->_ci->IssueModel->update(
|
||||
array(
|
||||
@@ -191,14 +210,15 @@ class IssuesLib
|
||||
* @param int $person_id
|
||||
* @param string $oe_kurzbz
|
||||
* @param array $fehlertext_params
|
||||
* @param string $resolution_params
|
||||
* @param string $fehlercode_extern
|
||||
* @param string $inhalt_extern
|
||||
* @return object success or error
|
||||
*/
|
||||
private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $fehlercode_extern = null, $inhalt_extern = null)
|
||||
private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null, $fehlercode_extern = null, $inhalt_extern = null)
|
||||
{
|
||||
if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
|
||||
return error("Person_id oder oe_kurzbz muss gesetzt sein.");
|
||||
return error("Person_id or oe_kurzbz must be set.");
|
||||
|
||||
// get fehlertextVorlage and replace it with params
|
||||
$fehlerRes = $this->_ci->FehlerModel->load($fehlercode);
|
||||
@@ -218,6 +238,20 @@ class IssuesLib
|
||||
|
||||
if ($openIssueCount == 0)
|
||||
{
|
||||
if (isset($resolution_params))
|
||||
{
|
||||
if (is_array($resolution_params))
|
||||
{
|
||||
foreach ($resolution_params as $resolution_key => $resolution_param)
|
||||
{
|
||||
if (!is_string($resolution_key))
|
||||
return error("Invalid parameter for resolution, must be an associative array");
|
||||
}
|
||||
}
|
||||
else
|
||||
return error("Invalid parameters for resolution");
|
||||
}
|
||||
|
||||
return $this->_ci->IssueModel->insert(
|
||||
array(
|
||||
'fehlercode' => $fehlercode,
|
||||
@@ -228,6 +262,7 @@ class IssuesLib
|
||||
'oe_kurzbz' => $oe_kurzbz,
|
||||
'datum' => date('Y-m-d H:i:s'),
|
||||
'status_kurzbz' => self::STATUS_NEU,
|
||||
'behebung_parameter' => isset($resolution_params) ? json_encode($resolution_params) : null,
|
||||
'insertvon' => $this->_insertvon
|
||||
)
|
||||
);
|
||||
@@ -236,9 +271,9 @@ class IssuesLib
|
||||
return success($openIssueCount);
|
||||
}
|
||||
else
|
||||
return error("Anzahl offener Issues konnte nicht ermittelt werden.");
|
||||
return error("Number of open issues could not be determined");
|
||||
}
|
||||
else
|
||||
return error("Fehler $fehlercode nicht gefunden");
|
||||
return error("Error $fehlercode could not be found");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class VorlageLib
|
||||
if (!hasData($vorlage))
|
||||
{
|
||||
// Builds where clause
|
||||
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
|
||||
$where = $this->_where($vorlage_kurzbz);
|
||||
|
||||
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
|
||||
'public',
|
||||
@@ -134,20 +134,11 @@ class VorlageLib
|
||||
/**
|
||||
* _where
|
||||
*/
|
||||
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
|
||||
private function _where($vorlage_kurzbz)
|
||||
{
|
||||
// Builds where clause
|
||||
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
|
||||
|
||||
if (is_null($sprache))
|
||||
{
|
||||
$where .= " AND sprache IS NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
|
||||
}
|
||||
|
||||
$where .= " AND aktiv = true";
|
||||
|
||||
return $where;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Bisio Zweck does not exist
|
||||
*/
|
||||
class CORE_INOUT_0001 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
// get all bisio Zwecke
|
||||
$this->_ci->BisiozweckModel->addSelect('1');
|
||||
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisiozweckRes))
|
||||
return $bisiozweckRes;
|
||||
|
||||
if (hasData($bisiozweckRes))
|
||||
return success(true); // resolved if bisio Zweck exists
|
||||
else
|
||||
return success(false); // not resolved if no bisio zweck
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* More than one Zweck for incoming
|
||||
*/
|
||||
class CORE_INOUT_0002 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
// get all bisio Zwecke
|
||||
$this->_ci->BisiozweckModel->addSelect('1');
|
||||
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisiozweckRes))
|
||||
return $bisiozweckRes;
|
||||
|
||||
if (hasData($bisiozweckRes))
|
||||
{
|
||||
if (count(getData($bisiozweckRes)) <= 1) // resolved if one bisio Zweck
|
||||
return success(true);
|
||||
else
|
||||
return success(false); // otherwise not resolved
|
||||
}
|
||||
else
|
||||
return success(true); // resolved if no bisio zweck
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Invalid Zweck for incoming
|
||||
*/
|
||||
class CORE_INOUT_0003 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->BisiozweckModel->addSelect('zweck_code');
|
||||
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisiozweckRes))
|
||||
return $bisiozweckRes;
|
||||
|
||||
if (hasData($bisiozweckRes))
|
||||
{
|
||||
$bisiozweckData = getData($bisiozweckRes);
|
||||
|
||||
// resolved if Zweck is 1, 2 or 3
|
||||
if (count($bisiozweckData) == 1 && !in_array($bisiozweckData[0]->zweck_code, array(1, 2, 3)))
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Aufenthaltsförderung must exist if certain length of outgoing stay is exceeded
|
||||
*/
|
||||
class CORE_INOUT_0004 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->AufenthaltfoerderungModel->addSelect('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code');
|
||||
$this->_ci->AufenthaltfoerderungModel->addJoin('bis.tbl_bisio_aufenthaltfoerderung', 'aufenthaltfoerderung_code');
|
||||
$this->_ci->AufenthaltfoerderungModel->addOrder('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code');
|
||||
$bisioFoerderungRes = $this->_ci->AufenthaltfoerderungModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisioFoerderungRes))
|
||||
return $bisioFoerderungRes;
|
||||
|
||||
if (hasData($bisioFoerderungRes))
|
||||
{
|
||||
// resolved if Aufenthaltsfoerderung exists
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
||||
|
||||
// get Bisio Aufenthaltsdauer
|
||||
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
||||
|
||||
if (isError($aufenthaltsdauerRes))
|
||||
return $aufenthaltsdauerRes;
|
||||
|
||||
if (hasData($aufenthaltsdauerRes))
|
||||
{
|
||||
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
||||
|
||||
// check if stay >= 29 days. If yes and no Aufenthaltsfoerderung - not resolved
|
||||
if ($aufenthaltsdauer >= 29)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else // no Aufenthaltsdauer - not resolved
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ECTS angerechnet must exist for outgoing if longer stay
|
||||
*/
|
||||
class CORE_INOUT_0005 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->BisioModel->addSelect('ects_angerechnet');
|
||||
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisioRes))
|
||||
return $bisioRes;
|
||||
|
||||
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_angerechnet))
|
||||
{
|
||||
// resolved if ects exists
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get Bisio Aufenthaltsdauer
|
||||
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
||||
|
||||
if (isError($aufenthaltsdauerRes))
|
||||
return $aufenthaltsdauerRes;
|
||||
|
||||
if (hasData($aufenthaltsdauerRes))
|
||||
{
|
||||
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
||||
|
||||
// check if stay >= 29 days. If yes and no ects - not resolved
|
||||
if ($aufenthaltsdauer >= 29)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else // no Aufenthaltsdauer - not resolved
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ECTS erworben must exist for outgoing if longer stay
|
||||
*/
|
||||
class CORE_INOUT_0006 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
||||
//$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->BisioModel->addSelect('ects_erworben');
|
||||
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisioRes))
|
||||
return $bisioRes;
|
||||
|
||||
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_erworben))
|
||||
{
|
||||
// resolved if ects exists
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get Bisio Aufenthaltsdauer
|
||||
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
||||
|
||||
if (isError($aufenthaltsdauerRes))
|
||||
return $aufenthaltsdauerRes;
|
||||
|
||||
if (hasData($aufenthaltsdauerRes))
|
||||
{
|
||||
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
||||
|
||||
// check if stay >= 29 days. If yes and no ects - not resolved
|
||||
if ($aufenthaltsdauer >= 29)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else // no Aufenthaltsdauer - not resolved
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV Datum in future
|
||||
*/
|
||||
class CORE_ZGV_0001 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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvdatum');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$zgvdatum = getData($prestudentRes)[0]->zgvdatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes after today
|
||||
if ($zgvdatum > date('Y-m-d'))
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV Datum must be after Geburtsdatum
|
||||
*/
|
||||
class CORE_ZGV_0002 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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvdatum, gebdatum');
|
||||
$this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudentData = getData($prestudentRes)[0];
|
||||
|
||||
$zgvdatum = $prestudentData->zgvdatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
$gebdatum = $prestudentData->gebdatum;
|
||||
|
||||
if (isEmptyString($gebdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes before geburtsdatum
|
||||
if ($zgvdatum < $gebdatum)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV master Datum in future
|
||||
*/
|
||||
class CORE_ZGV_0003 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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvmadatum');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$zgvdatum = getData($prestudentRes)[0]->zgvmadatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes after today
|
||||
if ($zgvdatum > date('Y-m-d'))
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV Datum should not be after ZGV master Datum
|
||||
*/
|
||||
class CORE_ZGV_0004 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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvdatum, zgvmadatum');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudentData = getData($prestudentRes)[0];
|
||||
|
||||
// get and compare zgvdatum and zgvmadatum
|
||||
$zgvdatum = $prestudentData->zgvdatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
$zgvmadatum = $prestudentData->zgvmadatum;
|
||||
|
||||
if (isEmptyString($zgvmadatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvmadatum comes after zgvdatum
|
||||
if ($zgvmadatum < $zgvdatum)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV master Datum before Geburtsdatum
|
||||
*/
|
||||
class CORE_ZGV_0005 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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum and geburtsdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvmadatum, gebdatum');
|
||||
$this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudentData = getData($prestudentRes)[0];
|
||||
|
||||
$zgvdatum = $prestudentData->zgvmadatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
$gebdatum = $prestudentData->gebdatum;
|
||||
|
||||
if (isEmptyString($gebdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes before geburtsdatum
|
||||
if ($zgvdatum < $gebdatum)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user