mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
Merge branch 'master' into feature-25999/C4_cleanup
This commit is contained in:
@@ -266,6 +266,8 @@ define('BIS_FUNKTIONSCODE_6_ARR', array(
|
|||||||
|
|
||||||
// bPk Abfrage
|
// bPk Abfrage
|
||||||
define('BPK_FUER_ALLE_BENUTZER_ABFRAGEN', false);
|
define('BPK_FUER_ALLE_BENUTZER_ABFRAGEN', false);
|
||||||
|
// bPk Typen in Form 'BEREICH' => 'kennzeichenTyp'
|
||||||
|
define('VBPK_TYPES', array('AS' => 'vbpkAs', 'BF' => 'vbpkBf', 'ZP-TD' => 'vbpkTd'));
|
||||||
|
|
||||||
// Docsbox configs
|
// Docsbox configs
|
||||||
define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/');
|
define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/');
|
||||||
|
|||||||
+73
-22
@@ -29,6 +29,7 @@ require_once(dirname(__FILE__).'/studiensemester.class.php');
|
|||||||
require_once(dirname(__FILE__).'/adresse.class.php');
|
require_once(dirname(__FILE__).'/adresse.class.php');
|
||||||
require_once(dirname(__FILE__).'/webservicelog.class.php');
|
require_once(dirname(__FILE__).'/webservicelog.class.php');
|
||||||
require_once(dirname(__FILE__).'/prestudent.class.php');
|
require_once(dirname(__FILE__).'/prestudent.class.php');
|
||||||
|
require_once(dirname(__FILE__).'/kennzeichen.class.php');
|
||||||
require_once(dirname(__FILE__).'/errorhandler.class.php');
|
require_once(dirname(__FILE__).'/errorhandler.class.php');
|
||||||
|
|
||||||
class dvb extends basis_db
|
class dvb extends basis_db
|
||||||
@@ -42,6 +43,7 @@ class dvb extends basis_db
|
|||||||
const DVB_URL_WEBSERVICE_RESERVIERUNG = DVB_PORTAL.'/rws/0.6/matrikelreservierung.xml';
|
const DVB_URL_WEBSERVICE_RESERVIERUNG = DVB_PORTAL.'/rws/0.6/matrikelreservierung.xml';
|
||||||
const DVB_URL_WEBSERVICE_MELDUNG = DVB_PORTAL.'/rws/0.6/matrikelmeldung.xml';
|
const DVB_URL_WEBSERVICE_MELDUNG = DVB_PORTAL.'/rws/0.6/matrikelmeldung.xml';
|
||||||
const DVB_URL_WEBSERVICE_BPK = DVB_PORTAL.'/rws/0.6/pruefebpk.xml';
|
const DVB_URL_WEBSERVICE_BPK = DVB_PORTAL.'/rws/0.6/pruefebpk.xml';
|
||||||
|
const DVB_URL_WEBSERVICE_BPK_ALL = DVB_PORTAL.'/rws/0.8/pruefebpk.xml';
|
||||||
|
|
||||||
public $authentication;
|
public $authentication;
|
||||||
private $username;
|
private $username;
|
||||||
@@ -1149,15 +1151,29 @@ class dvb extends basis_db
|
|||||||
*/
|
*/
|
||||||
public function getBPK($person_id)
|
public function getBPK($person_id)
|
||||||
{
|
{
|
||||||
|
$vbpkTypes = defined('VBPK_TYPES') && is_array(VBPK_TYPES) ? VBPK_TYPES : null;
|
||||||
|
|
||||||
$person = new person();
|
$person = new person();
|
||||||
if ($person->load($person_id))
|
if ($person->load($person_id))
|
||||||
{
|
{
|
||||||
if ($person->bpk != '')
|
if ($person->bpk != '')
|
||||||
{
|
{
|
||||||
// BPK exisitert bereits
|
|
||||||
$retval = new stdClass();
|
$retval = new stdClass();
|
||||||
$retval->bpk = $person->bpk;
|
$retval->bpk = $person->bpk;
|
||||||
return ErrorHandler::success($retval);
|
|
||||||
|
// BPK existiert bereits
|
||||||
|
if (!isset($vbpkTypes)) return ErrorHandler::success($retval);
|
||||||
|
|
||||||
|
$kennzeichen = new kennzeichen();
|
||||||
|
|
||||||
|
if ($kennzeichen->load_pers($person_id, $vbpkTypes))
|
||||||
|
{
|
||||||
|
if (array_unique(array_column($kennzeichen->result, 'kennzeichentyp_kurzbz')) == array_values($vbpkTypes))
|
||||||
|
{
|
||||||
|
// BPKs exisiteren bereits
|
||||||
|
return ErrorHandler::success($retval);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($person->gebdatum == '')
|
if ($person->gebdatum == '')
|
||||||
@@ -1178,7 +1194,8 @@ class dvb extends basis_db
|
|||||||
return ErrorHandler::error($errormsg);
|
return ErrorHandler::error($errormsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
$geburtsdatum = str_replace("-", "", $person->gebdatum);
|
//$geburtsdatum = str_replace("-", "", $person->gebdatum);
|
||||||
|
$geburtsdatum = $person->gebdatum;
|
||||||
$vorname = $person->vorname;
|
$vorname = $person->vorname;
|
||||||
$nachname = $person->nachname;
|
$nachname = $person->nachname;
|
||||||
$geschlecht = mb_strtoupper($person->geschlecht);
|
$geschlecht = mb_strtoupper($person->geschlecht);
|
||||||
@@ -1258,6 +1275,8 @@ class dvb extends basis_db
|
|||||||
*/
|
*/
|
||||||
public function pruefeBPK($geburtsdatum, $vorname, $nachname, $geschlecht, $plz = null, $strasse = null)
|
public function pruefeBPK($geburtsdatum, $vorname, $nachname, $geschlecht, $plz = null, $strasse = null)
|
||||||
{
|
{
|
||||||
|
$vbpkTypes = defined('VBPK_TYPES') && is_array(VBPK_TYPES) ? VBPK_TYPES : null;
|
||||||
|
|
||||||
if ($this->tokenIsExpired())
|
if ($this->tokenIsExpired())
|
||||||
{
|
{
|
||||||
$result = $this->authenticate();
|
$result = $this->authenticate();
|
||||||
@@ -1271,7 +1290,7 @@ class dvb extends basis_db
|
|||||||
|
|
||||||
$uuid = $this->getUUID();
|
$uuid = $this->getUUID();
|
||||||
|
|
||||||
$url = self::DVB_URL_WEBSERVICE_BPK;
|
$url = self::DVB_URL_WEBSERVICE_BPK_ALL;
|
||||||
$url .= '?geburtsdatum='.curl_escape($curl, $geburtsdatum);
|
$url .= '?geburtsdatum='.curl_escape($curl, $geburtsdatum);
|
||||||
$url .= '&vorname='.curl_escape($curl, $vorname);
|
$url .= '&vorname='.curl_escape($curl, $vorname);
|
||||||
$url .= '&nachname='.curl_escape($curl, $nachname);
|
$url .= '&nachname='.curl_escape($curl, $nachname);
|
||||||
@@ -1311,24 +1330,15 @@ class dvb extends basis_db
|
|||||||
if ($curl_info['http_code'] == '200')
|
if ($curl_info['http_code'] == '200')
|
||||||
{
|
{
|
||||||
/* Example Response:
|
/* Example Response:
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<simpleBpkResponse xmlns="http://www.brz.gv.at/datenverbund-unis">
|
<bpkResponse xmlns="http://www.brz.gv.at/datenverbund-unis">
|
||||||
<bpk>12345ABCDEFGHXXXXXXX=</bpk>
|
<uuid>5cc93441-a46a-4f97-a5e3-e64891b39f10</uuid>
|
||||||
<personInfo>
|
<bpk>12345ABCDEFG</bpk>
|
||||||
<person>
|
<vbpk bereich="AS" vkz="BBA-STA">12345ABCDEFG</vbpk>
|
||||||
<vorname>Hans</vorname>
|
<vbpk bereich="BF" vkz="BMBWF">12345ABCDEFG</vbpk>
|
||||||
<nachname>Huber</nachname>
|
<vbpk bereich="ZP-TD" vkz="BMF">12345ABCDEFG</vbpk>
|
||||||
<geschlecht>M</geschlecht>
|
<geprueft>true</geprueft>
|
||||||
<gebdat>1990-01-01</gebdat>
|
</bpkResponse>
|
||||||
</person>
|
|
||||||
<adresse>
|
|
||||||
<staat></staat>
|
|
||||||
<plz>1100</plz>
|
|
||||||
<ort></ort>
|
|
||||||
<strasse></strasse>
|
|
||||||
</adresse>
|
|
||||||
</personInfo>
|
|
||||||
</simpleBpkResponse>
|
|
||||||
|
|
||||||
Example Error:
|
Example Error:
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
@@ -1369,10 +1379,30 @@ class dvb extends basis_db
|
|||||||
}
|
}
|
||||||
|
|
||||||
$domnodes_bpk = $dom->getElementsByTagNameNS($namespace, 'bpk');
|
$domnodes_bpk = $dom->getElementsByTagNameNS($namespace, 'bpk');
|
||||||
|
|
||||||
if ($domnodes_bpk->length > 0)
|
if ($domnodes_bpk->length > 0)
|
||||||
{
|
{
|
||||||
$retval = new stdClass();
|
$retval = new stdClass();
|
||||||
$retval->bpk = $domnodes_bpk->item(0)->textContent;
|
$retval->bpk = $domnodes_bpk->item(0)->textContent;
|
||||||
|
|
||||||
|
// vbpks auslesen
|
||||||
|
$domnodes_vbpks = $dom->getElementsByTagNameNS($namespace, 'vbpk');
|
||||||
|
|
||||||
|
$retval->vbpks = array();
|
||||||
|
if ($domnodes_vbpks->length > 0)
|
||||||
|
{
|
||||||
|
foreach ($domnodes_vbpks as $domnode_vbpk)
|
||||||
|
{
|
||||||
|
foreach ($domnode_vbpk->attributes as $attribute)
|
||||||
|
{
|
||||||
|
if ($attribute->nodeName == 'bereich' && isset($vbpkTypes[$attribute->nodeValue]))
|
||||||
|
{
|
||||||
|
$retval->vbpks[$vbpkTypes[$attribute->nodeValue]] = $domnode_vbpk->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ErrorHandler::success($retval);
|
return ErrorHandler::success($retval);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1385,6 +1415,27 @@ class dvb extends basis_db
|
|||||||
$retval->multiple = true;
|
$retval->multiple = true;
|
||||||
return ErrorHandler::error(null, $retval);
|
return ErrorHandler::error(null, $retval);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errorTexts = array();
|
||||||
|
$domnodes_fehler = $dom->getElementsByTagNameNS($namespace, 'fehlerliste');
|
||||||
|
|
||||||
|
if ($domnodes_fehler->length > 0)
|
||||||
|
{
|
||||||
|
foreach ($domnodes_fehler as $domnode_fehler)
|
||||||
|
{
|
||||||
|
if ($domnode_fehler->childNodes->length > 0)
|
||||||
|
{
|
||||||
|
foreach ($domnode_fehler->childNodes as $childNode)
|
||||||
|
{
|
||||||
|
$errorTexts[] = $childNode->nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->errormsg = count($errorTexts) > 0 ? implode('; ', $errorTexts) : null;
|
||||||
|
return ErrorHandler::error(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ErrorHandler::error();
|
return ErrorHandler::error();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,261 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2006 Technikum-Wien
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Authors: Alexei Karpenko <[email protected]>,
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Klasse kennzeichen
|
||||||
|
*/
|
||||||
|
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||||
|
|
||||||
|
class kennzeichen extends basis_db
|
||||||
|
{
|
||||||
|
public $new; // boolean
|
||||||
|
public $result = array(); // adresse Objekt
|
||||||
|
|
||||||
|
//Tabellenspalten
|
||||||
|
public $kennzeichen_id; // integer
|
||||||
|
public $person_id; // integer
|
||||||
|
|
||||||
|
public $kennzeichentyp_kurzbz; // string
|
||||||
|
public $inhalt; // string
|
||||||
|
public $aktiv; // boolean
|
||||||
|
public $insertamum; // timestamp
|
||||||
|
public $insertvon; // string
|
||||||
|
public $updateamum; // timestamp
|
||||||
|
public $updatevon; // string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
* @param $kennzeichen_id ID des Kennzeichens das geladen werden soll (Default=null)
|
||||||
|
*/
|
||||||
|
public function __construct($kennzeichen_id=null)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->new = true;
|
||||||
|
|
||||||
|
if(!is_null($kennzeichen_id))
|
||||||
|
$this->load($kennzeichen_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laedt ein Kennzeichen mit der ID $kennzeichen_id
|
||||||
|
* @param $kennzeichen_id ID des zu ladenden Kennzeichens
|
||||||
|
* @return true wenn ok, false im Fehlerfall
|
||||||
|
*/
|
||||||
|
public function load($kennzeichen_id)
|
||||||
|
{
|
||||||
|
if (!is_numeric($kennzeichen_id))
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Kennzeichen Id ist ungueltig';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry = "SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
public.tbl_kennzeichen
|
||||||
|
WHERE
|
||||||
|
kennzeichen_id = " . $this->db_add_param($kennzeichen_id, FHC_INTEGER) . ";";
|
||||||
|
|
||||||
|
if ($this->db_query($qry))
|
||||||
|
{
|
||||||
|
if ($row = $this->db_fetch_object())
|
||||||
|
{
|
||||||
|
$this->kennzeichen_id = $row->kennzeichen_id;
|
||||||
|
$this->person_id = $row->person_id;
|
||||||
|
$this->kennzeichentyp_kurzbz = $row->kennzeichentyp_kurzbz;
|
||||||
|
$this->inhalt = $row->inhalt;
|
||||||
|
$this->aktiv = $this->db_parse_bool($row->aktiv);
|
||||||
|
$this->updateamum = $row->updateamum;
|
||||||
|
$this->updatevon = $row->updatevon;
|
||||||
|
$this->insertamum = $row->insertamum;
|
||||||
|
$this->insertvon = $row->insertvon;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Datensatz wurde nicht gefunden';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prueft die Kennzeichen auf Gueltigkeit
|
||||||
|
* @return true wenn ok, false im Fehlerfall
|
||||||
|
*/
|
||||||
|
public function validate()
|
||||||
|
{
|
||||||
|
//Gesamtlaenge pruefen
|
||||||
|
if(mb_strlen($this->kennzeichentyp_kurzbz)>32)
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Kennzeichentyp darf nicht länger als 32 Zeichen sein';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->errormsg = '';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert den aktuellen Datensatz in die Datenbank
|
||||||
|
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||||
|
* andernfalls wird der Datensatz mit der ID in $kennzeichen_id aktualisiert
|
||||||
|
* @return true wenn ok, false im Fehlerfall
|
||||||
|
*/
|
||||||
|
public function save($new = null)
|
||||||
|
{
|
||||||
|
if(!is_null($new))
|
||||||
|
$this->new = $new;
|
||||||
|
|
||||||
|
//Variablen pruefen
|
||||||
|
if(!$this->validate())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if($this->new)
|
||||||
|
{
|
||||||
|
//Neuen Datensatz einfuegen
|
||||||
|
$qry='BEGIN;INSERT INTO public.tbl_kennzeichen (person_id, kennzeichentyp_kurzbz, inhalt, aktiv, insertamum, insertvon) VALUES('.
|
||||||
|
$this->db_add_param($this->person_id, FHC_INTEGER).', '.
|
||||||
|
$this->db_add_param($this->kennzeichentyp_kurzbz).', '.
|
||||||
|
$this->db_add_param($this->inhalt).', '.
|
||||||
|
$this->db_add_param($this->aktiv, FHC_BOOLEAN).', now(), '.
|
||||||
|
$this->db_add_param($this->insertvon).');';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Updaten des bestehenden Datensatzes
|
||||||
|
|
||||||
|
//Pruefen ob kennzeichen_id eine gueltige Zahl ist
|
||||||
|
if(!is_numeric($this->kennzeichen_id))
|
||||||
|
{
|
||||||
|
$this->errormsg = 'kennzeichen_id muss eine gueltige Zahl sein';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry='UPDATE public.tbl_kennzeichen SET '.
|
||||||
|
'person_id='.$this->db_add_param($this->person_id,FHC_INTEGER).', '.
|
||||||
|
'kennzeichentyp_kurzbz='.$this->db_add_param($this->kennzeichentyp_kurzbz).', '.
|
||||||
|
'aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', '.
|
||||||
|
'updateamum= now(), '.
|
||||||
|
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||||
|
'WHERE kennzeichen_id='.$this->db_add_param($this->kennzeichen_id, FHC_INTEGER).';';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->db_query($qry))
|
||||||
|
{
|
||||||
|
//Sequence auslesen um die eingefuegte ID zu ermitteln
|
||||||
|
if($this->new)
|
||||||
|
{
|
||||||
|
$qry = "SELECT currval('public.tbl_kennzeichen_id_seq') as id;";
|
||||||
|
|
||||||
|
if($this->db_query($qry))
|
||||||
|
{
|
||||||
|
if($row = $this->db_fetch_object())
|
||||||
|
{
|
||||||
|
$this->kennzeichen_id = $row->id;
|
||||||
|
$this->db_query('COMMIT;');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Auslesen er Sequence';
|
||||||
|
$this->db_query('ROLLBACK;');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||||
|
$this->db_query('ROLLBACK;');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laedt Kennzeichen einer Person
|
||||||
|
* @param person_id
|
||||||
|
* @param kennzeichentyp_kurzbz_arr filtern nach Kennzeichentyp
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function load_pers($person_id, $kennzeichentyp_kurzbz_arr)
|
||||||
|
{
|
||||||
|
if(!is_numeric($person_id))
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Person_id ist ungueltig';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!is_array($kennzeichentyp_kurzbz_arr))
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Kennzeichen sind ungueltig';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry = "
|
||||||
|
SELECT
|
||||||
|
kz.kennzeichen_id, kz.person_id, kz.kennzeichentyp_kurzbz, inhalt, aktiv, updateamum, updatevon, insertamum, insertvon
|
||||||
|
FROM
|
||||||
|
public.tbl_kennzeichen kz
|
||||||
|
WHERE
|
||||||
|
person_id=".$this->db_add_param($person_id, FHC_INTEGER)."
|
||||||
|
AND aktiv = TRUE
|
||||||
|
AND kennzeichentyp_kurzbz IN (".$this->implode4SQL($kennzeichentyp_kurzbz_arr).")
|
||||||
|
ORDER BY
|
||||||
|
kz.kennzeichentyp_kurzbz, kz.kennzeichen_id;";
|
||||||
|
|
||||||
|
if($this->db_query($qry))
|
||||||
|
{
|
||||||
|
while($row = $this->db_fetch_object())
|
||||||
|
{
|
||||||
|
$obj = new kennzeichen();
|
||||||
|
|
||||||
|
$obj->kennzeichen_id = $row->kennzeichen_id;
|
||||||
|
$obj->person_id = $row->person_id;
|
||||||
|
$obj->kennzeichentyp_kurzbz = $row->kennzeichentyp_kurzbz;
|
||||||
|
$obj->inhalt = $row->inhalt;
|
||||||
|
$obj->aktiv = $this->db_parse_bool($row->aktiv);
|
||||||
|
$obj->updateamum = $row->updateamum;
|
||||||
|
$obj->updatevon = $row->updatevon;
|
||||||
|
$obj->insertamum = $row->insertamum;
|
||||||
|
$obj->insertvon = $row->insertvon;
|
||||||
|
|
||||||
|
$this->result[] = $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -98,9 +98,9 @@ class person extends basis_db
|
|||||||
geschlecht, staatsbuergerschaft, geburtsnation, kurzbeschreibung, zugangscode, foto_sperre,
|
geschlecht, staatsbuergerschaft, geburtsnation, kurzbeschreibung, zugangscode, foto_sperre,
|
||||||
matr_nr, bpk, wahlname";
|
matr_nr, bpk, wahlname";
|
||||||
if ($hasUDF = $udf->personHasUDF())
|
if ($hasUDF = $udf->personHasUDF())
|
||||||
$qry .= ", udf_values ";
|
$qry .= ", udf_values";
|
||||||
|
|
||||||
$qry .= "FROM public.tbl_person
|
$qry .= " FROM public.tbl_person
|
||||||
WHERE person_id = " . $this->db_add_param($personId, FHC_INTEGER);
|
WHERE person_id = " . $this->db_add_param($personId, FHC_INTEGER);
|
||||||
|
|
||||||
if (!$this->db_query($qry))
|
if (!$this->db_query($qry))
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ require_once(dirname(__FILE__).'/../../include/basis_db.class.php');
|
|||||||
require_once(dirname(__FILE__).'/../../include/dvb.class.php');
|
require_once(dirname(__FILE__).'/../../include/dvb.class.php');
|
||||||
require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php');
|
require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php');
|
||||||
require_once(dirname(__FILE__).'/../../include/datum.class.php');
|
require_once(dirname(__FILE__).'/../../include/datum.class.php');
|
||||||
|
require_once(dirname(__FILE__).'/../../include/kennzeichen.class.php');
|
||||||
require_once(dirname(__FILE__).'/../../include/errorhandler.class.php');
|
require_once(dirname(__FILE__).'/../../include/errorhandler.class.php');
|
||||||
|
|
||||||
if (!$db = new basis_db())
|
if (!$db = new basis_db())
|
||||||
@@ -34,6 +35,7 @@ if (!$db = new basis_db())
|
|||||||
|
|
||||||
$limit = '';
|
$limit = '';
|
||||||
$debug = false;
|
$debug = false;
|
||||||
|
$vbpkTypes = defined('VBPK_TYPES') && is_array(VBPK_TYPES) ? VBPK_TYPES : null;
|
||||||
|
|
||||||
// Wenn das Script nicht ueber Commandline gestartet wird, muss eine
|
// Wenn das Script nicht ueber Commandline gestartet wird, muss eine
|
||||||
// Authentifizierung stattfinden
|
// Authentifizierung stattfinden
|
||||||
@@ -85,8 +87,27 @@ if (defined('BPK_FUER_ALLE_BENUTZER_ABFRAGEN') && BPK_FUER_ALLE_BENUTZER_ABFRAGE
|
|||||||
JOIN public.tbl_benutzer USING(person_id)
|
JOIN public.tbl_benutzer USING(person_id)
|
||||||
WHERE
|
WHERE
|
||||||
public.tbl_benutzer.aktiv = true
|
public.tbl_benutzer.aktiv = true
|
||||||
AND tbl_person.bpk is null
|
AND
|
||||||
AND gebdatum is not null";
|
(
|
||||||
|
tbl_person.bpk is null";
|
||||||
|
|
||||||
|
// checken, ob vBpks fehlen
|
||||||
|
if (isset($vbpkTypes))
|
||||||
|
{
|
||||||
|
$qry .=
|
||||||
|
" OR (
|
||||||
|
SELECT
|
||||||
|
COUNT(DISTINCT kennzeichentyp_kurzbz)
|
||||||
|
FROM
|
||||||
|
public.tbl_kennzeichen
|
||||||
|
WHERE
|
||||||
|
person_id = tbl_person.person_id
|
||||||
|
AND kennzeichentyp_kurzbz IN (".$db->implode4SQL($vbpkTypes).")
|
||||||
|
) < ".$db->db_add_param(count($vbpkTypes), FHC_INTEGER);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry .=
|
||||||
|
") AND gebdatum is not null";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -100,8 +121,27 @@ else
|
|||||||
WHERE
|
WHERE
|
||||||
public.tbl_benutzer.aktiv = true
|
public.tbl_benutzer.aktiv = true
|
||||||
AND tbl_person.matr_nr is not null
|
AND tbl_person.matr_nr is not null
|
||||||
AND tbl_person.bpk is null
|
AND
|
||||||
AND studiengang_kz<10000
|
(
|
||||||
|
tbl_person.bpk is null";
|
||||||
|
|
||||||
|
// checken, ob vBpks fehlen
|
||||||
|
if (isset($vbpkTypes))
|
||||||
|
{
|
||||||
|
$qry .=
|
||||||
|
" OR (
|
||||||
|
SELECT
|
||||||
|
COUNT(DISTINCT kennzeichentyp_kurzbz)
|
||||||
|
FROM
|
||||||
|
public.tbl_kennzeichen
|
||||||
|
WHERE
|
||||||
|
person_id = tbl_person.person_id
|
||||||
|
AND kennzeichentyp_kurzbz IN (".$db->implode4SQL($vbpkTypes).")
|
||||||
|
) < ".$db->db_add_param(count($vbpkTypes), FHC_INTEGER);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qry .=
|
||||||
|
") AND studiengang_kz<10000
|
||||||
AND EXISTS(SELECT 1 FROM public.tbl_prestudent WHERE person_id=tbl_person.person_id AND bismelden=true)
|
AND EXISTS(SELECT 1 FROM public.tbl_prestudent WHERE person_id=tbl_person.person_id AND bismelden=true)
|
||||||
AND gebdatum is not null";
|
AND gebdatum is not null";
|
||||||
}
|
}
|
||||||
@@ -135,6 +175,50 @@ if ($result = $db->db_query($qry))
|
|||||||
echo ' OK';
|
echo ' OK';
|
||||||
else
|
else
|
||||||
echo ' Failed: '.$person->errormsg;
|
echo ' Failed: '.$person->errormsg;
|
||||||
|
|
||||||
|
$vbpkErrors = array();
|
||||||
|
|
||||||
|
// alle existierenden vBpks einer Person holen
|
||||||
|
$kennzeichenTypes = new kennzeichen();
|
||||||
|
if ($kennzeichenTypes->load_pers($row->person_id, $vbpkTypes))
|
||||||
|
{
|
||||||
|
$existingVbpks = $kennzeichenTypes->result;
|
||||||
|
|
||||||
|
foreach ($data->retval->vbpks as $vbpkType => $vbpkValue)
|
||||||
|
{
|
||||||
|
$new = true;
|
||||||
|
foreach ($existingVbpks as $existingVbpk)
|
||||||
|
{
|
||||||
|
// nicht speichern, wenn vBpk bereits vorhanden
|
||||||
|
if ($existingVbpk->kennzeichentyp_kurzbz == $vbpkType)
|
||||||
|
{
|
||||||
|
$new = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$new) continue;
|
||||||
|
|
||||||
|
// neue vBpk speichern
|
||||||
|
$kennzeichen = new kennzeichen();
|
||||||
|
|
||||||
|
$kennzeichen->person_id = $row->person_id;
|
||||||
|
$kennzeichen->kennzeichentyp_kurzbz = $vbpkType;
|
||||||
|
$kennzeichen->inhalt = $vbpkValue;
|
||||||
|
$kennzeichen->aktiv = true;
|
||||||
|
$kennzeichen->insertvon = 'bpkJob';
|
||||||
|
|
||||||
|
if (!$kennzeichen->save())
|
||||||
|
{
|
||||||
|
$vbpkErrors[] = 'Failed to save vBpk '.$vbpkType.':'.$kennzeichen->errormsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($vbpkErrors) > 0)
|
||||||
|
{
|
||||||
|
echo implode('; ', $vbpkErrors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user