- editieren von stammdaten im infocentertool

This commit is contained in:
ma0048
2022-10-18 11:00:57 +02:00
parent 6a2f570ffa
commit 0bd7d6f7c6
5 changed files with 271 additions and 21 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,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;
@@ -0,0 +1,14 @@
<?php
class Geschlecht_model extends DB_Model
{
/**
*
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_geschlecht';
$this->pk = 'geschlecht';
}
}
@@ -1,60 +1,93 @@
<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><input type="text" id="titelpre" readonly value="<?php echo $stammdaten->titelpre ?>"></td>
</tr>
<?php endif; ?>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','vorname')) ?></strong></td>
<td><?php echo $stammdaten->vorname ?></td>
<td><input type="text" id="vorname" readonly value="<?php echo $stammdaten->vorname ?>"></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','nachname')) ?></strong></td>
<td>
<?php echo $stammdaten->nachname ?></td>
<input type="text" id="nachname" readonly value="<?php echo $stammdaten->nachname ?>"></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','titelpost')) ?></strong></td>
<td><input type="text" id="titelpost" readonly value="<?php echo $stammdaten->titelpost ?>"></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>
<input type="text" id="gebdatum" readonly value="<?php echo date_format(date_create($stammdaten->gebdatum), 'd.m.Y') ?>" placeholder="DD.MM.YYYY"></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','svnr')) ?></strong></td>
<td>
<?php echo $stammdaten->svnr ?></td>
<input type="text" id="svnr" readonly value="<?php echo $stammdaten->svnr ?>"></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','staatsbuergerschaft')) ?></strong></td>
<td>
<?php echo $stammdaten->staatsbuergerschaft ?></td>
<select id="buergerschaft" readonly>
<?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" readonly>
<?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" readonly>
<?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><input type="text" id="gebort" readonly value="<?php echo $stammdaten->gebort ?>"></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>
@@ -83,7 +116,10 @@
<a href="mailto:<?php echo $kontakt->kontakt; ?>" target="_top">
<?php $lastMailAdress = $kontakt->kontakt;
endif;
echo $kontakt->kontakt;
if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil'))
echo '<input type="text" data-value="'. $kontakt->kontakt_id .'" class="kontakt_nummer" readonly value="'. $kontakt->kontakt . '"';
else
echo $kontakt->kontakt;
if ($kontakt->kontakttyp === 'email'):
?>
</a>
@@ -126,6 +162,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>