Merge branch 'feature-25430/stammdaten_im_infocentertool_editierbar'

This commit is contained in:
Andreas Österreicher
2023-02-02 10:32:36 +01:00
6 changed files with 461 additions and 26 deletions
@@ -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;
@@ -0,0 +1,14 @@
<?php
class Geschlecht_model extends DB_Model
{
/**
*
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_geschlecht';
$this->pk = 'geschlecht';
}
}
@@ -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(
@@ -1,60 +1,104 @@
<div class="row">
<div class="col-lg-6 table-responsive">
<div class="col-lg-6 table-responsive stammdaten_form">
<table class="table">
<?php if (!empty($stammdaten->titelpre)): ?>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','titelpre')) ?></strong></td>
<td><?php echo $stammdaten->titelpre ?></td>
<td>
<div class='stammdaten' id="titelpre"><?php echo $stammdaten->titelpre ?></div>
</td>
</tr>
<?php endif; ?>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','vorname')) ?></strong></td>
<td><?php echo $stammdaten->vorname ?></td>
<td>
<div class='stammdaten' id="vorname"><?php echo $stammdaten->vorname ?></div>
</td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','nachname')) ?></strong></td>
<td>
<?php echo $stammdaten->nachname ?></td>
<div class='stammdaten' id="nachname"><?php echo $stammdaten->nachname ?></div>
</td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','titelpost')) ?></strong></td>
<td>
<div class='stammdaten' id="titelpost"><?php echo $stammdaten->titelpost ?></div>
</td>
</tr>
<?php if (!empty($stammdaten->titelpost)): ?>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','titelpost')) ?></strong></td>
<td><?php echo $stammdaten->titelpost ?></td>
</tr>
<?php endif; ?>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','geburtsdatum')) ?></strong></td>
<td>
<?php echo date_format(date_create($stammdaten->gebdatum), 'd.m.Y') ?></td>
<div class='stammdaten' id="gebdatum"><?php echo date_format(date_create($stammdaten->gebdatum), 'd.m.Y') ?></div>
</td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','svnr')) ?></strong></td>
<td>
<?php echo $stammdaten->svnr ?></td>
<div class='stammdaten' id="svnr"><?php echo $stammdaten->svnr ?></div>
</td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','staatsbuergerschaft')) ?></strong></td>
<td>
<?php echo $stammdaten->staatsbuergerschaft ?></td>
<select id="buergerschaft" disabled>
<?php
foreach ($all_nations as $nation)
{
$selected = '';
if ($nation->nation_code === $stammdaten->staatsbuergerschaft_code)
$selected = 'selected';
echo "<option value='". $nation->nation_code ."' " . $selected . ">". $nation->langtext . "</option>";
}
?>
</select>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','geschlecht')) ?></strong></td>
<td>
<?php echo $stammdaten->geschlecht ?></td>
<?php
$language = getUserLanguage() == 'German' ? 0 : 1;
?>
<select id="geschlecht" disabled>
<?php
foreach ($all_genders as $gender)
{
$selected = '';
if ($gender->geschlecht === $stammdaten->geschlecht)
$selected = 'selected';
echo "<option value='". $gender->geschlecht ."' " . $selected . ">". ucfirst($gender->bezeichnung_mehrsprachig[$language]) . "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','geburtsnation')) ?></strong></td>
<td>
<?php echo $stammdaten->geburtsnation ?></td>
<select id="gebnation" disabled>
<?php
foreach ($all_nations as $nation)
{
$selected = '';
if ($nation->nation_code === $stammdaten->geburtsnation_code)
$selected = 'selected';
echo "<option value='". $nation->nation_code ."' " . $selected . ">". $nation->langtext . "</option>";
}
?>
</select>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','geburtsort')) ?></strong></td>
<td><?php echo $stammdaten->gebort ?></td>
<td>
<div class='stammdaten' id="gebort"><?php echo $stammdaten->gebort ?></div>
</td>
</tr>
</table>
</div>
<div class="col-lg-6 table-responsive">
<table class="table table-bordered">
<table class="table table-bordered stammdaten_form">
<thead>
<tr>
<th colspan="4" class="text-center"><?php echo ucfirst($this->p->t('global','kontakt')) ?></th>
@@ -78,7 +122,7 @@
<td><?php echo ucfirst($kontakt->kontakttyp) ?></td>
<?php endif; ?>
<td>
<?php echo '<span class="'.$kontakt->kontakttyp.'">';?>
<?php echo '<span class="kontakt '.$kontakt->kontakttyp.'" data-id="'. $kontakt->kontakt_id .'" data-value="' . $kontakt->kontakt .'">';?>
<?php if ($kontakt->kontakttyp === 'email'): ?>
<a href="mailto:<?php echo $kontakt->kontakt; ?>" target="_top">
<?php $lastMailAdress = $kontakt->kontakt;
@@ -99,8 +143,30 @@
<?php echo ucfirst($this->p->t('person','adresse')) ?>
</td>
<td>
<?php echo isset($adresse) ? $adresse->strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?>
<?php echo isset($adresse->nationkurztext) ? '<br />'.$adresse->nationkurztext : '' ?>
<?php if (isset($adresse)): ?>
<div class="row adresse col-sm-12" data-id="<?php echo $adresse->adresse_id ?>">
<div class="float-left" data-value="<?php echo $adresse->strasse ?>" data-type="strasse"><?php echo $adresse->strasse ?></div>
<div class="float-left" data-value="<?php echo $adresse->plz ?>" data-type="plz"><?php echo $adresse->plz ?></div>
<div class="float-left" data-value="<?php echo $adresse->ort ?>" data-type="ort"><?php echo $adresse->ort ?></div>
<?php if (isset($adresse->nationkurztext)): ?>
<select id="nation_<?php echo $adresse->adresse_id ?>" disabled>
<?php
foreach ($all_nations as $nation)
{
$selected = '';
if ($nation->nation_code === $adresse->nation)
$selected = 'selected';
echo "<option value='". $nation->nation_code ."' " . $selected . ">". $nation->langtext . "</option>";
}
?>
</select>
</div>
<br />
<?php endif; ?>
<?php endif; ?>
</td>
<td>
<?php echo ($adresse->heimatadresse === true ? 'Heimatadresse' : '').
@@ -126,6 +192,16 @@
target='_blank'><i class="glyphicon glyphicon-new-window"></i>&nbsp;<?php echo $this->p->t('infocenter','zugangBewerbung') ?></a>
</div>
<?php endif; ?>
<div class="col-xs-6">
<a class="editStammdaten">
<i class="fa fa-edit"></i>&nbsp;<?php echo $this->p->t('ui','bearbeiten'); ?></a>
<div class="editActionStammdaten" style="display:none">
<a class="cancelStammdaten">
<i class="fa fa-trash"></i>&nbsp;<?php echo $this->p->t('ui','abbrechen');?></a>
<a class="saveStammdaten">
<i class="fa fa-save"></i>&nbsp;<?php echo $this->p->t('ui','speichern'); ?></a>
</div>
</div>
</div>
</div>
</div>