diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index 618b6a2ef..f8a8539a0 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -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() diff --git a/application/libraries/PrestudentstatusCheckLib.php b/application/libraries/PrestudentstatusCheckLib.php index a64e67664..3b191619f 100644 --- a/application/libraries/PrestudentstatusCheckLib.php +++ b/application/libraries/PrestudentstatusCheckLib.php @@ -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 diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 7280fd9fb..4c295c3cd 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -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) * diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index 8993053b3..2d0d22346 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -34,8 +34,8 @@ !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 ]; ?> diff --git a/public/js/components/Betriebsmittel/Betriebsmittel.js b/public/js/components/Betriebsmittel/Betriebsmittel.js index ce0d6ce61..38563633f 100644 --- a/public/js/components/Betriebsmittel/Betriebsmittel.js +++ b/public/js/components/Betriebsmittel/Betriebsmittel.js @@ -111,7 +111,8 @@ export default { layoutColumnsOnNewData: false, height: '550', selectableRangeMode: 'click', - selectable: true + selectable: true, + persistenceID: 'core-betriebsmittel' }, tabulatorEvents: [ { diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index ec2c7696b..f766b96eb 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -151,7 +151,8 @@ export default { height: '250', selectableRangeMode: 'click', selectable: true, - index: 'notiz_id' + index: 'notiz_id', + persistenceID: 'core-notiz' }, tabulatorEvents: [ { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Details.js b/public/js/components/Stv/Studentenverwaltung/Details/Details.js index 7866f1c97..feec7a580 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Details.js @@ -1,4 +1,3 @@ -import {CoreRESTClient} from '../../../../RESTClient.js'; import CoreForm from '../../../Form/Form.js'; import FormInput from '../../../Form/Input.js'; import FormUploadImage from '../../../Form/Upload/Image.js'; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js index 20513add8..7e4cbc3db 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js @@ -97,6 +97,7 @@ export default{ height: 'auto', selectable: true, index: 'adresse_id', + persistenceID: 'stv-details-kontakt-address' }, tabulatorEvents: [ { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js index 2a26f9fc1..7d3e3e7da 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js @@ -85,7 +85,8 @@ export default{ layoutColumnsOnNewData: false, height: 'auto', selectable: true, - index: 'bankverbindung_id' + index: 'bankverbindung_id', + persistenceID: 'stv-details-kontakt-bankaccount' }, tabulatorEvents: [ { @@ -214,7 +215,7 @@ export default{ }, }, template: ` -