diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 29176d1ed..882fd8e47 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,11 +173,14 @@ 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'); + $this->load->model('person/adresse_model', 'AdresseModel'); // Loads libraries $this->load->library('PersonLogLib'); $this->load->library('WidgetLib'); - + $this->load->config('infocenter'); $this->loadPhrases( @@ -1322,6 +1326,126 @@ 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')); + } + } + + $adressen = $this->input->post('adresse'); + + foreach ($adressen as $adresse) + { + $adresseExists = $this->AdresseModel->loadWhere(array( + 'adresse_id' => $adresse['id'], + 'person_id' => $person_id, + )); + + if (hasData($adresseExists)) + { + $adresse = $adresse['value']; + $adresseExists = getData($adresseExists)[0]; + if ($adresseExists->strasse !== $adresse['strasse'] || + $adresseExists->plz !== $adresse['plz'] || + $adresseExists->ort !== $adresse['ort'] || + $adresseExists->nation !== $adresse['nation']) + { + $update = $this->AdresseModel->update( + array + ( + 'adresse_id' => $adresseExists->adresse_id + ), + array + ( + 'strasse' => isEmptyString($adresse['strasse']) ? null : $adresse['strasse'], + 'plz' => isEmptyString($adresse['plz']) ? null : $adresse['plz'], + 'ort' => isEmptyString($adresse['ort']) ? null : $adresse['ort'], + 'nation' => isEmptyString($adresse['nation']) ? null : $adresse['nation'], + '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'); @@ -1998,8 +2122,12 @@ class InfoCenter extends Auth_Controller $this->NationModel->addOrder('langtext'); $allNations = getData($this->NationModel->load()); + $additional_stg = explode(',', ($this->config->item('infocenter_studiengang_kz'))); + $this->GeschlechtModel->addOrder('sort'); + $allGenders = getData($this->GeschlechtModel->load()); + $data = array ( 'zgvpruefungen' => $zgvpruefungen, 'abwstatusgruende' => $abwstatusgruende, @@ -2008,7 +2136,8 @@ class InfoCenter extends Auth_Controller 'all_zgvs' => $allZGVs, 'all_zgvs_master' => $allZGVsMaster, 'all_nations' => $allNations, - 'additional_stg' => $additional_stg + 'additional_stg' => $additional_stg, + '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/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 158feeb2c..066e5cff6 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -25,7 +25,8 @@ 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', 'public/js/infocenter/zgvUeberpruefung.js', - 'public/js/infocenter/docUeberpruefung.js' + 'public/js/infocenter/docUeberpruefung.js', + 'public/js/infocenter/stammdaten.js' ), 'phrases' => array( 'infocenter' => array( diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index a80439bfe..f143c9c03 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -1,60 +1,104 @@
| p->t('person','titelpre')) ?> | -titelpre ?> | +
+ titelpre ?>
+ |
| p->t('person','vorname')) ?> | -vorname ?> | +
+ vorname ?>
+ |
| p->t('person','nachname')) ?> | - nachname ?> | +|
| p->t('person','titelpost')) ?> | +
+ 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 ?> | +
+ gebort ?>
+ |
| p->t('global','kontakt')) ?> | @@ -78,7 +122,7 @@kontakttyp) ?> | - kontakttyp.'">';?> + kontakttyp.'" data-id="'. $kontakt->kontakt_id .'" data-value="' . $kontakt->kontakt .'">';?> kontakttyp === 'email'): ?> kontakt; @@ -99,8 +143,30 @@ p->t('person','adresse')) ?> |
- strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?>
- nationkurztext) ? ' '.$adresse->nationkurztext : '' ?> + +
+
+ strasse ?>
+
+ plz ?>
+
+ ort ?>
+
+ nationkurztext)): ?>
+
+ + + |
heimatadresse === true ? 'Heimatadresse' : ''). @@ -126,6 +192,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..eca8dae46 --- /dev/null +++ b/public/js/infocenter/stammdaten.js @@ -0,0 +1,195 @@ +$(document).ready(function () +{ + var personid = $("#hiddenpersonid").val(); + + $('.editStammdaten').click(function() + { + Stammdaten._show(); + }); + + $('.cancelStammdaten').click(function() + { + Stammdaten._hide(); + }); + + $('.saveStammdaten').click(function() + { + var kontakt = []; + $('.kontakt_input').each(function(){ + kontakt.push({ + id: $(this).data('id'), + value: $(this).val() + }); + }); + + var adresse = []; + $('.adresse').each(function(){ + var id = $(this).data('id'); + adresse.push({ + id: id, + value: { + 'strasse': $('#strasse_' + id).val(), + 'plz': $('#plz_' + id).val(), + 'ort': $('#ort_' + id).val(), + 'nation': $('#nation_' + id).val(), + } + }); + }); + + var data = { + "personid" : personid, + "titelpre" : $('#titelpre_input').val(), + "vorname" : $('#vorname_input').val(), + "nachname" : $('#nachname_input').val(), + "titelpost" : $('#titelpost_input').val(), + "gebdatum" : $('#gebdatum_input').val(), + "svnr" : $('#svnr_input').val(), + "buergerschaft" : $('#buergerschaft').val(), + "geschlecht" : $('#geschlecht').val(), + "gebnation" : $('#gebnation').val(), + "gebort" : $('#gebort_input').val(), + "kontakt" : kontakt, + "adresse" : adresse, + }; + 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._updated(); + } + else + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + }, + errorCallback: function() { + FHC_DialogLib.alertWarning("Fehler beim Speichern!"); + } + } + ); + }, + + _hide: function() + { + $('.stammdaten_input').each(function(){ + $(this).parent('td').children('div').show(); + $(this).remove(); + }); + + $('.kontakt_input').each(function(){ + $(this).parent('td').children('span').show(); + $(this).remove(); + }); + + $('.adresse_input').each(function(){ + $(this).parent('div').children('div').show(); + $(this).remove(); + }); + }, + + _show: function() + { + $('.stammdaten').each(function() { + var id = $(this).attr('id'); + var input = $(''); + input.attr('id', id + '_input'); + input.addClass('form-control stammdaten_input'); + input.val($(this).html()); + $(this).hide(); + $(this).parent('td').append(input); + }); + + $('.kontakt').each(function() { + var id = $(this).data('id'); + var value = $(this).data('value'); + + $(this).hide(); + + var input = $(''); + input.attr('data-id', id); + input.attr('value', value); + input.addClass('form-control kontakt_input'); + input.val(value); + $(this).parent('td').append(input); + }); + + $('.adresse').each(function() { + var adressenID = $(this).data('id'); + $($(this).children('div').get().reverse()).each(function() { + $(this).hide(); + var type = $(this).data('type'); + var value = $(this).data('value'); + var input = $(''); + + input.attr('data-type', type); + input.attr('id', type + '_' + adressenID); + input.attr('value', value); + input.attr('placeholder', type.toUpperCase()); + input.addClass('form-control adresse_input'); + input.val(value); + $(this).parent().prepend(input); + }); + }); + + var stammdatenform = $('.stammdaten_form'); + + stammdatenform.find('select').attr('disabled', false); + $('.editActionStammdaten').show(); + $('.editStammdaten').hide(); + }, + + _updated: function() + { + $('.kontakt_input').each(function() { + var span = $(this).parent('td').children('span'); + var value = $(this).val(); + + var oldSpanValue = span.data('value'); + span.data('value', value); + var newhtml = span.html().replace(oldSpanValue, value); + span.html(newhtml); + if (span.hasClass('email')) + span.find('a').attr('href', 'mailto:' + value); + + span.show(); + $(this).remove(); + }); + + $('.adresse').each(function() { + $(this).children('input').each(function() { + var value = $(this).val(); + var type = $(this).data('type'); + var div = $('div[data-type="' + type + '"]'); + div.data('value', value); + div.html(value); + div.show(); + $(this).remove(); + }); + }); + + $('.stammdaten_input').each(function() { + var div = $(this).parent('td').children('div'); + var value = $(this).val(); + div.html(value); + div.show(); + $(this).remove(); + }); + + var stammdatenform = $('.stammdaten_form'); + stammdatenform.find('select').attr('disabled', true); + + $('.editActionStammdaten').hide(); + $('.editStammdaten').show(); + }, +} \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 157c2acc6..cf337e322 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -17142,7 +17142,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' + ) + ) + ), ); | |||
|---|---|---|---|---|---|---|---|