mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
Modified: Now user gets back error message if upload failes
...instead of hard program exit Signed-off-by: cris-technikum <[email protected]>
This commit is contained in:
@@ -113,8 +113,10 @@ class requestAnrechnung extends Auth_Controller
|
|||||||
return $this->outputJsonError($this->p->t('ui', 'errorUploadFehlt'));
|
return $this->outputJsonError($this->p->t('ui', 'errorUploadFehlt'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEmptyString($begruendung_id) || isEmptyString($anmerkung) ||
|
if (isEmptyString($begruendung_id) ||
|
||||||
isEmptyString($lehrveranstaltung_id) || isEmptyString($studiensemester_kurzbz))
|
isEmptyString($anmerkung) ||
|
||||||
|
isEmptyString($lehrveranstaltung_id) ||
|
||||||
|
isEmptyString($studiensemester_kurzbz))
|
||||||
{
|
{
|
||||||
return $this->outputJsonError($this->p->t('ui', 'errorFelderFehlen'));
|
return $this->outputJsonError($this->p->t('ui', 'errorFelderFehlen'));
|
||||||
}
|
}
|
||||||
@@ -143,7 +145,15 @@ class requestAnrechnung extends Auth_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upload document
|
// Upload document
|
||||||
$lastInsert_dms_id = self::_uploadFile();
|
$result = self::_uploadFile();
|
||||||
|
|
||||||
|
if (isError($result))
|
||||||
|
{
|
||||||
|
return $this->outputJsonError($result->retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store just inserted DMS ID
|
||||||
|
$lastInsert_dms_id = $result->retval['dms_id'];
|
||||||
|
|
||||||
// Start DB transaction
|
// Start DB transaction
|
||||||
$this->db->trans_start(false);
|
$this->db->trans_start(false);
|
||||||
@@ -159,7 +169,7 @@ class requestAnrechnung extends Auth_Controller
|
|||||||
'insertvon' => $this->_uid
|
'insertvon' => $this->_uid
|
||||||
));
|
));
|
||||||
|
|
||||||
// Save Anrechnungstatus 'inProgressSTGL'
|
// Save Anrechnungstatus
|
||||||
$this->AnrechnungModel->saveAnrechnungstatus($result->retval, self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL);
|
$this->AnrechnungModel->saveAnrechnungstatus($result->retval, self::ANRECHNUNGSTATUS_PROGRESSED_BY_STGL);
|
||||||
|
|
||||||
// Transaction complete
|
// Transaction complete
|
||||||
@@ -293,14 +303,8 @@ class requestAnrechnung extends Auth_Controller
|
|||||||
return $studiensemester_kurzbz == $actual_ss;
|
return $studiensemester_kurzbz == $actual_ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _uploadFile(){
|
private function _uploadFile()
|
||||||
|
{
|
||||||
if (empty($_FILES['uploadfile']['name']))
|
|
||||||
{
|
|
||||||
show_error('Missing upload file');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upload document
|
|
||||||
$dms = array(
|
$dms = array(
|
||||||
'kategorie_kurzbz' => 'anrechnung',
|
'kategorie_kurzbz' => 'anrechnung',
|
||||||
'version' => 0,
|
'version' => 0,
|
||||||
@@ -310,11 +314,7 @@ class requestAnrechnung extends Auth_Controller
|
|||||||
'insertvon' => $this->_uid
|
'insertvon' => $this->_uid
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isError($uploaddata = $this->dmslib->upload($dms, array('pdf'))))
|
// Upload document
|
||||||
{
|
return $this->dmslib->upload($dms, array('pdf'));
|
||||||
show_error(getError($uploaddata));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $uploaddata->retval['dms_id'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user