Commit 7680505d authored by Χάρης Παπαδόπουλος's avatar Χάρης Παπαδόπουλος
Browse files

Merge branch 'edge' into 'develop'

Removed second EpalConfig loading in ApplicationSubmit. Forbid first period application deletion

See merge request !223
parents 40720cf0 482ec0c4
...@@ -136,7 +136,7 @@ class ApplicationSubmit extends ControllerBase ...@@ -136,7 +136,7 @@ class ApplicationSubmit extends ControllerBase
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} }
$second_period = $this->retrievePeriod(); $second_period = $epalConfig->activate_second_period->value;
$student = array( $student = array(
'langcode' => 'el', 'langcode' => 'el',
...@@ -276,19 +276,6 @@ class ApplicationSubmit extends ControllerBase ...@@ -276,19 +276,6 @@ class ApplicationSubmit extends ControllerBase
return $res; return $res;
} }
private function retrievePeriod()
{
$config_storage = $this->entityTypeManager->getStorage('epal_config');
$epalConfigs = $config_storage->loadByProperties(array('name' => 'epal_config'));
$epalConfig = reset($epalConfigs);
if (!$epalConfig) {
$secondPeriodEnabled = 0;
} else {
$secondPeriodEnabled = intval($epalConfig->activate_second_period->getString());
}
return $secondPeriodEnabled;
}
/** /**
* *
* @return int error code ελέγχου; 0 εάν ο έλεγχος επιτύχει, μη μηδενικό εάν αποτύχει: * @return int error code ελέγχου; 0 εάν ο έλεγχος επιτύχει, μη μηδενικό εάν αποτύχει:
......
...@@ -84,8 +84,12 @@ class SubmitedApplications extends ControllerBase ...@@ -84,8 +84,12 @@ class SubmitedApplications extends ControllerBase
$epalStudents = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('epaluser_id' => $userid, 'id' => $applicationId)); $epalStudents = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('epaluser_id' => $userid, 'id' => $applicationId));
$epalStudent = reset($epalStudents); $epalStudent = reset($epalStudents);
if ($epalStudent) { if ($epalStudent) {
if (!$epalStudent->second_period->value && $epalConfig->activate_second_period->value) {
return $this->respondWithStatus([
"error_code" => 3002
], Response::HTTP_FORBIDDEN);
}
$epalStudentClasses = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('student_id' => $applicationId)); $epalStudentClasses = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('student_id' => $applicationId));
$epalStudentClass = reset($epalStudentClasses); $epalStudentClass = reset($epalStudentClasses);
if ($epalStudentClass) { if ($epalStudentClass) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment