mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
check Meldestichtag, update function getHistoryPrestudent
This commit is contained in:
@@ -11,4 +11,76 @@ class Bismeldestichtag_model extends DB_Model
|
||||
$this->dbTable = 'bis.tbl_bismeldestichtag';
|
||||
$this->pk = 'meldestichtag_id';
|
||||
}
|
||||
|
||||
public function getLastReachedMeldestichtag($studiensemester_kurzbz = null)
|
||||
{
|
||||
$qry = "
|
||||
SELECT
|
||||
meldestichtag_id, meldestichtag, studiensemester_kurzbz, insertamum, insertvon, updateamum, updatevon
|
||||
FROM
|
||||
bis.tbl_bismeldestichtag
|
||||
WHERE
|
||||
meldestichtag < NOW()
|
||||
";
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
$qry .= "
|
||||
AND
|
||||
studiensemester_kurzbz= ?";
|
||||
}
|
||||
|
||||
$qry .= "
|
||||
ORDER BY
|
||||
meldestichtag DESC
|
||||
LIMIT 1;";
|
||||
|
||||
$result = $this->execQuery($qry, array($studiensemester_kurzbz));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return error($result);
|
||||
}
|
||||
if (!hasData($result)) {
|
||||
return success("0",'Kein Meldestichtag vorhanden');
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob Meldestichtag für ein bestimmtes Statusdatum und Studiensemester erreicht ist.
|
||||
*
|
||||
* @param $status_datum
|
||||
* @return boolean true wenn erreicht, oder false
|
||||
*/
|
||||
public function checkIfMeldestichtagErreicht($status_datum)
|
||||
{
|
||||
$erreicht = false;
|
||||
// letztes erreichtes Bismeldedatum holen
|
||||
$result = $this->getLastReachedMeldestichtag();
|
||||
if (isError($result))
|
||||
{
|
||||
return error($result);
|
||||
}
|
||||
if (!hasData($result)) {
|
||||
return success("0",'No Statusdata vorhanden');
|
||||
}
|
||||
$stichtag = current(getData($result));
|
||||
$stichtag = $stichtag->meldestichtag;
|
||||
var_dump($status_datum . " < " . $stichtag . "?");
|
||||
|
||||
// Prüfen, ob Studentstatusdatum oder Studiensemester vor dem Stichtagsdatum liegen
|
||||
if (isset($statusDatum))
|
||||
{
|
||||
if (isset($stichtag))
|
||||
$erreicht = $statusDatum < $stichtag;
|
||||
}
|
||||
|
||||
if($erreicht)
|
||||
return success("1", "Studentstatus mit Datum oder Semesterende vor erreichtem Meldestichtag können nicht hinzugefügt werden");
|
||||
|
||||
return success("0", "Meldestatus nicht erreicht");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user