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

Removed second EpalConfig loading in ApplicationSubmit. Forbid first period application deletion in SubmitedApplications
parent 40720cf0
......@@ -136,7 +136,7 @@ class ApplicationSubmit extends ControllerBase
], Response::HTTP_FORBIDDEN);
}
$second_period = $this->retrievePeriod();
$second_period = $epalConfig->activate_second_period->value;
$student = array(
'langcode' => 'el',
......@@ -276,19 +276,6 @@ class ApplicationSubmit extends ControllerBase
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 εάν ο έλεγχος επιτύχει, μη μηδενικό εάν αποτύχει:
......
......@@ -84,8 +84,12 @@ class SubmitedApplications extends ControllerBase
$epalStudents = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('epaluser_id' => $userid, 'id' => $applicationId));
$epalStudent = reset($epalStudents);
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));
$epalStudentClass = reset($epalStudentClasses);
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