Phrases Validierungen

This commit is contained in:
ma0068
2024-05-14 14:13:38 +02:00
parent 1f4b029973
commit 4c671c2ee9
4 changed files with 93 additions and 32 deletions
@@ -216,20 +216,14 @@ class Status extends FHCAPI_Controller
//check if bewerberstatus exists
if($status_kurzbz == 'Aufgenommener' || $status_kurzbz == 'Wartender')
{
//TODO(manu) erst später für multiactions releveant
//FAS: Aufnahme ist möglich: Beispiel prestudent_id = 129629
$result = $this->PrestudentstatusModel->checkIfExistingBewerberstatus($prestudent_id, $name);
if (isError($result))
{
/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson(getError($result));*/
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
if($result->retval == "0")
{
/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson($result->code);*/
return $this->terminateWithError($this->p->t('lehre','error_keinBewerber', $name), self::ERROR_TYPE_GENERAL);
}
}
@@ -263,12 +257,9 @@ class Status extends FHCAPI_Controller
$result = $this->PrestudentstatusModel->checkDatumNewStatus($new_status_datum);
if (isError($result))
{
/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson(getError($result));*/
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
//return $this->terminateWithError($name, self::ERROR_TYPE_GENERAL);
$result = $this->PrestudentstatusModel->checkIfValidStatusHistory(
$prestudent_id,
$name,
@@ -324,8 +315,6 @@ class Status extends FHCAPI_Controller
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
if($isStudent)
{
$this->load->model('crm/Student_model', 'StudentModel');
@@ -352,8 +341,6 @@ class Status extends FHCAPI_Controller
$studiengang_kz = $studentData->studiengang_kz;
//Handle Abbrecher and Unterbrecher
//TODO(manu) for addStatus unterbrecher: valdidaton of ausbildungssemester 0 (default = 1)
//right now: just commented out
if($status_kurzbz == 'Abbrecher' || $status_kurzbz == 'Unterbrecher')
{
$ausbildungssemester = 0;
@@ -377,9 +364,9 @@ class Status extends FHCAPI_Controller
return $this->terminateWithError($this->p->t('lehre','error_duringInsertUpdateLehrverband'), self::ERROR_TYPE_GENERAL);
}
//Student updaten (fuer Abbrecher und Unterbrecher)
//update(fuer Abbrecher und Unterbrecher)
//implemented for multiaction "status ändern"
//TODO(Manu) implement also for newStatus
//TODO(Manu) implement also for newStatus?
if($status_kurzbz == 'Abbrecher' || $status_kurzbz == 'Unterbrecher')
{
@@ -505,12 +492,9 @@ class Status extends FHCAPI_Controller
//check if last status
$result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id);
//return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
if (isError($result))
{
/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
return $this->outputJson($result);*/
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
}
if($result->retval == "1")
@@ -1022,7 +1006,7 @@ class Status extends FHCAPI_Controller
$status_kurzbz,
$studiensemester_kurzbz,
$datum,
$ausbildungssemesteR
$ausbildungssemester
);
if (isError($result))
{
@@ -1118,8 +1102,6 @@ class Status extends FHCAPI_Controller
public function advanceStatus($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester)
{
$isStudent = false;
//get Studiengang von prestudent_id
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->load([
@@ -385,7 +385,6 @@ class Prestudentstatus_model extends DB_Model
}
else
{
//TODO(manu) nur retval übergeben
return success("1", $this->p->t('lehre','error_rolleBereitsVorhanden'));
}
}
@@ -38,11 +38,11 @@ class Studentlehrverband_model extends DB_Model
}
elseif (!hasData($result))
{
return success("0", "Kein Studentlehrverband vorhanden!");
return success("0", $this->p->t('lehre','error_noStudentlehrverband'));
}
else
{
return success("1","Studentlehrverband vorhanden!");
return success("1", $this->p->t('lehre','error_updateStudentlehrverband'));
}
}
@@ -56,7 +56,7 @@ class Studentlehrverband_model extends DB_Model
if (isError($result))
{
$this->db->trans_rollback();
return error("0", "Error during update Lehrverband");
return error("0", $this->p->t('lehre','error_updateLehrverband'));
}
if ($result->retval == "0") {
@@ -65,12 +65,12 @@ class Studentlehrverband_model extends DB_Model
$result = $this->LehrverbandModel->checkIfLehrverbandExists($studiengang_kz, $ausbildungssemester, '', '');
if (isError($result)) {
$this->db->trans_rollback();
return error("0", "Error during update Lehrverband");
return error("0", $this->p->t('lehre','error_updateLehrverband'));
}
if ($result->retval == "0")
{
$this->terminateWithError("in section 0 und weiter.. wo verband auf leer gesetzt wird", self::ERROR_TYPE_GENERAL);
//$this->terminateWithError("in section 0 und weiter.. wo verband auf leer gesetzt wird", self::ERROR_TYPE_GENERAL);
$result = $this->LehrverbandModel->insert([
'studiengang_kz' => $studiengang_kz,
'semester' => $ausbildungssemester,
@@ -83,7 +83,7 @@ class Studentlehrverband_model extends DB_Model
if ($this->db->trans_status() === false || isError($result))
{
$this->db->trans_rollback();
return error("0", "Error during insert lehrverband übergeordnet");
return error("0", $this->p->t('lehre','error_updateLehrverband'));
}
}
@@ -100,7 +100,7 @@ class Studentlehrverband_model extends DB_Model
if ($this->db->trans_status() === false || isError($result)) {
$this->db->trans_rollback();
return error("0", "Error during insert lehrverband");
return error("0", $this->p->t('lehre','error_updateLehrverband'));
}
}
@@ -127,7 +127,7 @@ class Studentlehrverband_model extends DB_Model
]);
if ($this->db->trans_status() === false || isError($result)) {
$this->db->trans_rollback();
return error("0", "Error during insert studentlehrverband");
return error("0", $this->p->t('lehre','error_updateStudentlehrverband'));
}
}
else
@@ -148,14 +148,14 @@ class Studentlehrverband_model extends DB_Model
);
if ($this->db->trans_status() === false || isError($result)) {
$this->db->trans_rollback();
return error("0", "Error during update studentlehrverband");
return error("0", $this->p->t('lehre','error_updateStudentlehrverband'));
}
}
// finish transaktion
if ($this->db->trans_status() === false || isError($result)) {
$this->db->trans_rollback();
return error("0", "Error during insert/update Studentlehrverband");
return error("0", $this->p->t('lehre','error_updateStudentlehrverband'));
} else {
$this->db->trans_commit();
return success();
+80
View File
@@ -27802,6 +27802,86 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_updateLehrverband',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler bei Aktualisierung Lehrverband',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error during insert/update lehrverband',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_noLehrverband',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Kein Lehrverband vorhanden',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error: no existing Lehrverband',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_updateStudentlehrverband',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler bei Aktualisierung Studentlehrverband',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error during insert/update Studentlehrverband',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_noStudentlehrverband',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Kein Studentlehrverband vorhanden',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error: no existing Studentlehrverband',
'description' => '',
'insertvon' => 'system'
)
)
),
);