Datenverbund

- Added new Page to Manage missing bPK
- Improved Error Handling on DVB Class
This commit is contained in:
Andreas Österreicher
2018-11-20 17:36:24 +01:00
parent 412c05c7e3
commit 6a26609aef
10 changed files with 718 additions and 129 deletions
+52 -12
View File
@@ -9,20 +9,60 @@ $config['navigation_header'] = array(
'link' => site_url(''),
'icon' => '',
'description' => 'FH-Complete',
'sort' => 1
'sort' => 10
),
'vilesci' => array(
'link' => base_url('vilesci'),
'icon' => '',
'description' => 'Vilesci',
'sort' => 2,
'requiredPermissions' => 'basis/vilesci:r'
'Organisation' => array(
'link' => '#',
'icon' => 'sitemap',
'description' => 'Organisation',
'sort' => 20,
'children'=> array(
'vilesci' => array(
'link' => base_url('vilesci'),
'icon' => '',
'description' => 'Vilesci',
'expand' => true,
'sort' => 1,
'requiredPermissions' => 'basis/vilesci:r'
)
)
),
'cis' => array(
'link' => CIS_ROOT,
'icon' => '',
'description' => 'CIS',
'sort' => 3
'Lehre' => array(
'link' => '#',
'icon' => 'graduation-cap',
'description' => 'Lehre',
'sort' => 30,
'children'=> array(
'cis' => array(
'link' => CIS_ROOT,
'icon' => '',
'description' => 'CIS',
'sort' => 10
),
'infocenter' => array(
'link' => site_url('system/infocenter/InfoCenter'),
'icon' => 'info',
'description' => 'Infocenter',
'expand' => true,
'sort' => 20,
'requiredPermissions' => 'infocenter:r'
),
)
),
'Personen' => array(
'link' => '#',
'icon' => 'user',
'description' => 'Personen',
'sort' => 40,
'children'=> array(
'bpk' => array(
'link' => site_url('person/BPKWartung'),
'icon' => '',
'description' => 'BPK Wartung',
'sort' => 10,
'requiredPermissions' => 'admin:r'
)
)
)
)
);
@@ -0,0 +1,199 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Page for checking Persons where no bPK was found automatically
*/
class BPKWartung extends Auth_Controller
{
private $_uid; // contains the UID of the logged user
/**
* Constructor
*/
public function __construct()
{
parent::__construct(
array(
'index' => 'admin:r',
'showDetails' => 'admin:r',
'saveBPK' => 'admin:rw',
)
);
// Loads models
$this->load->model('crm/akte_model', 'AkteModel');
$this->load->model('person/person_model', 'PersonModel');
$this->load->model('person/adresse_model', 'AdressModel');
$this->load->library('WidgetLib');
$this->loadPhrases(
array(
'global',
'person',
'lehre',
'ui',
'infocenter',
'filter'
)
);
$this->setControllerId(); // sets the controller id
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Main page of the InfoCenter tool
*/
public function index()
{
$this->_setNavigationMenuIndex(); // define the navigation menu for this page
$this->load->view('person/bpk/bpkwartung.php');
}
/**
* Personal details page of the InfoCenter tool
* Initialization function, gets person and prestudent data and loads the view with the data
* @param $person_id
*/
public function showDetails()
{
$this->_setNavigationMenuShowDetails();
$person_id = $this->input->get('person_id');
if (!is_numeric($person_id))
show_error('person id is not numeric!');
$personexists = $this->PersonModel->load($person_id);
if (isError($personexists))
show_error($personexists->retval);
if (!hasData($personexists))
show_error('Person does not exist!');
$persondata = $this->_loadPersonData($person_id);
$data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
$this->load->view('person/bpk/bpkDetails.php', $persondata);
}
/**
* Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master
* @param $prestudent_id
*/
public function saveBPK()
{
$person_id = $this->input->post('person_id');
$bpk = $this->input->post('bpk');
if (isEmptyString($person_id))
$result = error('PersonID missing');
else
{
$result = $this->PersonModel->update(
$person_id,
array(
'bpk' => $bpk,
'updateamum' => date('Y-m-d H:i:s')
)
);
redirect('person/BPKWartung/index');
}
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Loads all necessary Person data: Stammdaten (name, svnr, contact, ...), Dokumente, Logs and Notizen
* @param $person_id
* @return array
*/
private function _loadPersonData($person_id)
{
$stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true);
if (isError($stammdaten))
{
show_error($stammdaten->retval);
}
if (!isset($stammdaten->retval))
return null;
$adresse = $this->AdressModel->getZustellAdresse($person_id);
if (isError($adresse))
{
show_error($adresse->retval);
}
$data = array(
'stammdaten' => $stammdaten->retval,
'adresse' => $adresse->retval[0]
);
return $data;
}
/**
* Define the navigation menu for the showDetails page
*/
private function _setNavigationMenuShowDetails()
{
$this->load->library('NavigationLib', array('navigation_page' => 'person/BPKWartung/showDetails'));
$link = site_url('person/BPKWartung');
$this->navigationlib->setSessionMenu(
array(
'back' => $this->navigationlib->oneLevel(
'Zurück', // description
$link, // link
array(), // children
'angle-left', // icon
true, // expand
null, // subscriptDescription
null, // subscriptLinkClass
null, // subscriptLinkValue
'', // target
1 // sort
)
)
);
}
/**
* Define the navigation menu for the showDetails page
*/
private function _setNavigationMenuIndex()
{
$this->load->library('NavigationLib', array('navigation_page' => 'person/BPKWartung/index'));
$link = site_url();
$this->navigationlib->setSessionMenu(
array(
'back' => $this->navigationlib->oneLevel(
'Zurück', // description
$link, // link
array(), // children
'angle-left', // icon
true, // expand
null, // subscriptDescription
null, // subscriptLinkClass
null, // subscriptLinkValue
'', // target
1 // sort
)
)
);
}
}
@@ -11,4 +11,15 @@ class Adresse_model extends DB_Model
$this->dbTable = 'public.tbl_adresse';
$this->pk = 'adresse_id';
}
/**
* gets person data from uid
* @param $uid
* @return array
*/
public function getZustellAdresse($person_id)
{
return $this->loadWhere(array('person_id' => $person_id, 'zustelladresse'=> true));
}
}
+58
View File
@@ -0,0 +1,58 @@
<?php
$filterWidgetArray = array(
'query' => '
SELECT
person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr,
staatsbuergerschaft, gebdatum
FROM
public.tbl_person
WHERE
matr_nr is not null
AND bpk is null
AND EXISTS(SELECT 1 FROM public.tbl_benutzer JOIN public.tbl_student ON(uid=student_uid) AND
person_id=tbl_person.person_id AND tbl_benutzer.aktiv=true)
',
'requiredPermissions' => 'admin',
'additionalColumns' => array('Details'),
'columnsAliases' => array(
'PersonID',
ucfirst($this->p->t('person', 'vorname')) ,
ucfirst($this->p->t('person', 'nachname')),
ucfirst($this->p->t('person', 'geschlecht')),
ucfirst($this->p->t('person', 'svnr')),
ucfirst($this->p->t('person', 'ersatzkennzeichen')),
ucfirst($this->p->t('person', 'matrikelnummer')),
ucfirst($this->p->t('person', 'staatsbuergerschaft')),
ucfirst($this->p->t('person', 'geburtsdatum')),
),
'formatRow' => function($datasetRaw) {
/* NOTE: Dont use $this here for PHP Version compatibility */
$datasetRaw->{'Details'} = sprintf(
'<a href="%s?person_id=%s&origin_page=%s&fhc_controller_id=%s">Details</a>',
site_url('person/BPKWartung/showDetails'),
$datasetRaw->{'person_id'},
'index',
(isset($_GET['fhc_controller_id'])?$_GET['fhc_controller_id']:'')
);
if ($datasetRaw->{'ersatzkennzeichen'} == null)
{
$datasetRaw->{'ersatzkennzeichen'} = '-';
}
if ($datasetRaw->{'svnr'} == null)
{
$datasetRaw->{'svnr'} = '-';
}
return $datasetRaw;
}
);
$filterWidgetArray['app'] = 'core';
$filterWidgetArray['datasetName'] = 'overview';
$filterWidgetArray['filterKurzbz'] = 'BPKWartung';
$filterWidgetArray['filter_id'] = $this->input->get('filter_id');
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
?>
+153
View File
@@ -0,0 +1,153 @@
<?php
$this->load->view(
'templates/FHC-Header',
array(
'title' => 'bPK Details',
'jquery' => true,
'bootstrap' => true,
'fontawesome' => true,
'jqueryui' => true,
'ajaxlib' => true,
'tablesorter' => true,
'tinymce' => true,
'sbadmintemplate' => true,
'addons' => true,
'navigationwidget' => true,
'customCSSs' => array(
'public/css/sbadmin2/admintemplate.css',
'public/css/sbadmin2/tablesort_bootstrap.css',
'public/css/infocenter/infocenterDetails.css'
),
'customJSs' => array(
'public/js/bootstrapper.js',
'public/js/tablesort/tablesort.js'
),
'phrases' => array(
'ui' => array(
'gespeichert',
'fehlerBeimSpeichern'
),
'global' => array(
'bis',
'zeilen'
)
)
)
);
?>
<body>
<div id="wrapper">
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
<div id="page-wrapper">
<div class="container-fluid">
<input type="hidden" id="hiddenpersonid" value="<?php echo $stammdaten->person_id ?>">
<div class="row">
<div class="col-lg-8">
<h3 class="page-header">
bPK Details: <?php echo $stammdaten->vorname.' '.$stammdaten->nachname ?>
</h3>
</div>
</div>
<br/>
<section>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading text-center">
<h4><?php echo ucfirst($this->p->t('global', 'stammdaten')) ?></h4>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6 table-responsive">
<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>
</tr>
<?php endif; ?>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','vorname')) ?></strong></td>
<td><?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>
</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>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','svnr')) ?></strong></td>
<td>
<?php echo $stammdaten->svnr ?></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','ersatzkennzeichen')) ?></strong></td>
<td>
<?php echo $stammdaten->ersatzkennzeichen ?></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','staatsbuergerschaft')) ?></strong></td>
<td>
<?php echo $stammdaten->staatsbuergerschaft ?></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','geschlecht')) ?></strong></td>
<td>
<?php echo $stammdaten->geschlecht ?></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','bpk')) ?></strong></td>
<td>
<?php echo $stammdaten->bpk ?></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','postleitzahl')) ?></strong></td>
<td>
<?php echo $adresse->plz ?></td>
</tr>
<tr>
<td><strong><?php echo ucfirst($this->p->t('person','strasse')) ?></strong></td>
<td>
<?php echo $adresse->strasse ?></td>
</tr>
</table>
</div>
<div class="col-lg-4 table-responsive">
<form action="<?php echo base_url('soap/datenverbund_client.php?action=pruefeBPK');?>" method="POST" target="_blank">
<input type="hidden" name="vorname" value="<?php echo $stammdaten->vorname; ?>"/>
<input type="hidden" name="nachname" value="<?php echo $stammdaten->nachname; ?>"/>
<input type="hidden" name="geburtsdatum" value="<?php echo mb_str_replace('-','',$stammdaten->gebdatum); ?>"/>
<input type="hidden" name="geschlecht" value="<?php echo mb_strtoupper($stammdaten->geschlecht); ?>"/>
<input type="submit" value="Namenssuche starten" class="btn btn-default"/>
</form>
<br><br>
<form action="<?php echo site_url('person/BPKWartung/saveBPK');?>" method="POST">
<strong>bPK</strong><input type="text" name="bpk" value="" class="form-control"/>
<input type="hidden" name="person_id" value="<?php echo $stammdaten->person_id;?>"/>
<input type="submit" value="Speichern" class="btn btn-default"/>
</form>
</div>
</div> <!-- ./panel-body -->
</div> <!-- ./panel -->
</div> <!-- ./main column -->
</div> <!-- ./main row -->
</section>
</div> <!-- ./container-fluid-->
</div> <!-- ./page-wrapper-->
</div> <!-- ./wrapper -->
</body>
<?php $this->load->view('templates/FHC-Footer'); ?>
@@ -0,0 +1,51 @@
<?php
$this->load->view(
'templates/FHC-Header',
array(
'title' => 'bPK Wartung',
'jquery' => true,
'jqueryui' => true,
'bootstrap' => true,
'fontawesome' => true,
'sbadmintemplate' => true,
'tablesorter' => true,
'ajaxlib' => true,
'filterwidget' => true,
'navigationwidget' => true,
'phrases' => array(
'ui' => array('bitteEintragWaehlen')
),
'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css',
'customJSs' => array('public/js/bootstrapper.js')
)
);
?>
<body>
<div id="wrapper">
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">
bPK <?php echo ucfirst($this->p->t('global', 'uebersicht')); ?>
</h3>
</div>
</div>
<div>
Bei folgenden Personen mit Matrikelnummer konnte kein bPK ermittelt werden.
Es ist die Namensschreibweise zu prüfen und ggf zu korrigieren.
Falls die Person keine Meldeadresse hat, ist eine Eintragung der
Person in das "Ergänzungsregister für natürliche Personen" notwendig.
<br /><br />
<?php $this->load->view('person/bpk/bpkData.php'); ?>
</div>
</div>
</div>
</div>
</body>
<?php $this->load->view('templates/FHC-Footer'); ?>