Added Antragssperre for Noten, when STGL wants to create Anrechnung

Added check, if LV was already graded and if grades are defined in configs
'blocking grades array'. If so, Anrechnung is not allowed.

Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
cris-technikum
2021-05-19 16:18:04 +02:00
parent a783b0085b
commit 758b9991d5
2 changed files with 57 additions and 0 deletions
@@ -47,6 +47,9 @@ class CreateAnrechnung extends Auth_Controller
)
);
// Load configs
$this->load->config('anrechnung');
$this->_setAuthUID();
$this->setControllerId();
@@ -140,6 +143,12 @@ class CreateAnrechnung extends Auth_Controller
$this->terminateWithJsonError($this->p->t('global', 'antragBereitsGestellt'));
}
// Exit if Lehrveranstaltung was already graded with application blocking grades
if (self::_LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id, $prestudent_id))
{
$this->terminateWithJsonError($this->p->t('anrechnung', 'antragBenotungBlockiert'));
}
// Upload document
$result = self::_uploadFile();
@@ -231,4 +240,32 @@ class CreateAnrechnung extends Auth_Controller
return $this->dmslib->upload($dms, 'uploadfile', array('pdf'));
}
private function _LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id, $prestudent_id)
{
// Get Student UID
$student_uid = $this->StudentModel->getUID($prestudent_id);
// Get Note of Lehrveranstaltung
$this->load->model('education/Lvgesamtnote_model', 'LvgesamtnoteModel');
$result = $this->LvgesamtnoteModel->load(array(
'student_uid' => $student_uid,
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'lehrveranstaltung_id' => $lehrveranstaltung_id
)
);
// If Lehrveranstaltung has Note
if (hasData($result))
{
$note = getData($result)[0]->note;
// Check if Note is a blocking grade
if (in_array($note, $this->config->item('grades_blocking_application')))
{
return true;
}
}
return false;
}
}
+20
View File
@@ -12232,6 +12232,26 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'anrechnung',
'phrase' => 'antragBenotungBlockiert',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Antrag kann aufgrund der vorhandenen Benotung nicht erstellt werden.",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => "Application can not be created due to existing grade.",
'description' => '',
'insertvon' => 'system'
)
)
),
);