diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 48c50bb4a..deaee0e10 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -121,6 +121,7 @@ class InfoCenter extends Auth_Controller 'unlockPerson' => 'infocenter:rw', 'saveFormalGeprueft' => 'infocenter:rw', 'saveDocTyp' => 'infocenter:rw', + 'updateStammdaten' => 'infocenter:rw', 'saveNachreichung' => 'infocenter:rw', 'getPrestudentData' => 'infocenter:r', 'getLastPrestudentWithZgvJson' => 'infocenter:r', @@ -172,6 +173,8 @@ class InfoCenter extends Auth_Controller $this->load->model('codex/Zgv_model', 'ZgvModel'); $this->load->model('codex/Zgvmaster_model', 'ZgvmasterModel'); $this->load->model('codex/Nation_model', 'NationModel'); + $this->load->model('person/Kontakt_model', 'KontaktModel'); + $this->load->model('person/Geschlecht_model', 'GeschlechtModel'); // Loads libraries $this->load->library('PersonLogLib'); @@ -1320,6 +1323,85 @@ class InfoCenter extends Auth_Controller $this->outputJsonSuccess('success'); } + public function updateStammdaten() + { + if (isEmptyString($this->input->post('nachname')) || + isEmptyString($this->input->post('geschlecht')) || + isEmptyString($this->input->post('gebdatum'))) + { + $this->terminateWithJsonError($this->p->t('infocenter', 'stammdatenFeldFehlt')); + } + + $datum = explode('.', $this->input->post('gebdatum')); + + if (!checkdate($datum[1], $datum[0], $datum[2])) + { + $this->terminateWithJsonError($this->p->t('infocenter', 'datumUngueltig')); + } + + $person_id = $this->input->post('personid'); + + $update = $this->PersonModel->update( + array + ( + 'person_id' => $person_id + ), + array + ( + 'titelpre' => isEmptyString($this->input->post('titelpre')) ? null : $this->input->post('titelpre'), + 'vorname' => isEmptyString($this->input->post('vorname')) ? null : $this->input->post('vorname'), + 'nachname' => $this->input->post('nachname'), + 'titelpost' => isEmptyString($this->input->post('titelpost')) ? null : $this->input->post('titelpost'), + 'gebdatum' => isEmptyString($this->input->post('gebdatum')) ? null : date("Y-m-d", strtotime($this->input->post('gebdatum'))), + 'svnr' => isEmptyString($this->input->post('svnr')) ? null : $this->input->post('svnr'), + 'staatsbuergerschaft' => isEmptyString($this->input->post('buergerschaft')) ? null : $this->input->post('buergerschaft'), + 'geschlecht' => $this->input->post('geschlecht'), + 'geburtsnation' => isEmptyString($this->input->post('gebnation')) ? null : $this->input->post('gebnation'), + 'gebort' => isEmptyString($this->input->post('gebort')) ? null : $this->input->post('gebort'), + 'updateamum' => date('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + + if (isError($update)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + + $kontakte = $this->input->post('kontakt'); + foreach($kontakte as $kontakt) + { + $kontaktExists = $this->KontaktModel->loadWhere(array( + 'kontakt_id' => $kontakt['id'], + 'person_id' => $person_id, + )); + + if (hasData($kontaktExists)) + { + $kontaktExists = getData($kontaktExists)[0]; + + if ($kontaktExists->kontakt === $kontakt['value']) + continue; + + $update = $this->KontaktModel->update( + array + ( + 'kontakt_id' => $kontakt['id'] + ), + array + ( + 'kontakt' => isEmptyString($kontakt['value']) ? null : $kontakt['value'], + 'updateamum' => date('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + + if (isError($update)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + } + } + + $this->outputJsonSuccess('Success'); + } + public function saveNachreichung($person_id) { $nachreichungAm = $this->input->post('nachreichungAm'); @@ -1996,6 +2078,9 @@ class InfoCenter extends Auth_Controller $this->NationModel->addOrder('langtext'); $allNations = getData($this->NationModel->load()); + $this->GeschlechtModel->addOrder('sort'); + $allGenders = getData($this->GeschlechtModel->load()); + $data = array ( 'zgvpruefungen' => $zgvpruefungen, 'abwstatusgruende' => $abwstatusgruende, @@ -2004,6 +2089,7 @@ class InfoCenter extends Auth_Controller 'all_zgvs' => $allZGVs, 'all_zgvs_master' => $allZGVsMaster, 'all_nations' => $allNations, + 'all_genders' => $allGenders ); return $data; diff --git a/application/models/person/Geschlecht_model.php b/application/models/person/Geschlecht_model.php new file mode 100644 index 000000000..60ac3ba15 --- /dev/null +++ b/application/models/person/Geschlecht_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_geschlecht'; + $this->pk = 'geschlecht'; + } +} diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index a80439bfe..595f86b1a 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -1,60 +1,93 @@
-
+
- titelpre)): ?> - + - + - + + + + + + - titelpost)): ?> - - - - - + + + + + + + + - +
p->t('person','titelpre')) ?>titelpre ?>
p->t('person','vorname')) ?>vorname ?>
p->t('person','nachname')) ?> - nachname ?>
p->t('person','titelpost')) ?>
p->t('person','titelpost')) ?>titelpost ?>
p->t('person','geburtsdatum')) ?> - gebdatum), 'd.m.Y') ?>
p->t('person','svnr')) ?> - svnr ?>
p->t('person','staatsbuergerschaft')) ?> - staatsbuergerschaft ?>
p->t('person','geschlecht')) ?> - geschlecht ?>
p->t('person','geburtsnation')) ?> - geburtsnation ?>
p->t('person','geburtsort')) ?>gebort ?>
- +
@@ -83,7 +116,10 @@ kontakt; endif; - echo $kontakt->kontakt; + if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) + echo 'kontakt; if ($kontakt->kontakttyp === 'email'): ?> @@ -126,6 +162,16 @@ target='_blank'> p->t('infocenter','zugangBewerbung') ?> + diff --git a/public/js/infocenter/stammdaten.js b/public/js/infocenter/stammdaten.js new file mode 100644 index 000000000..d63df7b2f --- /dev/null +++ b/public/js/infocenter/stammdaten.js @@ -0,0 +1,84 @@ +$(document).ready(function () +{ + var personid = $("#hiddenpersonid").val(); + + $('.editStammdaten').click(function() + { + Stammdaten._show(); + }); + + $('.cancelStammdaten').click(function() + { + Stammdaten._hide(); + }); + + $('.saveStammdaten').click(function() + { + var kontakt = []; + $('.kontakt_nummer').each(function(){ + kontakt.push({ + id: $(this).data('value'), + value: $(this).val() + }); + }); + + var data = { + "personid" : personid, + "titelpre" : $('#titelpre').val(), + "vorname" : $('#vorname').val(), + "nachname" : $('#nachname').val(), + "titelpost" : $('#titelpost').val(), + "gebdatum" : $('#gebdatum').val(), + "svnr" : $('#svnr').val(), + "buergerschaft" : $('#buergerschaft').val(), + "geschlecht" : $('#geschlecht').val(), + "gebnation" : $('#gebnation').val(), + "gebort" : $('#gebort').val(), + "kontakt" : kontakt + + }; + Stammdaten.update(personid, data); + }); +}); + +var Stammdaten = { + update: function(personid, data) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + "/updateStammdaten/", + data, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.isSuccess(data)) + { + FHC_DialogLib.alertSuccess("Done!"); + Stammdaten._hide(); + } + else + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + }, + errorCallback: function() { + FHC_DialogLib.alertWarning("Fehler beim Speichern!"); + } + } + ); + }, + + _hide: function() + { + $('.stammdaten_form').find('input, select').attr('readonly', true); + + $('.editActionStammdaten').hide(); + $('.editStammdaten').show(); + }, + + _show: function() + { + $('.stammdaten_form').find('input, select').attr('readonly', false); + + $('.editActionStammdaten').show(); + $('.editStammdaten').hide(); + } +} \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 8ac09cee0..3151eb0f5 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -17137,7 +17137,27 @@ array( 'insertvon' => 'system' ) ) - ) + ), + array( + 'app' => 'infocenter', + 'category' => 'infocenter', + 'phrase' => 'stammdatenFeldFehlt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Bitte Nachname, Geschlecht und Geburtsdatum ausfüllen.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Please fill out the last name, gender and date of birth.', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), );
p->t('global','kontakt')) ?>