diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 43de8bb60..950507b0c 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -63,7 +63,13 @@ class InfoCenter extends Auth_Controller 'name' => 'Note updated', 'message' => 'Note with title %s was updated', 'success' => null - ) + ), + 'updatedoctyp' => array( + 'logtype' => 'Action', + 'name' => 'Document type updated', + 'message' => 'Type of Document %s was updated, set to %s', + 'success' => null + ), ); // Name of Interessentenstatus @@ -87,6 +93,7 @@ class InfoCenter extends Auth_Controller 'showDetails' => 'infocenter:r', 'unlockPerson' => 'infocenter:rw', 'saveFormalGeprueft' => 'infocenter:rw', + 'saveDocTyp' => 'infocenter:rw', 'getPrestudentData' => 'infocenter:r', 'getLastPrestudentWithZgvJson' => 'infocenter:r', 'getZgvInfoForPrestudent' => 'infocenter:r', @@ -114,6 +121,7 @@ class InfoCenter extends Auth_Controller // Loads models $this->load->model('crm/Akte_model', 'AkteModel'); + $this->load->model('crm/Dokument_model', 'DokumentModel'); $this->load->model('crm/Prestudent_model', 'PrestudentModel'); $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); $this->load->model('crm/Statusgrund_model', 'StatusgrundModel'); @@ -211,9 +219,12 @@ class InfoCenter extends Auth_Controller $persondata = $this->_loadPersonData($person_id); $prestudentdata = $this->_loadPrestudentData($person_id); + $dokumentdata = array('dokumententypen' => (getData($this->DokumentModel->load()))); + $data = array_merge( $persondata, - $prestudentdata + $prestudentdata, + $dokumentdata ); $data[self::FHC_CONTROLLER_ID] = $this->getControllerId(); @@ -898,6 +909,41 @@ class InfoCenter extends Auth_Controller $this->outputJsonSuccess('success'); } + public function saveDocTyp($person_id) + { + $akte_id = $this->input->post('akte_id'); + $typ = $this->input->post('typ'); + + if (!isset($akte_id) || !isset($typ) || !isset($person_id)) + $this->terminateWithJsonError("Nicht alle sind Parameter übergeben worden"); + + $akte = $this->AkteModel->load($akte_id); + + if (!hasData($akte)) + $this->terminateWithJsonError("Fehler beim Laden der Akte"); + + $result = $this->AkteModel->update($akte_id, array('dokument_kurzbz' => $typ)); + + if (!isSuccess($result)) + $this->terminateWithJsonError("Fehler beim Update aufgetreten"); + + $dokument = $this->DokumentModel->load($akte->retval[0]->dokument_kurzbz); + + if (!hasData($dokument)) + $this->terminateWithJsonError("Fehler beim Laden des Dokumententypes"); + + $this->_log( + $person_id, + 'updatedoctyp', + array( + isEmptyString($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel, + isEmptyString($dokument->retval[0]->bezeichnung) ? $dokument->retval[0]->dokument_kurbz : $dokument->retval[0]->bezeichnung + ) + ); + + $this->outputJsonSuccess('success'); + } + // ----------------------------------------------------------------------------------------------------------------- // Private methods diff --git a/application/views/system/infocenter/dokpruefung.php b/application/views/system/infocenter/dokpruefung.php index 7c431fc46..b7b22150f 100644 --- a/application/views/system/infocenter/dokpruefung.php +++ b/application/views/system/infocenter/dokpruefung.php @@ -18,7 +18,14 @@ titel) ? $dokument->bezeichnung : $dokument->titel ?> - dokument_bezeichnung ?> + + + erstelltam), 'd.m.Y') ?> langtext ?> diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 0c7030059..6eb1accae 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -208,10 +208,10 @@ LIMIT 1 ) AS "StgAktiv", ( - SELECT ps.zgvnation + SELECT CONCAT(COALESCE(ps.zgvnation, \'-\'), \' / \' , COALESCE(ps.zgvmanation, \'-\')) FROM public.tbl_prestudent ps WHERE ps.person_id = p.person_id - ORDER BY ps.zgvnation DESC NULLS LAST, ps.prestudent_id DESC + ORDER BY ps.zgvnation, ps.zgvmanation DESC NULLS LAST, ps.prestudent_id DESC LIMIT 1 ) AS "ZGVNation" FROM public.tbl_person p diff --git a/application/views/system/infocenter/infocenterFreigegebenData.php b/application/views/system/infocenter/infocenterFreigegebenData.php index aab69b651..02d15655a 100644 --- a/application/views/system/infocenter/infocenterFreigegebenData.php +++ b/application/views/system/infocenter/infocenterFreigegebenData.php @@ -205,10 +205,10 @@ LIMIT 1 ) AS "ReihungstestDate", ( - SELECT ps.zgvnation + SELECT CONCAT(COALESCE(ps.zgvnation, \'-\'), \' / \' , COALESCE(ps.zgvmanation, \'-\')) FROM public.tbl_prestudent ps WHERE ps.person_id = p.person_id - ORDER BY ps.zgvnation DESC NULLS LAST, ps.prestudent_id DESC + ORDER BY ps.zgvnation, ps.zgvmanation DESC NULLS LAST, ps.prestudent_id DESC LIMIT 1 ) AS "ZGVNation" FROM public.tbl_person p diff --git a/application/views/system/infocenter/infocenterReihungstestAbsolviertData.php b/application/views/system/infocenter/infocenterReihungstestAbsolviertData.php index 22b122bb0..9f7a5204a 100644 --- a/application/views/system/infocenter/infocenterReihungstestAbsolviertData.php +++ b/application/views/system/infocenter/infocenterReihungstestAbsolviertData.php @@ -161,10 +161,10 @@ LIMIT 1 ) AS "ReihungstestDatum", ( - SELECT ps.zgvnation + SELECT CONCAT(COALESCE(ps.zgvnation, \'-\'), \' / \' , COALESCE(ps.zgvmanation, \'-\')) FROM public.tbl_prestudent ps WHERE ps.person_id = p.person_id - ORDER BY ps.zgvnation DESC NULLS LAST, ps.prestudent_id DESC + ORDER BY ps.zgvnation, ps.zgvmanation DESC NULLS LAST, ps.prestudent_id DESC LIMIT 1 ) AS "ZGVNation" FROM public.tbl_person p diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index 7023af277..43f3315e0 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -114,7 +114,13 @@ $(document).ready(function () { $('html,body').animate({scrollTop:0},250,'linear'); } - ) + ); + + $('.aktenid').change(function(){ + var akteid = InfocenterDetails._getPrestudentIdFromElementId(this.id); + var typ = $(this).val(); + InfocenterDetails.saveDocTyp(personid, akteid, typ); + }); }); var InfocenterDetails = { @@ -702,6 +708,25 @@ var InfocenterDetails = { ); }, + saveDocTyp: function(personid, akteid, typ) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + "/saveDocTyp/"+encodeURIComponent(personid), + { + "akte_id": akteid, + "typ" : typ + }, + { + successCallback: function(data, textStatus, jqXHR) { + InfocenterDetails._refreshLog(); + }, + errorCallback: function() { + FHC_DialogLib.alertWarning("Document type could not be updated"); + } + } + ); + }, + // ----------------------------------------------------------------------------------------------------------------- // (private) methods executed after ajax (refreshers)