mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-04 12:29:28 +00:00
correct rolle exists check
This commit is contained in:
@@ -290,7 +290,7 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
return !$this->getDataOrTerminateWithError($result);
|
||||
}],
|
||||
//check if Rolle already exists
|
||||
//Check if Rolle already exists
|
||||
['rolle_doesnt_exist', function () use ($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester) {
|
||||
if (!$status_kurzbz || !$studiensemester_kurzbz || !$ausbildungssemester)
|
||||
return true; // Error will be handled by the required statements above
|
||||
@@ -1333,7 +1333,7 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
// Set Datum to null to prevent multiple is_valid_date checks in the following validation rules
|
||||
$this->form_validation->set_rules('_default', '', [
|
||||
//check if Rolle already exists
|
||||
//Check if Rolle already exists
|
||||
['new_rolle_doesnt_exist', function () use (
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
@@ -1609,7 +1609,7 @@ class Status extends FHCAPI_Controller
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('_default', '', [
|
||||
//check if Rolle already exists
|
||||
//Check if Rolle already exists
|
||||
['rolle_doesnt_exist', function () use (
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
|
||||
@@ -98,34 +98,6 @@ class PrestudentstatusCheckLib
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a prestudent role already exists.
|
||||
*
|
||||
* @param integer $prestudent_id
|
||||
* @param string $status_kurzbz
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @param integer $ausbildungssemester
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
public function checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
) {
|
||||
$result = $this->_ci->PrestudentstatusModel->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
return success(getData($result) != '1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a student already exists.
|
||||
*
|
||||
|
||||
@@ -358,56 +358,6 @@ class Prestudentstatus_model extends DB_Model
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Rolle already exists
|
||||
* @param integer $prestudent_id
|
||||
* @param string $status_kurzbz
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @param integer $ausbildungssemester
|
||||
* @return 1: if Rolle exists, 0: if it doesn't
|
||||
* Copy from studentDBDML.php
|
||||
*/
|
||||
public function checkIfExistingPrestudentRolle($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester)
|
||||
{
|
||||
$studentName = '';
|
||||
|
||||
$nameRes = $this->PersonModel->loadPrestudent($prestudent_id);
|
||||
|
||||
if (hasData($nameRes))
|
||||
{
|
||||
$nameData = getData($nameRes)[0];
|
||||
$studentName = $nameData->vorname.' '.$nameData->nachname;
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_prestudentstatus
|
||||
WHERE
|
||||
prestudent_id = ?
|
||||
AND
|
||||
status_kurzbz = ?
|
||||
AND
|
||||
studiensemester_kurzbz = ?
|
||||
AND
|
||||
ausbildungssemester = ?";
|
||||
|
||||
$result = $this->execQuery($qry, array($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return error($result);
|
||||
}
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
return success(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return success("1", $this->p->t('lehre', 'error_rolleBereitsVorhandenMitNamen', ['name' => $studentName]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is only one prestudentstatus left
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user