mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Update AddOn Studienplatzverwaltung
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
<?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: Werner Masik <werner@gefi.at>
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class bisberufstaetigkeit extends basis_db
|
||||
{
|
||||
public $new; // boolean
|
||||
public $result = array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $berufstaetigkeit_code;
|
||||
public $berufstaetigkeit_bez;
|
||||
public $berufstaetigkeit_kurzbz;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param bisverwendung_id ID des zu ladenden Datensatzes
|
||||
*/
|
||||
public function __construct($berufstaetigkeit_code=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if(!is_null($berufstaetigkeit_code))
|
||||
$this->load($berufstaetigkeit_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Datensatz
|
||||
* @param bisverwendung_id ID des zu ladenden Datensatzes
|
||||
* studiengang_kz
|
||||
*/
|
||||
public function load($berufstaetigkeit_code)
|
||||
{
|
||||
//berufstaetigkeit_code auf gueltigkeit pruefen
|
||||
if(!is_numeric($berufstaetigkeit_code) || $berufstaetigkeit_code == '')
|
||||
{
|
||||
$this->errormsg = 'berufstaetigkeit_code muss eine gueltige Zahl sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//laden des Datensatzes
|
||||
$qry = "SELECT * FROM bis.tbl_berufstaetigkeit WHERE berufstaetigkeit_code=".$this->db_add_param($berufstaetigkeit_code, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->berufstaetigkeit_code = $row->berufstaetigkeit_code;
|
||||
$this->berufstaetigkeit_bez = $row->berufstaetigkeit_bez;
|
||||
$this->berufstaetigkeit_kurzbz = $row->berufstaetigkeit_kurzbz;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
//laden des Datensatzes
|
||||
$qry = "SELECT * FROM bis.tbl_berufstaetigkeit order by berufstaetigkeit_bez";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new bisberufstaetigkeit();
|
||||
$obj->berufstaetigkeit_code = $row->berufstaetigkeit_code;
|
||||
$obj->berufstaetigkeit_bez = $row->berufstaetigkeit_bez;
|
||||
$obj->berufstaetigkeit_kurzbz = $row->berufstaetigkeit_kurzbz;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?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: Werner Masik <werner@gefi.at>
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class bisorgform extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result = array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $bisorgform_kurzbz;
|
||||
public $code;
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param code des zu ladenden Datensatzes
|
||||
*/
|
||||
public function __construct($code=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if(!is_null($code))
|
||||
$this->load($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Datensatz
|
||||
* @param code des zu ladenden Datensatzes
|
||||
*/
|
||||
public function load($code)
|
||||
{
|
||||
//code auf gueltigkeit pruefen
|
||||
if(!is_numeric($code) || $code == '')
|
||||
{
|
||||
$this->errormsg = 'code muss eine gueltige Zahl sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
//laden des Datensatzes
|
||||
$qry = "SELECT
|
||||
distinct code,bisorgform_kurzbz
|
||||
FROM
|
||||
bis.tbl_orgform
|
||||
WHERE
|
||||
code=".$this->db_add_param($code, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->bisorgform_kurzbz = $row->bisorgform_kurzbz;
|
||||
$this->code = $row->code;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Laedt alle BIS Orgformen
|
||||
* @return List mit Orgformen wenn ok, false wenn Fehler
|
||||
*/
|
||||
public function getList()
|
||||
{
|
||||
//laden des Datensatzes
|
||||
$qry = "SELECT
|
||||
distinct code,bisorgform_kurzbz
|
||||
FROM
|
||||
bis.tbl_bisorgfom
|
||||
ORDER BY code";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$this->result = array();
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new bisorgform();
|
||||
$obj->bisorgform_kurzbz = $row->bisorgform_kurzbz;
|
||||
$obj->code = $row->code;
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -470,6 +470,7 @@ class person extends basis_db
|
||||
' ext_id='.$this->db_add_param($this->ext_id).','.
|
||||
' kurzbeschreibung='.$this->db_add_param($this->kurzbeschreibung).','.
|
||||
' foto_sperre='.$this->db_add_param($this->foto_sperre, FHC_BOOLEAN).','.
|
||||
' zugangscode='.$this->db_add_param($this->zugangscode).','.
|
||||
' matr_nr ='.$this->db_add_param($this->matr_nr).
|
||||
' WHERE person_id='.$this->person_id.';';
|
||||
}
|
||||
|
||||
@@ -199,8 +199,8 @@ class studienplatz extends basis_db
|
||||
* Liefert Array mit GPZ und NPZ für die FÖBis relevanten Orgformen (BB, VZ, VBB).
|
||||
* Dient als Ersatz für load_studiengang_studiensemester_orgform weil hiermit
|
||||
* alle Daten mit einer Abfrage geholt werden können.
|
||||
* @param type $studienjahr z.B: 2013
|
||||
* @param type $zeitraum z.B: 10 [Semester]
|
||||
* @param string $studienjahr z.B: 2013
|
||||
* @param int $zeitraum z.B: 10 [Semester]
|
||||
* @return boolean|array false bei Fehler
|
||||
*/
|
||||
public function getAnzahlAlleOrgformen($studienjahr, $zeitraum)
|
||||
@@ -217,9 +217,9 @@ class studienplatz extends basis_db
|
||||
sum(case when orgform_kurzbz='BB' then npz else 0 end) as npz_bb,
|
||||
sum(case when orgform_kurzbz='VBB' then npz else 0 end) as npz_vbb,
|
||||
sum(npz) as npz_gesamt,
|
||||
sum(case when orgform_kurzbz='VZ' then npz else 0 end) as gpz_vz,
|
||||
sum(case when orgform_kurzbz='BB' then npz else 0 end) as gpz_bb,
|
||||
sum(case when orgform_kurzbz='VBB' then npz else 0 end) as gpz_vbb,
|
||||
sum(case when orgform_kurzbz='VZ' then gpz else 0 end) as gpz_vz,
|
||||
sum(case when orgform_kurzbz='BB' then gpz else 0 end) as gpz_bb,
|
||||
sum(case when orgform_kurzbz='VBB' then gpz else 0 end) as gpz_vbb,
|
||||
sum(gpz) as gpz_gesamt
|
||||
FROM lehre.tbl_studienplatz
|
||||
WHERE ausbildungssemester is null and studiensemester_kurzbz IN ($semesterList_comma_separated)
|
||||
@@ -236,7 +236,7 @@ class studienplatz extends basis_db
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['VZ']['NPZ'] = $row->npz_vz;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['VBB']['NPZ'] = $row->npz_vbb;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['gesamt']['NPZ'] = $row->npz_gesamt;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['BB']['GPZ'] = $row->npz_bb;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['BB']['GPZ'] = $row->gpz_bb;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['VZ']['GPZ'] = $row->gpz_vz;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['VBB']['GPZ'] = $row->gpz_vbb;
|
||||
$result[$row->studiensemester_kurzbz][$row->studiengang_kz]['gesamt']['GPZ'] = $row->gpz_gesamt;
|
||||
|
||||
@@ -96,7 +96,21 @@ class AqaClientTest extends PHPUnit_Framework_TestCase
|
||||
$client = new AqaFoebisClient();
|
||||
$result = $client->listFoebisAbrechnungStudiengang($stgKz,$studjahrCode,$runde);
|
||||
}
|
||||
|
||||
|
||||
public function testPersonClient() {
|
||||
$personKz = '1110256020';
|
||||
$client = new AqaFoebisClient();
|
||||
$result = $client->listFoebisAbrechnungPerson($personKz);
|
||||
}
|
||||
|
||||
public function testSemesterClient() {
|
||||
$stgKz = 256;
|
||||
$semester = 'WS2013';
|
||||
$client = new AqaFoebisClient();
|
||||
$result = $client->listFoebisAbrechnungSemester($stgKz, $semester);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testSyncAll() {
|
||||
|
||||
$client = StudienplatzverwaltungAPI::init();
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/*
|
||||
* AqaFoebisPersonTest.php
|
||||
*
|
||||
* Copyright 2014 fhcomplete.org
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* Authors: Werner Masik <werner.masik@gefi.at>
|
||||
*
|
||||
*/
|
||||
require_once('../../../../config/system.config.inc.php');
|
||||
require_once('../../../../include/studienplatz.class.php');
|
||||
require_once('../../../../include/benutzer.class.php');
|
||||
require_once('../../../../addons/studienplatzverwaltung/include/aqa_foebis_person.class.php');
|
||||
|
||||
class AqaFoebisPersonTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $benutzer;
|
||||
protected $uid = 'unittest';
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->benutzer = new benutzer();
|
||||
$this->benutzer->new = true;
|
||||
$this->benutzer->uid = $this->uid;
|
||||
$this->benutzer->alias = 'Unit Test Benutzer';
|
||||
$this->benutzer->aktiv = true;
|
||||
$this->benutzer->nachname = 'Unit';
|
||||
$this->benutzer->geschlecht = 'm';
|
||||
$result = $this->benutzer->save();
|
||||
if (!$result) {
|
||||
echo 'Fehler: '.$this->benutzer->errormsg;
|
||||
}
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->benutzer) {
|
||||
// Benutzer löschen
|
||||
$this->assertTrue(
|
||||
$this->benutzer->deleteBenutzer($this->uid));
|
||||
// Person löschen
|
||||
$this->assertTrue(
|
||||
$this->benutzer->delete($this->benutzer->person_id));
|
||||
// benutzer hat On Delete Restrict zu den appdaten!!!
|
||||
}
|
||||
}
|
||||
|
||||
public function testCRUD()
|
||||
{
|
||||
$matrikelnr = '012342343245';
|
||||
$studiengang_kz = '120'; // 120 = dummy
|
||||
$studiensemester_kurzbz = 'WS2014';
|
||||
$orgform_kurzbz = 'BB';
|
||||
$regelstudiendauer = 6;
|
||||
$ausbildungssemester = 2;
|
||||
$guthaben = 34;
|
||||
$gefoerdert = 1;
|
||||
$maxguthaben = 46;
|
||||
$stud_status = 1;
|
||||
$meldedatum = mktime(0, 0, 0, 10, 14, 2014);
|
||||
$insertvon = 'unittest';
|
||||
|
||||
// Create
|
||||
$foebis = new aqa_foebis_person();
|
||||
$foebis->matrikelnr = $matrikelnr;
|
||||
$foebis->studiengang_kz = $studiengang_kz;
|
||||
$foebis->studiensemester_kurzbz = $studiensemester_kurzbz;
|
||||
$foebis->orgform_kurzbz = $orgform_kurzbz;
|
||||
$foebis->regelstudiendauer = $regelstudiendauer;
|
||||
$foebis->ausbildungssemester = $ausbildungssemester;
|
||||
$foebis->guthaben = $guthaben;
|
||||
$foebis->gefoerdert = $gefoerdert;
|
||||
$foebis->maxguthaben = $maxguthaben;
|
||||
$foebis->stud_status = $stud_status;
|
||||
$foebis->meldedatum = $meldedatum;
|
||||
|
||||
$foebis->insertvon = $insertvon;
|
||||
$foebis_person_id = $foebis->save();
|
||||
$this->assertNotEquals($foebis_person_id, false);
|
||||
|
||||
// load
|
||||
$this->assertTrue($foebis->load_foebis($foebis_person_id));
|
||||
$this->assertEquals($studiengang_kz,$foebis->studiengang_kz);
|
||||
$this->assertEquals($studiensemester_kurzbz,$foebis->studiensemester_kurzbz);
|
||||
$this->assertEquals($orgform_kurzbz,$foebis->orgform_kurzbz);
|
||||
$this->assertEquals($regelstudiendauer,$foebis->regelstudiendauer);
|
||||
|
||||
$this->assertEquals($ausbildungssemester,$foebis->ausbildungssemester);
|
||||
$this->assertEquals($guthaben,$foebis->guthaben);
|
||||
$this->assertEquals($gefoerdert,$foebis->gefoerdert);
|
||||
$this->assertEquals($maxguthaben,$foebis->maxguthaben);
|
||||
$this->assertEquals($stud_status,$foebis->stud_status);
|
||||
$this->assertEquals($meldedatum, $foebis->meldedatum);
|
||||
$guthabenNeu = 28;
|
||||
|
||||
$foebis->guthaben = $guthabenNeu;
|
||||
$foebis->save();
|
||||
$this->assertTrue($foebis->load_foebis($foebis_person_id));
|
||||
$this->assertEquals($guthabenNeu,$foebis->guthaben);
|
||||
|
||||
// test delete + cleanup test data
|
||||
$this->assertNotEquals($foebis->delete($foebis_person_id), false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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: Werner Masik <werner@gefi.at>,
|
||||
*/
|
||||
|
||||
require_once('../../../../addons/studienplatzverwaltung/include/functions.inc.php');
|
||||
|
||||
class FunctionsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function testFormatStudiengangKz()
|
||||
{
|
||||
$this->assertEquals('0227',formatStudiengangKz(227));
|
||||
}
|
||||
|
||||
public function testSemester2BISDatum()
|
||||
{
|
||||
$this->assertEquals('15.11.2013',semester2BISDatum('WS2013'));
|
||||
$this->assertEquals('15.04.2014',semester2BISDatum('SS2014'));
|
||||
}
|
||||
|
||||
public function testBisDatum2Semester()
|
||||
{
|
||||
date_default_timezone_set('UTC');
|
||||
$datum = mktime(0,0,0,11,15,2013);
|
||||
$this->assertEquals('WS2013',bisDatum2Semester($datum));
|
||||
$datum = mktime(0,0,0,4,15,2013);
|
||||
$this->assertEquals('SS2013',bisDatum2Semester($datum));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -90,6 +90,16 @@ class StudienplatzverwaltungAPITest extends PHPUnit_Framework_TestCase
|
||||
printf($result);
|
||||
|
||||
}
|
||||
|
||||
public function testExportCSV()
|
||||
{
|
||||
$api = StudienplatzverwaltungAPI::init();
|
||||
$appdaten = $api->newUV('2013/14',3, $this->uid);
|
||||
$this->assertNotNull($appdaten);
|
||||
$result = $api->exportCSV('2013/14',1, $this->uid);
|
||||
printf($result);
|
||||
|
||||
}
|
||||
|
||||
public function testGetInfoData()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user