Merge branch 'master' into feature-19172/Abgabetool_digitale_signatur_pruefen

This commit is contained in:
Paolo
2023-04-17 10:21:09 +02:00
1109 changed files with 28716 additions and 100283 deletions
+268
View File
@@ -0,0 +1,268 @@
<?php
/**
* FH-Complete
*
* @package FHC-Helper
* @author FHC-Team
* @copyright Copyright (c) 2022 fhcomplete.net
* @license GPLv3
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
class AkteLib
{
const AKTE_KATEGORIE_KURZBZ = 'Akte'; // kategorie_kurzbz of dms when inserting for akte
private $_ci; // Code igniter instance
private $_who; // who added this document
/**
* Object initialization
*/
public function __construct($params = null)
{
$this->_ci =& get_instance();
// Set the the _who property
$this->_who = 'Akte system'; // default
// It is possible to set it using the who parameter
if (!isEmptyArray($params) && isset($params['who']) && !isEmptyString($params['who'])) $this->_who = $params['who'];
$this->_ci->load->model('crm/Akte_model', 'AkteModel');
$this->_ci->load->model('content/DmsFS_model', 'DmsFSModel');
$this->_ci->load->library('DmsLib');
}
/**
* Writes a new file, adds a new dms entry with given akte data,
* adds a new dms version 0 for the written file, and adds Akte if dms add was successfull
* Returns success with inserted akte id or error
*/
public function add(
$person_id, $dokument_kurzbz, $titel, $mimetype, $fileHandle, // Required parameters
$bezeichnung = null, $archiv = false, $signiert = false, $stud_selfservice = false
)
{
// add new dms entry and new dms version for the Akte, using Akte data (title, mimetype, file content as handle)
$dmsAddResult = $this->_ci->dmslib->add($titel, $mimetype, $fileHandle, self::AKTE_KATEGORIE_KURZBZ, $dokument_kurzbz, $bezeichnung);
if (isError($dmsAddResult)) return $dmsAddResult;
if (!hasData($dmsAddResult)) return error("Dms document could not be added");
$dmsAddData = getData($dmsAddResult);
// insert the Akte
return $this->_ci->AkteModel->insert(
array(
'person_id' => $person_id,
'dokument_kurzbz' => $dokument_kurzbz,
'titel' => $titel,
'mimetype' => $mimetype,
'bezeichnung' => $bezeichnung,
'erstelltam' => date('Y-m-d'),
'dms_id' => $dmsAddData->dms_id,
'archiv' => $archiv,
'signiert' => $signiert,
'stud_selfservice' => $stud_selfservice,
'insertamum' => date('Y-m-d H:i:s'),
'insertvon' => $this->_who
)
);
}
/**
* Writes a new file, adds a new dms version 0 for the written file, and updates Akte if dms version add was successfull
* Returns success with updated akte id or error
*/
public function update($akte_id, $titel, $mimetype, $fileHandle, $bezeichnung = null, $archiv = false, $signiert = false, $stud_selfservice = false)
{
// check if Akte with dms exists
$this->_ci->AkteModel->addSelect('dms_id');
$akteResult = $this->_ci->AkteModel->load($akte_id);
if (isError($akteResult)) return $akteResult;
if (!hasData($akteResult)) return error("Akte not found");
$dms_id = getData($akteResult)[0]->dms_id;
if (isEmptyString($dms_id)) return error("Akte has no dms document");
// if Akte with dms found, update the last dms version
$dmsUpdateResult = $this->_ci->dmslib->updateLastVersion($dms_id, $fileHandle, $titel, $mimetype, $bezeichnung);
if (isError($dmsUpdateResult)) return $dmsUpdateResult;
if (!hasData($dmsUpdateResult)) return error("Dms document could not be updated");
// update the Akte
return $this->_ci->AkteModel->update(
$akte_id,
array(
'titel' => $titel,
'mimetype' => $mimetype,
'bezeichnung' => $bezeichnung,
'erstelltam' => date('Y-m-d'),
'dms_id' => $dms_id,
'archiv' => $archiv,
'signiert' => $signiert,
'stud_selfservice' => $stud_selfservice,
'updateamum' => date('Y-m-d H:i:s'),
'updatevon' => $this->_who
)
);
}
/**
* Gets akte data and associated dms data by akte Id
* Returns success with akte and dms data or error
*/
public function get($akte_id)
{
// get Akte data
$this->_ci->AkteModel->addSelect('person_id, dokument_kurzbz, mimetype, erstelltam, titel, bezeichnung,
gedruckt, uid, dms_id, nachgereicht, nachgereicht_am, anmerkung,
ausstellungsnation, formal_geprueft_amum, archiv, signiert,
stud_selfservice, akzeptiertamum, insertvon, insertamum, updatevon, updateamum');
$this->_ci->AkteModel->load($akte_id);
$akteResult = $this->_ci->AkteModel->load($akte_id);
if (isError($akteResult)) return $akteResult;
if (!hasData($akteResult)) return error("Akte not found");
$resultObject = getData($akteResult)[0];
// set properties with same name in Akte and Dms table
$resultObject->akte_mimetype = $resultObject->mimetype;
// get dms data
$dmsResult = $this->_ci->dmslib->getLastVersion($resultObject->dms_id);
if (isError($dmsResult)) return $dmsResult;
// properties to retrieve from dms
$dmsProperties = array('version', 'filename', 'mimetype', 'name', 'beschreibung', 'cis_suche', 'schlagworte', DmsLib::FILE_CONTENT_PROPERTY);
// set dms properties
if (hasData($dmsResult))
{
$dmsData = getData($dmsResult);
foreach ($dmsProperties as $dmsProperty)
{
$resultObject->{$dmsProperty} = $dmsData->{$dmsProperty};
}
}
else
{
// set null if no dms result found
foreach ($dmsProperties as $dmsProperty)
{
$resultObject->{$dmsProperty} = null;
}
}
// return the object containing akte and dms data
return success($resultObject);
}
/**
* Gets Akte data and associated dms data by person Id and dokument_kurzbz
* Returns success with result array with akte and dms data or error
*/
public function getByPersonIdAndDocumentType($person_id, $dokument_kurzbz)
{
// load all Akte entries for given person and dokument_kurzbz
$this->_ci->AkteModel->addSelect('akte_id');
$akteResult = $this->_ci->AkteModel->loadWhere(
array(
'person_id' => $person_id,
'dokument_kurzbz' => $dokument_kurzbz
)
);
if (!hasData($akteResult)) return error("Akte not found");
$akteData = getData($akteResult);
$resultArr = array();
// for each found akte entry
foreach ($akteData as $akte)
{
// get dms and akte data from akte Id
$getAkteDmsResult = $this->get($akte->akte_id);
if (isError($getAkteDmsResult)) return $getAkteDmsResult;
$resultArr[] = getData($getAkteDmsResult);
}
// return all found entries
return success($resultArr);
}
/**
* Removes Akte by akte Id, removes all associated dms entries and versions, and deletes all associated files
* Returns success with removed version numbers or error
*/
public function remove($akte_id)
{
// get dms_id for akte
$this->_ci->AkteModel->addSelect('dms_id');
$akteResult = $this->_ci->AkteModel->load($akte_id);
if (isError($akteResult)) return $akteResult;
if (!hasData($akteResult)) return error("Akte not found");
$dms_id = getData($akteResult)[0]->dms_id;
$error = null;
// Start DB transaction to avoid deleting only part of the data
$this->_ci->db->trans_begin();
// delete Akte
$deleteResult = $this->_ci->AkteModel->delete($akte_id);
if (isError($deleteResult))
{
$error = $deleteResult;
}
else
{
// remove all dms entry for dms of the akte
$removeAllResult = $this->_ci->dmslib->removeAll($dms_id);
if (isError($removeAllResult))
$error = $removeAllResult;
}
// Transaction complete!
$this->_ci->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->_ci->db->trans_status() === false || isset($error))
{
$this->_ci->db->trans_rollback();
// return occured error
if (isset($error))
return $error;
else
return error("Error occured when deleting, rolled back");
}
else
{
$this->_ci->db->trans_commit();
// return removed dms entry data
return $removeAllResult;
}
}
}
+121 -1
View File
@@ -80,14 +80,24 @@ class AnrechnungLib
// Get latest ZGV
$result = $this->ci->PrestudentModel->getLatestZGVBezeichnung($prestudent_id);
$latest_zgv_bezeichnung = hasData($result) ? getData($result)[0]->bezeichnung : '';
// Get Sum of berufliche and schulische ECTS
$result = $this->ci->LehrveranstaltungModel->getEctsSumSchulisch($uid, $prestudent_id, $lv->studiengang_kz);
$sumEctsSchulisch = getData($result)[0]->ectssumschulisch;
$result = $this->ci->LehrveranstaltungModel->getEctsSumBeruflich($uid);
$sumEctsBeruflich = getData($result)[0]->ectssumberuflich;
// Set the given studiensemester
$antrag_data->lv_id = $lv_id;
$antrag_data->lv_bezeichnung = $lv->bezeichnung;
$antrag_data->ects = $lv->ects;
$antrag_data->sumEctsSchulisch = $sumEctsSchulisch;
$antrag_data->sumEctsBeruflich = $sumEctsBeruflich;
$antrag_data->studiensemester_kurzbz = $studiensemester_kurzbz;
$antrag_data->vorname = $person->vorname;
$antrag_data->nachname = $person->nachname;
$antrag_data->student_uid = $uid;
$antrag_data->matrikelnr = $student->matrikelnr;
$antrag_data->studiengang_kz = $studiengang->studiengang_kz;
$antrag_data->stg_bezeichnung = $studiengang->bezeichnung;
@@ -112,6 +122,7 @@ class AnrechnungLib
$anrechnung_data = new StdClass();
$this->ci->AnrechnungModel->addJoin('lehre.tbl_anrechnung_begruendung', 'begruendung_id');
$result = $this->ci->AnrechnungModel->load($anrechnung_id);
if (isError($result))
@@ -145,6 +156,7 @@ class AnrechnungLib
$anrechnung_data->prestudent_id = '';
$anrechnung_data->lehrveranstaltung = '';
$anrechnung_data->begruendung_id = '';
$anrechnung_data->begruendung = '';
$anrechnung_data->anmerkung = '';
$anrechnung_data->dms_id = '';
$anrechnung_data->insertamum = '';
@@ -155,6 +167,7 @@ class AnrechnungLib
$anrechnung_data->status = getUserLanguage() == 'German' ? 'neu' : 'new';
$anrechnung_data->dokumentname = '';
$this->ci->AnrechnungModel->addJoin('lehre.tbl_anrechnung_begruendung', 'begruendung_id');
$result = $this->ci->AnrechnungModel->loadWhere(
array(
'lehrveranstaltung_id' => $lehrveranstaltung_id,
@@ -800,6 +813,7 @@ class AnrechnungLib
$anrechnung_data->prestudent_id = $anrechnung->prestudent_id;
$anrechnung_data->lehrveranstaltung_id = $anrechnung->lehrveranstaltung_id;
$anrechnung_data->begruendung_id = $anrechnung->begruendung_id;
$anrechnung_data->begruendung = $anrechnung->bezeichnung;
$anrechnung_data->anmerkung = $anrechnung->anmerkung_student;
$anrechnung_data->dms_id = $anrechnung->dms_id;
$anrechnung_data->insertamum = (new DateTime($anrechnung->insertamum))->format('d.m.Y');
@@ -823,4 +837,110 @@ class AnrechnungLib
return $anrechnung_data;
}
/**
* If Student is a Quereinsteiger, get ECTS Summe of all angerechnete Studiensemester.
*
* @param $prestudent_id
* @param $studiengang_kz Studiengang_kz der LV
* @return int|mixed
*/
public function getQuereinsteigerEctsSumme($prestudent_id, $studiengang_kz)
{
$sumEctsQuereinsteiger = 0;
// Check, if student is Quereinsteiger
$this->ci->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
$result = $this->ci->PrestudentstatusModel->getFirstStatus($prestudent_id, 'Student');
$prestudentFirstStudentStatus = getData($result)[0];
// If Prestudent is not a Quereinsteiger
if ($prestudentFirstStudentStatus->ausbildungssemester == 1)
{
return $sumEctsQuereinsteiger; // return 0
}
$anzahlAngerechneteStudiensemester = $prestudentFirstStudentStatus->ausbildungssemester - 1;
// If Prestudent is a Quereinsteiger
if ($prestudentFirstStudentStatus->ausbildungssemester > 1)
{
// Get the 'angerechnete Studiensemester'
$this->ci->load->model('organisations/Studiensemester_model', 'StudiensemesterModel');
$result = $this->ci->StudiensemesterModel->getPreviousFrom(
$prestudentFirstStudentStatus->studiensemester_kurzbz,
$anzahlAngerechneteStudiensemester
);
// Get ECTS Summe of each 'angerechnetes Studiensemester'
foreach (getData($result) as $studiensemester)
{
$result = $this->ci->LehrveranstaltungModel->getSumQuereinstiegsECTSProSemester(
$studiengang_kz,
$studiensemester->studiensemester_kurzbz,
$anzahlAngerechneteStudiensemester--,
$prestudentFirstStudentStatus->orgform_kurzbz
);
if (hasData($result))
{
$sumEctsQuereinsteiger = $sumEctsQuereinsteiger + getData($result)[0]->sum_ects;
}
}
}
return $sumEctsQuereinsteiger; // return sum of ects of all 'angerechnete Studiensemester'
}
/**
* Get ECTS Summe of all Anrechnungen based on schulische Kenntnisse.
*
* @param $student_uid
* @return int|mixed
*/
public function getSchulischeAnrechnungenEctsSumme($student_uid)
{
$sumEctsSchule = 0;
$result = $this->ci->LehrveranstaltungModel->getSumAngerechneteECTSByBegruendung($student_uid);
if (hasData($result))
{
foreach (getData($result) as $ects)
{
if ($ects->begruendung_id != 4)
{
$sumEctsSchule = $sumEctsSchule + $ects->sum;
}
}
}
return $sumEctsSchule;
}
/**
* Get ECTS Summe of all Anrechnungen based on berufliche Kenntnisse.
*
* @param $student_uid
* @return int
*/
public function getBeruflicheAnrechnungenEctsSumme($student_uid)
{
$sumEctsBeruflich = 0;
$result = $this->ci->LehrveranstaltungModel->getSumAngerechneteECTSByBegruendung($student_uid);
if (hasData($result))
{
foreach (getData($result) as $ects)
{
if ($ects->begruendung_id == 4)
{
$sumEctsBeruflich = $ects->sum;
}
}
}
return $sumEctsBeruflich;
}
}
+588 -147
View File
@@ -1,26 +1,483 @@
<?php
/**
* FH-Complete
*
* @package FHC-Helper
* @author FHC-Team
* @copyright Copyright (c) 2022 fhcomplete.net
* @license GPLv3
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
class DmsLib extends FHC_Controller
use \stdClass as stdClass;
class DmsLib
{
const FILE_CONTENT_PROPERTY = 'file_content';
private $UPLOAD_PATH = DMS_PATH; // temporary directory to store the upload file
const FILE_CONTENT_PROPERTY = 'file_content'; // property name for file content
private $_ci; // code igniter instance
private $_who; // who added this document
/**
* Object initialization
*/
public function __construct()
public function __construct($params = null)
{
$this->ci =& get_instance();
$this->_ci =& get_instance();
$this->ci->load->model('crm/Akte_model', 'AkteModel');
$this->ci->load->model('content/Dms_model', 'DmsModel');
$this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel');
$this->ci->load->model('content/DmsFS_model', 'DmsFSModel');
// Set the the _who property
$this->_who = 'DMS system'; // default
// It is possible to set it using the who parameter
if (!isEmptyArray($params) && isset($params['who']) && !isEmptyString($params['who'])) $this->_who = $params['who'];
$this->_ci->load->model('crm/Akte_model', 'AkteModel'); // deprecated, should not be used here!
$this->_ci->load->model('content/Dms_model', 'DmsModel');
$this->_ci->load->model('content/DmsVersion_model', 'DmsVersionModel');
$this->_ci->load->model('content/DmsFS_model', 'DmsFSModel');
}
// -----------------------------------------------------------------------------------------------------------
// Public methods
/**
* Writes a new file, adds a new dms entry and a new dms version 0 for the written file
* Returns success info of added dms entry (dms_id, version, filename) or error
*/
public function add(
$name, $mimetype, $fileHandle, // Required parameters
$kategorie_kurzbz = null, $dokument_kurzbz = null, $beschreibung = null, $cis_suche = false, $schlagworte = null
)
{
// create unique filename, using original document name to detect file extension
$filename = $this->_getUniqueFilename($name);
// copy file from fileHandle to dms folder
$copyFileResult = $this->_copyFile($fileHandle, $filename);
if (isError($copyFileResult)) return $copyFileResult;
// if file written successful, insert dms
$dmsResult = $this->_ci->DmsModel->insert(
array(
'kategorie_kurzbz' => $kategorie_kurzbz,
'dokument_kurzbz' => $dokument_kurzbz
)
);
if (isError($dmsResult)) return $dmsResult;
if (hasData($dmsResult))
{
$dms_id = getData($dmsResult);
$version = 0;
// insert dms version
$dmsVersion = array(
'dms_id' => $dms_id,
'version' => $version,
'filename' => $filename,
'mimetype' => $mimetype,
'name' => $name,
'beschreibung' => $beschreibung,
'cis_suche' => $cis_suche,
'schlagworte' => $schlagworte,
'insertvon' => $this->_who,
'insertamum' => date('Y-m-d H:i:s')
);
$dmsVersionResult = $this->_ci->DmsVersionModel->insert($dmsVersion);
if (isError($dmsVersionResult)) return $dmsVersionResult;
// return dms info
$resObj = new stdClass();
$resObj->dms_id = $dms_id;
$resObj->version = $version;
$resObj->filename = $filename;
return success($resObj);
}
else
return error("error when inserting DMS");
}
/**
* Writes a new file with content of fileHandle, adds a new dms version (max version number + 1) for the written file
* Returns success with info of added dms version (version, filename) or error
*/
public function addNewVersion($dms_id, $fileHandle, $name = null, $mimetype = null, $beschreibung = null, $cis_suche = false, $schlagworte = null)
{
// get the latest version
$lastVersionResult = $this->getLastVersion($dms_id);
if (isError($lastVersionResult)) return $lastVersionResult;
if (hasData($lastVersionResult))
{
$lastVersion = getData($lastVersionResult);
$originalName = isset($name) ? $name : $lastVersion->name;
// create unique filename, using original document name to detect file extension
$filename = $this->_getUniqueFilename($originalName);
// copy file from fileHandle to dms folder
$copyFileResult = $this->_copyFile($fileHandle, $filename);
if (isError($copyFileResult)) return $copyFileResult;
// insert new version
$newVersionNumber = $lastVersion->version + 1;
// if new parameters given, use them, otherwise use parameters from last version
$newVersion = array(
'dms_id' => $dms_id,
'name' => $originalName,
'filename' => $filename,
'version' => $newVersionNumber,
'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype,
'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung,
'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche,
'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte,
'insertvon' => $this->_who,
'insertamum' => date('Y-m-d H:i:s')
);
$addVersionResult = $this->_ci->DmsVersionModel->insert($newVersion);
if (isError($addVersionResult)) return $addVersionResult;
// return dms info
$resObj = new stdClass();
$resObj->version = $newVersionNumber;
$resObj->filename = $filename;
return success($resObj);
}
else
return error("last version not found");
}
/**
* Updates the last version (max version number) of a dms entry
* Overwrites the file associated with this version with content read from fileHandle
* Returns success with info of added dms version (version, filename) or error
*/
public function updateLastVersion($dms_id, $fileHandle, $name = null, $mimetype = null, $beschreibung = null, $cis_suche = false, $schlagworte = null)
{
// get the latest version
$lastVersionResult = $this->getLastVersion($dms_id);
if (isError($lastVersionResult)) return $lastVersionResult;
if (hasData($lastVersionResult))
{
$lastVersion = getData($lastVersionResult);
$filename = $lastVersion->filename;
// update file in filesystem
$copyFileResult = $this->_copyFile($fileHandle, $filename);
if (isError($copyFileResult)) return $copyFileResult;
// if new parameters given, use them, otherwise use parameters from last version
$newVersion = array(
'name' => isset($name) ? $name : $lastVersion->name,
'filename' => $filename,
'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype,
'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung,
'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche,
'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte,
);
// update last dms version
$addVersionResult = $this->_ci->DmsVersionModel->update(
array($dms_id, $lastVersion->version),
$newVersion
);
if (isError($addVersionResult)) return $addVersionResult;
// return dms info
$resObj = new stdClass();
$resObj->version = $lastVersion->version;
$resObj->filename = $filename;
return success($resObj);
}
else
return error("last version not found");
}
/**
* Gets dms version with highest number
* Returns success with dms data and fileHandle with file content or error
*/
public function getLastVersion($dms_id)
{
// get the latest version number
$this->_ci->DmsVersionModel->addSelect('version');
$this->_ci->DmsVersionModel->addOrder('version', 'DESC');
$this->_ci->DmsVersionModel->addOrder('insertamum', 'DESC');
$this->_ci->DmsVersionModel->addLimit(1);
$lastDmsVersionResult = $this->_ci->DmsVersionModel->loadWhere(
array('dms_id' => $dms_id)
);
if (isError($lastDmsVersionResult)) return $lastDmsVersionResult;
if (hasData($lastDmsVersionResult))
{
$lastDmsVersionData = getData($lastDmsVersionResult)[0];
$lastDmsVersion = $lastDmsVersionData->version;
// call get Version with last version number
return $this->getVersion($dms_id, $lastDmsVersion);
}
else
return error("Dms last version not found");
}
/**
* Gets specified dms version
* Returns success with dms data and fileHandle with file content or error
*/
public function getVersion($dms_id, $version)
{
$this->_ci->DmsVersionModel->addSelect('dms_id, version, filename, mimetype, name, beschreibung, cis_suche, schlagworte');
$dmsVersionResult = $this->_ci->DmsVersionModel->loadWhere(
array(
'dms_id' => $dms_id,
'version' => $version
)
);
if (isError($dmsVersionResult)) return $dmsVersionResult;
if (hasData($dmsVersionResult))
{
$dmsVersion = getData($dmsVersionResult)[0];
// get file content as file pointer
$fileHandleResult = $this->_ci->DmsFSModel->openRead($dmsVersion->filename);
if (isError($fileHandleResult)) return $fileHandleResult;
if (hasData($fileHandleResult))
{
$fileHandle = getData($fileHandleResult);
$dmsVersion->{self::FILE_CONTENT_PROPERTY} = $fileHandle;
// close file pointer
$closeResult = $this->_ci->DmsFSModel->close($fileHandle);
if (isError($closeResult)) return $closeResult;
return success($dmsVersion);
}
else
return error("File could not be opened");
}
else
return error("Dms version not found");
}
/**
* Removes dms entry and all its versions, deletes all associated files
* Returns success with removed version numbers or error
*/
public function removeAll($dms_id)
{
$versionsRemoved = array();
$this->_ci->DmsVersionModel->addSelect('version, filename');
$allVersionsResult = $this->_ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
if (hasData($allVersionsResult))
{
$allVersionsData = getData($allVersionsResult);
$error = null;
// Start DB transaction to avoid deleting only part of the data
$this->_ci->db->trans_begin();
// remove all versions of the dms Id
foreach ($allVersionsData as $version)
{
$removeVersionResult = $this->removeVersion($dms_id, $version->version);
if (isError($removeVersionResult))
{
$error = $removeVersionResult;
break;
}
else
$versionsRemoved[] = $version; // return removed versions
}
// Transaction complete!
$this->_ci->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->_ci->db->trans_status() === false || isset($error))
{
$this->_ci->db->trans_rollback();
if (isset($error))
return $error;
else
return error("Error occured when deleting, rolled back");
}
else
{
$this->_ci->db->trans_commit();
}
}
return success($versionsRemoved);
}
/**
* Removes latest version and its associated file
* Returns success with removed dms version data (dms_id, version, filename) or error
*/
public function removeLastVersion($dms_id)
{
$lastVersionNumber = 0;
// get the latest version
$lastVersionResult = $this->getLastVersion($dms_id);
if (isError($lastVersionResult)) return $lastVersionResult;
if (hasData($lastVersionResult))
{
$lastVersion = getData($lastVersionResult);
$lastVersionNumber = $lastVersion->version;
}
// call remove method for latest version
return $this->removeVersion($dms_id, $lastVersionNumber);
}
/**
* Removes latest version and its associated file
* Returns success with removed dms version data (dms_id, version, filename) or error
*/
public function removeVersion($dms_id, $version)
{
$removeVersionResultObj = new stdClass();
$removeVersionResultObj->dms_id = null;
$removeVersionResultObj->version = null;
$removeVersionResultObj->filename = null;
// load dms version and check how many versions there are
$db = new DB_Model();
$checkDeleteResult = $db->execReadOnlyQuery(
"SELECT filename,
(SELECT count(version)
FROM campus.tbl_dms_version dv_anzahl
WHERE dv_anzahl.dms_id = dv.dms_id) AS anzahl_versionen
FROM campus.tbl_dms_version dv
WHERE dms_id=?
AND version=?",
array($dms_id, $version)
);
if (isError($checkDeleteResult)) return $checkDeleteResult;
if (hasData($checkDeleteResult))
{
$checkDeleteData = getData($checkDeleteResult)[0];
// delete version
$deleteVersionResult = $this->_ci->DmsVersionModel->delete(array($dms_id, $version));
if (isError($deleteVersionResult)) return $deleteVersionResult;
$removeVersionResultObj->version = $version;
$removeVersionResultObj->filename = $checkDeleteData->filename;
// delete dms too if no versions left
if ($checkDeleteData->anzahl_versionen <= 1)
{
$deleteDmsResult = $this->_ci->DmsModel->delete($dms_id);
if (isError($deleteDmsResult)) return $deleteDmsResult;
$removeVersionResultObj->dms_id = $dms_id;
}
// delete file from file system
$removeResult = $this->_ci->DmsFSModel->remove($checkDeleteData->filename);
if (isError($removeResult)) return $removeResult;
}
return success($removeVersionResultObj);
}
// -----------------------------------------------------------------------------------------------------------
// Private methods
/**
* Copies file from sourceFileHandle to destinationFilename in DMS folder
* Returns success or error on fail
*/
private function _copyFile($sourceFileHandle, $destinationFilename)
{
// get file location from file handle
$metaData = stream_get_meta_data($sourceFileHandle);
if (isset($metaData['uri']) && !isEmptyString($metaData['uri']))
{
// if file location determined, copy file
$source = $metaData['uri'];
if (copy($source, DMS_PATH.$destinationFilename))
{
return success();
}
else
{
// error if copy returned false
return error('error occured while copying file');
}
}
else
{
// error when source location could not be determined
return error('error occured while getting source file name');
}
return success($resObj);
}
/**
* Generates unique filename, appends file extension from document name
* Returns the filename string
*/
private function _getUniqueFilename($dokname)
{
// create unique id
$uniqueFilename = uniqid();
// getting extension of file from document name
$fileExtension = pathinfo($dokname, PATHINFO_EXTENSION);
// if file extension found, append it
if (!isEmptyString($fileExtension))
$uniqueFilename .= '.'.$fileExtension;
return $uniqueFilename;
}
// -----------------------------------------------------------------------------------------------------------
// Deprecated methods, not to be used
/**
* Load a DMS Document.
* If no version is particularly given, the latest version is loaded.
@@ -33,19 +490,20 @@ class DmsLib extends FHC_Controller
{
if (is_numeric($dms_id))
{
$this->ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
$this->ci->DmsModel->addOrder('version', 'DESC');
$this->ci->DmsModel->addLimit(1);
$this->_ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
$this->_ci->DmsModel->addOrder('version', 'DESC');
$this->_ci->DmsModel->addLimit(1);
if (!is_numeric($version))
{
return $this->ci->DmsModel->load($dms_id);
return $this->_ci->DmsModel->load($dms_id);
}
else
{
return $this->ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
return $this->_ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
}
}
return error('The parameter DMS ID must be a number');
}
@@ -57,34 +515,30 @@ class DmsLib extends FHC_Controller
*/
public function read($dms_id, $version = null)
{
$result = null;
$result = error('Wrong dms_id parameter');
if (isset($dms_id))
{
$this->ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
$this->ci->DmsModel->addOrder('version', 'DESC');
$this->ci->DmsModel->addLimit(1);
$this->_ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id');
$this->_ci->DmsModel->addOrder('version', 'DESC');
$this->_ci->DmsModel->addLimit(1);
if (!isset($version))
{
$result = $this->ci->DmsModel->load($dms_id);
$result = $this->_ci->DmsModel->load($dms_id);
}
else
{
$result = $this->ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
$result = $this->_ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version));
}
}
if (hasData($result))
{
$resultFS = $this->ci->DmsFSModel->read($result->retval[0]->filename);
if (isSuccess($resultFS))
// If a dms has been found
if (hasData($result))
{
$result->retval[0]->{DmsLib::FILE_CONTENT_PROPERTY} = $resultFS->retval;
}
else
{
$result = $resultFS;
$resultFS = $this->_ci->DmsFSModel->readBase64(getData($result)[0]->filename);
if (isError($resultFS)) return $resultFS; // if an error occurred return it
$result->retval[0]->{self::FILE_CONTENT_PROPERTY} = getData($resultFS);
}
}
@@ -101,28 +555,22 @@ class DmsLib extends FHC_Controller
*/
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null)
{
$result = $this->ci->AkteModel->getAktenAcceptedDms($person_id, $dokument_kurzbz);
$result = $this->_ci->AkteModel->getAktenAcceptedDms($person_id, $dokument_kurzbz);
if (hasData($result) && $no_file == null)
{
$cnt = count($result->retval);
for ($i = 0; $i < $cnt; $i++)
for ($i = 0; $i < count(getData($result)); $i++)
{
$resultFS = $this->ci->DmsFSModel->read($result->retval[$i]->filename);
if (isSuccess($resultFS))
{
$result->retval[$i]->{DmsLib::FILE_CONTENT_PROPERTY} = $resultFS->retval;
}
else
{
$result = $resultFS;
}
$resultFS = $this->_ci->DmsFSModel->readBase64(getData($result)[$i]->filename);
if (isError($resultFS)) return $resultFS; // if an error occurred return it
$result->retval[$i]->{self::FILE_CONTENT_PROPERTY} = getData($resultFS);
}
}
return $result;
}
/**
* Uploads a document and saves it to DMS
* @param $dms DMS assoc array
@@ -135,32 +583,33 @@ class DmsLib extends FHC_Controller
// Init upload configs
$this->_loadUploadLibrary($allowed_types);
if (!$this->ci->upload->do_upload($field_name))
if (!$this->_ci->upload->do_upload($field_name))
{
return error($this->ci->upload->display_errors());
return error($this->_ci->upload->display_errors());
}
$upload_data = $this->ci->upload->data(); // data about the uploaded file
$filename = $upload_data['file_name'];
$upload_data = $this->_ci->upload->data(); // data about the uploaded file
// Insert to DMS table
if (!$result = $this->ci->DmsModel->insert($this->ci->DmsModel->filterFields($dms)))
{
return error('Failed inserting to DMS');
}
$upload_data['dms_id'] = $result->retval;
$insDmsResult = $this->_ci->DmsModel->insert($this->_ci->DmsModel->filterFields($dms));
if (isError($insDmsResult)) return $insDmsResult;
$upload_data['dms_id'] = getData($insDmsResult);
// Insert DMS version
if (!$result = $this->ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $result->retval, $filename)))
{
return error('Failed inserting DMS version');
}
$insVersionResult = $this->_ci->DmsVersionModel->insert(
$this->_ci->DmsVersionModel->filterFields(
$dms,
$upload_data['dms_id'],
$upload_data['file_name']
)
);
if (isError($insVersionResult)) return $insVersionResult;
// return result of uploaded data
return success($upload_data); // data about the uploaded file
// Return result of uploaded data
return success($upload_data);
}
/**
* Download a document.
*
@@ -171,38 +620,31 @@ class DmsLib extends FHC_Controller
*/
public function download($dms_id, $filename = null, $disposition = 'inline')
{
$result = $this->getFileInfo($dms_id);
if (isError($result))
// Retrieves info about the given dms
$fileInfoResult = $this->getFileInfo($dms_id);
if (isError($fileInfoResult)) return error(getError($fileInfoResult));
// If data have been found
if (hasData($fileInfoResult))
{
return error(getError($result));
$fileObj = getData($fileInfoResult);
// Change filename, if filename is provided
if (!isEmptyString($filename)) $fileObj->name = $filename;
// Add file disposition if disposition has a valid value
if ($disposition == 'attachment' || $disposition == 'inline')
{
$fileObj->disposition = $disposition;
}
return success($fileObj);
}
$fileObj = getData($result);
// Change filename, if filename is provided
if (is_string($filename))
{
$fileObj->name = $filename;
}
// Add file disposition
if ($disposition == 'attachment')
{
$fileObj->disposition = 'attachment';
}
else
{
$fileObj->disposition = 'inline';
}
// Output file
if(!$this->outputFile($fileObj))
{
return error('Error on file output');
}
// If no data have been found then return an empty success
return success();
}
/**
* Get file information.
*
@@ -212,28 +654,28 @@ class DmsLib extends FHC_Controller
*/
public function getFileInfo($dms_id, $version = null)
{
if (!is_numeric($dms_id))
{
return error('Wrong parameter');
}
// Load file
// Checks the dms_id parameter
if (!is_numeric($dms_id)) return error('Wrong parameter');
// Load DMS from database
$result = $this->load($dms_id, $version);
if (isError($result)) return error(getError($result));
if (isError($result))
// If data have been found
if (hasData($result))
{
return error(getError($result));
// Store file information in fileObj
$fileObj = new stdClass();
$fileObj->filename = getData($result)[0]->filename;
$fileObj->file = DMS_PATH.getData($result)[0]->filename;
$fileObj->name = DMS_PATH.getData($result)[0]->name; // original user filename
$fileObj->mimetype = getData($result)[0]->mimetype;
return success($fileObj);
}
// Store file information in fileObj
$fileObj = new StdClass();
$fileObj->filename = getData($result)[0]->filename;
$fileObj->file = DMS_PATH. getData($result)[0]->filename;
$fileObj->name = DMS_PATH. getData($result)[0]->name; // original users filename
$fileObj->mimetype = DMS_PATH. getData($result)[0]->mimetype;
return success($fileObj);
// If no data have been found return an empty success
return success();
}
/**
@@ -253,20 +695,20 @@ class DmsLib extends FHC_Controller
$result = $this->_saveFileOnInsert($dms);
if (isSuccess($result))
{
$filename = $result->retval;
$filename = getData($result);
if (isset($dms['dms_id']) && $dms['dms_id'] != '')
{
$result = $this->ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename)
$result = $this->_ci->DmsVersionModel->insert(
$this->_ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename)
);
}
else
{
$result = $this->ci->DmsModel->insert($this->ci->DmsModel->filterFields($dms));
$result = $this->_ci->DmsModel->insert($this->_ci->DmsModel->filterFields($dms));
if (isSuccess($result))
{
$result = $this->ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $result->retval, $filename)
$result = $this->_ci->DmsVersionModel->insert(
$this->_ci->DmsVersionModel->filterFields($dms, getData($result), $filename)
);
}
}
@@ -277,15 +719,15 @@ class DmsLib extends FHC_Controller
$result = $this->_saveFileOnUpdate($dms);
if (isSuccess($result))
{
$result = $this->ci->DmsModel->update($dms['dms_id'], $this->ci->DmsModel->filterFields($dms));
$result = $this->_ci->DmsModel->update($dms['dms_id'], $this->_ci->DmsModel->filterFields($dms));
if (isSuccess($result))
{
$result = $this->ci->DmsVersionModel->update(
$result = $this->_ci->DmsVersionModel->update(
array(
$dms['dms_id'],
$dms['version']
),
$this->ci->DmsVersionModel->filterFields($dms)
$this->_ci->DmsVersionModel->filterFields($dms)
);
}
}
@@ -308,56 +750,54 @@ class DmsLib extends FHC_Controller
if (is_numeric($person_id) && is_numeric($dms_id))
{
// Start DB transaction
$this->ci->db->trans_start(false);
$this->_ci->db->trans_start(false);
// Get akte_id from table tbl_akte
$result = $this->ci->AkteModel->loadWhere(array('person_id' => $person_id, 'dms_id' => $dms_id));
$result = $this->_ci->AkteModel->loadWhere(array('person_id' => $person_id, 'dms_id' => $dms_id));
if (isSuccess($result))
{
// Delete all entries in tbl_akte
$cnt = count($result->retval);
for ($i = 0; $i < $cnt; $i++)
for ($i = 0; $i < count(getData($result)); $i++)
{
$this->ci->AkteModel->delete($result->retval[$i]->akte_id);
$this->_ci->AkteModel->delete(getData($result)[$i]->akte_id);
}
// Get all filenames related to this dms
$resultFileNames = $this->ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
$resultFileNames = $this->_ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id));
if (isSuccess($resultFileNames))
{
// Delete from tbl_dms_version
$result = $this->ci->DmsVersionModel->delete(array('dms_id' => $dms_id));
$result = $this->_ci->DmsVersionModel->delete(array('dms_id' => $dms_id));
if (isSuccess($result))
{
// Delete from tbl_dms
$result = $this->ci->DmsModel->delete($dms_id);
$result = $this->_ci->DmsModel->delete($dms_id);
}
}
}
// Transaction complete!
$this->ci->db->trans_complete();
$this->_ci->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->ci->db->trans_status() === false || isError($result))
if ($this->_ci->db->trans_status() === false || isError($result))
{
$this->ci->db->trans_rollback();
$this->_ci->db->trans_rollback();
$result = error('An error occurred while performing a delete operation', EXIT_ERROR);
}
else
{
$this->ci->db->trans_commit();
$this->_ci->db->trans_commit();
$result = success('Dms successfully removed from DB');
}
// If everything is ok
if (isSuccess($result))
{
$cnt = count($resultFileNames->retval);
// Remove all files related to this person and dms
for ($i = 0; $i < $cnt; $i++)
for ($i = 0; $i < count(getData($resultFileNames)); $i++)
{
$this->ci->DmsFSModel->remove($resultFileNames->retval[$i]->filename);
$this->_ci->DmsFSModel->removeBase64(getData($resultFileNames)[$i]->filename);
}
}
}
@@ -376,19 +816,19 @@ class DmsLib extends FHC_Controller
*/
public function getAkteContent($akte_id)
{
$akte = $this->ci->AkteModel->load($akte_id);
$akte = $this->_ci->AkteModel->load($akte_id);
if (hasData($akte))
{
if ($akte->retval[0]->inhalt != '')
if (getData($akte)[0]->inhalt != '')
{
return success(base64_decode($akte->retval[0]->inhalt));
return success(base64_decode(getData($akte)[0]->inhalt));
}
elseif ($akte->retval[0]->dms_id != '')
elseif (getData($akte)[0]->dms_id != '')
{
$dmscontent = $this->read($akte->retval[0]->dms_id);
$dmscontent = $this->read(getData($akte)[0]->dms_id);
if (isSuccess($dmscontent))
{
return success(base64_decode($dmscontent->retval[0]->file_content));
return success(base64_decode(getData($dmscontent)[0]->file_content));
}
else
{
@@ -415,10 +855,10 @@ class DmsLib extends FHC_Controller
{
$filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION);
$result = $this->ci->DmsFSModel->write($filename, $dms['file_content']);
$result = $this->_ci->DmsFSModel->writeBase64($filename, $dms['file_content']);
if (isSuccess($result))
{
$result->retval = $filename;
$result = success($filename);
}
return $result;
@@ -439,7 +879,7 @@ class DmsLib extends FHC_Controller
if (hasData($result))
{
$result = $this->ci->DmsFSModel->write($result->retval[0]->filename, $dms['file_content']);
$result = $this->_ci->DmsFSModel->writeBase64(getData($result)[0]->filename, $dms['file_content']);
}
}
@@ -451,12 +891,13 @@ class DmsLib extends FHC_Controller
*/
private function _loadUploadLibrary($allowed_types)
{
$config['upload_path'] = $this->UPLOAD_PATH;
$config['allowed_types'] = implode('|', $allowed_types);
$config['overwrite'] = true;
$config['file_name'] = uniqid().'.pdf';
$config = array();
$config['upload_path'] = DMS_PATH;
$config['allowed_types'] = implode('|', $allowed_types);
$config['overwrite'] = true;
$config['file_name'] = uniqid().'.pdf';
$this->ci->load->library('upload', $config);
$this->ci->upload->initialize($config);
$this->_ci->load->library('upload', $config);
$this->_ci->upload->initialize($config);
}
}
+304
View File
@@ -0,0 +1,304 @@
<?php
/* Copyright (C) 2022 fhcomplete.net
*
* 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.
*
*/
require_once(dirname(__FILE__).'/../../vendor/nategood/httpful/bootstrap.php');
use \ZipArchive as ZipArchive;
/**
* Simple client to convert documents using Docsbox
*/
class DocsboxLib
{
const ERROR = 1;
const SUCCESS = 0;
const STATUS_FINISHED = 'finished'; // Docsbox status when a document conversion ended
const STATUS_QUEUED = 'queued'; // Docsbox status when a file has been queued for the conversion
const STATUS_STARTED = 'started'; // Docsbox status when a file has started being worked
const STATUS_WORKING = 'working'; // Docsbox status when a file is being converted
const OUTPUT_FILENAME = 'out.zip.pdf'; // File name used by docsbox to save a converted document
const DEFAULT_FORMAT = 'pdf'; // Default supported format
// -------------------------------------------------------------------------------------------------
// Public static methods
/**
* Static method used to convert a document using a Docsbox installation (local/remote) over the network
* It return 0 on success and any other integer on error
* NOTE: currently format is not supported
*/
public static function convert($inputFileName, $outputFileName, $format)
{
// If a format has not been given
if (($format == null) || ($format != null && ctype_space($format) === true)) $format = self::DEFAULT_FORMAT;
// Posts the file to docsbox
$queueId = self::_postFile($inputFileName);
// If an error occurred
if ($queueId == null) return self::ERROR;
// Checks and waits if the file has been converted
$resultUrl = self::_checkConvertion($queueId);
// If an error occurred
if ($resultUrl == null) return self::ERROR;
// Download and rename the converted file
$downloaded = self::_downloadFile($resultUrl, $outputFileName);
// If an error occurred
if (!$downloaded) return self::ERROR;
return self::SUCCESS;
}
// -------------------------------------------------------------------------------------------------
// Private static methods
/**
* Posts the given file to a Docsboxserver and checks the response to return a valid queue id
* On failure it returns a null value
*/
private static function _postFile($inputFileName)
{
$queueId = null;
try
{
// Posts the given file and expects a response in JSON format
$postFileResponse = \Httpful\Request::post(DOCSBOX_SERVER.DOCSBOX_PATH_API)
->attach(array('file' => $inputFileName))
->expectsJson()
->send();
// Checks that:
// - the response is not empty
// - the reponse body has the property id
// - the property id is a valid string
// - the reponse body has the property status
// - docsbox queued the conversion of the posted file
if (is_object($postFileResponse)
&& isset($postFileResponse->body)
&& isset($postFileResponse->body->id)
&& $postFileResponse->body->id != '' && $postFileResponse->body->id != null
&& isset($postFileResponse->body->status)
&& $postFileResponse->body->status == self::STATUS_QUEUED)
{
$queueId = $postFileResponse->body->id;
}
else
{
// If docsbox refused to convert the posted file
if (isset($postFileResponse->body->status)
&& $postFileResponse->body->status != self::STATUS_QUEUED)
{
error_log(
'Docsbox did not queue the posted file. Returned status: '.
$postFileResponse->body->status
);
}
else // any other generic error
{
error_log(
'An error occurred while posting to docsbox. Response: '.
print_r($postFileResponse, 1)
);
}
}
}
catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception
{
error_log($cee->getMessage());
}
catch (Exception $e) // any other exception
{
error_log($e->getMessage());
}
return $queueId;
}
/**
* Check the status of the file convertion identified by the given queue element id
* A URL is returned with the path where it is possible to download the converted file
* If an error occurred then a null value is returned
*/
private static function _checkConvertion($queueId)
{
$resultUrl = null;
$startConvertionsTime = time(); // time when the file conversion has started
// Until a timeout has occurred
while (time() - $startConvertionsTime <= DOCSBOX_CONVERSION_TIMEOUT)
{
sleep(DOCSBOX_WAITING_SLEEP_TIME); // takes a nap on every round
try
{
// Calls the docsbox server to check the status of the
// file conversion using the provided queue id
// it expects a response in JSON format
$getStatusResponse = \Httpful\Request::get(DOCSBOX_SERVER.DOCSBOX_PATH_API.$queueId)
->expectsJson()
->send();
// Checks that:
// - the response is not empty
// - the reponse body has the property id
// - the property id is a valid string
// - the reponse body has the property status
// - docsbox is working the conversion of the posted file
if (is_object($getStatusResponse)
&& isset($getStatusResponse->body->id)
&& $getStatusResponse->body->id != '' && $getStatusResponse->body->id != null
&& isset($getStatusResponse->body->status))
{
// Checks that docsbox has finished working on the file conversion
// and that there is a valid resultUrl property
if ($getStatusResponse->body->status == self::STATUS_FINISHED
&& isset($getStatusResponse->body->result_url)
&& $getStatusResponse->body->result_url != ''
&& $getStatusResponse->body->result_url != null)
{
$resultUrl = $getStatusResponse->body->result_url;
break;
}
// Just started or still working on it
elseif ($getStatusResponse->body->status == self::STATUS_WORKING
|| $getStatusResponse->body->status == self::STATUS_STARTED)
{
// go on!
}
else // any other status is abnormal
{
error_log(
'Not valid status for queue element: '.$queueId.'. Response: '.
print_r($getStatusResponse, 1)
);
break; // interrupt the loop on error
}
}
else // if the response from the docsbox server is not valid
{
error_log(
'An error occurred while checking the docsbox activity. Response: '.
print_r($getStatusResponse, 1)
);
break; // interrupt the loop on error
}
}
catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception
{
error_log($cee->getMessage());
break; // interrupt the loop on error
}
catch (Exception $e) // any other exception
{
error_log($e->getMessage());
break; // interrupt the loop on error
}
}
return $resultUrl;
}
/**
* Download the converted file using the provided URL, unzip it, and renames it into the provided file name
*/
private static function _downloadFile($resultUrl, $outputFileName)
{
$downloaded = false; // pessimistic assumption
try
{
// Download the file
$getFileResponse = \Httpful\Request::get(DOCSBOX_SERVER.$resultUrl)->send();
// If the downloaded file content is valid and not empty
if (isset($getFileResponse->body)
&& $getFileResponse->body != null
&& $getFileResponse->body != '')
{
// Output directory where to unzip the downloaded zip file
$outputDirectory = dirname($outputFileName);
// The path and name of the downloaded zip file
$temporaryDownloadedZip = sys_get_temp_dir().'/'.basename($resultUrl);
// Write the file content into a temporary directory and file
if (file_put_contents($temporaryDownloadedZip, $getFileResponse->body) != false)
{
$zipArchive = new ZipArchive;
// Open and extract the dowloaded zip file into the directory of the output file
if ($zipArchive->open($temporaryDownloadedZip) === true
&& $zipArchive->extractTo($outputDirectory) === true
&& $zipArchive->close() === true)
{
// Opened, extracted and closed!
// Rename the extracted file to the given output file name
if (rename($outputDirectory.'/'.self::OUTPUT_FILENAME, $outputFileName))
{
$downloaded = true;
}
else
{
error_log(
'An error occurred while renaming the extracted file: '.
$outputDirectory.'/'.self::OUTPUT_FILENAME.' into: '.
$outputFileName
);
}
}
else
{
error_log(
'An error occurred while working the dowloaded zip file: '.
$temporaryDownloadedZip
);
}
}
else // if an error occurred while writing
{
error_log(
'An error occurred while writing the file content to: '.
$temporaryDownloadedZip
);
}
}
else // if the downloaded file is not valid
{
error_log(
'An error occurred while downloading the file from the docsbox server: '.
print_r($getFileResponse, 1)
);
}
}
catch(\Httpful\Exception\ConnectionErrorException $cee)
{
error_log($cee->getMessage());
}
catch (Exception $e)
{
error_log($e->getMessage());
}
return $downloaded;
}
}
+50 -20
View File
@@ -14,20 +14,28 @@ class DocumentLib
// Gets CI instance
$this->ci =& get_instance();
exec('unoconv --version', $ret_arr);
if(isset($ret_arr[0]))
// Which document converter has to be used
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
$hlp = explode(' ', $ret_arr[0]);
if(isset($hlp[1]))
{
$this->unoconv_version = $hlp[1];
}
else
show_error('Could not get Unoconv Version');
// Use docsbox!!
}
else
show_error('Unoconv not found - Please install Unoconv');
{
exec('unoconv --version', $ret_arr);
if(isset($ret_arr[0]))
{
$hlp = explode(' ', $ret_arr[0]);
if(isset($hlp[1]))
{
$this->unoconv_version = $hlp[1];
}
else
show_error('Could not get Unoconv Version');
}
else
show_error('Unoconv not found - Please install Unoconv');
}
}
/**
@@ -57,9 +65,16 @@ class DocumentLib
case 'application/vnd.ms-word':
case 'application/vnd.oasis.opendocument.text':
case 'text/plain':
// Unoconv Version 0.6 seems to fail on converting TXT Files
if ($this->unoconv_version == '0.6')
return error();
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
// Use docsbox
}
else
{
// Unoconv Version 0.6 seems to fail on converting TXT Files
if ($this->unoconv_version == '0.6')
return error();
}
$ret = $this->convert($filename, $outFile, 'pdf');
if(isSuccess($ret))
@@ -105,6 +120,7 @@ class DocumentLib
finfo_close($finfo);
$out = null;
exec($cmd, $out, $ret);
if ($ret != 0)
{
@@ -123,13 +139,26 @@ class DocumentLib
*/
public function convert($inFile, $outFile, $format)
{
if ($this->unoconv_version == '0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
$ret = 0;
exec($command, $out, $ret);
// If it is set to use docsbox
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php');
$ret = DocsboxLib::convert($inFile, $outFile, $format);
}
else // otherwise use unoconv
{
if ($this->unoconv_version == '0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
$out = null;
exec($command, $out, $ret);
}
if ($ret != 0)
{
@@ -191,6 +220,7 @@ class DocumentLib
$cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> ';
$cmd .= 'setpagedevice viewJPEG"';
$out = null;
exec($cmd, $out, $ret);
if ($ret != 0)
{
+44 -20
View File
@@ -1,7 +1,25 @@
<?php
/**
* Copyright (C) 2022 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 3 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, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \stdClass as stdClass;
/**
* Library to manage core extensions
*/
@@ -23,7 +41,7 @@ class ExtensionsLib
// Directories that are part of the extension archive
private $SOFTLINK_TARGET_DIRECTORIES = array(
APPPATH => array('config', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'),
APPPATH => array('config', 'components', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'),
DOC_ROOT => array('public')
);
@@ -181,17 +199,15 @@ class ExtensionsLib
// Select all the version of this extension
$this->_ci->ExtensionsModel->addSelect('extension_id');
$result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $extensionName));
if (hasData($result)) // if something was found
// If something was found
if (hasData($result))
{
$extsArray = array();
foreach ($result->retval as $key => $extension) // loops on them
// Loops on them
foreach ($result->retval as $extension)
{
// Remove them all
$result = $this->_ci->ExtensionsModel->delete($extension->extension_id);
if (isSuccess($result))
{
$delExtension = true;
}
if (isSuccess($result)) $delExtension = true;
}
}
}
@@ -432,9 +448,13 @@ class ExtensionsLib
// If no errors occurred
if ($extensionJson != null)
{
// Default value
$fhcomplete_version = 0;
require_once('version.php'); // get the core version
// Checks if the required core version of the extension is the same of this system
if (isset($extensionJson->core_version) && $extensionJson->core_version == $fhcomplete_version)
if (isset($extensionJson->core_version) && version_compare($extensionJson->core_version, $fhcomplete_version,'<='))
{
$this->_printMessage('Required core version: '.$extensionJson->core_version);
$this->_printMessage('Current core version: '.$fhcomplete_version);
@@ -587,18 +607,22 @@ class ExtensionsLib
for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++)
{
// If a directory with the same value of the version is present in the sql scripts directory
if (($files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION)) != false)
{
$files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION);
if ($files != false)
{
// Loads every sql files
foreach ($files as $file)
{
$sql = file_get_contents($file); // gets the entire content of the file
foreach ($files as $file)
{
$sql = file_get_contents($file); // gets the entire content of the file
$this->_printMessage('Executing query:');
$this->_printMessage($sql);
// Try to execute that
if (!isSuccess($result = @$this->_ci->ExtensionsModel->executeQuery($sql)))
$resultQuery = @$this->_ci->ExtensionsModel->executeQuery($sql);
// If _not_ a success
if (!isSuccess($resultQuery))
{
$this->_errorOccurred = true;
$this->_printFailure(' error occurred while executing the query');
@@ -608,11 +632,11 @@ class ExtensionsLib
else
{
$this->_printMessage('Query result:');
var_dump($result->retval); // KEEP IT!!!
var_dump(getData($resultQuery)); // KEEP IT!!!
$this->_ci->eprintflib->printEOL();
}
}
}
}
}
}
$this->_printSuccess(!$this->_errorOccurred);
@@ -673,7 +697,7 @@ class ExtensionsLib
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories)
{
foreach ($targetDirectories as $key => $targetDirectory)
foreach ($targetDirectories as $targetDirectory)
{
if (file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
{
@@ -727,7 +751,7 @@ class ExtensionsLib
// For every target directory
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories)
{
foreach ($targetDirectories as $key => $targetDirectory)
foreach ($targetDirectories as $targetDirectory)
{
// If destination of the symlink does not exist
if (!file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
-142
View File
@@ -1,142 +0,0 @@
<?php
/***
* FH-Complete
*
* @package FHC-API
* @author FHC-Team
* @copyright Copyright (c) 2016, fhcomplete.org
* @license GPLv3
* @link http://fhcomplete.org
* @since Version 1.0
* @filesource
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class FilesystemLib
{
/**
* checkParameters
*/
private function checkParameters($filepath, $filename)
{
if (isset($filepath) && isset($filename) &&
$filepath != '' && $filename != '')
{
return true;
}
else
{
return false;
}
}
/**
* read
*/
public function read($filepath, $filename)
{
$result = null;
if ($this->checkParameters($filepath, $filename))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (file_exists($resource) && $fileHandle = fopen($resource, 'r'))
{
$result = '';
while (!feof($fileHandle))
{
$result .= fread($fileHandle, 8192);
}
fclose($fileHandle);
}
}
return $result;
}
/**
* write
*/
public function write($filepath, $filename, $content)
{
$result = null;
if ($this->checkParameters($filepath, $filename) && isset($content))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($filepath) && $fileHandle = fopen($resource, 'w'))
{
if (fwrite($fileHandle, $content) !== false)
{
$result = true;
}
fclose($fileHandle);
}
}
return $result;
}
/**
* append
*/
public function append($filepath, $filename, $content)
{
$result = null;
if ($this->checkParameters($filepath, $filename) && isset($content))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($resource) && $fileHandle = fopen($resource, 'a'))
{
if (fwrite($fileHandle, $content) !== false)
{
$result = true;
}
fclose($fileHandle);
}
}
return $result;
}
/**
* remove
*/
public function remove($filepath, $filename)
{
$result = null;
if ($this->checkParameters($filepath, $filename))
{
if (is_writable($filepath))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
$result = unlink($resource);
}
}
return $result;
}
/**
* rename
*/
public function rename($filepath, $filename, $newFilepath, $newFilename)
{
$result = null;
if ($this->checkParameters($filepath, $filename) && $this->checkParameters($newFilepath, $newFilename))
{
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($filepath) && is_writable($newFilepath) && file_exists($resource))
{
$destination = $newFilepath.DIRECTORY_SEPARATOR.$newFilename;
$result = rename($resource, $destination);
}
}
return $result;
}
}
File diff suppressed because it is too large Load Diff
+15 -10
View File
@@ -340,20 +340,25 @@ class FilterWidgetLib
{
$filterDefinition = $filters[$filtersCounter]; // definition of one filter
if ($filtersCounter > 0)
$where .= ' AND '; // if it's NOT the last one
if (!isEmptyString($filterDefinition->name)) // if the name of the applied filter is valid
// If the name of the applied filter is valid
if (!isEmptyString($filterDefinition->name))
{
// ...build the condition
$where .= '"'.$filterDefinition->name.'"'.$this->_getDatasetQueryCondition($filterDefinition);
// Build the query conditions
$datasetQueryCondition = $this->_getDatasetQueryCondition($filterDefinition);
// If the built condition is valid then add it to the query clause
if (!isEmptyString($datasetQueryCondition))
{
// // If this is NOT the first one
if ($filtersCounter > 0) $where .= ' AND ';
$where .= '"'.$filterDefinition->name.'"'.$datasetQueryCondition;
}
}
}
if ($where != '') // if the SQL where clause was built
{
$datasetQuery .= ' WHERE '.$where;
}
// If the SQL where clause was built
if ($where != '') $datasetQuery .= ' WHERE '.$where;
}
return $datasetQuery;
+24 -5
View File
@@ -169,6 +169,9 @@ class IssuesLib
return $this->_changeIssueStatus($issue_id, $data, $user);
}
// --------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Changes status of an issue.
* @param int $issue_id
@@ -215,8 +218,15 @@ class IssuesLib
* @param string $inhalt_extern
* @return object success or error
*/
private function _addIssue($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null, $fehlercode_extern = null, $inhalt_extern = null)
{
private function _addIssue(
$fehlercode,
$person_id = null,
$oe_kurzbz = null,
$fehlertext_params = null,
$resolution_params = null,
$fehlercode_extern = null,
$inhalt_extern = null
) {
if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
return error("Person_id or oe_kurzbz must be set.");
@@ -226,7 +236,15 @@ class IssuesLib
if (hasData($fehlerRes))
{
$fehlertextVorlage = getData($fehlerRes)[0]->fehlertext;
$fehlertext = isEmptyArray($fehlertext_params) ? $fehlertextVorlage : vsprintf($fehlertextVorlage, $fehlertext_params);
$fehlertext = $fehlertextVorlage;
if (!isEmptyArray($fehlertext_params))
{
if (count($fehlertext_params) != substr_count($fehlertextVorlage, '%s'))
return error('Wrong number of parameters for Fehlertext, fehler_kurzbz ' . $fehlercode);
$fehlertext = vsprintf($fehlertextVorlage, $fehlertext_params);
}
$openIssuesCountRes = $this->_ci->IssueModel->getOpenIssueCount($fehlercode, $person_id, $oe_kurzbz, $fehlercode_extern);
@@ -252,6 +270,7 @@ class IssuesLib
return error("Invalid parameters for resolution");
}
// insert new issue
return $this->_ci->IssueModel->insert(
array(
'fehlercode' => $fehlercode,
@@ -267,8 +286,8 @@ class IssuesLib
)
);
}
else
return success($openIssueCount);
else // return success if issue already exists
return success("Issue already exists");
}
else
return error("Number of open issues could not be determined");
+34 -7
View File
@@ -1,4 +1,20 @@
<?php
/**
* Copyright (C) 2022 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 3 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, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
@@ -37,7 +53,7 @@ class NavigationLib
// Loads library ExtensionsLib
$this->_ci->load->library('ExtensionsLib');
$this->_navigationPage = $this->_getNavigationtPage($params); // sets the id for the related navigation widget
$this->_navigationPage = $this->_getNavigationPage($params); // sets the id for the related navigation widget
}
//------------------------------------------------------------------------------------------------------------------
@@ -67,9 +83,19 @@ class NavigationLib
* Returns the structure for one level of the menu
*/
public function oneLevel(
$description, $link = '#', $children = null, $icon = '', $expand = false,
$subscriptDescription = null, $subscriptLinkClass = null, $subscriptLinkValue = null, $target = '',
$sort = null, $requiredPermissions = null, $subscriptLinkHref = '#')
$description,
$link = '#',
$children = null,
$icon = '',
$expand = false,
$subscriptDescription = null,
$subscriptLinkClass = null,
$subscriptLinkValue = null,
$target = '',
$sort = null,
$requiredPermissions = null,
$subscriptLinkHref = '#'
)
{
return array(
'description' => $description,
@@ -223,7 +249,8 @@ class NavigationLib
$filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_NAVIGATION_FILENAME;
if (file_exists($filename))
{
unset($config);
$config = array(); // default value
include($filename);
if (isset($config[$configName]) && is_array($config[$configName]))
@@ -278,7 +305,7 @@ class NavigationLib
}
else
{
foreach ($navigationArray as $key=>$row)
foreach ($navigationArray as $key => $row)
{
// Search for * Entries
if (mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1)
@@ -300,7 +327,7 @@ class NavigationLib
* Return an unique string that identify this navigation widget
* NOTE: The default value is the URI where the NavigationWidget is called
*/
private function _getNavigationtPage($params)
private function _getNavigationPage($params)
{
if ($params != null
&& is_array($params)
+298
View File
@@ -0,0 +1,298 @@
<?php
/**
* Copyright (C) 2022 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 3 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, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \stdClass as stdClass;
/**
*
*/
class SearchBarLib
{
// Error constats
const ERROR_WRONG_JSON = 'ERR001';
const ERROR_WRONG_SEARCHSTR = 'ERR002';
const ERROR_NO_TYPES = 'ERR003';
const ERROR_WRONG_TYPES = 'ERR004';
// List of allowed types of search
const ALLOWED_TYPES = ['mitarbeiter', 'organisationunit', 'raum', 'person', 'student', 'prestudent', 'document', 'cms'];
const PHOTO_IMG_URL = '/cis/public/bild.php?src=person&person_id=';
private $_ci; // Code igniter instance
/**
* Gets the CI instance and loads model
*/
public function __construct()
{
$this->_ci =& get_instance(); // get code igniter instance
// It is loaded only to have the DB_Model available
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel');
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* It performes the search of the given search string using the specified search types
*/
public function search($searchstr, $types)
{
// Checks if the given parameters are fine
$search = $this->_checkParameters($searchstr, $types);
// If the check was successful then perform the search
if (isSuccess($search)) $search = $this->_search($searchstr, $types);
return $search; // return the result
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Checks:
* - The given searchstr is a not empty string
* - The given types is a not empty array and contains allowed search types
*/
private function _checkParameters($searchstr, $types)
{
// If searchstr is empty
if (isEmptyString($searchstr)) return error(self::ERROR_WRONG_SEARCHSTR);
// If types is not an array or it is empty
if (isEmptyArray($types)) return error(self::ERROR_NO_TYPES);
// If all the elements in types are allowed search types
if (!isEmptyArray(array_diff($types, self::ALLOWED_TYPES))) return error(self::ERROR_WRONG_TYPES);
return success(); // The check is fine!
}
/**
* Loops on types and perform the search of that type using searchstr
* Then it collects all the returned data into an array as property of an object
*/
private function _search($searchstr, $types)
{
// Object to be returned
$result = new stdClass();
$result->data = array();
// For each search type
foreach ($types as $type)
{
// Perform the search and then add the result to data
$result->data = array_merge($result->data, $this->{'_'.$type}($searchstr, $type));
}
return $result;
}
/**
* Search for employees
*/
private function _mitarbeiter($searchstr, $type)
{
$dbModel = new DB_Model();
$employees = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
b.uid AS uid,
p.person_id AS person_id,
p.vorname || \' \' || p.nachname AS name,
ARRAY_AGG(DISTINCT(org.bezeichnung)) AS organisationunit_name,
COALESCE(b.alias, b.uid) || \''.'@'.DOMAIN.'\' AS email,
TRIM(COALESCE(k.kontakt, \'\') || \' \' || COALESCE(m.telefonklappe, \'\')) AS phone,
\''.base_url(self::PHOTO_IMG_URL).'\' || p.person_id AS photo_url,
ARRAY_AGG(DISTINCT(stdkst.bezeichnung)) AS standardkostenstelle
FROM public.tbl_mitarbeiter m
JOIN public.tbl_benutzer b ON(b.uid = m.mitarbeiter_uid)
JOIN (
SELECT o.bezeichnung, bf.uid
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
WHERE bf.funktion_kurzbz = \'kstzuordnung\'
AND (bf.datum_von IS NULL OR bf.datum_von <= NOW())
AND (bf.datum_bis IS NULL OR bf.datum_bis >= NOW())
GROUP BY o.bezeichnung, bf.uid
) stdkst ON stdkst.uid = b.uid
JOIN public.tbl_person p USING(person_id)
JOIN (
SELECT o.bezeichnung, bf.uid
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
WHERE bf.funktion_kurzbz = \'oezuordnung\'
AND (bf.datum_von IS NULL OR bf.datum_von <= NOW())
AND (bf.datum_bis IS NULL OR bf.datum_bis >= NOW())
GROUP BY o.bezeichnung, bf.uid
) org ON org.uid = b.uid
LEFT JOIN (
SELECT kontakt, standort_id
FROM public.tbl_kontakt
WHERE kontakttyp = \'telefon\'
) k ON(k.standort_id = m.standort_id)
WHERE b.uid ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.vorname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR p.nachname ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR org.bezeichnung ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR stdkst.bezeichnung ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
GROUP BY type, b.uid, p.person_id, name, email, m.telefonklappe, phone
');
// If something has been found then return it
if (hasData($employees)) return getData($employees);
// Otherwise return an empty array
return array();
}
/**
* Seach for organisation units
*/
private function _organisationunit($searchstr, $type)
{
$dbModel = new DB_Model();
$ous = $dbModel->execReadOnlyQuery('
SELECT
\''.$type.'\' AS type,
o.oe_kurzbz AS oe_kurzbz,
o.bezeichnung AS name,
oParent.oe_kurzbz AS parentoe_kurzbz,
oParent.bezeichnung AS parentoe_name,
ARRAY_AGG(DISTINCT(bfLeader.uid)) AS leader_uid,
ARRAY_AGG(DISTINCT(bfLeader.vorname || \' \' || bfLeader.nachname)) AS leader_name,
COUNT(bfCount.benutzerfunktion_id) AS number_of_people,
(CASE WHEN o.mailverteiler = TRUE THEN o.oe_kurzbz || \''.'@'.DOMAIN.'\' END) AS mailgroup
FROM public.tbl_organisationseinheit o
LEFT JOIN public.tbl_organisationseinheit oParent ON(oParent.oe_kurzbz = o.oe_parent_kurzbz)
LEFT JOIN (
SELECT benutzerfunktion_id, oe_kurzbz
FROM public.tbl_benutzerfunktion
WHERE funktion_kurzbz = \'oezuordnung\'
AND (datum_von IS NULL OR datum_von <= NOW())
AND (datum_bis IS NULL OR datum_bis >= NOW())
) bfCount ON(bfCount.oe_kurzbz = o.oe_kurzbz)
LEFT JOIN (
SELECT bf.oe_kurzbz, bf.uid, p.vorname, p.nachname
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_benutzer b USING(uid)
JOIN public.tbl_person p USING(person_id)
WHERE funktion_kurzbz = \'Leitung\'
AND (datum_von IS NULL OR datum_von <= NOW())
AND (datum_bis IS NULL OR datum_bis >= NOW())
AND b.aktiv = TRUE
) bfLeader ON(bfLeader.oe_kurzbz = o.oe_kurzbz)
WHERE o.oe_kurzbz ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
OR o.bezeichnung ILIKE \'%'.$dbModel->escapeLike($searchstr).'%\'
GROUP BY type, o.oe_kurzbz, o.bezeichnung, oParent.oe_kurzbz, oParent.bezeichnung
');
// If something has been found
if (hasData($ous))
{
// Loop through the returned dataset
foreach (getData($ous) as $ou)
{
// Create the new property leaders as an empty array
$ou->leaders = array();
// Loop through the found leaders for this organisation unit
for ($i = 0; $i < count($ou->leader_uid); $i++)
{
// If a leader exists for this organisationunit and has a name :D
if (!isEmptyString($ou->leader_uid[$i]) && !isEmptyString($ou->leader_name[$i]))
{
// Empty object that will contains the leader uid and name
$leader = new stdClass();
// Set the properties name and uid
$leader->uid = $ou->leader_uid[$i];
$leader->name = $ou->leader_name[$i];
// Add the leader object to the leaders array
$ou->leaders[] = $leader;
}
}
// Remove the not needed properties leader_uid and leader_name
unset($ou->leader_uid);
unset($ou->leader_name);
}
// Returns the changed dataset
return getData($ous);
}
// Otherwise return an empty array
return array();
}
/**
* Search for persons
*/
private function _person($searchstr, $type)
{
return array();
}
/**
* Search for students
*/
private function _student($searchstr, $type)
{
return array();
}
/**
* Search for prestudents
*/
private function _prestudent($searchstr, $type)
{
return array();
}
/**
* Search for documents
*/
private function _document($searchstr, $type)
{
return array();
}
/**
* Search for CMSs
*/
private function _cms($searchstr, $type)
{
return array();
}
/**
* Search for rooms
*/
private function _raum($searchstr, $type)
{
return array();
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,103 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class PlausicheckProducerLib
{
const CI_LIBRARY_PATH = 'application/libraries';
const PLAUSI_ISSUES_FOLDER = 'issues/plausichecks';
const EXECUTE_PLAUSI_CHECK_METHOD_NAME = 'executePlausiCheck';
private $_ci; // ci instance
private $_currentStudiensemester; // current Studiensemester
// set fehler which can be produced by the job
// structure: fehler_kurzbz => class (library) name for resolving
private $_fehlerLibMappings = array(
'AbbrecherAktiv' => 'AbbrecherAktiv',
'AbschlussstatusFehlt' => 'AbschlussstatusFehlt',
'AktSemesterNull' => 'AktSemesterNull',
'AktiverStudentOhneStatus' => 'AktiverStudentOhneStatus',
'AktiverStudentstatusOhneKontobuchung' => 'AktiverStudentstatusOhneKontobuchung',
'AusbildungssemPrestudentUngleichAusbildungssemStatus' => 'AusbildungssemPrestudentUngleichAusbildungssemStatus',
'BewerberNichtZumRtAngetreten' => 'BewerberNichtZumRtAngetreten',
'DatumAbschlusspruefungFehlt' => 'DatumAbschlusspruefungFehlt',
'DatumSponsionFehlt' => 'DatumSponsionFehlt',
'DatumStudiensemesterFalscheReihenfolge' => 'DatumStudiensemesterFalscheReihenfolge',
'FalscheAnzahlAbschlusspruefungen' => 'FalscheAnzahlAbschlusspruefungen',
'FalscheAnzahlHeimatadressen' => 'FalscheAnzahlHeimatadressen',
'FalscheAnzahlZustelladressen' => 'FalscheAnzahlZustelladressen',
'GbDatumWeitZurueck' => 'GbDatumWeitZurueck',
'InaktiverStudentAktiverStatus' => 'InaktiverStudentAktiverStatus',
'IncomingHeimatNationOesterreich' => 'IncomingHeimatNationOesterreich',
'IncomingOhneIoDatensatz' => 'IncomingOhneIoDatensatz',
'IncomingOrGsFoerderrelevant' => 'IncomingOrGsFoerderrelevant',
'InskriptionVorLetzerBismeldung' => 'InskriptionVorLetzerBismeldung',
'NationNichtOesterreichAberGemeinde' => 'NationNichtOesterreichAberGemeinde',
'OrgformStgUngleichOrgformPrestudent' => 'OrgformStgUngleichOrgformPrestudent',
'PrestudentMischformOhneOrgform' => 'PrestudentMischformOhneOrgform',
'StgPrestudentUngleichStgStudienplan' => 'StgPrestudentUngleichStgStudienplan',
'StgPrestudentUngleichStgStudent' => 'StgPrestudentUngleichStgStudent',
'StudentstatusNachAbbrecher' => 'StudentstatusNachAbbrecher'
//'StudienplanUngueltig' => 'StudienplanUngueltig'
);
public function __construct()
{
$this->_ci =& get_instance(); // get ci instance
// load models
$this->_ci->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
// get current Studiensemester
$studiensemesterRes = $this->_ci->StudiensemesterModel->getAkt();
if (hasData($studiensemesterRes)) $this->_currentStudiensemester = getData($studiensemesterRes)[0]->studiensemester_kurzbz;
}
/**
* Executes check for a fehler_kurzbz, returns the result.
* @param $fehler_kurzbz string
* @param $studiensemester_kurzbz string optionally needed for issue production
* @param $studiengang_kz int optionally needed for issue production
*/
public function producePlausicheckIssue($fehler_kurzbz, $studiensemester_kurzbz = null, $studiengang_kz = null)
{
$libName = $this->_fehlerLibMappings[$fehler_kurzbz];
// get Studiensemester
if (isEmptyString($studiensemester_kurzbz)) $studiensemester_kurzbz = $this->_currentStudiensemester;
// get path of library for issue to be produced
$issuesLibPath = DOC_ROOT . self::CI_LIBRARY_PATH . '/' . self::PLAUSI_ISSUES_FOLDER . '/';
$issuesLibFilePath = $issuesLibPath . $libName . '.php';
// check if library file exists
if (!file_exists($issuesLibFilePath)) return error("Issue library file " . $issuesLibFilePath . " does not exist");
// load library connected to fehlercode
$this->_ci->load->library(self::PLAUSI_ISSUES_FOLDER . '/'.$libName);
$lowercaseLibName = mb_strtolower($libName);
// check if method is defined in library class
if (!is_callable(array($this->_ci->{$lowercaseLibName}, self::EXECUTE_PLAUSI_CHECK_METHOD_NAME)))
return error("Method " . self::EXECUTE_PLAUSI_CHECK_METHOD_NAME . " is not defined in library $lowercaseLibName");
// pass the data needed for issue check
$paramsForCheck = array(
'studiensemester_kurzbz' => $studiensemester_kurzbz,
'studiengang_kz' => $studiengang_kz
);
// call the function for checking for issue production
return $this->_ci->{$lowercaseLibName}->{self::EXECUTE_PLAUSI_CHECK_METHOD_NAME}($paramsForCheck);
}
/**
* Gets all fehler_kurzbz for fehler which need to be checked.
*/
public function getFehlerKurzbz()
{
return array_keys($this->_fehlerLibMappings);
}
}
@@ -0,0 +1,43 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class AbbrecherAktiv extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getAbbrecherAktiv($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,44 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class AbschlussstatusFehlt extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getAbschlussstatusFehlt($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,50 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class AktSemesterNull extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getAktSemesterNull($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,43 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class AktiverStudentOhneStatus extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getAktiverStudentOhneStatus($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,50 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
* Student with active status should have been charged, i.e. have a Kontobuchung with negative or zero value.
*/
class AktiverStudentstatusOhneKontobuchung extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getAktiverStudentstatusOhneKontobuchung($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,56 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class AusbildungssemPrestudentUngleichAusbildungssemStatus extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getAusbildungssemPrestudentUngleichAusbildungssemStatus(
$studiensemester_kurzbz,
$studiengang_kz
);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'status_ausbildungssemester' => $prestudent->status_ausbildungssemester,
'student_ausbildungssemester' => $prestudent->student_ausbildungssemester,
'student_uid' => $prestudent->student_uid,
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,47 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class BewerberNichtZumRtAngetreten extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getBewerberNichtZumRtAngetreten($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array(
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz,
'prestudent_id' => $prestudent->prestudent_id
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,47 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class DatumAbschlusspruefungFehlt extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getDatumAbschlusspruefungFehlt($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'abschlusspruefung_id' => $prestudent->abschlusspruefung_id
),
'resolution_params' => array('abschlusspruefung_id' => $prestudent->abschlusspruefung_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,47 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class DatumSponsionFehlt extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getDatumSponsionFehlt($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'abschlusspruefung_id' => $prestudent->abschlusspruefung_id
),
'resolution_params' => array('abschlusspruefung_id' => $prestudent->abschlusspruefung_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,45 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class DatumStudiensemesterFalscheReihenfolge extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getDatumStudiensemesterFalscheReihenfolge($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,44 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class FalscheAnzahlAbschlusspruefungen extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getFalscheAnzahlAbschlusspruefungen($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class FalscheAnzahlHeimatadressen extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$personRes = $this->_ci->plausichecklib->getFalscheAnzahlHeimatadressen($studiensemester_kurzbz, $studiengang_kz);
if (isError($personRes)) return $personRes;
if (hasData($personRes))
{
$persons = getData($personRes);
// populate results with data necessary for writing issues
foreach ($persons as $person)
{
$results[] = array(
'person_id' => $person->person_id,
'resolution_params' => array('person_id' => $person->person_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class FalscheAnzahlZustelladressen extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$personRes = $this->_ci->plausichecklib->getFalscheAnzahlZustelladressen($studiensemester_kurzbz, $studiengang_kz);
if (isError($personRes)) return $personRes;
if (hasData($personRes))
{
$persons = getData($personRes);
// populate results with data necessary for writing issues
foreach ($persons as $person)
{
$results[] = array(
'person_id' => $person->person_id,
'resolution_params' => array('person_id' => $person->person_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class GbDatumWeitZurueck extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$personRes = $this->_ci->plausichecklib->getGbDatumWeitZurueck($studiensemester_kurzbz, $studiengang_kz);
if (isError($personRes)) return $personRes;
if (hasData($personRes))
{
$persons = getData($personRes);
// populate results with data necessary for writing issues
foreach ($persons as $person)
{
$results[] = array(
'person_id' => $person->person_id,
'resolution_params' => array('person_id' => $person->person_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,47 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class InaktiverStudentAktiverStatus extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getInaktiverStudentAktiverStatus($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class IncomingHeimatNationOesterreich extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$personRes = $this->_ci->plausichecklib->getIncomingHeimatNationOesterreich($studiensemester_kurzbz, $studiengang_kz);
if (isError($personRes)) return $personRes;
if (hasData($personRes))
{
$persons = getData($personRes);
// populate results with data necessary for writing issues
foreach ($persons as $person)
{
$results[] = array(
'person_id' => $person->person_id,
'resolution_params' => array('person_id' => $person->person_id, 'studiensemester_kurzbz' => $studiensemester_kurzbz)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,43 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class IncomingOhneIoDatensatz extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getIncomingOhneIoDatensatz($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,44 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class IncomingOrGsFoerderrelevant extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getIncomingOrGsFoerderrelevant($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,51 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class InskriptionVorLetzerBismeldung extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getInskriptionVorLetzerBismeldung($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'datum_bismeldung' => date_format(date_create($prestudent->datum_bismeldung), 'd.m.Y'),
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,42 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class NationNichtOesterreichAberGemeinde extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$personRes = $this->_ci->plausichecklib->getNationNichtOesterreichAberGemeinde($studiengang_kz);
if (isError($personRes)) return $personRes;
if (hasData($personRes))
{
$persons = getData($personRes);
// populate results with data necessary for writing issues
foreach ($persons as $person)
{
$results[] = array(
'person_id' => $person->person_id,
'fehlertext_params' => array('gemeinde' => $person->gemeinde, 'adresse_id' => $person->adresse_id),
'resolution_params' => array('adresse_id' => $person->adresse_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,52 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class OrgformStgUngleichOrgformPrestudent extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getOrgformStgUngleichOrgformPrestudent($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'student_studiengang' => $prestudent->student_studiengang,
'student_orgform' => $prestudent->student_orgform,
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,24 @@
<?php
/**
* class defining ressources and method to use for plausicheck issue producer
*/
abstract class PlausiChecker
{
protected $_ci; // code igniter instance
public function __construct()
{
$this->_ci =& get_instance(); // get code igniter instance
// load libraries
$this->_ci->load->library('issues/PlausicheckLib'); // load plausicheck library
}
/**
* Executes a plausi check.
* @param $paramsForChecking array parameters needed for executing the check
* @return array with objects which failed the plausi check
*/
abstract public function executePlausiCheck($paramsForChecking);
}
@@ -0,0 +1,50 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class PrestudentMischformOhneOrgform extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getPrestudentMischformOhneOrgform($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,43 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class StgPrestudentUngleichStgStudent extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getStgPrestudentUngleichStgStudent($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,43 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class StgPrestudentUngleichStgStudienplan extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getStgPrestudentUngleichStgStudienplan($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id, 'studienplan' => $prestudent->studienplan),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id, 'studienordnung_id' => $prestudent->studienordnung_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,43 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class StudentstatusNachAbbrecher extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getStudentstatusNachAbbrecher($studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array('prestudent_id' => $prestudent->prestudent_id),
'resolution_params' => array('prestudent_id' => $prestudent->prestudent_id)
);
}
}
// return the results
return success($results);
}
}
@@ -0,0 +1,51 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once('PlausiChecker.php');
/**
*
*/
class StudienplanUngueltig extends PlausiChecker
{
public function executePlausiCheck($params)
{
$results = array();
// pass parameters needed for plausicheck
$studiensemester_kurzbz = isset($params['studiensemester_kurzbz']) ? $params['studiensemester_kurzbz'] : null;
$studiengang_kz = isset($params['studiengang_kz']) ? $params['studiengang_kz'] : null;
// get all students failing the plausicheck
$prestudentRes = $this->_ci->plausichecklib->getStudienplanUngueltig($studiensemester_kurzbz, $studiengang_kz);
if (isError($prestudentRes)) return $prestudentRes;
if (hasData($prestudentRes))
{
$prestudents = getData($prestudentRes);
// populate results with data necessary for writing issues
foreach ($prestudents as $prestudent)
{
$results[] = array(
'person_id' => $prestudent->person_id,
'oe_kurzbz' => $prestudent->prestudent_stg_oe_kurzbz,
'fehlertext_params' => array(
'studienplan' => $prestudent->studienplan,
'ausbildungssemester' => $prestudent->ausbildungssemester,
'prestudent_id' => $prestudent->prestudent_id
),
'resolution_params' => array(
'prestudent_id' => $prestudent->prestudent_id,
'studiensemester_kurzbz' => $prestudent->studiensemester_kurzbz
)
);
}
}
// return the results
return success($results);
}
}
@@ -15,7 +15,6 @@ class CORE_INOUT_0006 implements IIssueResolvedChecker
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
//$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
// get all Zwecke
$this->_ci->BisioModel->addSelect('ects_erworben');
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_INOUT_0007 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
return error('Person Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getIncomingHeimatNationOesterreich($params['studiensemester_kurzbz'], null, $params['issue_person_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_INOUT_0008 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getIncomingOhneIoDatensatz(null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming or external GS student should not be foerderrelevant.
*/
class CORE_INOUT_0009 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getIncomingOrGsFoerderrelevant(null, null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_PERSON_0001 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
return error('Person Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getGbDatumWeitZurueck(null, null, $params['issue_person_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_PERSON_0002 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
return error('Person Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getNationNichtOesterreichAberGemeinde(null, $params['issue_person_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_PERSON_0003 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
return error('Person Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getFalscheAnzahlHeimatadressen(null, null, $params['issue_person_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_PERSON_0004 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['issue_person_id']) || !is_numeric($params['issue_person_id']))
return error('Person Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getFalscheAnzahlZustelladressen(null, null, $params['issue_person_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STG_0001 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getStgPrestudentUngleichStgStudent(null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STG_0002 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getOrgformStgUngleichOrgformPrestudent($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STG_0003 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getPrestudentMischformOhneOrgform($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STG_0004 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studienordnung_id']) || !is_numeric($params['studienordnung_id']))
return error('Studienordnung Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getStgPrestudentUngleichStgStudienplan(null, $params['prestudent_id'], $params['studienordnung_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0001 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getAbbrecherAktiv(null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0002 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getStudentstatusNachAbbrecher(null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0003 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getAusbildungssemPrestudentUngleichAusbildungssemStatus($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0004 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getInaktiverStudentAktiverStatus($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0005 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getInskriptionVorLetzerBismeldung($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0006 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getDatumStudiensemesterFalscheReihenfolge(null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0007 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getAktiverStudentOhneStatus(null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0008 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getStudienplanUngueltig($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0009 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getFalscheAnzahlAbschlusspruefungen(null, null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0010 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['abschlusspruefung_id']) || !is_numeric($params['abschlusspruefung_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getDatumAbschlusspruefungFehlt(null, null, $params['abschlusspruefung_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0011 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['abschlusspruefung_id']) || !is_numeric($params['abschlusspruefung_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getDatumSponsionFehlt(null, null, $params['abschlusspruefung_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0012 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getBewerberNichtZumRtAngetreten($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,32 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0013 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getAktSemesterNull($params['studiensemester_kurzbz'], null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,29 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Incoming shouldn't have austrian home address.
*/
class CORE_STUDENTSTATUS_0014 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getAbschlussstatusFehlt(null, null, $params['prestudent_id']);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}
@@ -0,0 +1,36 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Student with active status should have been charged, i.e. have a Kontobuchung with negative or zero value.
*/
class CORE_STUDENTSTATUS_0015 implements IIssueResolvedChecker
{
public function checkIfIssueIsResolved($params)
{
if (!isset($params['prestudent_id']) || !is_numeric($params['prestudent_id']))
return error('Prestudent Id missing, issue_id: '.$params['issue_id']);
if (!isset($params['studiensemester_kurzbz']) || isEmptyString($params['studiensemester_kurzbz']))
return error('Studiensemester missing, issue_id: '.$params['issue_id']);
$this->_ci =& get_instance(); // get code igniter instance
$this->_ci->load->library('issues/PlausicheckLib');
// check if issue persists
$checkRes = $this->_ci->plausichecklib->getAktiverStudentstatusOhneKontobuchung(
$params['studiensemester_kurzbz'],
null,
$params['prestudent_id']
);
if (isError($checkRes)) return $checkRes;
if (hasData($checkRes))
return success(false); // not resolved if issue is still present
else
return success(true); // resolved otherwise
}
}