mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
Merge branch 'feature-30660/FHC4_StudierendenGUI_Prototyp' of github.com:FH-Complete/FHC-Core into feature-30660/FHC4_StudierendenGUI_Prototyp
This commit is contained in:
@@ -300,26 +300,15 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
//update(1) loading all dms-entries with this notiz_id
|
||||
$this->load->model('person/Notizdokument_model', 'NotizdokumentModel');
|
||||
$this->NotizdokumentModel->addJoin('campus.tbl_dms_version', 'dms_id');
|
||||
$dms_uploaded = null;
|
||||
#$dms_uploaded = null;//
|
||||
|
||||
$result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id));
|
||||
if (isError($result))
|
||||
{
|
||||
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
$dms_id_arr = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = getData($result);
|
||||
foreach($result as $doc) {
|
||||
$dms_id_arr[] = array(
|
||||
'name' => $doc->name,
|
||||
'dms_id' => $doc->dms_id
|
||||
);
|
||||
}
|
||||
$result = $this->getDataOrTerminateWithError($result);
|
||||
foreach ($result as $doc) {
|
||||
$dms_id_arr[$doc->dms_id] = array(
|
||||
'name' => $doc->name,
|
||||
'dms_id' => $doc->dms_id
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($_FILES as $k => $file)
|
||||
@@ -327,9 +316,9 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
//update(2) attach all new files (except type application/x.fhc-dms+json)
|
||||
if($file["type"] == 'application/x.fhc-dms+json')
|
||||
{
|
||||
$dms_uploaded[] = array(
|
||||
'name' => $file["name"]
|
||||
);
|
||||
$jsonFile = json_decode(file_get_contents($file['tmp_name']));
|
||||
unset($dms_id_arr[$jsonFile->dms_id]);
|
||||
#$dms_uploaded[] = $jsonFile->dms_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -347,48 +336,23 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
//Todo define in dms component: readFile, downloadFile
|
||||
$result = $this->dmslib->upload($dms, $k, array('*'));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$dms_id = $result->retval['dms_id'];
|
||||
$result = $this->getDataOrTerminateWithError($result);
|
||||
$dms_id = $result['dms_id'];
|
||||
|
||||
$result = $this->NotizdokumentModel->insert(array('notiz_id' => $notiz_id, 'dms_id' => $dms_id));
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
}
|
||||
|
||||
//update(3) check if all files have been deleted
|
||||
if(count($dms_uploaded) != count($dms_id_arr))
|
||||
foreach ($dms_id_arr as $file)
|
||||
{
|
||||
if (count($dms_uploaded) == 0)
|
||||
{
|
||||
$filesDeleted = $dms_id_arr;
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_new_names = array_column($dms_uploaded, "name");
|
||||
$result = $this->dmslib->removeAll($file['dms_id']);
|
||||
|
||||
$filesDeleted = array_filter($dms_id_arr, function ($file) use ($upload_new_names) {
|
||||
return !in_array($file["name"], $upload_new_names);
|
||||
});
|
||||
}
|
||||
|
||||
foreach ($filesDeleted as $file)
|
||||
{
|
||||
$result = $this->dmslib->removeAll($file['dms_id']);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->outputJson($result);
|
||||
}
|
||||
$this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
|
||||
return $this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
@@ -396,7 +360,6 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
{
|
||||
$this->load->library('DmsLib');
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
$notiz_id = $this->input->post('notiz_id');
|
||||
$typeId = $this->input->post('type_id');
|
||||
$id = $this->input->post('id');
|
||||
@@ -404,43 +367,24 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
//TODO(manu): define Permissions for deletion document if filecomponent finished
|
||||
|
||||
//get dms_id from notizdokument
|
||||
$dms_id_arr = [];
|
||||
$this->load->model('person/Notizdokument_model', 'NotizdokumentModel');
|
||||
|
||||
$result = $this->NotizdokumentModel->loadWhere(array('notiz_id' => $notiz_id));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$result = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
if(hasData($result))
|
||||
{
|
||||
$result = getData($result);
|
||||
foreach ($result as $doc) {
|
||||
$dms_id_arr[] = $doc->dms_id;
|
||||
}
|
||||
}
|
||||
|
||||
if($dms_id_arr)
|
||||
{
|
||||
// Start DB transaction
|
||||
$this->db->trans_start();
|
||||
// Start DB transaction
|
||||
$this->db->trans_start();
|
||||
|
||||
if ($result)
|
||||
$this->load->library('DmsLib');
|
||||
|
||||
|
||||
foreach($dms_id_arr as $dms_id)
|
||||
foreach ($result as $doc) {
|
||||
$res = $this->dmslib->removeAll($doc->dms_id);
|
||||
if (isError($result))
|
||||
{
|
||||
$result = $this->dmslib->removeAll($dms_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
$this->db->trans_rollback();
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$this->outputJson($result);
|
||||
$this->db->trans_rollback();
|
||||
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,9 +399,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
$this->load->model('person/Notiz_model', 'NotizModel');
|
||||
|
||||
//Delete Note
|
||||
$result = $this->NotizModel->delete(
|
||||
array('notiz_id' => $notiz_id)
|
||||
);
|
||||
$result = $this->NotizModel->delete($notiz_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
@@ -469,8 +411,8 @@ abstract class Notiz_Controller extends FHCAPI_Controller
|
||||
return $this->terminateWithError($this->p->t('ui','error_missingId', ['id'=> 'Notiz_id']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$this->db->trans_rollback();
|
||||
return $this->terminateWithSuccess(current(getData($result)));
|
||||
$this->db->trans_complete();
|
||||
return $this->terminateWithSuccess(getData($result));
|
||||
}
|
||||
|
||||
public function loadDokumente()
|
||||
|
||||
@@ -334,7 +334,7 @@ class PrestudentstatusCheckLib
|
||||
|
||||
foreach ($resultArr as $row)
|
||||
{
|
||||
// gerade bearbeiteten Status überspringen
|
||||
// Status, der gerade in Bearbeitung ist, überspringen
|
||||
if (isset($old_status_studiensemester)
|
||||
&& isset($old_status_ausbildungssemester)
|
||||
&& $row->status_kurzbz == $status_kurzbz
|
||||
|
||||
@@ -709,7 +709,7 @@ class Prestudent_model extends DB_Model
|
||||
{
|
||||
$query = "
|
||||
SELECT ps.studiensemester_kurzbz, p.priorisierung, p.studiengang_kz, sg.kurzbzlang, sg.orgform_kurzbz, ps.status_kurzbz, s.student_uid, sp.bezeichnung, ps.ausbildungssemester,
|
||||
CONCAT(ps.status_kurzbz, ' (', ps.ausbildungssemester, '. Semester)') as status
|
||||
CONCAT(ps.status_kurzbz, ' (', ps.ausbildungssemester, '. Semester)') as status, p.prestudent_id
|
||||
FROM public.tbl_prestudent p
|
||||
JOIN (
|
||||
SELECT DISTINCT ON(prestudent_id) *
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
<?php
|
||||
$configArray = [
|
||||
'generateAlias' => !defined('GENERATE_ALIAS_STUDENT') ? true : GENERATE_ALIAS_STUDENT,
|
||||
'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? true : ZGV_DOKTOR_ANZEIGEN,
|
||||
'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? true : ZGV_ERFUELLT_ANZEIGEN
|
||||
'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? false : ZGV_DOKTOR_ANZEIGEN,
|
||||
'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? false : ZGV_ERFUELLT_ANZEIGEN
|
||||
];
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user