mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
Merge branch 'master' into feature-15029/Docsbox
This commit is contained in:
@@ -23,6 +23,14 @@ $config['navigation_header'] = array(
|
||||
'expand' => true,
|
||||
'sort' => 10,
|
||||
'requiredPermissions' => 'basis/vilesci:r'
|
||||
),
|
||||
'oehbeitragsverwaltung' => array(
|
||||
'link' => site_url('codex/Oehbeitrag'),
|
||||
'icon' => '',
|
||||
'description' => 'ÖH-Beitragsverwaltung',
|
||||
'expand' => true,
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'admin:w'
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -94,6 +102,13 @@ $config['navigation_header'] = array(
|
||||
'description' => 'BPK Wartung',
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'admin:r'
|
||||
),
|
||||
'errormonitoring' => array(
|
||||
'link' => site_url('system/issues/Issues'),
|
||||
'description' => 'Fehler Monitoring',
|
||||
'expand' => true,
|
||||
'sort' => 30,
|
||||
'requiredPermissions' => 'system/issues_verwalten:r'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": ["checkbox", "textfield", "textarea", "date", "dropdown", "multipledropdown"]
|
||||
},
|
||||
"requiredPermissions": {
|
||||
"type": "array"
|
||||
},
|
||||
"description": {
|
||||
"type": "array",
|
||||
},
|
||||
@@ -18,10 +25,6 @@
|
||||
"title": {
|
||||
"type": "array",
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": ["checkbox", "textfield", "textarea", "date", "dropdown", "multipledropdown"]
|
||||
},
|
||||
"sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
@@ -67,5 +70,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["type", "name"]
|
||||
}
|
||||
"required": ["type", "name", "requiredPermissions"]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Oehbeitrag extends Auth_Controller
|
||||
{
|
||||
const STUDIENSEMESTER_START = 'WS2020'; // Öhbeitrage can be assigned beginning with this Studiensemester
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'admin:r',// TODO which Berechtigung?
|
||||
'getOehbeitraege' => 'admin:r',
|
||||
'getValidStudiensemester' => 'admin:r',
|
||||
'addOehbeitrag' => 'admin:rw',
|
||||
'updateOehbeitrag' => 'admin:rw',
|
||||
'deleteOehbeitrag' => 'admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
$this->load->model('codex/Oehbeitrag_model', 'OehbeitragModel');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'oehbeitrag'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$oehbeitraege = array();
|
||||
|
||||
$oehbeitragRes = $this->_loadOehbeitraege();
|
||||
|
||||
if (isError($oehbeitragRes))
|
||||
show_error(getError($oehbeitragRes));
|
||||
|
||||
if (hasData($oehbeitragRes))
|
||||
$oehbeitraege = getData($oehbeitragRes);
|
||||
|
||||
$this->load->view("codex/oehbeitrag.php", array('oehbeitraege' => $oehbeitraege));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all valid, i.e. unassigned, Studiensemester.
|
||||
*/
|
||||
public function getValidStudiensemester()
|
||||
{
|
||||
$oehbeitrag_id = $this->input->get('oehbeitrag_id');
|
||||
$oehbeitrag_id_arr = isset($oehbeitrag_id) ? array($oehbeitrag_id) : null;
|
||||
|
||||
$studiensemester = array();
|
||||
|
||||
$studiensemesterres = $this->OehbeitragModel->getUnassignedStudiensemester(self::STUDIENSEMESTER_START, $oehbeitrag_id_arr);
|
||||
if (isError($studiensemesterres))
|
||||
{
|
||||
$this->outputJsonError(getError($studiensemesterres));
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasData($studiensemesterres))
|
||||
$studiensemester = getData($studiensemesterres);
|
||||
|
||||
$this->outputJsonSuccess($studiensemester);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all Öhbeiträge. Wrapper function for output as JSON.
|
||||
*/
|
||||
public function getOehbeitraege()
|
||||
{
|
||||
$this->outputJson($this->_loadOehbeitraege());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an Öhbeitrag. Checks for errors beforehand.
|
||||
*/
|
||||
public function addOehbeitrag()
|
||||
{
|
||||
$studierendenbeitrag = $this->input->post('studierendenbeitrag');
|
||||
$versicherung = $this->input->post('versicherung');
|
||||
$von_studiensemester_kurzbz = $this->input->post('von_studiensemester_kurzbz');
|
||||
$bis_studiensemester_kurzbz = $this->input->post('bis_studiensemester_kurzbz');
|
||||
if ($bis_studiensemester_kurzbz == 'null')
|
||||
$bis_studiensemester_kurzbz = null;
|
||||
|
||||
if (!$this->_checkAmount($studierendenbeitrag))
|
||||
$this->outputJsonError('Ungültiger Studierendenbeitrag');
|
||||
elseif (!$this->_checkAmount($versicherung))
|
||||
$this->outputJsonError('Ungültige Versicherung');
|
||||
else
|
||||
{
|
||||
$vonBisCheck = $this->_checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz);
|
||||
|
||||
if (isError($vonBisCheck))
|
||||
$this->outputJsonError(getError($vonBisCheck));
|
||||
else
|
||||
{
|
||||
$data = array(
|
||||
'studierendenbeitrag' => $studierendenbeitrag,
|
||||
'versicherung' => $versicherung,
|
||||
'von_studiensemester_kurzbz' => $von_studiensemester_kurzbz,
|
||||
'bis_studiensemester_kurzbz' => $bis_studiensemester_kurzbz
|
||||
);
|
||||
|
||||
$this->outputJson($this->OehbeitragModel->insert($data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an Öhbeitrag. Checks for errors beforehand.
|
||||
*/
|
||||
public function updateOehbeitrag()
|
||||
{
|
||||
$oehbeitrag_id = $this->input->post("oehbeitrag_id");
|
||||
$data = $this->input->post("data");
|
||||
|
||||
if (!is_numeric($oehbeitrag_id) || isEmptyArray($data))
|
||||
{
|
||||
$this->outputJsonError("Ungültige Parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $idx => $value)
|
||||
{
|
||||
if ($idx == 'studierendenbeitrag' || $idx == 'versicherung')
|
||||
{
|
||||
if (!$this->_checkAmount($value))
|
||||
{
|
||||
$this->outputJsonError("Ungültige(r) $idx");
|
||||
return;
|
||||
}
|
||||
}
|
||||
elseif ($idx == 'von_studiensemester_kurzbz' || $idx == 'bis_studiensemester_kurzbz')
|
||||
{
|
||||
$this->OehbeitragModel->addSelect('von_studiensemester_kurzbz, bis_studiensemester_kurzbz');
|
||||
$vonBisStudiensemesterRes = $this->OehbeitragModel->load($oehbeitrag_id);
|
||||
|
||||
if (!hasData($vonBisStudiensemesterRes))
|
||||
{
|
||||
$this->outputJsonError("Fehler beim Holen des Öhbeitrags");
|
||||
return;
|
||||
}
|
||||
|
||||
$vonBisStudiensemester = getData($vonBisStudiensemesterRes);
|
||||
|
||||
$von_studiensemester_kurzbz = isset($data['von_studiensemester_kurzbz'])
|
||||
? $data['von_studiensemester_kurzbz']
|
||||
: $vonBisStudiensemester[0]->von_studiensemester_kurzbz;
|
||||
|
||||
if (isset($data['bis_studiensemester_kurzbz']))
|
||||
{
|
||||
$bis_studiensemester_kurzbz = $data['bis_studiensemester_kurzbz'] = $data['bis_studiensemester_kurzbz'] == 'null' ? null : $data['bis_studiensemester_kurzbz'];
|
||||
}
|
||||
else
|
||||
$bis_studiensemester_kurzbz = $vonBisStudiensemester[0]->bis_studiensemester_kurzbz;
|
||||
|
||||
$checkStudiensemester = $this->_checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz, $oehbeitrag_id);
|
||||
|
||||
if (isError($checkStudiensemester))
|
||||
{
|
||||
$this->outputJsonError(getError($checkStudiensemester));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->outputJson($this->OehbeitragModel->update($oehbeitrag_id, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an Öhbeitrag.
|
||||
*/
|
||||
public function deleteOehbeitrag()
|
||||
{
|
||||
$oehbeitrag_id = $this->input->post("oehbeitrag_id");
|
||||
|
||||
$this->outputJson($this->OehbeitragModel->delete($oehbeitrag_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all Öhbeiträge sorted by date descending.
|
||||
* @return object
|
||||
*/
|
||||
private function _loadOehbeitraege()
|
||||
{
|
||||
$this->OehbeitragModel->addSelect('oehbeitrag_id, von_studiensemester_kurzbz, bis_studiensemester_kurzbz, studierendenbeitrag, versicherung, sem_von.start as von_datum, sem_bis.ende as bis_datum');
|
||||
$this->OehbeitragModel->addJoin('public.tbl_studiensemester sem_von', 'tbl_oehbeitrag.von_studiensemester_kurzbz = sem_von.studiensemester_kurzbz');
|
||||
$this->OehbeitragModel->addJoin('public.tbl_studiensemester sem_bis', 'tbl_oehbeitrag.bis_studiensemester_kurzbz = sem_bis.studiensemester_kurzbz', 'LEFT');
|
||||
$this->OehbeitragModel->addOrder('sem_von.start', 'DESC');
|
||||
return $this->OehbeitragModel->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an amount is numeric and not too big.
|
||||
* @param $amount
|
||||
* @return bool true if valid amount, false otherwise
|
||||
*/
|
||||
private function _checkAmount($amount)
|
||||
{
|
||||
return is_numeric($amount) && (float) $amount <= 99999.99;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a certain Von-Studiensemester is valid together with a Bis-Studiensemester.
|
||||
* Checks for correct format, Von-Studiensemester cannot be after the Bis-Studiensemester,
|
||||
* checks that semester are not overlapping with semester for existent Öhbeiträge.
|
||||
* @param string $von_studiensemester_kurzbz
|
||||
* @param string $bis_studiensemester_kurzbz
|
||||
* @param int $oehbeitrag_id öhbeitrag to ignore, i.e. which is assignable (id of Öhbeitrag of the passed semesters)
|
||||
* @return object array with true if assignable, with false if not
|
||||
*/
|
||||
private function _checkVonBisStudiensemester($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz, $oehbeitrag_id = null)
|
||||
{
|
||||
$regex = "/^(WS|SS)\d{4}$/";
|
||||
if (!preg_match($regex, $von_studiensemester_kurzbz))
|
||||
return error("Ungültiges Von-Studiensemester");
|
||||
|
||||
if (!preg_match($regex, $bis_studiensemester_kurzbz) && $bis_studiensemester_kurzbz != null)
|
||||
return error("Ungültiges Bis-Studiensemester");
|
||||
|
||||
$this->StudiensemesterModel->addSelect("start");
|
||||
$vonStudiensemesterRes = $this->StudiensemesterModel->load($von_studiensemester_kurzbz);
|
||||
|
||||
if (!hasData($vonStudiensemesterRes))
|
||||
return error("Fehler beim Holen von Von-Studiensemester");
|
||||
|
||||
$this->StudiensemesterModel->addSelect("start");
|
||||
$bisStudiensemesterRes = $this->StudiensemesterModel->load($bis_studiensemester_kurzbz);
|
||||
|
||||
if (!hasData($bisStudiensemesterRes))
|
||||
return error("Fehler beim Holen von Bis-Studiensemester");
|
||||
|
||||
$vonStudiensemester = getData($vonStudiensemesterRes)[0]->start;
|
||||
$bisStudiensemester = getData($bisStudiensemesterRes)[0]->start;
|
||||
|
||||
if ($bis_studiensemester_kurzbz != null && new DateTime($vonStudiensemester) > new DateTime($bisStudiensemester))
|
||||
return error("Von-Studiensemester größer als Bis-Studiensemester");
|
||||
|
||||
$oehbeitrag_id_arr = isset($oehbeitrag_id) ? array($oehbeitrag_id) : null;
|
||||
|
||||
$assignableRes = $this->OehbeitragModel->checkIfStudiensemesterAssignable(
|
||||
$von_studiensemester_kurzbz,
|
||||
$bis_studiensemester_kurzbz,
|
||||
$oehbeitrag_id_arr
|
||||
);
|
||||
|
||||
if (isError($assignableRes))
|
||||
return $assignableRes;
|
||||
|
||||
if (hasData($assignableRes))
|
||||
{
|
||||
$assignable = getData($assignableRes)[0];
|
||||
|
||||
if (!$assignable)
|
||||
return error("Keine Zuweisung möglich, Semesterüberschneidung");
|
||||
}
|
||||
|
||||
return success("Studiensemester gültig");
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ class AnrechnungJob extends JOB_Controller
|
||||
$studiengang_bezeichnung = $this->StudiengangModel->load($studiengang_kz)->retval[0]->stg_bezeichnung;
|
||||
|
||||
// Get STGL mail address
|
||||
list ($to, $vorname) = self::_getSTGLMailAddress($studiengang_kz);
|
||||
$stglMailReceiver_arr = self::_getSTGLMailAddress($studiengang_kz);
|
||||
|
||||
// Get HTML table with new Anrechnungen of that STG plus amount of them
|
||||
list ($anrechnungen_amount, $anrechnungen_table) = self::_getSTGLMailDataTable($studiengang_kz, $anrechnungen);
|
||||
@@ -199,22 +199,25 @@ class AnrechnungJob extends JOB_Controller
|
||||
CIS_ROOT. 'cis/menu.php?content_id=&content='.
|
||||
CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
|
||||
|
||||
foreach ($stglMailReceiver_arr as $stgl)
|
||||
{
|
||||
// Prepare mail content
|
||||
$body_fields = array(
|
||||
'vorname' => $vorname,
|
||||
'studiengang' => $studiengang_bezeichnung,
|
||||
'anzahl' => $anrechnungen_amount,
|
||||
'datentabelle' => $anrechnungen_table,
|
||||
'link' => anchor($url, 'Anrechnungsanträge Übersicht')
|
||||
);
|
||||
|
||||
// Send mail
|
||||
sendSanchoMail(
|
||||
'AnrechnungAntragStellen',
|
||||
$body_fields,
|
||||
$to,
|
||||
'Anerkennung nachgewiesener Kenntnisse: Neuer Antrag wurde gestellt'
|
||||
);
|
||||
$body_fields = array(
|
||||
'vorname' => $stgl['vorname'],
|
||||
'studiengang' => $studiengang_bezeichnung,
|
||||
'anzahl' => $anrechnungen_amount,
|
||||
'datentabelle' => $anrechnungen_table,
|
||||
'link' => anchor($url, 'Anrechnungsanträge Übersicht')
|
||||
);
|
||||
|
||||
// Send mail
|
||||
sendSanchoMail(
|
||||
'AnrechnungAntragStellen',
|
||||
$body_fields,
|
||||
$stgl['to'],
|
||||
'Anerkennung nachgewiesener Kenntnisse: Neuer Antrag wurde gestellt'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logInfo('SUCCEDED: Sending emails to STGL about yesterdays new Anrechnungen succeded.');
|
||||
@@ -342,15 +345,21 @@ html;
|
||||
// Get STGL mail address
|
||||
private function _getSTGLMailAddress($studiengang_kz)
|
||||
{
|
||||
$stglMailAdress_arr = array();
|
||||
$result = $this->StudiengangModel->getLeitung($studiengang_kz);
|
||||
|
||||
// Get STGL mail address
|
||||
if (hasData($result))
|
||||
{
|
||||
return array(
|
||||
$result->retval[0]->uid. '@'. DOMAIN,
|
||||
$result->retval[0]->vorname
|
||||
);
|
||||
foreach (getData($result) as $stgl)
|
||||
{
|
||||
$stglMailAdress_arr[]= array(
|
||||
'to' => $stgl->uid. '@'. DOMAIN,
|
||||
'vorname' => $stgl->vorname
|
||||
);
|
||||
}
|
||||
|
||||
return $stglMailAdress_arr;
|
||||
}
|
||||
// If not available, get assistance mail address
|
||||
else
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Job for resolving core issues
|
||||
*/
|
||||
class IssueResolver extends IssueResolver_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// set fehler codes which can be resolved by the job
|
||||
// structure: fehlercode => class (library) name for resolving
|
||||
$this->_codeLibMappings = array(
|
||||
'CORE_ZGV_0001' => 'CORE_ZGV_0001',
|
||||
'CORE_ZGV_0002' => 'CORE_ZGV_0002',
|
||||
'CORE_ZGV_0003' => 'CORE_ZGV_0003',
|
||||
'CORE_ZGV_0004' => 'CORE_ZGV_0004',
|
||||
'CORE_ZGV_0005' => 'CORE_ZGV_0005',
|
||||
'CORE_INOUT_0001' => 'CORE_INOUT_0001',
|
||||
'CORE_INOUT_0002' => 'CORE_INOUT_0002',
|
||||
'CORE_INOUT_0003' => 'CORE_INOUT_0003',
|
||||
'CORE_INOUT_0004' => 'CORE_INOUT_0004',
|
||||
'CORE_INOUT_0005' => 'CORE_INOUT_0005',
|
||||
'CORE_INOUT_0006' => 'CORE_INOUT_0006'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,8 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'download' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'index' => 'lehre/anrechnung_genehmigen:r',
|
||||
'download' => 'lehre/anrechnung_genehmigen:r',
|
||||
'approve' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'reject' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw',
|
||||
@@ -81,7 +81,7 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
}
|
||||
|
||||
// Check if user is entitled to read the Anrechnung
|
||||
self::_checkIfEntitledToReadAnrechnung($anrechnung_id);
|
||||
$this->_checkIfEntitledToReadAnrechnung($anrechnung_id);
|
||||
|
||||
// Get Anrechung data
|
||||
$anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id);
|
||||
@@ -99,11 +99,16 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
// Get Genehmigung data
|
||||
$genehmigungData = $this->anrechnunglib->getGenehmigungData($anrechnung_id);
|
||||
|
||||
$hasReadOnlyAccess =
|
||||
$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $antragData->studiengang_kz)
|
||||
&& !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid', $antragData->studiengang_kz);
|
||||
|
||||
$viewData = array(
|
||||
'antragData' => $antragData,
|
||||
'anrechnungData' => $anrechnungData,
|
||||
'empfehlungData' => $empfehlungData,
|
||||
'genehmigungData' => $genehmigungData
|
||||
'genehmigungData' => $genehmigungData,
|
||||
'hasReadOnlyAccess' => $hasReadOnlyAccess
|
||||
);
|
||||
|
||||
$this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData);
|
||||
@@ -385,7 +390,7 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
}
|
||||
|
||||
// Check if user is entitled to read dms doc
|
||||
self::_checkIfEntitledToReadDMSDoc($dms_id);
|
||||
$this->_checkIfEntitledToReadDMSDoc($dms_id);
|
||||
|
||||
// Set filename to be used on downlaod
|
||||
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
|
||||
@@ -412,32 +417,22 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
$result = $this->AnrechnungModel->load($anrechnung_id);
|
||||
|
||||
if(!$result = getData($result)[0])
|
||||
if(!hasData($result))
|
||||
{
|
||||
show_error('Failed loading Anrechnung');
|
||||
}
|
||||
|
||||
|
||||
$result = $this->LehrveranstaltungModel->loadWhere(array(
|
||||
'lehrveranstaltung_id' => $result->lehrveranstaltung_id
|
||||
'lehrveranstaltung_id' => getData($result)[0]->lehrveranstaltung_id
|
||||
));
|
||||
|
||||
if(!$result = getData($result)[0])
|
||||
{
|
||||
show_error('Failed loading Lehrveranstaltung');
|
||||
}
|
||||
$studiengang_kz = getData($result)[0]->studiengang_kz;
|
||||
|
||||
// Get STGL
|
||||
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
|
||||
|
||||
if($result = getData($result)[0])
|
||||
{
|
||||
if ($result->uid == $this->_uid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
show_error('You are not entitled to read this Anrechnung');
|
||||
// Check if user is entitled
|
||||
if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
|
||||
{
|
||||
show_error('You are not entitled to read this page');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,23 +452,13 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
'lehrveranstaltung_id' => $result->lehrveranstaltung_id
|
||||
));
|
||||
|
||||
if(!$result = getData($result)[0])
|
||||
{
|
||||
show_error('Failed loading Lehrveranstaltung');
|
||||
}
|
||||
$studiengang_kz = getData($result)[0]->studiengang_kz;
|
||||
|
||||
// Get STGL
|
||||
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
|
||||
|
||||
if($result = getData($result)[0])
|
||||
{
|
||||
if ($result->uid == $this->_uid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
show_error('You are not entitled to read this document');
|
||||
// Check if user is entitled
|
||||
if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
|
||||
{
|
||||
show_error('You are not entitled to read this document');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class approveAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
const BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN = 'lehre/anrechnung_genehmigen';
|
||||
|
||||
const BERECHTIGUNG_ANRECHNUNG_ANLEGEN = 'lehre/anrechnung_anlegen';
|
||||
|
||||
const REVIEW_ANRECHNUNG_URI = '/lehre/anrechnung/ReviewAnrechnungUebersicht';
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
@@ -19,8 +20,8 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'download' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'index' => 'lehre/anrechnung_genehmigen:r',
|
||||
'download' => 'lehre/anrechnung_genehmigen:r',
|
||||
'approve' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'reject' => 'lehre/anrechnung_genehmigen:rw',
|
||||
'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw'
|
||||
@@ -76,10 +77,19 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
show_error(getError($studiengang_kz_arr));
|
||||
}
|
||||
|
||||
|
||||
$hasReadOnlyAccess =
|
||||
$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's')
|
||||
&& !$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 'suid');
|
||||
|
||||
// This permission is checked here to disable create Anrechnung button, if permission is not given
|
||||
$hasCreateAnrechnungAccess = $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_ANLEGEN, 's');
|
||||
|
||||
$viewData = array(
|
||||
'studiensemester_selected' => $studiensemester_kurzbz,
|
||||
'studiengaenge_entitled' => $studiengang_kz_arr
|
||||
'studiengaenge_entitled' => $studiengang_kz_arr,
|
||||
'hasReadOnlyAccess' => $hasReadOnlyAccess,
|
||||
'hasCreateAnrechnungAccess' => $hasCreateAnrechnungAccess
|
||||
);
|
||||
|
||||
$this->load->view('lehre/anrechnung/approveAnrechnungUebersicht.php', $viewData);
|
||||
@@ -239,7 +249,7 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
}
|
||||
|
||||
// Check if user is entitled to read dms doc
|
||||
self::_checkIfEntitledToReadDMSDoc($dms_id);
|
||||
$this->_checkIfEntitledToReadDMSDoc($dms_id);
|
||||
|
||||
// Set filename to be used on downlaod
|
||||
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
|
||||
@@ -281,19 +291,14 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
show_error('Failed loading Lehrveranstaltung');
|
||||
}
|
||||
|
||||
$studiengang_kz = $result->studiengang_kz;
|
||||
|
||||
// Get STGL
|
||||
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
|
||||
|
||||
if($result = getData($result)[0])
|
||||
{
|
||||
if ($result->uid == $this->_uid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
show_error('You are not entitled to read this document');
|
||||
// Check if user is entitled
|
||||
if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz))
|
||||
{
|
||||
show_error('You are not entitled to read this document');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,23 +381,24 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||
$result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']);
|
||||
|
||||
if (!$result = getData($result))
|
||||
if (!hasData($result))
|
||||
{
|
||||
show_error('Failed retrieving lectors of Lehrveranstaltung');
|
||||
}
|
||||
|
||||
$lecturersByLv = getData($result);
|
||||
|
||||
// Check if lv has LV-Leitung
|
||||
$key = array_search(true, array_column($result, 'lvleiter'));
|
||||
|
||||
$key = array_search(true, array_column($lecturersByLv, 'lvleiter'));
|
||||
// If lv has LV-Leitung, keep only the one
|
||||
if ($key !== false)
|
||||
{
|
||||
$lector_arr[]= $result[$key];
|
||||
$lector_arr[]= $lecturersByLv[$key];
|
||||
}
|
||||
// ...otherwise keep all lectors
|
||||
else
|
||||
{
|
||||
$lector_arr = array_merge($lector_arr, $result);
|
||||
$lector_arr = array_merge($lector_arr, $lecturersByLv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class requestAnrechnung extends Auth_Controller
|
||||
$prestudent_id = getData($result)[0]->prestudent_id;
|
||||
|
||||
// Check if application deadline is expired
|
||||
$is_expired = self::_checkAntragDeadline(
|
||||
$is_expired = self::_isExpired(
|
||||
$this->config->item('submit_application_start'),
|
||||
$this->config->item('submit_application_end'),
|
||||
$studiensemester_kurzbz
|
||||
@@ -226,10 +226,10 @@ class requestAnrechnung extends Auth_Controller
|
||||
* @param $start Start date for application submission.
|
||||
* @param $ende End date for application submission.
|
||||
* @param $studiensemester_kurzbz
|
||||
* @return bool True if today is not during the start- and ending deadlines (= if is expired)
|
||||
* @return bool True if deadline is expired
|
||||
* @throws Exception
|
||||
*/
|
||||
private function _checkAntragDeadline($start, $ende, $studiensemester_kurzbz)
|
||||
private function _isExpired($start, $ende, $studiensemester_kurzbz)
|
||||
{
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
@@ -253,8 +253,8 @@ class requestAnrechnung extends Auth_Controller
|
||||
$start = new DateTime($start);
|
||||
$ende = new DateTime($ende);
|
||||
|
||||
// True if today is not during the start- and ending deadlines (= if is expired)
|
||||
return ($today <= $start || $today >= $ende);
|
||||
// True if expired
|
||||
return ($today < $start || $today > $ende);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,8 +324,8 @@ class requestAnrechnung extends Auth_Controller
|
||||
private function _LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id)
|
||||
{
|
||||
// Get Note of Lehrveranstaltung
|
||||
$this->load->model('education/Lvgesamtnote_model', 'LvgesamtnoteModel');
|
||||
$result = $this->LvgesamtnoteModel->load(array(
|
||||
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
|
||||
$result = $this->ZeugnisnoteModel->load(array(
|
||||
'student_uid' => $this->_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'lehrveranstaltung_id' => $lehrveranstaltung_id
|
||||
|
||||
@@ -79,7 +79,7 @@ class reviewAnrechnungDetail extends Auth_Controller
|
||||
|
||||
// Get Anrechung data
|
||||
$anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id);
|
||||
|
||||
|
||||
// Get Antrag data
|
||||
$antragData = $this->anrechnunglib->getAntragData(
|
||||
$anrechnungData->prestudent_id,
|
||||
@@ -110,7 +110,7 @@ class reviewAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
|
||||
|
||||
// Get lectors person data
|
||||
if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0])
|
||||
{
|
||||
@@ -218,10 +218,10 @@ class reviewAnrechnungDetail extends Auth_Controller
|
||||
|
||||
// Check if user is entitled to read dms doc
|
||||
self::_checkIfEntitledToReadDMSDoc($dms_id);
|
||||
|
||||
|
||||
// Set filename to be used on downlaod
|
||||
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
|
||||
|
||||
|
||||
// Download file
|
||||
$this->dmslib->download($dms_id, $filename);
|
||||
}
|
||||
@@ -320,7 +320,12 @@ class reviewAnrechnungDetail extends Auth_Controller
|
||||
foreach ($studiengang_kz_arr as $studiengang_kz)
|
||||
{
|
||||
// Get STGL mail address, if available, otherwise get assistance mail address
|
||||
list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz);
|
||||
$stgmail = $this->_getSTGLMailAddress($studiengang_kz);
|
||||
|
||||
if(isSuccess($stgmail) && hasData($stgmail))
|
||||
list ($to, $vorname) = getData($stgmail)[0];
|
||||
else
|
||||
show_error ('Failed retrieving DegreeProgram Mail');
|
||||
|
||||
// Get full name of lector
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
@@ -361,24 +366,28 @@ class reviewAnrechnungDetail extends Auth_Controller
|
||||
$result = $this->StudiengangModel->getLeitung($stg_kz);
|
||||
|
||||
// Get STGL mail address, if available
|
||||
if (hasData($result))
|
||||
if (isSuccess($result) && hasData($result))
|
||||
{
|
||||
return array(
|
||||
return success(array(
|
||||
$result->retval[0]->uid. '@'. DOMAIN,
|
||||
$result->retval[0]->vorname
|
||||
);
|
||||
));
|
||||
}
|
||||
// ...otherwise get assistance mail address
|
||||
else
|
||||
{
|
||||
$result = $this->StudiengangModel->load($stg_kz);
|
||||
|
||||
if (hasData($result))
|
||||
if (isSuccess($result) && hasData($result))
|
||||
{
|
||||
return array(
|
||||
return success(array(
|
||||
$result->retval[0]->email,
|
||||
''
|
||||
);
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Keine E-Mail für diesen Stg gefunden');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
const BERECHTIGUNG_ANRECHNUNG_EMPFEHLEN = 'lehre/anrechnung_empfehlen';
|
||||
|
||||
|
||||
const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht';
|
||||
|
||||
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
|
||||
const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
|
||||
const ANRECHNUNGSTATUS_APPROVED = 'approved';
|
||||
const ANRECHNUNGSTATUS_REJECTED = 'rejected';
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
@@ -25,24 +25,24 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
'dontRecommend' => 'lehre/anrechnung_empfehlen:rw'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Load models
|
||||
$this->load->model('education/Anrechnung_model', 'AnrechnungModel');
|
||||
$this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel');
|
||||
$this->load->model('content/DmsVersion_model', 'DmsVersionModel');
|
||||
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('WidgetLib');
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->library('AnrechnungLib');
|
||||
$this->load->library('DmsLib');
|
||||
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('hlp_sancho_helper');
|
||||
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
@@ -54,12 +54,12 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
'table'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$this->_setAuthUID();
|
||||
|
||||
|
||||
$this->setControllerId();
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
// Get study semester
|
||||
@@ -70,14 +70,14 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
$result = $this->StudiensemesterModel->getNearest();
|
||||
$studiensemester_kurzbz = getData($result)[0]->studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
|
||||
$viewData = array(
|
||||
'studiensemester_selected' => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
|
||||
$this->load->view('lehre/anrechnung/reviewAnrechnungUebersicht.php', $viewData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recommend Anrechnungen.
|
||||
*/
|
||||
@@ -103,7 +103,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Output json to ajax
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
{
|
||||
@@ -123,19 +123,19 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dont recommend Anrechnungen.
|
||||
*/
|
||||
public function dontRecommend()
|
||||
{
|
||||
$data = $this->input->post('data');
|
||||
|
||||
|
||||
if(isEmptyArray($data))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
|
||||
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Approve Anrechnung
|
||||
@@ -149,7 +149,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Output json to ajax
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
{
|
||||
@@ -158,7 +158,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
show_error('Failed sending emails');
|
||||
}
|
||||
|
||||
|
||||
return $this->outputJsonSuccess($json);
|
||||
}
|
||||
else
|
||||
@@ -166,7 +166,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download and open uploaded document (Nachweisdokument).
|
||||
*/
|
||||
@@ -178,28 +178,28 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
show_error('Wrong parameter');
|
||||
}
|
||||
|
||||
|
||||
// Check if user is entitled to read dms doc
|
||||
self::_checkIfEntitledToReadDMSDoc($dms_id);
|
||||
|
||||
|
||||
// Set filename to be used on downlaod
|
||||
$filename = $this->anrechnunglib->setFilenameOnDownload($dms_id);
|
||||
|
||||
|
||||
// Download file
|
||||
$this->dmslib->download($dms_id, $filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if user is entitled to read dms doc
|
||||
* @param $dms_id
|
||||
@@ -207,15 +207,15 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
private function _checkIfEntitledToReadDMSDoc($dms_id)
|
||||
{
|
||||
$result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id));
|
||||
|
||||
|
||||
if(!$result = getData($result)[0])
|
||||
{
|
||||
show_error('Failed retrieving Anrechnung');
|
||||
}
|
||||
|
||||
|
||||
$result = $this->LehrveranstaltungModel
|
||||
->getLecturersByLv($result->studiensemester_kurzbz, $result->lehrveranstaltung_id);
|
||||
|
||||
|
||||
if($result = getData($result))
|
||||
{
|
||||
$entitled_lector_arr = array_column($result, 'uid');
|
||||
@@ -225,10 +225,10 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
show_error('You are not entitled to read this document');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send mails to STGL (if not present then to STGL assistance)
|
||||
* @param $mail_params
|
||||
@@ -239,36 +239,41 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
// Get studiengaenge
|
||||
$studiengang_kz_arr = array();
|
||||
|
||||
|
||||
foreach ($mail_params as $item)
|
||||
{
|
||||
$this->AnrechnungModel->addSelect('studiengang_kz');
|
||||
$this->AnrechnungModel->addJoin('public.tbl_prestudent', 'prestudent_id');
|
||||
|
||||
|
||||
$studiengang_kz_arr[]= $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiengang_kz;
|
||||
}
|
||||
|
||||
|
||||
$studiengang_kz_arr = array_unique($studiengang_kz_arr);
|
||||
|
||||
|
||||
// Send mail to STGL of each studiengang
|
||||
foreach ($studiengang_kz_arr as $studiengang_kz)
|
||||
{
|
||||
// Get STGL mail address, if available, otherwise get assistance mail address
|
||||
list ($to, $vorname) = $this->_getSTGLMailAddress($studiengang_kz);
|
||||
|
||||
$stgmail = $this->_getSTGLMailAddress($studiengang_kz);
|
||||
|
||||
if(isSuccess($stgmail) && hasData($stgmail))
|
||||
list ($to, $vorname) = getData($stgmail)[0];
|
||||
else
|
||||
show_error ('Failed retrieving DegreeProgram Mail');
|
||||
|
||||
// Get full name of lector
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
if (!$lector_name = getData($this->PersonModel->getFullName($this->_uid)))
|
||||
{
|
||||
show_error ('Failed retrieving person');
|
||||
}
|
||||
|
||||
|
||||
// Link to Antrag genehmigen
|
||||
$url =
|
||||
CIS_ROOT. 'cis/index.php?menu='.
|
||||
CIS_ROOT. 'cis/menu.php?content_id=&content='.
|
||||
CIS_ROOT. index_page(). self::APPROVE_ANRECHNUNG_URI;
|
||||
|
||||
|
||||
// Prepare mail content
|
||||
$body_fields = array(
|
||||
'vorname' => $vorname,
|
||||
@@ -276,7 +281,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
'empfehlung' => $empfehlung ? 'positive' : 'negative',
|
||||
'link' => anchor($url, 'Anrechnungsanträge Übersicht')
|
||||
);
|
||||
|
||||
|
||||
sendSanchoMail(
|
||||
'AnrechnungEmpfehlungAbgeben',
|
||||
$body_fields,
|
||||
@@ -284,37 +289,41 @@ class reviewAnrechnungUebersicht extends Auth_Controller
|
||||
'Anerkennung nachgewiesener Kenntnisse: Empfehlung wurde abgegeben'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Get STGL mail address, if available, otherwise get assistance mail address
|
||||
private function _getSTGLMailAddress($stg_kz)
|
||||
{
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$result = $this->StudiengangModel->getLeitung($stg_kz);
|
||||
|
||||
|
||||
// Get STGL mail address, if available
|
||||
if (hasData($result))
|
||||
if (isSuccess($result) && hasData($result))
|
||||
{
|
||||
return array(
|
||||
return success(array(
|
||||
$result->retval[0]->uid. '@'. DOMAIN,
|
||||
$result->retval[0]->vorname
|
||||
);
|
||||
));
|
||||
}
|
||||
// ...otherwise get assistance mail address
|
||||
else
|
||||
{
|
||||
$result = $this->StudiengangModel->load($stg_kz);
|
||||
|
||||
if (hasData($result))
|
||||
|
||||
if (isSuccess($result) && hasData($result))
|
||||
{
|
||||
return array(
|
||||
return success(array(
|
||||
$result->retval[0]->email,
|
||||
''
|
||||
);
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Keine E-Mail für diesen Stg gefunden');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class FAS_UDF extends Auth_Controller
|
||||
|
||||
if (isset($person_id) && is_numeric($person_id))
|
||||
{
|
||||
if ($this->PersonModel->hasUDF())
|
||||
if ($this->PersonModel->udfsExistAndDefined())
|
||||
{
|
||||
$personUdfs = $this->PersonModel->getUDFs($person_id);
|
||||
$data['person_id'] = $person_id;
|
||||
@@ -41,7 +41,7 @@ class FAS_UDF extends Auth_Controller
|
||||
|
||||
if (isset($prestudent_id) && is_numeric($prestudent_id))
|
||||
{
|
||||
if ($this->PrestudentModel->hasUDF())
|
||||
if ($this->PrestudentModel->udfsExistAndDefined())
|
||||
{
|
||||
$prestudentUdfs = $this->PrestudentModel->getUDFs($prestudent_id);
|
||||
$data['prestudent_id'] = $prestudent_id;
|
||||
|
||||
@@ -20,6 +20,7 @@ class InfoCenter extends Auth_Controller
|
||||
const INDEX_PAGE = 'index';
|
||||
const FREIGEGEBEN_PAGE = 'freigegeben';
|
||||
const REIHUNGSTESTABSOLVIERT_PAGE = 'reihungstestAbsolviert';
|
||||
const ABGEWIESEN_PAGE = 'abgewiesen';
|
||||
const SHOW_DETAILS_PAGE = 'showDetails';
|
||||
const SHOW_ZGV_DETAILS_PAGE = 'showZGVDetails';
|
||||
const ZGV_UBERPRUEFUNG_PAGE = 'ZGVUeberpruefung';
|
||||
@@ -107,6 +108,7 @@ class InfoCenter extends Auth_Controller
|
||||
array(
|
||||
'index' => 'infocenter:r',
|
||||
'freigegeben' => 'infocenter:r',
|
||||
'abgewiesen' => 'infocenter:r',
|
||||
'reihungstestAbsolviert' => 'infocenter:r',
|
||||
'showDetails' => 'infocenter:r',
|
||||
'showZGVDetails' => 'lehre/zgvpruefung:r',
|
||||
@@ -203,6 +205,16 @@ class InfoCenter extends Auth_Controller
|
||||
$this->load->view('system/infocenter/infocenterFreigegeben.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Abgewiesen page of the InfoCenter tool
|
||||
*/
|
||||
public function abgewiesen()
|
||||
{
|
||||
$this->_setNavigationMenu(self::ABGEWIESEN_PAGE); // define the navigation menu for this page
|
||||
|
||||
$this->load->view('system/infocenter/infocenterAbgewiesen.php');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -297,6 +309,13 @@ class InfoCenter extends Auth_Controller
|
||||
}
|
||||
|
||||
$persondata = $this->_loadPersonData($person_id);
|
||||
|
||||
$checkPerson = $this->PersonModel->checkDuplicate($person_id);
|
||||
|
||||
if (isError($checkPerson)) show_error(getError($checkPerson));
|
||||
|
||||
$duplicate = array('duplicated' => getData($checkPerson));
|
||||
|
||||
$prestudentdata = $this->_loadPrestudentData($person_id);
|
||||
|
||||
$this->DokumentModel->addOrder('bezeichnung');
|
||||
@@ -305,7 +324,8 @@ class InfoCenter extends Auth_Controller
|
||||
$data = array_merge(
|
||||
$persondata,
|
||||
$prestudentdata,
|
||||
$dokumentdata
|
||||
$dokumentdata,
|
||||
$duplicate
|
||||
);
|
||||
|
||||
$data[self::FHC_CONTROLLER_ID] = $this->getControllerId();
|
||||
@@ -540,8 +560,10 @@ class InfoCenter extends Auth_Controller
|
||||
/**
|
||||
* Sendet bei einer neuen ZGV Prüfung die Mail raus an den Studiengang
|
||||
*/
|
||||
private function sendZgvMail($mail, $typ){
|
||||
private function sendZgvMail($mail, $typ, $person){
|
||||
$data = array(
|
||||
'vorname' => $person->vorname,
|
||||
'nachname' => $person->nachname,
|
||||
'link' => site_url('system/infocenter/ZGVUeberpruefung')
|
||||
);
|
||||
|
||||
@@ -637,6 +659,16 @@ class InfoCenter extends Auth_Controller
|
||||
if (isEmptyString($prestudent_id) || isEmptyString($person_id))
|
||||
$this->terminateWithJsonError('Prestudentid OR/AND Personid missing');
|
||||
|
||||
$person = $this->PersonModel->load($person_id);
|
||||
|
||||
if (isError($person))
|
||||
$this->terminateWithJsonError(getError($person));
|
||||
|
||||
if (!hasData($person))
|
||||
$this->terminateWithJsonError('Person existiert nicht.');
|
||||
|
||||
$person = getData($person)[0];
|
||||
|
||||
$zgv = $this->ZGVPruefungStatusModel->getZgvStatusByPrestudent($prestudent_id);
|
||||
|
||||
$data = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
|
||||
@@ -668,7 +700,7 @@ class InfoCenter extends Auth_Controller
|
||||
$this->_log($person_id, 'updatezgv', array($zgv[0]->zgvpruefung_id, 'pruefung_stg'));
|
||||
|
||||
if (isSuccess($insert))
|
||||
$this->sendZgvMail($mail, $typ);
|
||||
$this->sendZgvMail($mail, $typ, $person);
|
||||
elseif (isError($insert))
|
||||
$this->terminateWithJsonError('Fehler beim Speichern');
|
||||
}else
|
||||
@@ -694,7 +726,7 @@ class InfoCenter extends Auth_Controller
|
||||
$this->_log($person_id, 'newzgv', array($zgvpruefung_id));
|
||||
|
||||
if (isSuccess($result))
|
||||
$this->sendZgvMail($mail, $typ);
|
||||
$this->sendZgvMail($mail, $typ, $person);
|
||||
elseif (isError($result))
|
||||
$this->terminateWithJsonError('Fehler beim Speichern');
|
||||
}
|
||||
@@ -734,7 +766,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (hasData($lastStatus) && hasData($statusgrresult))
|
||||
{
|
||||
//check if still Interessent
|
||||
//check if still Interessent, Bewerber or Wartender
|
||||
if ($lastStatus->retval[0]->status_kurzbz === self::INTERESSENTSTATUS
|
||||
|| $lastStatus->retval[0]->status_kurzbz === self::BEWERBERSTATUS
|
||||
|| $lastStatus->retval[0]->status_kurzbz === self::WARTENDER)
|
||||
@@ -913,7 +945,8 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
$this->_log($person_id, 'freigegeben', $logparams);
|
||||
|
||||
$this->_sendFreigabeMail($prestudent_id);
|
||||
if (is_numeric($statusgrund_id) || $logdata['studiengang_typ'] === 'm')
|
||||
$this->_sendFreigabeMail($prestudent_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1191,6 +1224,10 @@ class InfoCenter extends Auth_Controller
|
||||
{
|
||||
$this->_setNavigationMenu(self::REIHUNGSTESTABSOLVIERT_PAGE);
|
||||
}
|
||||
elseif (strpos($navigation_page, self::ABGEWIESEN_PAGE) !== false)
|
||||
{
|
||||
$this->_setNavigationMenu(self::ABGEWIESEN_PAGE);
|
||||
}
|
||||
|
||||
$this->outputJsonSuccess('success');
|
||||
}
|
||||
@@ -1414,12 +1451,14 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
$freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE);
|
||||
$reihungstestAbsolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE);
|
||||
$abgewiesenLink = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE);
|
||||
|
||||
$currentFilterId = $this->input->get(self::FILTER_ID);
|
||||
if (isset($currentFilterId))
|
||||
{
|
||||
$freigegebenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId;
|
||||
$reihungstestAbsolviertLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId;
|
||||
$abgewiesenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId;
|
||||
}
|
||||
|
||||
$this->navigationlib->setSessionMenu(
|
||||
@@ -1458,6 +1497,18 @@ class InfoCenter extends Auth_Controller
|
||||
null, // subscriptLinkValue
|
||||
'', // target
|
||||
20 // sort
|
||||
),
|
||||
'abgewiesen' => $this->navigationlib->oneLevel(
|
||||
'Abgewiesene', // description
|
||||
$abgewiesenLink, // link
|
||||
null, // children
|
||||
'close', // icon
|
||||
null, // subscriptDescription
|
||||
false, // expand
|
||||
null, // subscriptLinkClass
|
||||
null, // subscriptLinkValue
|
||||
'', // target
|
||||
30 // sort
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -1483,6 +1534,8 @@ class InfoCenter extends Auth_Controller
|
||||
}
|
||||
if ($origin_page === self::ZGV_UBERPRUEFUNG_PAGE)
|
||||
$link = site_url(self::ZGV_UEBERPRUEFUNG_URI);
|
||||
if ($origin_page === self::ABGEWIESEN_PAGE)
|
||||
$link = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE);
|
||||
|
||||
$prevFilterId = $this->input->get(self::PREV_FILTER_ID);
|
||||
if (isset($prevFilterId))
|
||||
@@ -1520,6 +1573,7 @@ class InfoCenter extends Auth_Controller
|
||||
$homeLink = site_url(self::INFOCENTER_URI.'/'.self::INDEX_PAGE);
|
||||
$freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE);
|
||||
$absolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE);
|
||||
$abgewiesenLink = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE);
|
||||
$prevFilterId = $this->input->get(self::PREV_FILTER_ID);
|
||||
if (isset($prevFilterId))
|
||||
{
|
||||
@@ -1578,6 +1632,24 @@ class InfoCenter extends Auth_Controller
|
||||
)
|
||||
);
|
||||
}
|
||||
if($page == self::ABGEWIESEN_PAGE)
|
||||
{
|
||||
$this->navigationlib->setSessionElementMenu(
|
||||
'abgewiesen',
|
||||
$this->navigationlib->oneLevel(
|
||||
'Abgewiesene', // description
|
||||
$abgewiesenLink, // link
|
||||
null, // children
|
||||
'close', // icon
|
||||
null, // subscriptDescription
|
||||
false, // expand
|
||||
null, // subscriptLinkClass
|
||||
null, // subscriptLinkValue
|
||||
'', // target
|
||||
40 // sort
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1648,9 +1720,15 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isset($locked->retval[0]->uid))
|
||||
{
|
||||
$lockedby = $locked->retval[0]->uid;
|
||||
if ($lockedby !== $this->_uid)
|
||||
if (!$lockedby = getData($this->PersonModel->getFullName($locked->retval[0]->uid)))
|
||||
{
|
||||
show_error('Failed retrieving person');
|
||||
}
|
||||
|
||||
if ($locked->retval[0]->uid !== $this->_uid)
|
||||
{
|
||||
$lockedbyother = true;
|
||||
}
|
||||
}
|
||||
|
||||
$stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true);
|
||||
@@ -2134,17 +2212,18 @@ class InfoCenter extends Auth_Controller
|
||||
{
|
||||
$statusgrund = $this->input->post('statusgrund');
|
||||
$studiengang = $this->input->post('studiengang');
|
||||
$abgeschickt = $this->input->post('abgeschickt');
|
||||
$personen = $this->input->post('personen');
|
||||
$studienSemester = $this->variablelib->getVar('infocenter_studiensemester');
|
||||
|
||||
if ($statusgrund === 'null' || $studiengang === 'null' || empty($personen))
|
||||
$this->terminateWithJsonError("Bitte Statusgrund, Studiengang und Personen auswählen.");
|
||||
if ($statusgrund === 'null' || $studiengang === 'null' || $abgeschickt === 'null' || empty($personen))
|
||||
$this->terminateWithJsonError("Bitte füllen Sie alle Felder aus");
|
||||
|
||||
foreach($personen as $person)
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester);
|
||||
$prestudent = $this->PrestudentModel->getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt);
|
||||
|
||||
if(!hasData($prestudent))
|
||||
if (!hasData($prestudent))
|
||||
continue;
|
||||
|
||||
$prestudentData = getData($prestudent);
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Issues extends Auth_Controller
|
||||
{
|
||||
private $_uid;
|
||||
|
||||
const FUNKTION_KURZBZ = 'ass'; // // user having this funktion can see issues for oes assigned with this funktion
|
||||
const BERECHTIGUNG_KURZBZ = 'system/issues_verwalten'; // user having this permission can see issues for oes assigned with this permission
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => array(self::BERECHTIGUNG_KURZBZ.':r'),
|
||||
'changeIssueStatus' => array(self::BERECHTIGUNG_KURZBZ.':rw')
|
||||
)
|
||||
);
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('IssuesLib');
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Load models
|
||||
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'filter',
|
||||
'lehre',
|
||||
'person',
|
||||
'fehlermonitoring'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$oes_for_issues = $this->_getOesForIssues();
|
||||
|
||||
$this->load->view(
|
||||
'system/issues/issues',
|
||||
$oes_for_issues
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes issues status change
|
||||
*/
|
||||
public function changeIssueStatus()
|
||||
{
|
||||
$issue_ids = $this->input->post('issue_ids');
|
||||
$status_kurzbz = $this->input->post('status_kurzbz');
|
||||
$user = $this->_uid;
|
||||
|
||||
$errors = array();
|
||||
foreach ($issue_ids as $issue_id)
|
||||
{
|
||||
switch ($status_kurzbz)
|
||||
{
|
||||
case IssuesLib::STATUS_NEU:
|
||||
$changeIssueMethod = 'setNeu';
|
||||
break;
|
||||
case IssuesLib::STATUS_IN_BEARBEITUNG:
|
||||
$changeIssueMethod = 'setInBearbeitung';
|
||||
break;
|
||||
case IssuesLib::STATUS_BEHOBEN:
|
||||
$changeIssueMethod = 'setBehoben';
|
||||
break;
|
||||
default:
|
||||
$changeIssueMethod = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isEmptyString($changeIssueMethod))
|
||||
$errors[] = error("Invalid issue status given");
|
||||
else
|
||||
{
|
||||
$issueRes = $this->issueslib->{$changeIssueMethod}($issue_id, $user);
|
||||
|
||||
if (isError($issueRes))
|
||||
$errors[] = getError($issueRes);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEmptyArray($errors))
|
||||
$this->outputJsonError(implode(", ", $errors));
|
||||
else
|
||||
$this->outputJsonSuccess("Status successfully refreshed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets oes of logged in user, which are needed to display issues of the user.
|
||||
* This includes oes assigned by a funktio and as the issue permission.
|
||||
* @return array
|
||||
*/
|
||||
private function _getOesForIssues()
|
||||
{
|
||||
// get oes of uid for which there is a current funktion
|
||||
$all_funktionen_oe_kurzbz = array();
|
||||
$oe_kurzbz_for_funktion = array();
|
||||
$benutzerfunktionRes = $this->BenutzerfunktionModel->getBenutzerFunktionByUid($this->_uid, null, date('Y-m-d'), date('Y-m-d'));
|
||||
|
||||
if (isError($benutzerfunktionRes))
|
||||
show_error(getError($benutzerfunktionRes));
|
||||
|
||||
if (hasData($benutzerfunktionRes))
|
||||
{
|
||||
foreach (getData($benutzerfunktionRes) as $benutzerfunktion)
|
||||
{
|
||||
$all_funktionen_oe_kurzbz[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz;
|
||||
|
||||
// separate oes for the funktion needed for displaying issues
|
||||
if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ)
|
||||
{
|
||||
$oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz;
|
||||
|
||||
// permission also for all oes under the oe for which funktion is assigend
|
||||
$childOesFunktionRes = $this->OrganisationseinheitModel->getChilds($benutzerfunktion->oe_kurzbz);
|
||||
|
||||
if (isError($childOesFunktionRes))
|
||||
show_error(getError($childOesFunktionRes));
|
||||
|
||||
if (hasData($childOesFunktionRes))
|
||||
{
|
||||
$childOesFunktion = getData($childOesFunktionRes);
|
||||
|
||||
foreach ($childOesFunktion as $childOeFunktion)
|
||||
{
|
||||
if (!in_array($childOeFunktion->oe_kurzbz, $oe_kurzbz_for_funktion))
|
||||
$oe_kurzbz_for_funktion[] = $childOeFunktion->oe_kurzbz;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add oes for which there is the "manage issues" Berechtigung
|
||||
if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ))
|
||||
show_error('No permission or error when checking permissions');
|
||||
|
||||
$all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt));
|
||||
|
||||
return array(
|
||||
'all_funktionen_oe_kurzbz' => $all_funktionen_oe_kurzbz,
|
||||
'all_oe_kurzbz_berechtigt' => $all_oe_kurzbz_berechtigt
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,6 @@ class UDF extends FHC_Controller
|
||||
|
||||
// Loads the UDFLib with HTTP GET/POST parameters
|
||||
$this->_loadUDFLib();
|
||||
|
||||
// Checks if the caller is allow to use this UDF widget
|
||||
$this->_isAllowed();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
@@ -39,7 +36,6 @@ class UDF extends FHC_Controller
|
||||
*/
|
||||
public function saveUDFs()
|
||||
{
|
||||
$udfUniqueId = $this->input->post(self::UDF_UNIQUE_ID);
|
||||
$udfs = $this->input->post(UDFLib::UDFS_ARG_NAME);
|
||||
|
||||
if (!isEmptyString($udfs))
|
||||
@@ -47,7 +43,7 @@ class UDF extends FHC_Controller
|
||||
$jsonDecodedUDF = json_decode($udfs);
|
||||
if ($jsonDecodedUDF != null)
|
||||
{
|
||||
$this->outputJson($this->udflib->saveUDFs($udfUniqueId, $jsonDecodedUDF));
|
||||
$this->outputJson($this->udflib->saveUDFs($jsonDecodedUDF));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -63,17 +59,6 @@ class UDF extends FHC_Controller
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Checks if the user is allowed to use this UDFWidget
|
||||
*/
|
||||
private function _isAllowed()
|
||||
{
|
||||
if (!$this->udflib->isAllowed())
|
||||
{
|
||||
$this->terminateWithJsonError('You are not allowed to access to this content');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the UDFLib with the UDF_UNIQUE_ID parameter
|
||||
* If the parameter UDF_UNIQUE_ID is not given then the execution of the controller is terminated and
|
||||
@@ -105,3 +90,4 @@ class UDF extends FHC_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class DB_Model extends CI_Model
|
||||
if (is_null($this->dbTable)) return error('The given database table name is not valid', EXIT_MODEL);
|
||||
|
||||
// If this table has UDF and the validation of them is ok
|
||||
if (isError($validate = $this->_manageUDFs($data, $this->dbTable))) return $validate;
|
||||
if (isError($validate = $this->_prepareUDFsWrite($data, $this->dbTable))) return $validate;
|
||||
|
||||
// DB-INSERT
|
||||
$insert = $this->db->insert($this->dbTable, $data);
|
||||
@@ -137,7 +137,7 @@ class DB_Model extends CI_Model
|
||||
if (is_null($this->dbTable)) return error('The given database table name is not valid', EXIT_MODEL);
|
||||
|
||||
// If this table has UDF and the validation of them is ok
|
||||
if (isError($validate = $this->_manageUDFs($data, $this->dbTable, $id))) return $validate;
|
||||
if (isError($validate = $this->_prepareUDFsWrite($data, $this->dbTable, $id))) return $validate;
|
||||
|
||||
$tmpId = $id;
|
||||
|
||||
@@ -670,6 +670,7 @@ class DB_Model extends CI_Model
|
||||
/**
|
||||
* Returns all the UDF contained in this table ($dbTable)
|
||||
* If no UDF are present, an empty array will be returned
|
||||
* NOTE: only the UDFs that the logged user is allowed to read are loaded by this method
|
||||
*/
|
||||
public function getUDFs($id, $udfName = null)
|
||||
{
|
||||
@@ -700,9 +701,9 @@ class DB_Model extends CI_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this table has the field udf_values
|
||||
* Checks if this table has the field udf_values and if there is a UDF definition for this table
|
||||
*/
|
||||
public function hasUDF()
|
||||
public function udfsExistAndDefined()
|
||||
{
|
||||
if ($this->fieldExists(UDFLib::COLUMN_NAME))
|
||||
{
|
||||
@@ -844,25 +845,25 @@ class DB_Model extends CI_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method for UDFLib->manageUDFs
|
||||
* Wrapper method for UDFLib->prepareUDFsWrite
|
||||
*/
|
||||
private function _manageUDFs(&$data, $schemaAndTable, $id = null)
|
||||
private function _prepareUDFsWrite(&$data, $schemaAndTable, $id = null)
|
||||
{
|
||||
$manageUDFs = success();
|
||||
$prepareUDFsWrite = success();
|
||||
|
||||
if ($this->hasUDF())
|
||||
if ($this->udfsExistAndDefined())
|
||||
{
|
||||
if ($id != null)
|
||||
{
|
||||
$manageUDFs = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id));
|
||||
$prepareUDFsWrite = $this->udflib->prepareUDFsWrite($data, $this->dbTable, $this->_getUDFsNoPerms($id));
|
||||
}
|
||||
else
|
||||
{
|
||||
$manageUDFs = $this->udflib->manageUDFs($data, $this->dbTable);
|
||||
$prepareUDFsWrite = $this->udflib->prepareUDFsWrite($data, $this->dbTable);
|
||||
}
|
||||
}
|
||||
|
||||
return $manageUDFs;
|
||||
return $prepareUDFsWrite;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -874,9 +875,10 @@ class DB_Model extends CI_Model
|
||||
*/
|
||||
private function _toPhp($result)
|
||||
{
|
||||
$udfs = false; // if UDFs are inside the given result set
|
||||
$toPhp = $result; // if there is nothing to convert then return the result from DB
|
||||
|
||||
// If it's an object its fields will be parsed to find booleans and arrays types
|
||||
// If it's an object its fields will be parsed to find booleans, arrays and UDFs types
|
||||
if (is_object($result))
|
||||
{
|
||||
$toBeConverterdArray = array(); // Fields to be converted
|
||||
@@ -884,40 +886,48 @@ class DB_Model extends CI_Model
|
||||
$this->executedQueryMetaData = $result->field_data(); // Fields information
|
||||
$this->executedQueryListFields = $result->list_fields(); // List of the retrieved fields
|
||||
|
||||
for ($i = 0; $i < count($this->executedQueryMetaData); $i++) // Looking for booleans and arrays
|
||||
// Looking for booleans, arrays and UDFs
|
||||
foreach ($this->executedQueryMetaData as $eqmd)
|
||||
{
|
||||
// If array type, boolean type OR a UDF
|
||||
if (strpos($this->executedQueryMetaData[$i]->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|
||||
|| $this->executedQueryMetaData[$i]->type == DB_Model::PGSQL_BOOLEAN_TYPE
|
||||
|| $this->udflib->isUDFColumn($this->executedQueryMetaData[$i]->name, $this->executedQueryMetaData[$i]->type))
|
||||
if (strpos($eqmd->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|
||||
|| $eqmd->type == DB_Model::PGSQL_BOOLEAN_TYPE
|
||||
|| $this->udflib->isUDFColumn($eqmd->name, $eqmd->type))
|
||||
{
|
||||
// Name and type of the field to be converted
|
||||
$toBeConverted = new stdClass();
|
||||
// Set the type of the field to be converted
|
||||
$toBeConverted->type = $this->executedQueryMetaData[$i]->type;
|
||||
// Set the name of the field to be converted
|
||||
$toBeConverted->name = $this->executedQueryMetaData[$i]->name;
|
||||
// Add the field to be converted to $toBeConverterdArray
|
||||
array_push($toBeConverterdArray, $toBeConverted);
|
||||
// If UDFs are inside this result set
|
||||
if ($this->udflib->isUDFColumn($eqmd->name, $eqmd->type))
|
||||
{
|
||||
$udfs = true;
|
||||
}
|
||||
else // all the other cases
|
||||
{
|
||||
// Name and type of the field to be converted
|
||||
$toBeConverted = new stdClass();
|
||||
// Set the type of the field to be converted
|
||||
$toBeConverted->type = $eqmd->type;
|
||||
// Set the name of the field to be converted
|
||||
$toBeConverted->name = $eqmd->name;
|
||||
// Add the field to be converted to $toBeConverterdArray
|
||||
array_push($toBeConverterdArray, $toBeConverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is something to convert, otherwhise don't lose time
|
||||
if (count($toBeConverterdArray) > 0)
|
||||
{
|
||||
// Returns the array of objects, each of them represents a DB record
|
||||
$resultsArray = $result->result();
|
||||
// Looping on results
|
||||
for ($i = 0; $i < count($resultsArray); $i++)
|
||||
{
|
||||
// Single element
|
||||
$resultElement = $resultsArray[$i];
|
||||
// Looping on fields to be converted
|
||||
for ($j = 0; $j < count($toBeConverterdArray); $j++)
|
||||
{
|
||||
// Single element
|
||||
$toBeConverted = $toBeConverterdArray[$j];
|
||||
// Returns the array of objects, each of them represents a DB record
|
||||
$resultsArray = $result->result();
|
||||
|
||||
// If in this result set there are UDFs then prepare them
|
||||
if ($udfs) $this->udflib->prepareUDFsRead($resultsArray, $this->dbTable);
|
||||
|
||||
// If there is something to convert, otherwhise don't waste time
|
||||
if (!isEmptyArray($toBeConverterdArray))
|
||||
{
|
||||
// Looping on results
|
||||
foreach ($resultsArray as $resultElement)
|
||||
{
|
||||
// Looping on fields to be converted
|
||||
foreach ($toBeConverterdArray as $toBeConverted)
|
||||
{
|
||||
// Array type
|
||||
if (strpos($toBeConverted->type, DB_Model::PGSQL_ARRAY_TYPE) !== false)
|
||||
{
|
||||
@@ -931,30 +941,12 @@ class DB_Model extends CI_Model
|
||||
{
|
||||
$resultElement->{$toBeConverted->name} = $this->pgBoolPhp($resultElement->{$toBeConverted->name});
|
||||
}
|
||||
// UDF
|
||||
elseif ($this->udflib->isUDFColumn($toBeConverted->name, $toBeConverted->type))
|
||||
{
|
||||
$jsonValues = json_decode($resultElement->{$toBeConverted->name}); // decode UDFs values
|
||||
if ($jsonValues != null) // if decode is ok
|
||||
{
|
||||
// For every UDF
|
||||
foreach ($jsonValues as $key => $value)
|
||||
{
|
||||
$resultElement->{$key} = $value; // create a new element called like the UDF
|
||||
}
|
||||
}
|
||||
unset($resultElement->{UDFLib::COLUMN_NAME}); // remove udf_values from the response
|
||||
}
|
||||
}
|
||||
}
|
||||
// Returns DB data as an array
|
||||
$toPhp = $resultsArray;
|
||||
}
|
||||
// And returns DB data as an array
|
||||
else
|
||||
{
|
||||
$toPhp = $result->result();
|
||||
}
|
||||
|
||||
// Returns DB data as an array
|
||||
$toPhp = $resultsArray;
|
||||
}
|
||||
|
||||
return $toPhp;
|
||||
@@ -998,4 +990,48 @@ class DB_Model extends CI_Model
|
||||
{
|
||||
if ($this->debugMode) $this->loglib->logDebug($this->db->last_query());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the UDF contained in this table ($dbTable)
|
||||
* If no UDF are present, an empty array will be returned
|
||||
* NOTE: it returns all the UDFs, does _not_ check the permissions
|
||||
*/
|
||||
private function _getUDFsNoPerms($id)
|
||||
{
|
||||
$udfs = array();
|
||||
|
||||
$this->db->select(UDFLib::COLUMN_NAME, true); // get only the UDF column
|
||||
|
||||
// Primary key management
|
||||
$tmpId = $id;
|
||||
|
||||
// Check for composite Primary Key
|
||||
if (is_array($id))
|
||||
{
|
||||
if (isset($id[0]))
|
||||
{
|
||||
$tmpId = $this->_arrayCombine($this->pk, $id);
|
||||
}
|
||||
}
|
||||
elseif ($id != null)
|
||||
{
|
||||
$tmpId = array($this->pk => $id);
|
||||
}
|
||||
|
||||
// Read the record from the table
|
||||
$result = $this->db->get_where($this->dbTable, $tmpId);
|
||||
|
||||
// If was a success and there are data
|
||||
if ($result && count($result->result()) == 1)
|
||||
{
|
||||
// Get the UDF column and decode it from JSON
|
||||
$jsonValues = json_decode($result->result()[0]->{UDFLib::COLUMN_NAME});
|
||||
|
||||
// If the JSON convertion was fine convert the object to an array
|
||||
if ($jsonValues != null) $udfs = get_object_vars($jsonValues);
|
||||
}
|
||||
|
||||
return $udfs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Interface defining method to implement for issue resolution checker (from core and extensions)
|
||||
*/
|
||||
interface IIssueResolvedChecker
|
||||
{
|
||||
/**
|
||||
* Checks if a issue of a certain type is resolved.
|
||||
* Classes for resolving a certain issue type implement this method.
|
||||
* @param array $params parameters needed for issue resolution
|
||||
* @return object with success(true) if issue resolved, success(false) otherwise
|
||||
*/
|
||||
public function checkIfIssueIsResolved($params);
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Controller for retrieving open issues and, if the issue condition is not met anymore, automatically set it to resolved
|
||||
*/
|
||||
abstract class IssueResolver_Controller extends JOB_Controller
|
||||
{
|
||||
const ISSUES_FOLDER = 'issues';
|
||||
const CHECK_ISSUE_RESOLVED_METHOD_NAME = 'checkIfIssueIsResolved';
|
||||
|
||||
protected $_codeLibMappings;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('system/Issue_model', 'IssueModel');
|
||||
|
||||
$this->load->library('IssuesLib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes issue resolution.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->logInfo("Issue resolve job started");
|
||||
|
||||
// load open issues with given errorcodes
|
||||
$openIssuesRes = $this->IssueModel->getOpenIssues(array_keys($this->_codeLibMappings));
|
||||
|
||||
// log error if occured
|
||||
if (isError($openIssuesRes))
|
||||
{
|
||||
$this->logError(getError($openIssuesRes));
|
||||
}
|
||||
else
|
||||
{
|
||||
// log info if no data found
|
||||
if (!hasData($openIssuesRes))
|
||||
{
|
||||
$this->logInfo("No open issues found");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$openIssues = getData($openIssuesRes);
|
||||
|
||||
foreach ($openIssues as $issue)
|
||||
{
|
||||
if (isset($this->_codeLibMappings[$issue->fehlercode]))
|
||||
{
|
||||
$libName = $this->_codeLibMappings[$issue->fehlercode];
|
||||
|
||||
// add person id and oe kurzbz automatically as params, merge it with additional params
|
||||
// decode bewerbung_parameter into assoc array
|
||||
$params = array_merge(
|
||||
array('issue_id' => $issue->issue_id, 'issue_person_id' => $issue->person_id, 'issue_oe_kurzbz' => $issue->oe_kurzbz),
|
||||
isset($issue->behebung_parameter) ? json_decode($issue->behebung_parameter, true) : array()
|
||||
);
|
||||
|
||||
// if called from extension (extension name set), path includes extension names, otherwise it is the core library folder
|
||||
$libRootPath = isset($this->_extensionName) ? 'extensions/' . $this->_extensionName . '/' : '';
|
||||
$issuesLibPath = $libRootPath . self::ISSUES_FOLDER . '/';
|
||||
$issuesLibFilePath = DOC_ROOT . 'application/' . $libRootPath . 'libraries/' . self::ISSUES_FOLDER . '/' . $libName . '.php';
|
||||
|
||||
// check if library file exists
|
||||
if (!file_exists($issuesLibFilePath))
|
||||
{
|
||||
// log error and continue with next issue if not
|
||||
$this->logError("Issue library file " . $issuesLibFilePath . " does not exist");
|
||||
continue;
|
||||
}
|
||||
|
||||
// load library connected to fehlercode
|
||||
$this->load->library(
|
||||
$issuesLibPath . $libName
|
||||
);
|
||||
|
||||
$lowercaseLibName = mb_strtolower($libName);
|
||||
|
||||
// check if method is defined in libary class
|
||||
if (!is_callable(array($this->{$lowercaseLibName}, self::CHECK_ISSUE_RESOLVED_METHOD_NAME)))
|
||||
{
|
||||
// log error and continue with next issue if not
|
||||
$this->logError("Method " . self::CHECK_ISSUE_RESOLVED_METHOD_NAME . " is not defined in library $lowercaseLibName");
|
||||
continue;
|
||||
}
|
||||
|
||||
// call the function for checking for issue resolution
|
||||
$issueResolvedRes = $this->{$lowercaseLibName}->{self::CHECK_ISSUE_RESOLVED_METHOD_NAME}($params);
|
||||
|
||||
if (isError($issueResolvedRes))
|
||||
{
|
||||
$this->logError(getError($issueResolvedRes));
|
||||
}
|
||||
else
|
||||
{
|
||||
$issueResolvedData = getData($issueResolvedRes);
|
||||
|
||||
if ($issueResolvedData === true)
|
||||
{
|
||||
// set issue to resolved if needed
|
||||
$behobenRes = $this->issueslib->setBehoben($issue->issue_id, null);
|
||||
|
||||
if (isError($behobenRes))
|
||||
$this->logError(getError($behobenRes));
|
||||
else
|
||||
$this->logInfo("Issue " . $issue->issue_id . " successfully resolved");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->logInfo("Issue resolve job ended");
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,19 @@ abstract class JQW_Controller extends JOB_Controller
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
protected function getJobsByTypeStatus($type, $status)
|
||||
{
|
||||
$jobs = $this->jobsqueuelib->getJobsByTypeStatus($type, $status);
|
||||
|
||||
// If an error occurred then log it in database
|
||||
if (isError($jobs)) $this->logError(getError($jobs), array($type, $status));
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
|
||||
@@ -314,32 +314,40 @@ function sanitizeProblemChars($str)
|
||||
$enc = 'UTF-8';
|
||||
|
||||
$acentos = array(
|
||||
'A' => '/À|Á|Â|Ã|Å/',
|
||||
'A' => '/À|Á|Â|Ã|Å|Ă|Ǎ/',
|
||||
'Ae' => '/Ä/',
|
||||
'a' => '/à|á|â|ã|å/',
|
||||
'ae'=> '/ä/',
|
||||
'C' => '/Ç/',
|
||||
'c' => '/ç/',
|
||||
'a' => '/à|á|â|ã|å|ă|ǎ/',
|
||||
'ae' => '/ä/',
|
||||
'C' => '/Ç|Č/',
|
||||
'c' => '/ç|č/',
|
||||
'E' => '/È|É|Ê|Ë/',
|
||||
'e' => '/è|é|ê|ë/',
|
||||
'I' => '/Ì|Í|Î|Ï/',
|
||||
'i' => '/ì|í|î|ï/',
|
||||
'N' => '/Ñ/',
|
||||
'I' => '/Ì|Í|Î|Ï|Ǐ/',
|
||||
'i' => '/ì|í|î|ï|ǐ/',
|
||||
'N' => '/Ñ|Ň|ň/',
|
||||
'n' => '/ñ/',
|
||||
'O' => '/Ò|Ó|Ô|Õ/',
|
||||
'O' => '/Ò|Ó|Ô|Õ|Ǒ/',
|
||||
'Oe' => '/Ö/',
|
||||
'o' => '/ò|ó|ô|õ/',
|
||||
'o' => '/ò|ó|ô|õ|ǒ/',
|
||||
'oe' => '/ö/',
|
||||
'U' => '/Ù|Ú|Û/',
|
||||
'R' => '/Ř/',
|
||||
'r' => '/ř/',
|
||||
'S' => '/Š/',
|
||||
's' => '/š/',
|
||||
'T' => '/Ť/',
|
||||
't' => '/ť/',
|
||||
'U' => '/Ù|Ú|Û|Ŭ|Ǔ/',
|
||||
'Ue' => '/Ü/',
|
||||
'u' => '/ù|ú|û/',
|
||||
'u' => '/ù|ú|û|ŭ|ǔ/',
|
||||
'ue' => '/ü/',
|
||||
'Y' => '/Ý/',
|
||||
'y' => '/ý|ÿ/',
|
||||
'Z' => '/Ž/',
|
||||
'z' => '/ž/',
|
||||
'a.' => '/ª/',
|
||||
'o.' => '/º/',
|
||||
'ss' => '/ß/'
|
||||
);
|
||||
|
||||
return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc));
|
||||
return preg_replace($acentos, array_keys($acentos), htmlentities($str, ENT_NOQUOTES | ENT_HTML5, $enc));
|
||||
}
|
||||
|
||||
@@ -39,6 +39,24 @@ function printPageTitle($title)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the meta tag http-equiv refresh having as content the value of the given parameter
|
||||
*/
|
||||
function printRefreshMeta($refresh)
|
||||
{
|
||||
if ($refresh != null)
|
||||
{
|
||||
if (is_numeric($refresh) && $refresh > 0)
|
||||
{
|
||||
echo '<meta http-equiv="refresh" content="'.$refresh.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('The provided refresh parameter has to be a number greater then 0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates tags for the style sheets you want to include, the parameter could by a string or an array of strings
|
||||
*/
|
||||
|
||||
@@ -89,6 +89,7 @@ class AnrechnungLib
|
||||
$antrag_data->vorname = $person->vorname;
|
||||
$antrag_data->nachname = $person->nachname;
|
||||
$antrag_data->matrikelnr = $student->matrikelnr;
|
||||
$antrag_data->studiengang_kz = $studiengang->studiengang_kz;
|
||||
$antrag_data->stg_bezeichnung = $studiengang->bezeichnung;
|
||||
$antrag_data->lektoren = $lv_lektoren_arr;
|
||||
$antrag_data->zgv = $latest_zgv_bezeichnung;
|
||||
|
||||
@@ -203,7 +203,7 @@ class FilterWidgetLib
|
||||
// Loops in the session for all the filter widgets
|
||||
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
|
||||
{
|
||||
// If this filter widget is not the currrent used filter widget and the it is expired...
|
||||
// If this filter widget is not the current used filter widget and the it is expired...
|
||||
if ($this->_filterUniqueId != $filterWidget && $filterWidgetData[self::SESSION_TIMEOUT] <= time())
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
|
||||
@@ -232,7 +232,7 @@ class FilterWidgetLib
|
||||
if ($filterId != null && is_numeric($filterId) && $filterId > 0)
|
||||
{
|
||||
$whereParameters = array(
|
||||
'filter_id' => $filterId
|
||||
self::FILTER_ID => $filterId
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -279,6 +279,18 @@ class FilterWidgetLib
|
||||
if ($definition == null && $whereParameters != null)
|
||||
{
|
||||
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
|
||||
|
||||
// Last chance!!!
|
||||
if (!hasData($definition)) // If no data have been found until now the tries the most desperate query
|
||||
{
|
||||
$this->_ci->FiltersModel->addOrder('filter_id', 'ASC'); // sort on column filter_id to get the oldest
|
||||
$whereParameters = array(
|
||||
'app' => $app,
|
||||
'dataset_name' => $datasetName
|
||||
);
|
||||
|
||||
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
|
||||
}
|
||||
}
|
||||
|
||||
return $definition;
|
||||
@@ -712,8 +724,11 @@ class FilterWidgetLib
|
||||
{
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel'); // to remove the filter definitions from DB
|
||||
|
||||
// delete it!
|
||||
$this->_ci->FiltersModel->delete(array('filter_id' => $filterId));
|
||||
// Delete it from database
|
||||
$this->_ci->FiltersModel->delete(array(self::FILTER_ID => $filterId));
|
||||
|
||||
// Delete it from session
|
||||
$this->_dropFromSessionFilterWidgetById($filterId);
|
||||
|
||||
$removeCustomFilter = true;
|
||||
}
|
||||
@@ -735,7 +750,7 @@ class FilterWidgetLib
|
||||
$session = $this->getSession(); // The filter currently stored in session (the one that is currently used)
|
||||
if ($session != null)
|
||||
{
|
||||
// Loads the Fitlers model
|
||||
// Loads the Filters model
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Loads all the filters related to this page (same dataset_name and same app name)
|
||||
@@ -761,7 +776,7 @@ class FilterWidgetLib
|
||||
'%s?%s=%s',
|
||||
site_url($navigationPage),
|
||||
self::FILTER_ID,
|
||||
$filter->filter_id
|
||||
$filter->{self::FILTER_ID}
|
||||
) // link
|
||||
);
|
||||
|
||||
@@ -774,7 +789,7 @@ class FilterWidgetLib
|
||||
{
|
||||
$menuEntry['subscriptDescription'] = 'Remove';
|
||||
$menuEntry['subscriptLinkClass'] = 'remove-custom-filter';
|
||||
$menuEntry['subscriptLinkValue'] = $filter->filter_id;
|
||||
$menuEntry['subscriptLinkValue'] = $filter->{self::FILTER_ID};
|
||||
$childrenPersonalArray[] = $menuEntry; // adds to personal filters menu array
|
||||
}
|
||||
}
|
||||
@@ -974,5 +989,29 @@ class FilterWidgetLib
|
||||
|
||||
return $pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove from the session the given filter widget
|
||||
*/
|
||||
private function _dropFromSessionFilterWidgetById($filterId)
|
||||
{
|
||||
// Loads the session for all the filter widgets
|
||||
$filterWidgetsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($filterWidgetsSession != null)
|
||||
{
|
||||
// Loops in the session for all the filter widgets
|
||||
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
|
||||
{
|
||||
// If this filter widget is not the one that we are looking for
|
||||
if ($filterWidgetData[self::FILTER_ID] == $filterId)
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
|
||||
break; // stop to search
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Library for writing and reading issues (problems in fhcomplete system which need resolving)
|
||||
*/
|
||||
class IssuesLib
|
||||
{
|
||||
private $_ci; // Code igniter instance
|
||||
|
||||
const APP_INDEX = 'app';
|
||||
const INSERTVON_INDEX = 'insertvon';
|
||||
const FALLBACK_FEHLERCODE_INDEX = 'fallbackFehlercode';
|
||||
|
||||
const STATUS_NEU = 'new';
|
||||
const STATUS_IN_BEARBEITUNG = 'inProgress';
|
||||
const STATUS_BEHOBEN = 'resolved';
|
||||
|
||||
const ERRORTYPE_CODE = 'error';
|
||||
const WARNINGTYPE_CODE = 'warning';
|
||||
|
||||
public function __construct($params = null)
|
||||
{
|
||||
$this->_ci =& get_instance();
|
||||
|
||||
// Properties default values
|
||||
$this->_app = 'core';
|
||||
$this->_insertvon = 'system';
|
||||
$this->_fallbackFehlercode = 'UNKNOWN_ERROR';
|
||||
|
||||
// If parameters are given then overwrite the default values
|
||||
if (!isEmptyArray($params)) $this->setConfigs($params);
|
||||
|
||||
// load models
|
||||
$this->_ci->load->model('system/Issue_model', 'IssueModel');
|
||||
$this->_ci->load->model('system/Fehler_model', 'FehlerModel');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Store configuration parameters for this lib
|
||||
*/
|
||||
public function setConfigs($params)
|
||||
{
|
||||
// If parameters are given then overwrite the default values
|
||||
if (!isEmptyArray($params))
|
||||
{
|
||||
if (isset($params[self::APP_INDEX])) $this->_app = $params[self::APP_INDEX];
|
||||
if (isset($params[self::INSERTVON_INDEX])) $this->_insertvon = $params[self::INSERTVON_INDEX];
|
||||
if (isset($params[self::FALLBACK_FEHLERCODE_INDEX])) $this->_fallbackFehlercode = $params[self::FALLBACK_FEHLERCODE_INDEX];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an Fhc issue, i.e. an internal, self-defined issue.
|
||||
* @param string $fehler_kurzbz short unique text name of the issue
|
||||
* @param int $person_id
|
||||
* @param string $oe_kurzbz
|
||||
* @param array $fehlertext_params params for sprint replace of error text in system.tbl_fehler
|
||||
* @return object success or error
|
||||
*/
|
||||
public function addFhcIssue($fehler_kurzbz, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null, $resolution_params = null)
|
||||
{
|
||||
$fehlerRes = $this->_ci->FehlerModel->loadWhere(array('fehler_kurzbz' => $fehler_kurzbz));
|
||||
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$fehlercode = getData($fehlerRes)[0]->fehlercode;
|
||||
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, $resolution_params);
|
||||
}
|
||||
else
|
||||
return error("Error $fehler_kurzbz not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an external issue, already defined externally by another system.
|
||||
* @param string $fehlercode_extern the error code in the external system
|
||||
* @param string $inhalt_extern error text in external system
|
||||
* @param int $person_id
|
||||
* @param int $oe_kurzbz
|
||||
* @param array $fehlertext_params params for replacement of parts of error text
|
||||
* @param bool $force_predefined if true, only predefined (with entry in fehler table) external issues are added
|
||||
* @return object success or error
|
||||
*/
|
||||
public function addExternalIssue($fehlercode_extern, $inhalt_extern, $person_id = null, $oe_kurzbz = null, $fehlertext_params = null)
|
||||
{
|
||||
if (isEmptyString($fehlercode_extern))
|
||||
return error("fehlercode_extern missing");
|
||||
|
||||
// get external fehlercode (unique for each app)
|
||||
$this->_ci->FehlerModel->addSelect('fehlercode');
|
||||
$fehlerRes = $this->_ci->FehlerModel->loadWhere(
|
||||
array(
|
||||
'fehlercode_extern' => $fehlercode_extern,
|
||||
'app' => $this->_app
|
||||
)
|
||||
);
|
||||
|
||||
if (isError($fehlerRes))
|
||||
return $fehlerRes;
|
||||
|
||||
// check if there is a predefined custom error for the external issue
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$fehlerData = getData($fehlerRes)[0];
|
||||
// if found, use the code
|
||||
$fehlercode = $fehlerData->fehlercode;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if predefined error is not found, insert with fallback code
|
||||
$fehlercode = $this->_fallbackFehlercode;
|
||||
}
|
||||
|
||||
// add external issue
|
||||
return $this->_addIssue($fehlercode, $person_id, $oe_kurzbz, $fehlertext_params, null, $fehlercode_extern, $inhalt_extern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set issue to resolved.
|
||||
* @param int $issue_id
|
||||
* @param string $user uid of issue resolver
|
||||
* @return object success or error
|
||||
*/
|
||||
public function setBehoben($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_BEHOBEN,
|
||||
'verarbeitetvon' => $user,
|
||||
'verarbeitetamum' => date('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set issue to in progress.
|
||||
* @param int $issue_id
|
||||
* @param string $user uid of issue resovler
|
||||
* @return object success or error
|
||||
*/
|
||||
public function setInBearbeitung($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_IN_BEARBEITUNG,
|
||||
'verarbeitetvon' => $user
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set issue to new.
|
||||
* @param int $issue_id
|
||||
* @param string $user uid of issue resolver
|
||||
* @return object success or error
|
||||
*/
|
||||
public function setNeu($issue_id, $user)
|
||||
{
|
||||
$data = array(
|
||||
'status_kurzbz' => self::STATUS_NEU,
|
||||
'verarbeitetvon' => null,
|
||||
'verarbeitetamum' => null
|
||||
);
|
||||
|
||||
return $this->_changeIssueStatus($issue_id, $data, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes status of an issue.
|
||||
* @param int $issue_id
|
||||
* @param array $sdata the data to save, including status
|
||||
* @param string $user uid of person changing the status (needed for in Bearbeitung and behoben)
|
||||
* @return success or error
|
||||
*/
|
||||
private function _changeIssueStatus($issue_id, $data, $user)
|
||||
{
|
||||
if (!isset($issue_id) || !is_numeric($issue_id))
|
||||
return error("Issue Id must be set correctly.");
|
||||
|
||||
// check if given status is same as existing
|
||||
$this->_ci->IssueModel->addSelect('status_kurzbz');
|
||||
$currStatus = $this->_ci->IssueModel->load($issue_id);
|
||||
|
||||
if (hasData($currStatus))
|
||||
{
|
||||
if (getData($currStatus)[0]->status_kurzbz == $data['status_kurzbz'])
|
||||
return success("Same status already set");
|
||||
}
|
||||
else
|
||||
return error("Error when getting status");
|
||||
|
||||
$data['updatevon'] = $user;
|
||||
$data['updateamum'] = date('Y-m-d H:i:s');
|
||||
|
||||
return $this->_ci->IssueModel->update(
|
||||
array(
|
||||
'issue_id' => $issue_id
|
||||
),
|
||||
$data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an issue.
|
||||
* @param $fehlercode
|
||||
* @param int $person_id
|
||||
* @param string $oe_kurzbz
|
||||
* @param array $fehlertext_params
|
||||
* @param string $resolution_params
|
||||
* @param string $fehlercode_extern
|
||||
* @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)
|
||||
{
|
||||
if (isEmptyString($person_id) && isEmptyString($oe_kurzbz))
|
||||
return error("Person_id or oe_kurzbz must be set.");
|
||||
|
||||
// get fehlertextVorlage and replace it with params
|
||||
$fehlerRes = $this->_ci->FehlerModel->load($fehlercode);
|
||||
|
||||
if (hasData($fehlerRes))
|
||||
{
|
||||
$fehlertextVorlage = getData($fehlerRes)[0]->fehlertext;
|
||||
$fehlertext = isEmptyArray($fehlertext_params) ? $fehlertextVorlage : vsprintf($fehlertextVorlage, $fehlertext_params);
|
||||
|
||||
$openIssuesCountRes = $this->_ci->IssueModel->getOpenIssueCount($fehlercode, $person_id, $oe_kurzbz, $fehlercode_extern);
|
||||
|
||||
if (hasData($openIssuesCountRes))
|
||||
{
|
||||
// don't insert if issue is already open
|
||||
// already open - status new with same fehlercode or same fehlercode-extern (if set)
|
||||
$openIssueCount = getData($openIssuesCountRes)[0]->anzahl_open_issues;
|
||||
|
||||
if ($openIssueCount == 0)
|
||||
{
|
||||
if (isset($resolution_params))
|
||||
{
|
||||
if (is_array($resolution_params))
|
||||
{
|
||||
foreach ($resolution_params as $resolution_key => $resolution_param)
|
||||
{
|
||||
if (!is_string($resolution_key))
|
||||
return error("Invalid parameter for resolution, must be an associative array");
|
||||
}
|
||||
}
|
||||
else
|
||||
return error("Invalid parameters for resolution");
|
||||
}
|
||||
|
||||
return $this->_ci->IssueModel->insert(
|
||||
array(
|
||||
'fehlercode' => $fehlercode,
|
||||
'fehlercode_extern' => $fehlercode_extern,
|
||||
'inhalt' => $fehlertext,
|
||||
'inhalt_extern' => $inhalt_extern,
|
||||
'person_id' => $person_id,
|
||||
'oe_kurzbz' => $oe_kurzbz,
|
||||
'datum' => date('Y-m-d H:i:s'),
|
||||
'status_kurzbz' => self::STATUS_NEU,
|
||||
'behebung_parameter' => isset($resolution_params) ? json_encode($resolution_params) : null,
|
||||
'insertvon' => $this->_insertvon
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
return success($openIssueCount);
|
||||
}
|
||||
else
|
||||
return error("Number of open issues could not be determined");
|
||||
}
|
||||
else
|
||||
return error("Error $fehlercode could not be found");
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,18 @@ class JobsQueueLib
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
public function getJobsByTypeStatus($type, $status)
|
||||
{
|
||||
$this->_ci->JobsQueueModel->resetQuery();
|
||||
|
||||
$this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC');
|
||||
|
||||
return $this->_ci->JobsQueueModel->loadWhere(array('status' => $status, 'type' => $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* To get all the jobs specified by the given parameters
|
||||
*/
|
||||
|
||||
+295
-126
@@ -30,13 +30,14 @@ class UDFLib
|
||||
// ...to specify permissions that are needed to use this TableWidget
|
||||
const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions';
|
||||
|
||||
const PERMISSION_TABLE_METHOD = 'UDFWidget'; // Name for fake method to be checked by the PermissionLib
|
||||
const PERMISSION_TYPE_READ = 'r';
|
||||
const PERMISSION_TYPE_WRITE = 'w';
|
||||
|
||||
// ...to specify the primary key name and value
|
||||
const PRIMARY_KEY_NAME = 'primaryKeyName';
|
||||
const PRIMARY_KEY_VALUE = 'primaryKeyValue';
|
||||
|
||||
const PERMISSION_TABLE_METHOD = 'UDFWidget'; // Name for fake method to be checked by the PermissionLib
|
||||
const PERMISSION_TYPE = 'rw';
|
||||
|
||||
// HTML components
|
||||
const LABEL = 'title';
|
||||
const TITLE = 'description';
|
||||
@@ -76,10 +77,10 @@ class UDFLib
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* UDFWidget
|
||||
*/
|
||||
public function UDFWidget($args, $htmlArgs = array())
|
||||
{
|
||||
* UDFWidget
|
||||
*/
|
||||
public function UDFWidget($args, $htmlArgs = array())
|
||||
{
|
||||
if ((isset($args[self::SCHEMA_ARG_NAME]) && !isEmptyString($args[self::SCHEMA_ARG_NAME]))
|
||||
&& (isset($args[self::TABLE_ARG_NAME]) && !isEmptyString($args[self::TABLE_ARG_NAME])))
|
||||
{
|
||||
@@ -112,16 +113,17 @@ class UDFLib
|
||||
show_error(self::TABLE_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* It renders the HTML of the UDF
|
||||
*
|
||||
* NOTE: When this method is called $widgetData contains different data from
|
||||
* parameter $args in the constructor
|
||||
*/
|
||||
public function displayUDFWidget(&$widgetData)
|
||||
public function displayUDFWidget(&$widgetData)
|
||||
{
|
||||
$field = null;
|
||||
$schema = $widgetData[self::SCHEMA_ARG_NAME]; // schema attribute
|
||||
$table = $widgetData[self::TABLE_ARG_NAME]; // table attribute
|
||||
|
||||
@@ -133,7 +135,7 @@ class UDFLib
|
||||
$udfResults = $this->_loadUDF($schema, $table); // loads UDF definition
|
||||
if (hasData($udfResults))
|
||||
{
|
||||
$udf = $udfResults->retval[0]; // only one record is loaded
|
||||
$udf = getData($udfResults)[0]; // only one record is loaded
|
||||
if (isset($udf->jsons))
|
||||
{
|
||||
$jsonSchemas = json_decode($udf->jsons); // decode the json schema
|
||||
@@ -155,7 +157,7 @@ class UDFLib
|
||||
$found = false; // used to check if the field is found or not in the json schema
|
||||
|
||||
$this->_sortJsonSchemas($jsonSchemasArray); // Sort the list of UDF by sort property
|
||||
|
||||
|
||||
// Loops through json schemas
|
||||
foreach ($jsonSchemasArray as $jsonSchema)
|
||||
{
|
||||
@@ -169,21 +171,37 @@ class UDFLib
|
||||
{
|
||||
show_error(sprintf('%s.%s: Attribute "name" not present in the json schema', $schema, $table));
|
||||
}
|
||||
// If the requiredPermissions property is not present then show an error
|
||||
if (!isset($jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER}))
|
||||
{
|
||||
show_error(sprintf('%s.%s: Attribute "requiredPermissions" not present in the json schema', $schema, $table));
|
||||
}
|
||||
|
||||
// Set the required permissions for this UDF
|
||||
$this->_setRequiredPermissions($jsonSchema->{self::NAME}, $jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER});
|
||||
|
||||
// If a UDF is specified and is present in the json schemas list or no UDF is specified
|
||||
if ((isset($field) && $field == $jsonSchema->{self::NAME}) || !isset($field))
|
||||
{
|
||||
// Set attributes using phrases
|
||||
$this->_setAttributesWithPhrases($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
// If the user has the permissions to read this field
|
||||
if ($this->_readAllowed($jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER}))
|
||||
{
|
||||
// Set attributes using phrases
|
||||
$this->_setAttributesWithPhrases($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
|
||||
// Set validation attributes
|
||||
$this->_setValidationAttributes($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
// Set validation attributes
|
||||
$this->_setValidationAttributes($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
|
||||
// Set name and id attributes
|
||||
$this->_setNameAndId($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
// Set name and id attributes
|
||||
$this->_setNameAndId($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
|
||||
// Render the HTML for this UDF
|
||||
$this->_render($jsonSchema, $widgetData);
|
||||
// Set if the field is in read only mode
|
||||
$this->_setReadOnly($jsonSchema, $widgetData[HTMLWidget::HTML_ARG_NAME]);
|
||||
|
||||
// Render the HTML for this UDF
|
||||
$this->_render($jsonSchema, $widgetData);
|
||||
}
|
||||
// otherwise the UDF is not displayed
|
||||
|
||||
// If a UDf is specified and it was found then stop looking through this list
|
||||
if (isset($field) && $field == $jsonSchema->{self::NAME})
|
||||
@@ -213,12 +231,97 @@ class UDFLib
|
||||
show_error(sprintf('%s.%s: Does not contain "jsons" field', $schema, $table));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage UDFs
|
||||
* UDFs permissions check and convertion to read them from database
|
||||
*/
|
||||
public function manageUDFs(&$data, $schemaAndTable, $udfValues = null)
|
||||
public function prepareUDFsRead(&$data, $schemaAndTable, $udfValues = null)
|
||||
{
|
||||
$this->_ci->load->model('system/UDF_model', 'UDFModel');
|
||||
|
||||
// Retrieves UDFs definitions for this table
|
||||
$resultUDFsDefinitions = $this->_ci->UDFModel->getUDFsDefinitions($schemaAndTable);
|
||||
|
||||
// If an error occurred while reading from database
|
||||
if (isError($resultUDFsDefinitions))
|
||||
{
|
||||
$data = array(); // then set data as an empty array
|
||||
return; // and exit from this method
|
||||
}
|
||||
|
||||
// If there are no UDFs defined for this table the return
|
||||
if (!hasData($resultUDFsDefinitions)) return;
|
||||
|
||||
// If not an error and has data, decodes json that define the UDFs for this table
|
||||
$decodedUDFDefinitions = json_decode(
|
||||
getData($resultUDFsDefinitions)[0]->{self::COLUMN_JSON_DESCRIPTION}
|
||||
);
|
||||
|
||||
// Looping on results, resultElement is an object that represent a database record
|
||||
foreach ($data as $resultElement)
|
||||
{
|
||||
// Decode the JSON column udf_values
|
||||
$udfColumn = json_decode($resultElement->{self::COLUMN_NAME});
|
||||
|
||||
// If this is not a valid JSON then skip to the next database record
|
||||
if ($udfColumn == null) continue;
|
||||
|
||||
// For each UDF column of this database record
|
||||
foreach (get_object_vars($udfColumn) as $columnName => $columnValue)
|
||||
{
|
||||
$udfColumnToBeRemoved = $columnName; // let's try to remove it
|
||||
|
||||
// Loops through the UDFs definitions
|
||||
foreach ($decodedUDFDefinitions as $decodedUDFDefinition)
|
||||
{
|
||||
// If the column exists in the UDF definition
|
||||
if ($columnName == $decodedUDFDefinition->{self::NAME})
|
||||
{
|
||||
$udfColumnToBeRemoved = null; // then keep it
|
||||
}
|
||||
}
|
||||
|
||||
// If in this record have been found a _not_ defined UDF then remove it
|
||||
if (!isEmptyString($udfColumnToBeRemoved)) unset($udfColumn->{$udfColumnToBeRemoved});
|
||||
}
|
||||
|
||||
// Loops through the UDFs definitions
|
||||
foreach ($decodedUDFDefinitions as $decodedUDFDefinition)
|
||||
{
|
||||
// Checks if the requiredPermissions is available and it is a valid array or a valid string
|
||||
if (isset($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})
|
||||
&& (!isEmptyArray($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})
|
||||
|| !isEmptyString($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})))
|
||||
{
|
||||
// Then check if the user has the permissions to read such UDF
|
||||
if (!$this->_readAllowed($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER}))
|
||||
{
|
||||
// If not then remove the UDF from the result set
|
||||
unset($udfColumn->{$decodedUDFDefinition->{self::NAME}});
|
||||
}
|
||||
}
|
||||
else // If not then remove the UDF from the result set
|
||||
{
|
||||
unset($udfColumn->{$decodedUDFDefinition->{self::NAME}});
|
||||
}
|
||||
}
|
||||
|
||||
// Add the defined and permitted UDF columns to the record set
|
||||
foreach (get_object_vars($udfColumn) as $columnName => $columnValue)
|
||||
{
|
||||
$resultElement->{$columnName} = $columnValue;
|
||||
}
|
||||
|
||||
// And finally remove the UDFs column
|
||||
unset($resultElement->{self::COLUMN_NAME});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UDFs validation and permissions check to write them into database
|
||||
*/
|
||||
public function prepareUDFsWrite(&$data, $schemaAndTable, $udfValues = null)
|
||||
{
|
||||
$validate = success(true); // returned value
|
||||
// Contains a list of validation errors for the UDFs that have not passed the validation
|
||||
@@ -241,18 +344,34 @@ class UDFLib
|
||||
|
||||
// Decodes json that define the UDFs for this table
|
||||
$decodedUDFDefinitions = json_decode(
|
||||
$resultUDFsDefinitions->retval[0]->{self::COLUMN_JSON_DESCRIPTION}
|
||||
getData($resultUDFsDefinitions)[0]->{self::COLUMN_JSON_DESCRIPTION}
|
||||
);
|
||||
|
||||
// Loops through the UDFs definitions
|
||||
for ($i = 0; $i < count($decodedUDFDefinitions); $i++)
|
||||
foreach ($decodedUDFDefinitions as $decodedUDFDefinition)
|
||||
{
|
||||
$decodedUDFDefinition = $decodedUDFDefinitions[$i]; // Definition of a single UDF
|
||||
// Checks if the requiredPermissions is available and it is a valid array or a valid string
|
||||
if (isset($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})
|
||||
&& (!isEmptyArray($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})
|
||||
|| !isEmptyString($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER})))
|
||||
{
|
||||
// Then check if the user has the permissions to write such UDF
|
||||
if (!$this->_writeAllowed($decodedUDFDefinition->{self::REQUIRED_PERMISSIONS_PARAMETER}))
|
||||
{
|
||||
// If the logged user has no permissions then remove the UDF
|
||||
unset($udfsParameters[$decodedUDFDefinition->{self::NAME}]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no permissions have been defined for this UDF then remove it
|
||||
unset($udfsParameters[$decodedUDFDefinition->{self::NAME}]);
|
||||
}
|
||||
|
||||
// Loops through the UDFs values that should be stored
|
||||
foreach ($udfsParameters as $key => $val)
|
||||
{
|
||||
$tmpValidate = success(true); // temporary variable used to store the returned value from _validateUDFs
|
||||
$tmpValidateArray = array(); // temporary variable used to store the returned value from _validateUDFs
|
||||
|
||||
// If this is the definition of this UDF
|
||||
if ($decodedUDFDefinition->{self::NAME} == $key)
|
||||
@@ -314,7 +433,7 @@ class UDFLib
|
||||
|
||||
if ($toBeValidated === true) // Checks if validation should be performed
|
||||
{
|
||||
$tmpValidate = $this->_validateUDFs(
|
||||
$tmpValidateArray = $this->_validateUDFs(
|
||||
$decodedUDFDefinition->{self::VALIDATION},
|
||||
$decodedUDFDefinition->{self::NAME},
|
||||
$val
|
||||
@@ -324,13 +443,13 @@ class UDFLib
|
||||
}
|
||||
|
||||
// If validation is ok copy the value that is to be stored into $toBeStoredUDFsArray
|
||||
if (isSuccess($tmpValidate))
|
||||
if (isEmptyArray($tmpValidateArray))
|
||||
{
|
||||
$toBeStoredUDFsArray[$key] = $val;
|
||||
}
|
||||
else // otherwise store the validation error in $notValidUDFsArray
|
||||
else // otherwise store the validation errors in $notValidUDFsArray
|
||||
{
|
||||
$notValidUDFsArray[] = $tmpValidate;
|
||||
$notValidUDFsArray = array_merge($notValidUDFsArray, $tmpValidateArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,11 +463,11 @@ class UDFLib
|
||||
}
|
||||
|
||||
// If the validation of all the supplied UDFs is ok
|
||||
if (count($notValidUDFsArray) == 0)
|
||||
if (isEmptyArray($notValidUDFsArray))
|
||||
{
|
||||
// An update is performed, then in this case it preserves the values
|
||||
// of the UDF that are not updated
|
||||
if (is_array($udfValues) && count($udfValues) > 0)
|
||||
if (!isEmptyArray($udfValues))
|
||||
{
|
||||
foreach ($udfValues as $fieldName => $fieldValue)
|
||||
{
|
||||
@@ -379,7 +498,7 @@ class UDFLib
|
||||
/**
|
||||
* isUDFColumn
|
||||
*/
|
||||
public function isUDFColumn($columnName, $columnType)
|
||||
public function isUDFColumn($columnName, $columnType = self::COLUMN_TYPE)
|
||||
{
|
||||
$isUDFColumn = false;
|
||||
|
||||
@@ -466,7 +585,7 @@ class UDFLib
|
||||
/**
|
||||
* Save UDFs
|
||||
*/
|
||||
public function saveUDFs($udfUniqueId, $udfs)
|
||||
public function saveUDFs($udfs)
|
||||
{
|
||||
// Read the all session for this udf widget
|
||||
$session = $this->getSession();
|
||||
@@ -490,30 +609,80 @@ class UDFLib
|
||||
// Returns the result of the database update operation to save UDFs
|
||||
return $dbModel->update(
|
||||
array($session[self::PRIMARY_KEY_NAME] => $session[self::PRIMARY_KEY_VALUE]),
|
||||
(array)$udfs
|
||||
get_object_vars($udfs)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if at least one of the permissions given as parameter (requiredPermissions) belongs
|
||||
* to the authenticated user, if confirmed then is allowed to use this UDFWidget.
|
||||
* If the parameter requiredPermissions is NOT given or is not present in the session,
|
||||
* then NO one is allow to use this UDFWidget
|
||||
* Wrapper method to permissionlib->hasAtLeastOne
|
||||
*/
|
||||
public function isAllowed($requiredPermissions = null)
|
||||
{
|
||||
$this->_ci->load->library('PermissionLib'); // Load permission library
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
//
|
||||
|
||||
/**
|
||||
* Checks if at least one of the permissions given as parameter belongs to the authenticated user in read mode
|
||||
* Wrapper method to permissionlib->hasAtLeastOne
|
||||
*/
|
||||
private function _readAllowed($requiredPermissions)
|
||||
{
|
||||
$readAllowed = false;
|
||||
|
||||
// If the user is logged then it is possible to check the permissions
|
||||
if (isLogged())
|
||||
{
|
||||
$this->_ci->load->library('PermissionLib'); // Load permission library
|
||||
|
||||
$readAllowed = $this->_ci->permissionlib->hasAtLeastOne(
|
||||
$requiredPermissions,
|
||||
self::PERMISSION_TABLE_METHOD,
|
||||
self::PERMISSION_TYPE_READ
|
||||
);
|
||||
} // otherwise it is not possible to check the permissions
|
||||
|
||||
return $readAllowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if at least one of the permissions given as parameter belongs to the authenticated user in write mode
|
||||
* Wrapper method to permissionlib->hasAtLeastOne
|
||||
*/
|
||||
private function _writeAllowed($requiredPermissions)
|
||||
{
|
||||
$writeAllowed = false;
|
||||
|
||||
// If the user is logged then it is possible to check the permissions
|
||||
if (isLogged())
|
||||
{
|
||||
$this->_ci->load->library('PermissionLib'); // Load permission library
|
||||
|
||||
$writeAllowed = $this->_ci->permissionlib->hasAtLeastOne(
|
||||
$requiredPermissions,
|
||||
self::PERMISSION_TABLE_METHOD,
|
||||
self::PERMISSION_TYPE_WRITE
|
||||
);
|
||||
} // otherwise it is not possible to check the permissions
|
||||
|
||||
return $writeAllowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array of required permissions for a UDF into the session
|
||||
*/
|
||||
private function _setRequiredPermissions($udfName, $permissions)
|
||||
{
|
||||
// Get the session for this UDFWidget
|
||||
$session = $this->getSession();
|
||||
|
||||
// If does _not_ exist yet in the session
|
||||
if (!isset($session[self::REQUIRED_PERMISSIONS_PARAMETER]))
|
||||
{
|
||||
$session[self::REQUIRED_PERMISSIONS_PARAMETER] = array();
|
||||
}
|
||||
|
||||
// Set the required permission in the session for this UDFWidget
|
||||
$session[self::REQUIRED_PERMISSIONS_PARAMETER][$udfName] = $permissions;
|
||||
|
||||
// Write into the session
|
||||
$this->setSession($session);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the block for UDFs
|
||||
@@ -544,12 +713,12 @@ class UDFLib
|
||||
{
|
||||
$udfsParameters = array();
|
||||
|
||||
foreach ($data as $key => $val)
|
||||
foreach ($data as $columnName => $columnValue)
|
||||
{
|
||||
if (substr($key, 0, 4) == self::COLUMN_PREFIX)
|
||||
if ($this->isUDFColumn($columnName))
|
||||
{
|
||||
$udfsParameters[$key] = $val; // stores UDF value into property UDFs
|
||||
unset($data[$key]); // remove from data
|
||||
$udfsParameters[$columnName] = $columnValue; // stores UDF value into property UDFs
|
||||
unset($data[$columnName]); // remove from data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,29 +814,39 @@ class UDFLib
|
||||
}
|
||||
}
|
||||
|
||||
// If no UDF validation errors were raised, it's a success!!
|
||||
if (count($returnArrayValidation) == 0)
|
||||
{
|
||||
$returnArrayValidation = success(true);
|
||||
}
|
||||
|
||||
return $returnArrayValidation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name and id attribute of the HTML element
|
||||
*/
|
||||
private function _setNameAndId($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
/**
|
||||
* Disable the HTML element if in read only mode
|
||||
*/
|
||||
private function _setReadOnly($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
// If write permissions _not_ exist then set the field as disabled
|
||||
if (!$this->_writeAllowed($jsonSchema->{self::REQUIRED_PERMISSIONS_PARAMETER}))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::DISABLED] = HTMLWidget::DISABLED; // any values is fine
|
||||
}
|
||||
else // otherwise restore to default
|
||||
{
|
||||
if (isset($htmlParameters[HTMLWidget::DISABLED])) unset($htmlParameters[HTMLWidget::DISABLED]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name and id attribute of the HTML element
|
||||
*/
|
||||
private function _setNameAndId($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
$htmlParameters[HTMLWidget::HTML_ID] = $jsonSchema->{self::NAME};
|
||||
$htmlParameters[HTMLWidget::HTML_NAME] = $jsonSchema->{self::NAME};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the list of UDF by sort property
|
||||
*/
|
||||
private function _sortJsonSchemas(&$jsonSchemasArray)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the list of UDF by sort property
|
||||
*/
|
||||
private function _sortJsonSchemas(&$jsonSchemasArray)
|
||||
{
|
||||
usort($jsonSchemasArray, function ($a, $b) {
|
||||
if (!isset($a->{self::SORT}))
|
||||
{
|
||||
@@ -684,13 +863,13 @@ class UDFLib
|
||||
|
||||
return ($a->{self::SORT} < $b->{self::SORT}) ? -1 : 1;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the UDF description by the given schema and table
|
||||
*/
|
||||
private function _loadUDF($schema, $table)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the UDF description by the given schema and table
|
||||
*/
|
||||
private function _loadUDF($schema, $table)
|
||||
{
|
||||
// Loads UDF model
|
||||
$this->_ci->load->model('system/UDF_model', 'UDFModel');
|
||||
|
||||
@@ -703,18 +882,7 @@ class UDFLib
|
||||
|
||||
if (isError($udfResults))
|
||||
{
|
||||
if (is_object($udfResults) && isset($udfResults->retval))
|
||||
{
|
||||
show_error(getError($udfResults));
|
||||
}
|
||||
elseif (is_string($udfResults))
|
||||
{
|
||||
show_error($udfResults);
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('UDFWidget: generic error occurred');
|
||||
}
|
||||
show_error(getError($udfResults));
|
||||
}
|
||||
elseif (!hasData($udfResults))
|
||||
{
|
||||
@@ -722,13 +890,13 @@ class UDFLib
|
||||
}
|
||||
|
||||
return $udfResults;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the HTML for the UDF
|
||||
*/
|
||||
private function _render($jsonSchema, &$widgetData)
|
||||
{
|
||||
/**
|
||||
* Render the HTML for the UDF
|
||||
*/
|
||||
private function _render($jsonSchema, &$widgetData)
|
||||
{
|
||||
// Checkbox
|
||||
if ($jsonSchema->{self::TYPE} == 'checkbox')
|
||||
{
|
||||
@@ -759,11 +927,11 @@ class UDFLib
|
||||
{
|
||||
$this->_renderDropdown($jsonSchema, $widgetData, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropdown element
|
||||
*/
|
||||
/**
|
||||
* Renders a dropdown element
|
||||
*/
|
||||
private function _renderDropdown($jsonSchema, &$widgetData, $multiple = false)
|
||||
{
|
||||
// Selected element/s
|
||||
@@ -792,7 +960,7 @@ class UDFLib
|
||||
$queryResult = $this->_ci->UDFModel->execReadOnlyQuery($jsonSchema->{self::LIST_VALUES}->sql);
|
||||
if (hasData($queryResult))
|
||||
{
|
||||
$parameters = $queryResult->retval;
|
||||
$parameters = getData($queryResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,8 +973,8 @@ class UDFLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a textarea element
|
||||
*/
|
||||
* Renders a textarea element
|
||||
*/
|
||||
private function _renderTextarea($jsonSchema, &$widgetData)
|
||||
{
|
||||
$text = null; // text value
|
||||
@@ -823,8 +991,8 @@ class UDFLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an input text element
|
||||
*/
|
||||
* Renders an input text element
|
||||
*/
|
||||
private function _renderTextfield($jsonSchema, &$widgetData)
|
||||
{
|
||||
$text = null; // text value
|
||||
@@ -841,8 +1009,8 @@ class UDFLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a checkbox element
|
||||
*/
|
||||
* Renders a checkbox element
|
||||
*/
|
||||
private function _renderCheckbox($jsonSchema, &$widgetData)
|
||||
{
|
||||
// Set checkbox value if present in the DB
|
||||
@@ -861,11 +1029,11 @@ class UDFLib
|
||||
$checkboxWidgetUDF->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the attributes of the HTML element using the phrases system
|
||||
*/
|
||||
private function _setAttributesWithPhrases($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
/**
|
||||
* Sets the attributes of the HTML element using the phrases system
|
||||
*/
|
||||
private function _setAttributesWithPhrases($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
// By default set to null all the attributes
|
||||
$htmlParameters[HTMLWidget::LABEL] = null;
|
||||
$htmlParameters[HTMLWidget::TITLE] = null;
|
||||
@@ -893,7 +1061,7 @@ class UDFLib
|
||||
);
|
||||
if (hasData($tmpResult))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::LABEL] = $tmpResult->retval[0]->text;
|
||||
$htmlParameters[HTMLWidget::LABEL] = getData($tmpResult)[0]->text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,7 +1079,7 @@ class UDFLib
|
||||
);
|
||||
if (hasData($tmpResult))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::TITLE] = $tmpResult->retval[0]->text;
|
||||
$htmlParameters[HTMLWidget::TITLE] = getData($tmpResult)[0]->text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -929,17 +1097,17 @@ class UDFLib
|
||||
);
|
||||
if (hasData($tmpResult))
|
||||
{
|
||||
$htmlParameters[HTMLWidget::PLACEHOLDER] = $tmpResult->retval[0]->text;
|
||||
$htmlParameters[HTMLWidget::PLACEHOLDER] = getData($tmpResult)[0]->text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the validation attributes of the HTML element using the configuration inside the json schema
|
||||
*/
|
||||
private function _setValidationAttributes($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
/**
|
||||
* Sets the validation attributes of the HTML element using the configuration inside the json schema
|
||||
*/
|
||||
private function _setValidationAttributes($jsonSchema, &$htmlParameters)
|
||||
{
|
||||
// Validation attributes set by default to null
|
||||
$htmlParameters[HTMLWidget::REGEX] = null;
|
||||
$htmlParameters[HTMLWidget::REQUIRED] = null;
|
||||
@@ -998,3 +1166,4 @@ class UDFLib
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ class VorlageLib
|
||||
if (!hasData($vorlage))
|
||||
{
|
||||
// Builds where clause
|
||||
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
|
||||
$where = $this->_where($vorlage_kurzbz);
|
||||
|
||||
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
|
||||
'public',
|
||||
@@ -134,20 +134,11 @@ class VorlageLib
|
||||
/**
|
||||
* _where
|
||||
*/
|
||||
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
|
||||
private function _where($vorlage_kurzbz)
|
||||
{
|
||||
// Builds where clause
|
||||
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
|
||||
|
||||
if (is_null($sprache))
|
||||
{
|
||||
$where .= " AND sprache IS NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
|
||||
}
|
||||
|
||||
$where .= " AND aktiv = true";
|
||||
|
||||
return $where;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Bisio Zweck does not exist
|
||||
*/
|
||||
class CORE_INOUT_0001 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
// get all bisio Zwecke
|
||||
$this->_ci->BisiozweckModel->addSelect('1');
|
||||
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisiozweckRes))
|
||||
return $bisiozweckRes;
|
||||
|
||||
if (hasData($bisiozweckRes))
|
||||
return success(true); // resolved if bisio Zweck exists
|
||||
else
|
||||
return success(false); // not resolved if no bisio zweck
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* More than one Zweck for incoming
|
||||
*/
|
||||
class CORE_INOUT_0002 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
// get all bisio Zwecke
|
||||
$this->_ci->BisiozweckModel->addSelect('1');
|
||||
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisiozweckRes))
|
||||
return $bisiozweckRes;
|
||||
|
||||
if (hasData($bisiozweckRes))
|
||||
{
|
||||
if (count(getData($bisiozweckRes)) <= 1) // resolved if one bisio Zweck
|
||||
return success(true);
|
||||
else
|
||||
return success(false); // otherwise not resolved
|
||||
}
|
||||
else
|
||||
return success(true); // resolved if no bisio zweck
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Invalid Zweck for incoming
|
||||
*/
|
||||
class CORE_INOUT_0003 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisiozweck_model', 'BisiozweckModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->BisiozweckModel->addSelect('zweck_code');
|
||||
$bisiozweckRes = $this->_ci->BisiozweckModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisiozweckRes))
|
||||
return $bisiozweckRes;
|
||||
|
||||
if (hasData($bisiozweckRes))
|
||||
{
|
||||
$bisiozweckData = getData($bisiozweckRes);
|
||||
|
||||
// resolved if Zweck is 1, 2 or 3
|
||||
if (count($bisiozweckData) == 1 && !in_array($bisiozweckData[0]->zweck_code, array(1, 2, 3)))
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Aufenthaltsförderung must exist if certain length of outgoing stay is exceeded
|
||||
*/
|
||||
class CORE_INOUT_0004 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->AufenthaltfoerderungModel->addSelect('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code');
|
||||
$this->_ci->AufenthaltfoerderungModel->addJoin('bis.tbl_bisio_aufenthaltfoerderung', 'aufenthaltfoerderung_code');
|
||||
$this->_ci->AufenthaltfoerderungModel->addOrder('tbl_aufenthaltfoerderung.aufenthaltfoerderung_code');
|
||||
$bisioFoerderungRes = $this->_ci->AufenthaltfoerderungModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisioFoerderungRes))
|
||||
return $bisioFoerderungRes;
|
||||
|
||||
if (hasData($bisioFoerderungRes))
|
||||
{
|
||||
// resolved if Aufenthaltsfoerderung exists
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
||||
|
||||
// get Bisio Aufenthaltsdauer
|
||||
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
||||
|
||||
if (isError($aufenthaltsdauerRes))
|
||||
return $aufenthaltsdauerRes;
|
||||
|
||||
if (hasData($aufenthaltsdauerRes))
|
||||
{
|
||||
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
||||
|
||||
// check if stay >= 29 days. If yes and no Aufenthaltsfoerderung - not resolved
|
||||
if ($aufenthaltsdauer >= 29)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else // no Aufenthaltsdauer - not resolved
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ECTS angerechnet must exist for outgoing if longer stay
|
||||
*/
|
||||
class CORE_INOUT_0005 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_ci->load->model('codex/Bisio_model', 'BisioModel');
|
||||
|
||||
// get all Zwecke
|
||||
$this->_ci->BisioModel->addSelect('ects_angerechnet');
|
||||
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisioRes))
|
||||
return $bisioRes;
|
||||
|
||||
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_angerechnet))
|
||||
{
|
||||
// resolved if ects exists
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get Bisio Aufenthaltsdauer
|
||||
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
||||
|
||||
if (isError($aufenthaltsdauerRes))
|
||||
return $aufenthaltsdauerRes;
|
||||
|
||||
if (hasData($aufenthaltsdauerRes))
|
||||
{
|
||||
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
||||
|
||||
// check if stay >= 29 days. If yes and no ects - not resolved
|
||||
if ($aufenthaltsdauer >= 29)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else // no Aufenthaltsdauer - not resolved
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ECTS erworben must exist for outgoing if longer stay
|
||||
*/
|
||||
class CORE_INOUT_0006 implements IIssueResolvedChecker
|
||||
{
|
||||
public function checkIfIssueIsResolved($params)
|
||||
{
|
||||
if (!isset($params['bisio_id']) || !is_numeric($params['bisio_id']))
|
||||
return error('Bisio Id missing, issue_id: '.$params['issue_id']);
|
||||
|
||||
$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');
|
||||
$bisioRes = $this->_ci->BisioModel->loadWhere(array('bisio_id' => $params['bisio_id']));
|
||||
|
||||
if (isError($bisioRes))
|
||||
return $bisioRes;
|
||||
|
||||
if (hasData($bisioRes) && !isEmptyString(getData($bisioRes)[0]->ects_erworben))
|
||||
{
|
||||
// resolved if ects exists
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// get Bisio Aufenthaltsdauer
|
||||
$aufenthaltsdauerRes = $this->_ci->BisioModel->getAufenthaltsdauer($params['bisio_id']);
|
||||
|
||||
if (isError($aufenthaltsdauerRes))
|
||||
return $aufenthaltsdauerRes;
|
||||
|
||||
if (hasData($aufenthaltsdauerRes))
|
||||
{
|
||||
$aufenthaltsdauer = getData($aufenthaltsdauerRes);
|
||||
|
||||
// check if stay >= 29 days. If yes and no ects - not resolved
|
||||
if ($aufenthaltsdauer >= 29)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else // no Aufenthaltsdauer - not resolved
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV Datum in future
|
||||
*/
|
||||
class CORE_ZGV_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
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvdatum');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$zgvdatum = getData($prestudentRes)[0]->zgvdatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes after today
|
||||
if ($zgvdatum > date('Y-m-d'))
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV Datum must be after Geburtsdatum
|
||||
*/
|
||||
class CORE_ZGV_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
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvdatum, gebdatum');
|
||||
$this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudentData = getData($prestudentRes)[0];
|
||||
|
||||
$zgvdatum = $prestudentData->zgvdatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
$gebdatum = $prestudentData->gebdatum;
|
||||
|
||||
if (isEmptyString($gebdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes before geburtsdatum
|
||||
if ($zgvdatum < $gebdatum)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV master Datum in future
|
||||
*/
|
||||
class CORE_ZGV_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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvmadatum');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$zgvdatum = getData($prestudentRes)[0]->zgvmadatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes after today
|
||||
if ($zgvdatum > date('Y-m-d'))
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV Datum should not be after ZGV master Datum
|
||||
*/
|
||||
class CORE_ZGV_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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvdatum, zgvmadatum');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudentData = getData($prestudentRes)[0];
|
||||
|
||||
// get and compare zgvdatum and zgvmadatum
|
||||
$zgvdatum = $prestudentData->zgvdatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
$zgvmadatum = $prestudentData->zgvmadatum;
|
||||
|
||||
if (isEmptyString($zgvmadatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvmadatum comes after zgvdatum
|
||||
if ($zgvmadatum < $zgvdatum)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ZGV master Datum before Geburtsdatum
|
||||
*/
|
||||
class CORE_ZGV_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']);
|
||||
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// get zgvdatum and geburtsdatum of prestudent
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$this->_ci->PrestudentModel->addSelect('zgvmadatum, gebdatum');
|
||||
$this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id');
|
||||
$prestudentRes = $this->_ci->PrestudentModel->load($params['prestudent_id']);
|
||||
|
||||
if (isError($prestudentRes))
|
||||
return $prestudentRes;
|
||||
|
||||
if (hasData($prestudentRes))
|
||||
{
|
||||
$prestudentData = getData($prestudentRes)[0];
|
||||
|
||||
$zgvdatum = $prestudentData->zgvmadatum;
|
||||
|
||||
if (isEmptyString($zgvdatum))
|
||||
return success(false);
|
||||
|
||||
$gebdatum = $prestudentData->gebdatum;
|
||||
|
||||
if (isEmptyString($gebdatum))
|
||||
return success(false);
|
||||
|
||||
// check if zgvdatum comes before geburtsdatum
|
||||
if ($zgvdatum < $gebdatum)
|
||||
return success(false);
|
||||
else
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Aufenthaltfoerderung_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'bis.tbl_aufenthaltfoerderung';
|
||||
$this->pk = 'aufenthaltfoerderung_code';
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,37 @@ class Bisio_model extends DB_Model
|
||||
$this->dbTable = 'bis.tbl_bisio';
|
||||
$this->pk = 'bisio_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets duration of stay in days by bisio_id.
|
||||
* @param int $bisio_id
|
||||
* @return object success with number of days or error
|
||||
*/
|
||||
public function getAufenthaltsdauer($bisio_id)
|
||||
{
|
||||
// get from and to date
|
||||
$this->addSelect('von, bis');
|
||||
$bisioRes = $this->load($bisio_id);
|
||||
|
||||
if (isError($bisioRes))
|
||||
return $bisioRes;
|
||||
|
||||
if (hasData($bisioRes))
|
||||
{
|
||||
$bisioData = getData($bisioRes)[0];
|
||||
|
||||
$avon = $bisioData->von;
|
||||
$abis = $bisioData->bis;
|
||||
|
||||
if (is_null($avon) || is_null($abis))
|
||||
return success("Von or bis date not set");
|
||||
|
||||
$vonDate = new DateTime($avon);
|
||||
$bisDate = new DateTime($abis);
|
||||
$interval = $vonDate->diff($bisDate);
|
||||
return success($interval->days);
|
||||
}
|
||||
else
|
||||
return success("Bisio not found");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
class Oehbeitrag_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'bis.tbl_oehbeitrag';
|
||||
$this->pk = 'oehbeitrag_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets oehbeitrag data valid for a certain Studiensemester.
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @return object
|
||||
*/
|
||||
public function getByStudiensemester($studiensemester_kurzbz)
|
||||
{
|
||||
$qry = "WITH semstart AS (
|
||||
SELECT start FROM public.tbl_studiensemester
|
||||
WHERE studiensemester_kurzbz = ?
|
||||
)
|
||||
SELECT * FROM bis.tbl_oehbeitrag oehb
|
||||
JOIN public.tbl_studiensemester semvon ON oehb.von_studiensemester_kurzbz = semvon.studiensemester_kurzbz
|
||||
LEFT JOIN public.tbl_studiensemester sembis ON oehb.bis_studiensemester_kurzbz = sembis.studiensemester_kurzbz
|
||||
JOIN semstart ON semstart.start::date >= semvon.start::date AND (sembis.studiensemester_kurzbz IS NULL OR semstart.start::date <= sembis.start::date)
|
||||
ORDER BY semvon.start
|
||||
LIMIT 1";
|
||||
|
||||
return $this->execQuery($qry, array($studiensemester_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all Studiensemester for which no Oehbeitrag value assignment exists.
|
||||
* @param string $start_studiensemester_kurzbz semester before the given semester are ignored
|
||||
* @param array $excluded_oehbeitrag_id oehbeitraege to be ignored, i.e. which are assigned
|
||||
* @return object
|
||||
*/
|
||||
public function getUnassignedStudiensemester($start_studiensemester_kurzbz, $excluded_oehbeitrag_id = array())
|
||||
{
|
||||
$params = array($start_studiensemester_kurzbz);
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_studiensemester sem
|
||||
WHERE sem.start >= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?)
|
||||
AND NOT EXISTS (SELECT 1 FROM bis.tbl_oehbeitrag oeh
|
||||
JOIN public.tbl_studiensemester oeh_von ON oeh.von_studiensemester_kurzbz = oeh_von.studiensemester_kurzbz
|
||||
LEFT JOIN public.tbl_studiensemester oeh_bis ON oeh.bis_studiensemester_kurzbz = oeh_bis.studiensemester_kurzbz
|
||||
WHERE sem.start::date >= oeh_von.start::date AND (sem.start::date <= oeh_bis.start::date OR oeh_bis.studiensemester_kurzbz IS NULL)";
|
||||
|
||||
if (!isEmptyArray($excluded_oehbeitrag_id))
|
||||
{
|
||||
$qry .= " AND oehbeitrag_id NOT IN ?";
|
||||
$params[] = $excluded_oehbeitrag_id;
|
||||
}
|
||||
|
||||
$qry .= ") ORDER BY sem.start";
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a Öhbeitrag can be assigned for a Studiensemester range.
|
||||
* @param string $von_studiensemester_kurzbz
|
||||
* @param string $bis_studiensemester_kurzbz
|
||||
* @param array $excluded_oehbeitrag_id oehbeitraege to ignore, i.e. which are assignable
|
||||
* @return object array with true if assignable, with false if not
|
||||
*/
|
||||
public function checkIfStudiensemesterAssignable($von_studiensemester_kurzbz, $bis_studiensemester_kurzbz = null, $excluded_oehbeitrag_id = array())
|
||||
{
|
||||
$params = array($von_studiensemester_kurzbz);
|
||||
|
||||
$allStdSemSpanQry = "SELECT count(studiensemester_kurzbz) as number_assigned FROM public.tbl_studiensemester sem
|
||||
WHERE start >= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?)";
|
||||
|
||||
if ($bis_studiensemester_kurzbz != null)
|
||||
{
|
||||
$allStdSemSpanQry .= " AND (start <= (SELECT start FROM public.tbl_studiensemester WHERE studiensemester_kurzbz = ?))";
|
||||
$params[] = $bis_studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
$allStdSemSpanQry .= " AND EXISTS (SELECT 1 FROM bis.tbl_oehbeitrag
|
||||
JOIN public.tbl_studiensemester sem_von ON tbl_oehbeitrag.von_studiensemester_kurzbz = sem_von.studiensemester_kurzbz
|
||||
LEFT JOIN public.tbl_studiensemester sem_bis ON tbl_oehbeitrag.bis_studiensemester_kurzbz = sem_bis.studiensemester_kurzbz
|
||||
WHERE sem.start >= sem_von.start AND (sem.start <= sem_bis.start OR sem_bis.studiensemester_kurzbz IS NULL)";
|
||||
|
||||
if (!isEmptyArray($excluded_oehbeitrag_id))
|
||||
{
|
||||
$allStdSemSpanQry .= " AND oehbeitrag_id NOT IN ?";
|
||||
$params[] = $excluded_oehbeitrag_id;
|
||||
}
|
||||
|
||||
$allStdSemSpanQry .= ")";
|
||||
|
||||
$nrAssigned = $this->execQuery($allStdSemSpanQry, $params);
|
||||
|
||||
if (isError($nrAssigned))
|
||||
return $nrAssigned;
|
||||
|
||||
if (!hasData($nrAssigned))
|
||||
return error("Fehler bei Überprüfung der Möglichkeit der Semesterzuweisung");
|
||||
|
||||
return success(array(getData($nrAssigned)[0]->number_assigned == 0));
|
||||
}
|
||||
}
|
||||
@@ -18,45 +18,50 @@ class Konto_model extends DB_Model
|
||||
public function setPaid($buchungsnr)
|
||||
{
|
||||
// get payment
|
||||
$buchungResult = $this->loadWhere(array('buchungsnr' => $buchungsnr));
|
||||
$buchungResult = $this->loadWhere(array('buchungsnr' => $buchungsnr));
|
||||
|
||||
if(isSuccess($buchungResult) && hasData($buchungResult))
|
||||
if (isSuccess($buchungResult) && hasData($buchungResult))
|
||||
{
|
||||
$buchung = getData($buchungResult)[0];
|
||||
|
||||
// get already paid amount
|
||||
$this->addSelect('sum(betrag) as bezahlt');
|
||||
$this->addGroupBy('buchungsnr_verweis');
|
||||
$buchungVerweisResult = $this->loadWhere(array('buchungsnr_verweis' => $buchungsnr));
|
||||
$buchungVerweisResult = $this->loadWhere(array('buchungsnr_verweis' => $buchungsnr));
|
||||
|
||||
if(isSuccess($buchungVerweisResult))
|
||||
if (isSuccess($buchungVerweisResult))
|
||||
{
|
||||
if(hasData($buchungVerweisResult))
|
||||
{
|
||||
$betragBezahltResult = getData($buchungVerweisResult);
|
||||
$betragBezahlt = $betragBezahltResult->bezahlt;
|
||||
}
|
||||
else
|
||||
$betragBezahlt = 0;
|
||||
$betragBezahlt = 0;
|
||||
|
||||
$buchung = getData($buchungResult);
|
||||
$buchung = $buchung[0];
|
||||
if (hasData($buchungVerweisResult))
|
||||
{
|
||||
$betragBezahlt = getData($buchungVerweisResult)[0]->bezahlt;
|
||||
}
|
||||
|
||||
// calculate open amount
|
||||
$betragOffen = $betragBezahlt - $buchung->betrag*(-1);
|
||||
$betragOffen = $betragBezahlt - $buchung->betrag * (-1);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $buchung->person_id,
|
||||
'studiengang_kz' => $buchung->studiengang_kz,
|
||||
'studiensemester_kurzbz' => $buchung->studiensemester_kurzbz,
|
||||
'buchungsnr_verweis' => $buchungsnr,
|
||||
'betrag' => str_replace(',','.',$betragOffen*(-1)),
|
||||
'buchungsdatum' => date('Y-m-d'),
|
||||
'buchungstext' => $buchung->buchungstext,
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => '',
|
||||
'buchungstyp_kurzbz' => $buchung->buchungstyp_kurzbz,
|
||||
);
|
||||
if ($betragOffen != 0)
|
||||
{
|
||||
$data = array(
|
||||
'person_id' => $buchung->person_id,
|
||||
'studiengang_kz' => $buchung->studiengang_kz,
|
||||
'studiensemester_kurzbz' => $buchung->studiensemester_kurzbz,
|
||||
'buchungsnr_verweis' => $buchungsnr,
|
||||
'betrag' => str_replace(',', '.', $betragOffen * (-1)),
|
||||
'buchungsdatum' => date('Y-m-d'),
|
||||
'buchungstext' => $buchung->buchungstext,
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => '',
|
||||
'buchungstyp_kurzbz' => $buchung->buchungstyp_kurzbz,
|
||||
);
|
||||
|
||||
return $this->insert($data);
|
||||
return $this->insert($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -291,7 +291,7 @@ class Prestudent_model extends DB_Model
|
||||
$prestudentdata->prestudentstatus = $lastStatusData;
|
||||
|
||||
|
||||
if ($this->hasUDF())
|
||||
if ($this->udfsExistAndDefined())
|
||||
{
|
||||
$prestudentdata->prestudentUdfs = $this->getUDFs($prestudent_id);
|
||||
}
|
||||
@@ -611,7 +611,7 @@ class Prestudent_model extends DB_Model
|
||||
));
|
||||
}
|
||||
|
||||
public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester)
|
||||
public function getPrestudentByStudiengangAndPerson($studiengang, $person, $studienSemester, $abgeschickt)
|
||||
{
|
||||
$query = "SELECT ps.prestudent_id
|
||||
FROM public.tbl_prestudentstatus pss
|
||||
@@ -621,8 +621,49 @@ class Prestudent_model extends DB_Model
|
||||
WHERE ps.person_id = ?
|
||||
AND UPPER((sg.typ || sg.kurzbz) || ':' || sp.orgform_kurzbz) = ?
|
||||
AND pss.studiensemester_kurzbz = ?
|
||||
";
|
||||
AND";
|
||||
|
||||
if ($abgeschickt === 'true')
|
||||
$query .= " EXISTS";
|
||||
else
|
||||
$query .= " NOT EXISTS";
|
||||
|
||||
$query .= " (SELECT 1 FROM public.tbl_prestudentstatus spss
|
||||
JOIN public.tbl_prestudent sps USING(prestudent_id)
|
||||
WHERE sps.prestudent_id = ps.prestudent_id
|
||||
AND spss.bewerbung_abgeschicktamum IS NOT NULL)";
|
||||
|
||||
return $this->execQuery($query, array($person, $studiengang, $studienSemester));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets förderrelevant flag for a prestudent, from prestudent, or, if not set on prestudent level, from studiengang
|
||||
* @param int $prestudent_id
|
||||
* @return object
|
||||
*/
|
||||
public function getFoerderrelevant($prestudent_id)
|
||||
{
|
||||
$query = 'SELECT COALESCE (ps.foerderrelevant, stg.foerderrelevant) AS foerderrelevant
|
||||
FROM public.tbl_prestudent ps
|
||||
LEFT JOIN public.tbl_studiengang stg USING (studiengang_kz)
|
||||
WHERE prestudent_id = ?';
|
||||
|
||||
return $this->execQuery($query, array($prestudent_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets bis standort_code for a prestudent, from prestudent, or, if not set on prestudent level, from studiengang
|
||||
* @param int $prestudent_id
|
||||
* @return object
|
||||
*/
|
||||
public function getStandortCode($prestudent_id)
|
||||
{
|
||||
$query = 'SELECT COALESCE (ps.standort_code, stg.standort_code) AS standort_code
|
||||
FROM public.tbl_prestudent ps
|
||||
LEFT JOIN public.tbl_studiengang stg USING (studiengang_kz)
|
||||
WHERE prestudent_id = ?';
|
||||
|
||||
return $this->execQuery($query, array($prestudent_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,4 +11,29 @@ class Pruefung_model extends DB_Model
|
||||
$this->dbTable = 'campus.tbl_pruefung';
|
||||
$this->pk = 'pruefung_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Pruefungen of a person for a Studiensemester.
|
||||
* @param int $person_id
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @return object
|
||||
*/
|
||||
public function getByPerson($person_id, $studiensemester_kurzbz)
|
||||
{
|
||||
$qry = '
|
||||
SELECT prfg.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id,
|
||||
UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung
|
||||
FROM public.tbl_person pers
|
||||
JOIN public.tbl_prestudent prst USING (person_id)
|
||||
JOIN public.tbl_student USING (prestudent_id)
|
||||
JOIN lehre.tbl_pruefung prfg USING (student_uid)
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz
|
||||
WHERE pers.person_id = ?
|
||||
AND le.studiensemester_kurzbz = ?
|
||||
ORDER BY prfg.datum, pruefung_id';
|
||||
|
||||
return $this->execQuery($qry, array($person_id, $studiensemester_kurzbz));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,132 @@ class Zeugnisnote_model extends DB_Model
|
||||
$this->pk = array('studiensemester_kurzbz', 'student_uid', 'lehrveranstaltung_id');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ECTS sums of completed courses (Zeugnisnoten) of a person for a Studiensemester.
|
||||
* If no valid Noten for the course were entered, 0 ects is returned.
|
||||
* @param int $person_id
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @param bool $aktiv
|
||||
* @param bool $lehre
|
||||
* @param bool $offiziell
|
||||
* @param bool $positiv
|
||||
* @return object
|
||||
*/
|
||||
public function getEctsSumsByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
$qry = "SELECT DISTINCT ON (prst.prestudent_id) pers.matr_nr, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz,
|
||||
UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung, COALESCE(summen.summe_ects, 0) AS summe_ects
|
||||
FROM public.tbl_person pers
|
||||
JOIN public.tbl_prestudent prst USING (person_id)
|
||||
JOIN public.tbl_prestudentstatus prstst USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz
|
||||
LEFT JOIN (
|
||||
SELECT zgnisnote.student_uid, prestudent_id, zgnisnote.studiensemester_kurzbz, sum(ects) AS summe_ects
|
||||
FROM public.tbl_student
|
||||
LEFT JOIN lehre.tbl_zeugnisnote zgnisnote USING(student_uid)
|
||||
LEFT JOIN lehre.tbl_note note ON zgnisnote.note = note.note
|
||||
LEFT JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
WHERE TRUE";
|
||||
|
||||
if (isset($aktiv))
|
||||
{
|
||||
$qry .= ' AND (note.aktiv = ?)';
|
||||
$params[] = $aktiv;
|
||||
}
|
||||
|
||||
if (isset($lehre))
|
||||
{
|
||||
$qry .= ' AND (note.lehre = ?)';
|
||||
$params[] = $lehre;
|
||||
}
|
||||
|
||||
if (isset($offiziell))
|
||||
{
|
||||
$qry .= ' AND (note.offiziell = ?)';
|
||||
$params[] = $offiziell;
|
||||
}
|
||||
|
||||
if (isset($positiv))
|
||||
{
|
||||
$qry .= ' AND (note.positiv = ?)';
|
||||
$params[] = $positiv;
|
||||
}
|
||||
|
||||
$qry .= " GROUP BY zgnisnote.studiensemester_kurzbz, zgnisnote.student_uid, prestudent_id
|
||||
) summen ON prst.prestudent_id = summen.prestudent_id AND prstst.studiensemester_kurzbz = summen.studiensemester_kurzbz
|
||||
WHERE pers.person_id = ?
|
||||
AND prstst.studiensemester_kurzbz = ?
|
||||
ORDER BY prst.prestudent_id";
|
||||
|
||||
$params[] = $person_id;
|
||||
$params[] = $studiensemester_kurzbz;
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets courses (Zeugnisnoten) of a person for a Studiensemester.
|
||||
* @param int $person_id
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @param bool $aktiv
|
||||
* @param bool $lehre
|
||||
* @param bool $offiziell
|
||||
* @param bool $positiv
|
||||
* @param bool $zeugnis
|
||||
* @return object
|
||||
*/
|
||||
public function getByPerson($person_id, $studiensemester_kurzbz, $aktiv = true, $lehre = null, $offiziell = null, $positiv = null, $zeugnis = null)
|
||||
{
|
||||
$params = array($person_id, $studiensemester_kurzbz);
|
||||
|
||||
$qry = "SELECT zgnisnote.*, pers.matr_nr, lv.ects, stg.studiengang_kz, prst.prestudent_id, stg.erhalter_kz,
|
||||
UPPER(stg.typ||stg.kurzbz) AS studiengang, stg.bezeichnung AS studiengang_bezeichnung, note.note,
|
||||
note.bezeichnung AS note_bezeichnung
|
||||
FROM public.tbl_person pers
|
||||
JOIN public.tbl_prestudent prst USING (person_id)
|
||||
JOIN public.tbl_student USING (prestudent_id)
|
||||
JOIN lehre.tbl_zeugnisnote zgnisnote USING (student_uid)
|
||||
JOIN lehre.tbl_note note ON zgnisnote.note = note.note
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN public.tbl_studiengang stg ON prst.studiengang_kz = stg.studiengang_kz
|
||||
WHERE pers.person_id = ?
|
||||
AND zgnisnote.studiensemester_kurzbz = ?";
|
||||
|
||||
if (isset($aktiv))
|
||||
{
|
||||
$qry .= ' AND note.aktiv = ?';
|
||||
$params[] = $aktiv;
|
||||
}
|
||||
|
||||
if (isset($lehre))
|
||||
{
|
||||
$qry .= ' AND note.lehre = ?';
|
||||
$params[] = $lehre;
|
||||
}
|
||||
|
||||
if (isset($offiziell))
|
||||
{
|
||||
$qry .= ' AND note.offiziell = ?';
|
||||
$params[] = $offiziell;
|
||||
}
|
||||
|
||||
if (isset($positiv))
|
||||
{
|
||||
$qry .= ' AND note.positiv = ?';
|
||||
$params[] = $positiv;
|
||||
}
|
||||
|
||||
if (isset($zeugnis))
|
||||
{
|
||||
$qry .= ' AND lv.zeugnis = ?';
|
||||
$params[] = $zeugnis;
|
||||
}
|
||||
|
||||
$qry .= ' ORDER BY zgnisnote.benotungsdatum';
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,10 +448,11 @@ class Studiengang_model extends DB_Model
|
||||
|
||||
return $this->execQuery($query, array($typ));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Studiengangsleitung
|
||||
* @param null $studiengang_kz
|
||||
* Get Studiengangsleitung/en of Studiengang/Studiengaenge.
|
||||
*
|
||||
* @param null $studiengang_kz Numeric or Array
|
||||
* @return array
|
||||
*/
|
||||
public function getLeitung($studiengang_kz = null)
|
||||
@@ -460,7 +461,12 @@ class Studiengang_model extends DB_Model
|
||||
$this->addJoin('public.tbl_benutzerfunktion', 'oe_kurzbz');
|
||||
$this->addJoin('public.tbl_benutzer', 'uid');
|
||||
$this->addJoin('public.tbl_person', 'person_id');
|
||||
|
||||
|
||||
if (!is_numeric($studiengang_kz) && !is_array($studiengang_kz))
|
||||
{
|
||||
return error('Studiengangskennzahl ungültig');
|
||||
}
|
||||
|
||||
if (is_null($studiengang_kz))
|
||||
{
|
||||
$condition = '
|
||||
@@ -469,16 +475,21 @@ class Studiengang_model extends DB_Model
|
||||
AND ( datum_bis >= NOW() OR datum_bis IS NULL )
|
||||
';
|
||||
}
|
||||
elseif (is_numeric($studiengang_kz))
|
||||
elseif (is_numeric($studiengang_kz) || is_array($studiengang_kz))
|
||||
{
|
||||
if (is_array($studiengang_kz))
|
||||
{
|
||||
$studiengang_kz = array_map(array($this,'escape'), $studiengang_kz);
|
||||
$studiengang_kz = implode(', ', $studiengang_kz);
|
||||
}
|
||||
$condition = '
|
||||
funktion_kurzbz = \'Leitung\'
|
||||
AND ( datum_von <= NOW() OR datum_von IS NULL )
|
||||
AND ( datum_bis >= NOW() OR datum_bis IS NULL )
|
||||
AND studiengang_kz = ' . $this->db->escape($studiengang_kz)
|
||||
AND studiengang_kz IN (' . $studiengang_kz. ')';
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,34 +152,36 @@ class Person_model extends DB_Model
|
||||
*/
|
||||
public function getPersonStammdaten($person_id, $zustellung_only = false)
|
||||
{
|
||||
$this->addSelect('public.tbl_person.*, s.kurztext as staatsbuergerschaft, g.kurztext as geburtsnation');
|
||||
$this->addSelect('public.tbl_person.*, tbl_person.staatsbuergerschaft AS staatsbuergerschaft_code, tbl_person.geburtsnation AS geburtsnation_code,
|
||||
s.kurztext as staatsbuergerschaft, g.kurztext as geburtsnation');
|
||||
$this->addJoin('bis.tbl_nation s', 'public.tbl_person.staatsbuergerschaft = s.nation_code', 'LEFT');
|
||||
$this->addJoin('bis.tbl_nation g', 'public.tbl_person.geburtsnation = g.nation_code', 'LEFT');
|
||||
|
||||
$person = $this->load($person_id);
|
||||
|
||||
if($person->error) return $person;
|
||||
if (isError($person)) return $person;
|
||||
|
||||
//return null if not found
|
||||
if(count($person->retval) < 1)
|
||||
if (!hasData($person))
|
||||
return success(null);
|
||||
|
||||
$this->KontaktModel->addDistinct();
|
||||
$this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung');
|
||||
$this->KontaktModel->addSelect('kontakt_id, kontakttyp, anmerkung, kontakt, zustellung');
|
||||
$this->KontaktModel->addOrder('kontakttyp');
|
||||
$this->KontaktModel->addOrder('insertamum', 'DESC');
|
||||
$where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id);
|
||||
$kontakte = $this->KontaktModel->loadWhere($where);
|
||||
if($kontakte->error) return $kontakte;
|
||||
if (isError($kontakte)) return $kontakte;
|
||||
|
||||
$where = $zustellung_only === true ? array('person_id' => $person_id, 'zustelladresse' => true) : array('person_id' => $person_id);
|
||||
$this->AdresseModel->addSelect('public.tbl_adresse.*, bis.tbl_nation.kurztext AS nationkurztext');
|
||||
$this->AdresseModel->addJoin('bis.tbl_nation', 'tbl_adresse.nation = tbl_nation.nation_code', 'LEFT');
|
||||
$this->AdresseModel->addOrder('insertamum', 'DESC');
|
||||
$adressen = $this->AdresseModel->loadWhere($where);
|
||||
if($adressen->error) return $adressen;
|
||||
if (isError($adressen)) return $adressen;
|
||||
|
||||
$stammdaten = $person->retval[0];
|
||||
$stammdaten->kontakte = $kontakte->retval;
|
||||
$stammdaten->adressen = $adressen->retval;
|
||||
$stammdaten = getData($person)[0];
|
||||
$stammdaten->kontakte = hasData($kontakte) ? getData($kontakte) : array();
|
||||
$stammdaten->adressen = hasData($adressen) ? getData($adressen) : array();
|
||||
|
||||
return success($stammdaten);
|
||||
}
|
||||
@@ -263,4 +265,64 @@ class Person_model extends DB_Model
|
||||
|
||||
return success($result->vorname. ' '. $result->nachname);
|
||||
}
|
||||
|
||||
public function checkDuplicate($person_id)
|
||||
{
|
||||
$qry = "SELECT person_id
|
||||
FROM public.tbl_prestudent p
|
||||
JOIN
|
||||
(
|
||||
SELECT DISTINCT ON(prestudent_id) *
|
||||
FROM public.tbl_prestudentstatus
|
||||
WHERE prestudent_id IN
|
||||
(
|
||||
SELECT prestudent_id
|
||||
FROM public.tbl_prestudent
|
||||
WHERE person_id IN
|
||||
(
|
||||
SELECT p2.person_id
|
||||
FROM public.tbl_person p
|
||||
JOIN public.tbl_person p2
|
||||
ON p.vorname = p2.vorname
|
||||
AND p.nachname = p2.nachname
|
||||
AND p.gebdatum = p2.gebdatum
|
||||
AND p.person_id = ?
|
||||
)
|
||||
)
|
||||
ORDER BY prestudent_id, datum DESC, insertamum DESC
|
||||
) ps USING(prestudent_id)
|
||||
JOIN public.tbl_status USING(status_kurzbz)
|
||||
WHERE status_kurzbz = 'Interessent'
|
||||
AND studiengang_kz IN
|
||||
(
|
||||
SELECT studiengang_kz
|
||||
FROM public.tbl_prestudent p
|
||||
JOIN
|
||||
(
|
||||
SELECT DISTINCT ON(prestudent_id) *
|
||||
FROM public.tbl_prestudentstatus
|
||||
WHERE prestudent_id IN
|
||||
(
|
||||
SELECT prestudent_id
|
||||
FROM public.tbl_prestudent
|
||||
WHERE person_id IN
|
||||
(
|
||||
SELECT p2.person_id
|
||||
FROM public.tbl_person p
|
||||
JOIN public.tbl_person p2
|
||||
ON p.vorname = p2.vorname
|
||||
AND p.nachname = p2.nachname
|
||||
AND p.gebdatum = p2.gebdatum
|
||||
AND p.person_id = ?
|
||||
)
|
||||
)
|
||||
ORDER BY prestudent_id, datum DESC, insertamum DESC
|
||||
) ps USING(prestudent_id)
|
||||
JOIN public.tbl_status USING(status_kurzbz)
|
||||
WHERE status_kurzbz = 'Abbrecher'
|
||||
)
|
||||
";
|
||||
|
||||
return $this->execQuery($qry, array($person_id, $person_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class Betriebsmittelperson_model extends DB_Model
|
||||
* @param bool $isRetourniert False to retrieve only active Betriebsmittel.
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null)
|
||||
public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null, $onlyAktiveBenutzer=false)
|
||||
{
|
||||
if (!is_numeric($person_id))
|
||||
{
|
||||
@@ -28,8 +28,12 @@ class Betriebsmittelperson_model extends DB_Model
|
||||
|
||||
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
|
||||
|
||||
if( $onlyAktiveBenutzer ) {
|
||||
$this->addJoin('public.tbl_benutzer b', 'b.uid = wawi.tbl_betriebsmittelperson.uid AND b.aktiv = \'t\'');
|
||||
}
|
||||
|
||||
$condition = '
|
||||
person_id = '. $this->escape($person_id). '
|
||||
wawi.tbl_betriebsmittelperson.person_id = '. $this->escape($person_id). '
|
||||
';
|
||||
|
||||
if (is_string($betriebsmitteltyp)) {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Fehler_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'system.tbl_fehler';
|
||||
$this->pk = 'fehlercode';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
class Issue_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'system.tbl_issue';
|
||||
$this->pk = 'issue_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets issues which are open, i.e. not resolved.
|
||||
* @param array $fehlercodes only issues for given fehler are retrieved
|
||||
* @param int $person_id
|
||||
* @param string $oe_kurzbz
|
||||
* @param string $fehlercode_extern
|
||||
* @return object success with issues or error
|
||||
*/
|
||||
public function getOpenIssues($fehlercodes, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null)
|
||||
{
|
||||
$params = array($fehlercodes);
|
||||
// issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet
|
||||
$qry = 'SELECT issue_id, fehlercode, inhalt, fehlercode_extern, inhalt_extern, person_id, oe_kurzbz,
|
||||
behebung_parameter, datum, verarbeitetvon, verarbeitetamum
|
||||
FROM system.tbl_issue
|
||||
WHERE fehlercode IN ?
|
||||
AND verarbeitetamum IS NULL';
|
||||
|
||||
if (!isEmptyString($fehlercode_extern))
|
||||
{
|
||||
$qry .= ' AND fehlercode_extern = ?';
|
||||
$params[] = $fehlercode_extern;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= ' AND person_id = ?';
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($oe_kurzbz))
|
||||
{
|
||||
$qry .= ' AND oe_kurzbz = ?';
|
||||
$params[] = $oe_kurzbz;
|
||||
}
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of open (non-resolved) issues.
|
||||
* @param string $fehlercode unique error code
|
||||
* @param int $person_id if provided, only issues with this person_id are counted.
|
||||
* @param string $oe_kurzbz if provided, only issues with this oe_kurzbz are counted.
|
||||
* @param string $fehlercode_extern if provided, only issues with this external fehlercode are counted (for identifying issues from external systems).
|
||||
* @return Object success with number of issues or error
|
||||
*/
|
||||
public function getOpenIssueCount($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null)
|
||||
{
|
||||
$params = array($fehlercode);
|
||||
// issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet
|
||||
$qry = 'SELECT count(*) as anzahl_open_issues FROM system.tbl_issue
|
||||
WHERE fehlercode = ?
|
||||
AND verarbeitetamum IS NULL';
|
||||
|
||||
if (!isEmptyString($fehlercode_extern))
|
||||
{
|
||||
$qry .= ' AND fehlercode_extern = ?';
|
||||
$params[] = $fehlercode_extern;
|
||||
}
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$qry .= ' AND person_id = ?';
|
||||
$params[] = $person_id;
|
||||
}
|
||||
|
||||
if (isset($oe_kurzbz))
|
||||
{
|
||||
$qry .= ' AND oe_kurzbz = ?';
|
||||
$params[] = $oe_kurzbz;
|
||||
}
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'ÖH-Beitragsverwaltung',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'tablesorter' => true,
|
||||
'dialoglib' => true,
|
||||
'ajaxlib' => true,
|
||||
'navigationwidget' => true,
|
||||
'phrases' => array(
|
||||
'person' => array('vorname', 'nachname'),
|
||||
'global' => array('unbeschraenkt'),
|
||||
'ui' => array('bearbeiten', 'loeschen', 'speichern', 'entfernen'),
|
||||
'oehbeitrag' => array('oehbeitraegeFestgelegt', 'fehlerHolenOehbeitraege', 'fehlerHolenSemester',
|
||||
'fehlerHinzufuegenOehbeitrag', 'fehlerAktualisierenOehbeitrag',
|
||||
'fehlerLoeschenOehbeitrag')
|
||||
),
|
||||
'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/codex/oehbeitrag.css'),
|
||||
'customJSs' => array('public/js/tablesort/tablesort.js', 'public/js/codex/oehbeitrag.js')
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="page-header">
|
||||
<?php echo $this->p->t('oehbeitrag', 'oehbeitragsVerwaltung') ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button class="btn btn-default" id="addNewOeh"><?php echo $this->p->t('oehbeitrag', 'oehbeitragHinzufuegen') ?></button>
|
||||
<br />
|
||||
<br />
|
||||
<table class="table table-bordered table-condensed" id="oehbeitraegeTbl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo ucfirst($this->p->t('global', 'gueltigVon')) ?></th>
|
||||
<th><?php echo ucfirst($this->p->t('global', 'gueltigBis')) ?></th>
|
||||
<th><?php echo ucfirst($this->p->t('oehbeitrag', 'studierendenbetrag')) ?></th>
|
||||
<th><?php echo ucfirst($this->p->t('oehbeitrag', 'versicherungsbetrag')) ?></th>
|
||||
<th id="actionHeading"><?php echo ucfirst($this->p->t('ui', 'aktion')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -25,7 +25,8 @@ $this->load->view(
|
||||
'bitteBegruendungAngeben',
|
||||
'empfehlungWurdeAngefordert',
|
||||
'anrechnungenWurdenGenehmigt',
|
||||
'anrechnungenWurdenAbgelehnt'
|
||||
'anrechnungenWurdenAbgelehnt',
|
||||
'nurLeseberechtigung'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
@@ -72,7 +73,7 @@ $this->load->view(
|
||||
</div>
|
||||
<!--end header -->
|
||||
|
||||
<div class="row">
|
||||
<div class="row" id="approveAnrechnungDetail-generell" data-readonly="<?php echo json_encode($hasReadOnlyAccess)?>">
|
||||
<div class="col-xs-8">
|
||||
<!-- Antragsdaten -->
|
||||
<div class="row">
|
||||
|
||||
@@ -48,7 +48,8 @@ $this->load->view(
|
||||
'empfehlungWurdeAngefordert',
|
||||
'empfehlungWurdeAngefordertAusnahmeWoKeineLektoren',
|
||||
'anrechnungenWurdenGenehmigt',
|
||||
'anrechnungenWurdenAbgelehnt'
|
||||
'anrechnungenWurdenAbgelehnt',
|
||||
'nurLeseberechtigung'
|
||||
),
|
||||
'person' => array(
|
||||
'student',
|
||||
@@ -101,7 +102,7 @@ $this->load->view(
|
||||
<!-- dropdown studiensemester -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formApproveAnrechnungUebersicht" class="form-inline" action="" method="get">
|
||||
<form id="formApproveAnrechnungUebersicht" class="form-inline" action="" method="get" data-readonly="<?php echo json_encode($hasReadOnlyAccess)?>" data-createaccess="<?php echo json_encode($hasCreateAnrechnungAccess)?>">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
@@ -226,7 +227,7 @@ $this->load->view(
|
||||
class='fa fa-times'></i>
|
||||
</button>
|
||||
</div>
|
||||
<a type="button" class="btn btn-default" style="margin-left: 20px;" href='<?php echo site_url('lehre/anrechnung/createAnrechnung') ?>' target='_blank'>
|
||||
<a type="button" id="approveAnrechnungUebersicht-create-anrechnung" class="btn btn-default" style="margin-left: 20px;" href='<?php echo site_url('lehre/anrechnung/createAnrechnung') ?>' target='_blank'>
|
||||
<i class='fa fa-plus' aria-hidden='true'></i> <?php echo $this->p->t('global', 'antragAnlegen'); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$ORGANISATIONSEINHEIT = (isset($organisationseinheit_selected) && !is_null($organisationseinheit_selected)) ? array($organisationseinheit_selected) : $organisationseinheit;
|
||||
$AUSBILDUNGSSEMESTER = (isset($ausbildungssemester_selected) && !is_null($ausbildungssemester_selected)) ? $ausbildungssemester_selected : '1,2,3,4,5,6,7,8';
|
||||
$AUSBILDUNGSSEMESTER = (isset($ausbildungssemester_selected) && !is_null($ausbildungssemester_selected)) ? $ausbildungssemester_selected : '1,2,3,4,5,6,7,8,9,10';
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
@@ -187,7 +187,7 @@ FROM
|
||||
(SELECT
|
||||
uid
|
||||
FROM
|
||||
public.tbl_benutzer JOIN public.tbl_mitarbeiter ma
|
||||
public.tbl_benutzer JOIN public.tbl_mitarbeiter ma
|
||||
ON tbl_benutzer.uid = ma.mitarbeiter_uid
|
||||
WHERE
|
||||
person_id = tmp_projektbetreuung.person_id
|
||||
@@ -268,7 +268,7 @@ FROM
|
||||
ELSE (oe.organisationseinheittyp_kurzbz ||
|
||||
\' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
(vorname || \' \' || nachname) AS "lektor",
|
||||
(nachname || \' \' || vorname) AS "lektor",
|
||||
TRUNC(pb.stunden, 1) AS "stunden",
|
||||
TRUNC((pb.stunden * pb.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
|
||||
@@ -160,7 +160,7 @@ $this->load->view(
|
||||
'Ausbildungssemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $ausbildungssemester_selected,
|
||||
'number_semester' => 6
|
||||
'number_semester' => 10
|
||||
),
|
||||
array(
|
||||
'name' => 'ausbildungssemester',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$STUDIENGANG = (isset($studiengang_selected) && !is_null($studiengang_selected)) ? array($studiengang_selected) : $studiengang;
|
||||
$AUSBILDUNGSSEMESTER = (isset($ausbildungssemester_selected) && !is_null($ausbildungssemester_selected)) ? $ausbildungssemester_selected : '1,2,3,4,5,6,7,8';
|
||||
$AUSBILDUNGSSEMESTER = (isset($ausbildungssemester_selected) && !is_null($ausbildungssemester_selected)) ? $ausbildungssemester_selected : '1,2,3,4,5,6,7,8,9,10';
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
'query' => '
|
||||
SELECT
|
||||
person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr,
|
||||
staatsbuergerschaft, gebdatum, false AS mitarbeiter
|
||||
staatsbuergerschaft, gebdatum, false AS mitarbeiter,
|
||||
(SELECT count(*) FROM public.tbl_akte WHERE person_id=tbl_person.person_id) AS anzahl_dokumente
|
||||
FROM
|
||||
public.tbl_person
|
||||
WHERE
|
||||
@@ -14,7 +15,8 @@
|
||||
UNION
|
||||
SELECT
|
||||
person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr,
|
||||
staatsbuergerschaft, gebdatum, true AS mitarbeiter
|
||||
staatsbuergerschaft, gebdatum, true AS mitarbeiter,
|
||||
(SELECT count(*) FROM public.tbl_akte WHERE person_id=tbl_person.person_id) AS anzahl_dokumente
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer USING(person_id)
|
||||
@@ -36,7 +38,8 @@
|
||||
ucfirst($this->p->t('person', 'matrikelnummer')),
|
||||
ucfirst($this->p->t('person', 'staatsbuergerschaft')),
|
||||
ucfirst($this->p->t('person', 'geburtsdatum')),
|
||||
'Mitarbeiter'
|
||||
'Mitarbeiter',
|
||||
'Anzahl Dokumente'
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
echo $this->udflib->UDFWidget(
|
||||
array(
|
||||
UDFLib::UDF_UNIQUE_ID => 'fasPersonUDFs',
|
||||
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'basis/person',
|
||||
UDFLib::SCHEMA_ARG_NAME => 'public',
|
||||
UDFLib::TABLE_ARG_NAME => 'tbl_person',
|
||||
UDFLib::PRIMARY_KEY_NAME => 'person_id',
|
||||
@@ -70,7 +69,6 @@
|
||||
echo $this->udflib->UDFWidget(
|
||||
array(
|
||||
UDFLib::UDF_UNIQUE_ID => 'fasPrestudentUDFs',
|
||||
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'basis/person',
|
||||
UDFLib::SCHEMA_ARG_NAME => 'public',
|
||||
UDFLib::TABLE_ARG_NAME => 'tbl_prestudent',
|
||||
UDFLib::PRIMARY_KEY_NAME => 'prestudent_id',
|
||||
@@ -109,3 +107,4 @@
|
||||
</body>
|
||||
|
||||
<?php $this->load->view("templates/footer"); ?>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<a href="outputAkteContent/<?php echo $dokument->akte_id ?>"><?php echo isEmptyString($dokument->titel) ? $dokument->bezeichnung : $dokument->titel ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<select class="aktenid" id="aktenid_<?php echo $dokument->akte_id?>" <?php echo (isset($formalReadonly) ? 'disabled' : '') ?>>
|
||||
<select class="aktenid" id="aktenid_<?php echo $dokument->akte_id?>" <?php echo (isset($formalReadonly) ? 'disabled' : '') ?> autocomplete="off">
|
||||
<?php
|
||||
foreach($dokumententypen as $dokumenttyp)
|
||||
echo "<option " . ($dokumenttyp->bezeichnung === $dokument->dokument_bezeichnung ? 'selected' : '') . " value = " . $dokumenttyp->dokument_kurzbz . ">" . $dokumenttyp->bezeichnung . "</option>"
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Info Center',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'tablesorter' => true,
|
||||
'ajaxlib' => true,
|
||||
'filterwidget' => true,
|
||||
'navigationwidget' => true,
|
||||
'dialoglib' => true,
|
||||
'phrases' => array(
|
||||
'person' => array('vorname', 'nachname'),
|
||||
'global' => array('mailAnXversandt'),
|
||||
'ui' => array('bitteEintragWaehlen')
|
||||
),
|
||||
'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css', 'public/css/infocenter/infocenterPersonDataset.css'),
|
||||
'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js')
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="page-header">
|
||||
Abgewiesene
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->load->view('system/infocenter/infocenterAbgewiesenData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
$this->config->load('infocenter');
|
||||
$ABGEWIESENEN_STATUS = '\'Abgewiesener\'';
|
||||
$STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\'';
|
||||
$ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz');
|
||||
$STUDIENSEMESTER = '\''.$this->variablelib->getVar('infocenter_studiensemester').'\'';
|
||||
$LOGDATA_NAME = '\'Message sent\'';
|
||||
$LOGDATA_VON = '\'online\'';
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
p.person_id AS "PersonID",
|
||||
ps.prestudent_id AS "PreStudentID",
|
||||
p.vorname AS "Vorname",
|
||||
p.nachname AS "Nachname",
|
||||
sg.kurzbzlang as "Studiengang",
|
||||
pss.insertamum AS "AbgewiesenAm",
|
||||
(
|
||||
SELECT l.zeitpunkt
|
||||
FROM system.tbl_log l
|
||||
WHERE l.person_id = p.person_id
|
||||
AND '. $LOGDATA_NAME .' = (
|
||||
SELECT l.logdata->>\'name\'
|
||||
FROM system.tbl_log l
|
||||
WHERE l.person_id = p.person_id
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
)
|
||||
AND '. $LOGDATA_VON .' = (
|
||||
SELECT l.insertvon
|
||||
FROM system.tbl_log l
|
||||
WHERE l.person_id = p.person_id
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
)
|
||||
AND l.zeitpunkt >= pss.insertamum
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "Nachricht"
|
||||
FROM
|
||||
public.tbl_prestudentstatus pss
|
||||
JOIN public.tbl_prestudent ps USING(prestudent_id)
|
||||
JOIN public.tbl_person p USING(person_id)
|
||||
JOIN public.tbl_studiengang sg USING(studiengang_kz)
|
||||
WHERE pss.status_kurzbz = '. $ABGEWIESENEN_STATUS .'
|
||||
AND pss.studiensemester_kurzbz = '. $STUDIENSEMESTER .'
|
||||
AND (sg.typ IN ('. $STUDIENGANG_TYP .')
|
||||
OR
|
||||
sg.studiengang_kz IN ('. $ADDITIONAL_STG .')
|
||||
)
|
||||
ORDER BY "AbgewiesenAm" DESC';
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'app' => InfoCenter::APP,
|
||||
'datasetName' => 'abgewiesen',
|
||||
'filter_id' => $this->input->get('filter_id'),
|
||||
'requiredPermissions' => 'infocenter',
|
||||
'datasetRepresentation' => 'tablesorter',
|
||||
'columnsAliases' => array(
|
||||
'PersonID',
|
||||
'PreStudentID',
|
||||
'Vorname',
|
||||
'Nachname',
|
||||
'Studiengang',
|
||||
'Abgewiesen am',
|
||||
'Nachricht'
|
||||
),
|
||||
|
||||
'formatRow' => function($datasetRaw) {
|
||||
if ($datasetRaw->{'Nachricht'} === null)
|
||||
{
|
||||
$datasetRaw->{'Nachricht'} = 'Nein';
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'Nachricht'} = 'Ja';
|
||||
}
|
||||
|
||||
$datasetRaw->{'AbgewiesenAm'} = date_format(date_create($datasetRaw->{'AbgewiesenAm'}),'Y-m-d H:i');
|
||||
return $datasetRaw;
|
||||
}
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
|
||||
?>
|
||||
@@ -6,7 +6,7 @@
|
||||
$INTERESSENT_STATUS = '\'Interessent\'';
|
||||
$STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\'';
|
||||
$TAETIGKEIT_KURZBZ = '\'bewerbung\', \'kommunikation\'';
|
||||
$LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'New application\', \'Interessent rejected\'';
|
||||
$LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'Interessent rejected\', \'Attempt to register with existing mailadress\'';
|
||||
$LOGDATA_NAME_PARKED = '\'Parked\'';
|
||||
$LOGDATA_NAME_ONHOLD = '\'Onhold\'';
|
||||
$LOGTYPE_KURZBZ = '\'Processstate\'';
|
||||
@@ -14,6 +14,7 @@
|
||||
$ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz');
|
||||
$AKTE_TYP = '\'identity\', \'zgv_bakk\'';
|
||||
$STUDIENSEMESTER = '\''.$this->variablelib->getVar('infocenter_studiensemester').'\'';
|
||||
$ORG_NAME = '\'InfoCenter\'';
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
@@ -33,7 +34,7 @@
|
||||
WHERE l.taetigkeit_kurzbz IN ('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "LastAction",
|
||||
(
|
||||
@@ -42,7 +43,7 @@
|
||||
WHERE l.taetigkeit_kurzbz IN('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "LastActionType",
|
||||
(
|
||||
@@ -54,12 +55,14 @@
|
||||
a.dokument_kurzbz in ('.$AKTE_TYP.')
|
||||
) AS "AnzahlAkte",
|
||||
(
|
||||
SELECT l.insertvon
|
||||
SELECT CASE WHEN sp.nachname IS NULL THEN l.insertvon ELSE sp.nachname END
|
||||
FROM system.tbl_log l
|
||||
LEFT JOIN public.tbl_benutzer on l.insertvon = tbl_benutzer.uid
|
||||
LEFT JOIN public.tbl_person sp on tbl_benutzer.person_id = sp.person_id
|
||||
WHERE l.taetigkeit_kurzbz IN ('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "User/Operator",
|
||||
(
|
||||
@@ -254,13 +257,14 @@
|
||||
JOIN public.tbl_organisationseinheit USING(oe_kurzbz)
|
||||
WHERE (tbl_benutzerfunktion.datum_von IS NULL OR tbl_benutzerfunktion.datum_von <= now())
|
||||
AND (tbl_benutzerfunktion.datum_bis IS NULL OR tbl_benutzerfunktion.datum_bis >= now())
|
||||
AND tbl_organisationseinheit.bezeichnung = '.$ORG_NAME.'
|
||||
AND tbl_benutzerfunktion.uid = (
|
||||
SELECT l.insertvon
|
||||
FROM system.tbl_log l
|
||||
WHERE l.taetigkeit_kurzbz IN ('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
)
|
||||
LIMIT 1
|
||||
@@ -269,8 +273,10 @@
|
||||
LEFT JOIN (
|
||||
SELECT tpl.person_id,
|
||||
tpl.zeitpunkt,
|
||||
tpl.uid AS lockuser
|
||||
sp.nachname AS lockuser
|
||||
FROM system.tbl_person_lock tpl
|
||||
JOIN public.tbl_benutzer sb USING (uid)
|
||||
JOIN public.tbl_person sp ON sb.person_id = sp.person_id
|
||||
WHERE tpl.app = '.$APP.'
|
||||
) pl USING(person_id)
|
||||
LEFT JOIN (
|
||||
@@ -408,6 +414,10 @@
|
||||
{
|
||||
$datasetRaw->{'OnholdDate'} = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'OnholdDate'} = date_format(date_create($datasetRaw->{'OnholdDate'}), 'Y-m-d H:i');
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'StgAbgeschickt'} == null)
|
||||
{
|
||||
@@ -439,13 +449,13 @@
|
||||
$datasetRaw->{'ZGVMNation'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'InfoCenterMitarbeiter'} === 'InfoCenter')
|
||||
if ($datasetRaw->{'InfoCenterMitarbeiter'} === null)
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja';
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Nein';
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Nein';
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja';
|
||||
}
|
||||
|
||||
return $datasetRaw;
|
||||
|
||||
@@ -101,6 +101,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!is_null($duplicated)): ?>
|
||||
<div class="row alert-warning">
|
||||
<h3 class="header col-lg-12">
|
||||
<?php echo $this->p->t('global', 'bewerberVorhanden') . ':'; ?>
|
||||
</h3>
|
||||
<div class="text-left col-lg-12">
|
||||
<?php
|
||||
foreach ($duplicated as $duplicate)
|
||||
{
|
||||
echo 'Person ID: ' . $duplicate->person_id . '<br />';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<br/>
|
||||
<section>
|
||||
<div class="row">
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
$INTERESSENT_STATUS = '\'Interessent\'';
|
||||
$STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\'';
|
||||
$TAETIGKEIT_KURZBZ = '\'bewerbung\', \'kommunikation\'';
|
||||
$LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'New application\'';
|
||||
$LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'Attempt to register with existing mailadress\'';
|
||||
$REJECTED_STATUS = '\'Abgewiesener\'';
|
||||
$ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz');
|
||||
$STATUS_KURZBZ = '\'Wartender\', \'Bewerber\', \'Aufgenommener\', \'Student\'';
|
||||
$STUDIENSEMESTER = '\''.$this->variablelib->getVar('infocenter_studiensemester').'\'';
|
||||
$ORG_NAME = '\'InfoCenter\'';
|
||||
$IDENTITY = '\'identity\'';
|
||||
|
||||
$query = '
|
||||
$query = '
|
||||
SELECT
|
||||
p.person_id AS "PersonId",
|
||||
p.vorname AS "Vorname",
|
||||
@@ -27,7 +29,7 @@
|
||||
WHERE l.taetigkeit_kurzbz IN('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "LastAction",
|
||||
(
|
||||
@@ -36,16 +38,18 @@
|
||||
WHERE l.taetigkeit_kurzbz IN('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "LastActionType",
|
||||
(
|
||||
SELECT l.insertvon
|
||||
SELECT CASE WHEN sp.nachname IS NULL THEN l.insertvon ELSE sp.nachname END
|
||||
FROM system.tbl_log l
|
||||
LEFT JOIN public.tbl_benutzer on l.insertvon = tbl_benutzer.uid
|
||||
LEFT JOIN public.tbl_person sp on tbl_benutzer.person_id = sp.person_id
|
||||
WHERE l.taetigkeit_kurzbz IN('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "User/Operator",
|
||||
(
|
||||
@@ -231,23 +235,34 @@
|
||||
JOIN public.tbl_organisationseinheit USING(oe_kurzbz)
|
||||
WHERE (tbl_benutzerfunktion.datum_von IS NULL OR tbl_benutzerfunktion.datum_von <= now())
|
||||
AND (tbl_benutzerfunktion.datum_bis IS NULL OR tbl_benutzerfunktion.datum_bis >= now())
|
||||
AND tbl_organisationseinheit.bezeichnung = '.$ORG_NAME.'
|
||||
AND tbl_benutzerfunktion.uid = (
|
||||
SELECT l.insertvon
|
||||
FROM system.tbl_log l
|
||||
WHERE l.taetigkeit_kurzbz IN ('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
)
|
||||
LIMIT 1
|
||||
) AS "InfoCenterMitarbeiter"
|
||||
) AS "InfoCenterMitarbeiter",
|
||||
(
|
||||
SELECT akte.akte_id
|
||||
FROM public.tbl_akte akte
|
||||
JOIN public.tbl_dokument USING (dokument_kurzbz)
|
||||
WHERE akte.person_id = p.person_id
|
||||
AND dokument_kurzbz = '. $IDENTITY .'
|
||||
LIMIT 1
|
||||
) AS "AktenId"
|
||||
FROM public.tbl_person p
|
||||
LEFT JOIN (
|
||||
SELECT tpl.person_id,
|
||||
tpl.zeitpunkt,
|
||||
tpl.uid AS lockuser
|
||||
sp.nachname AS lockuser
|
||||
FROM system.tbl_person_lock tpl
|
||||
JOIN public.tbl_benutzer sb USING (uid)
|
||||
JOIN public.tbl_person sp ON sb.person_id = sp.person_id
|
||||
WHERE tpl.app = '.$APP.'
|
||||
) pl USING(person_id)
|
||||
WHERE
|
||||
@@ -311,7 +326,8 @@
|
||||
'Reihungstest date',
|
||||
'ZGV Nation BA',
|
||||
'ZGV Nation MA',
|
||||
'InfoCenter Mitarbeiter'
|
||||
'InfoCenter Mitarbeiter',
|
||||
'Identitätsnachweis'
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
|
||||
@@ -410,14 +426,27 @@
|
||||
$datasetRaw->{'ZGVMNation'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'InfoCenterMitarbeiter'} === 'InfoCenter')
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja';
|
||||
}
|
||||
else
|
||||
if ($datasetRaw->{'InfoCenterMitarbeiter'} === null)
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Nein';
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'AktenId'} !== null)
|
||||
{
|
||||
$datasetRaw->{'AktenId'} = sprintf(
|
||||
'<a href="outputAkteContent/%s">Identitätsnachweis</a>',
|
||||
$datasetRaw->{'AktenId'}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'AktenId'} = '-';
|
||||
}
|
||||
|
||||
|
||||
return $datasetRaw;
|
||||
},
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
$INTERESSENT_STATUS = '\'Interessent\'';
|
||||
$STUDIENGANG_TYP = '\''.$this->variablelib->getVar('infocenter_studiensgangtyp').'\'';
|
||||
$TAETIGKEIT_KURZBZ = '\'bewerbung\', \'kommunikation\'';
|
||||
$LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'New application\'';
|
||||
$LOGDATA_NAME = '\'Login with code\', \'Login with user\', \'Attempt to register with existing mailadress\'';
|
||||
$ADDITIONAL_STG = $this->config->item('infocenter_studiengang_kz');
|
||||
$STUDIENSEMESTER = '\''.$this->variablelib->getVar('infocenter_studiensemester').'\'';
|
||||
$ORG_NAME = '\'InfoCenter\'';
|
||||
|
||||
$query = '
|
||||
$query = '
|
||||
SELECT
|
||||
p.person_id AS "PersonId",
|
||||
p.vorname AS "Vorname",
|
||||
@@ -25,7 +26,7 @@
|
||||
WHERE l.taetigkeit_kurzbz IN('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "LastAction",
|
||||
(
|
||||
@@ -34,7 +35,7 @@
|
||||
WHERE l.taetigkeit_kurzbz IN('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
) AS "User/Operator",
|
||||
(
|
||||
@@ -182,13 +183,14 @@
|
||||
JOIN public.tbl_organisationseinheit USING(oe_kurzbz)
|
||||
WHERE (tbl_benutzerfunktion.datum_von IS NULL OR tbl_benutzerfunktion.datum_von <= now())
|
||||
AND (tbl_benutzerfunktion.datum_bis IS NULL OR tbl_benutzerfunktion.datum_bis >= now())
|
||||
AND tbl_organisationseinheit.bezeichnung = '.$ORG_NAME.'
|
||||
AND tbl_benutzerfunktion.uid = (
|
||||
SELECT l.insertvon
|
||||
FROM system.tbl_log l
|
||||
WHERE l.taetigkeit_kurzbz IN ('.$TAETIGKEIT_KURZBZ.')
|
||||
AND l.logdata->>\'name\' NOT IN ('.$LOGDATA_NAME.')
|
||||
AND l.person_id = p.person_id
|
||||
ORDER BY l.zeitpunkt DESC
|
||||
ORDER BY l.log_id DESC
|
||||
LIMIT 1
|
||||
)
|
||||
LIMIT 1
|
||||
@@ -347,13 +349,13 @@
|
||||
$datasetRaw->{'ZGVMNation'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'InfoCenterMitarbeiter'} === 'InfoCenter')
|
||||
if ($datasetRaw->{'InfoCenterMitarbeiter'} === null)
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja';
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Nein';
|
||||
}
|
||||
else
|
||||
{
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Nein';
|
||||
$datasetRaw->{'InfoCenterMitarbeiter'} = 'Ja';
|
||||
}
|
||||
|
||||
return $datasetRaw;
|
||||
|
||||
@@ -341,7 +341,6 @@
|
||||
echo $this->udflib->UDFWidget(
|
||||
array(
|
||||
UDFLib::UDF_UNIQUE_ID => 'infocenterPrestudentUDFs_'.$zgvpruefung->prestudent_id,
|
||||
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => 'infocenter',
|
||||
UDFLib::SCHEMA_ARG_NAME => 'public',
|
||||
UDFLib::TABLE_ARG_NAME => 'tbl_prestudent',
|
||||
UDFLib::PRIMARY_KEY_NAME => 'prestudent_id',
|
||||
@@ -553,3 +552,4 @@
|
||||
endforeach; // end foreach zgvpruefungen
|
||||
?>
|
||||
</div><!-- /.panel-group -->
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Fehler Monitoring',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'tablesorter' => true,
|
||||
'ajaxlib' => true,
|
||||
'filterwidget' => true,
|
||||
'navigationwidget' => true,
|
||||
'dialoglib' => true,
|
||||
'phrases' => array(
|
||||
'ui',
|
||||
'fehlermonitoring'
|
||||
),
|
||||
'customCSSs' => array('public/css/issues/issuesDataset.css', 'public/css/sbadmin2/tablesort_bootstrap.css'),
|
||||
'customJSs' => array('public/js/issues/issuesDataset.js', 'public/js/bootstrapper.js'),
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="page-header">
|
||||
<?php echo $this->p->t('fehlermonitoring', 'fehlerMonitoring') ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->load->view('system/issues/issuesData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
$PERSON_ID = getAuthPersonId();
|
||||
$ALL_FUNKTIONEN_OE_KURZBZ = "('" . implode("','", array_keys($all_funktionen_oe_kurzbz)) . "')";
|
||||
$ALL_OE_KURZBZ_BERECHTIGT = "('" . implode("','", $all_oe_kurzbz_berechtigt) . "')";
|
||||
$RELEVANT_PRESTUDENT_STATUS = "('Aufgenommener', 'Student', 'Incoming', 'Diplomand', 'Abbrecher', 'Unterbrecher', 'Absolvent')";
|
||||
$LANGUAGE_INDEX = getUserLanguage() == 'German' ? '1' : '2';
|
||||
|
||||
// get issues for the oes of the logged user or for the persons (students, oe-zuordnung) of the oes
|
||||
$query = "WITH zustaendigkeiten AS (
|
||||
SELECT fehlercode,
|
||||
CASE
|
||||
WHEN zst.person_id = ".$PERSON_ID;
|
||||
|
||||
if (!isEmptyArray($all_funktionen_oe_kurzbz))
|
||||
{
|
||||
$query .= " OR (zst.oe_kurzbz IN $ALL_FUNKTIONEN_OE_KURZBZ AND zst.funktion_kurzbz IS NULL) /* if oe is specified in fehler_zustaendigkeiten */";
|
||||
|
||||
// check for each oe for each function if zustaendig
|
||||
foreach ($all_funktionen_oe_kurzbz as $oe_kurzbz => $funktionen_kurzbz)
|
||||
{
|
||||
foreach ($funktionen_kurzbz as $funktion_kurzbz)
|
||||
{
|
||||
$query .= " OR (zst.oe_kurzbz = '$oe_kurzbz' AND zst.funktion_kurzbz = '$funktion_kurzbz')";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query .= " THEN TRUE
|
||||
ELSE FALSE
|
||||
END AS \"zustaendig\"
|
||||
FROM system.tbl_fehler_zustaendigkeiten zst
|
||||
)";
|
||||
|
||||
$query .= "SELECT issue_id, fehlercode AS \"Fehlercode\", iss.fehlercode_extern AS \"Fehlercode extern\", datum AS \"Datum\",
|
||||
inhalt AS \"Inhalt\", inhalt_extern AS \"Inhalt extern\", iss.person_id AS \"PersonId\", iss.oe_kurzbz AS \"OE\",
|
||||
ftyp.bezeichnung_mehrsprachig[".$LANGUAGE_INDEX."] AS \"Fehlertyp\", stat.bezeichnung_mehrsprachig[".$LANGUAGE_INDEX."] AS \"Fehlerstatus\",
|
||||
verarbeitetvon AS \"Verarbeitet von\",verarbeitetamum AS \"Verarbeitet am\", fr.app AS \"Applikation\",
|
||||
fr.fehlertyp_kurzbz AS \"Fehlertypcode\", iss.status_kurzbz AS \"Statuscode\",
|
||||
pers.vorname AS \"Vorname\", pers.nachname AS \"Nachname\",
|
||||
CASE
|
||||
WHEN
|
||||
EXISTS(SELECT 1
|
||||
FROM zustaendigkeiten
|
||||
WHERE fehlercode = iss.fehlercode
|
||||
AND zustaendig = TRUE) /* If Zuständigkeit is defined for the oe/person, zustaendig. */
|
||||
THEN 'Ja'
|
||||
WHEN
|
||||
EXISTS(SELECT 1
|
||||
FROM zustaendigkeiten
|
||||
WHERE fehlercode = iss.fehlercode
|
||||
AND zustaendig = FALSE) /* If Zuständigkeit is defined for different oe/person, not zustaendig. */
|
||||
THEN 'Nein'
|
||||
ELSE 'Ja' /* If no Zuständigkeit defined, zustaendig by default. */
|
||||
END AS \"Hauptzuständig\"
|
||||
FROM system.tbl_issue iss
|
||||
JOIN system.tbl_fehler fr USING (fehlercode)
|
||||
JOIN system.tbl_fehlertyp ftyp USING (fehlertyp_kurzbz)
|
||||
JOIN system.tbl_issue_status stat USING (status_kurzbz)
|
||||
LEFT JOIN public.tbl_person pers ON iss.person_id = pers.person_id
|
||||
WHERE EXISTS ( /* if oe or person is specified in fehler_zustaendigkeiten */
|
||||
SELECT 1 FROM zustaendigkeiten
|
||||
WHERE fehlercode = iss.fehlercode
|
||||
AND zustaendig = TRUE)";
|
||||
|
||||
// show issue if it is assigend to oe of logged in user or to student of oe of logged in user
|
||||
if (!isEmptyArray($all_oe_kurzbz_berechtigt))
|
||||
{
|
||||
$query .= " OR iss.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT /* if issue is for oe */";
|
||||
|
||||
$query .= " OR (iss.oe_kurzbz IS NULL AND EXISTS ( /* if person_id of issue is a student of studiengang oe */
|
||||
SELECT 1 FROM public.tbl_prestudent ps
|
||||
JOIN public.tbl_prestudentstatus pss USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang stg USING (studiengang_kz)
|
||||
WHERE person_id = iss.person_id
|
||||
AND stg.oe_kurzbz IN $ALL_OE_KURZBZ_BERECHTIGT
|
||||
AND pss.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS
|
||||
AND NOT EXISTS (SELECT 1 /* irrelevant if already finished studies and studied a while ago */
|
||||
FROM public.tbl_prestudentstatus ps_finished
|
||||
JOIN public.tbl_studiensemester sem_finished USING (studiensemester_kurzbz)
|
||||
WHERE prestudent_id = ps.prestudent_id
|
||||
AND status_kurzbz IN ('Absolvent','Abbrecher','Abgewiesener')
|
||||
AND datum::date + interval '2 months' < NOW()
|
||||
AND EXISTS (SELECT 1 FROM public.tbl_prestudent /* if more recent prestudent exists, still display the issue */
|
||||
JOIN public.tbl_prestudentstatus USING (prestudent_id)
|
||||
JOIN public.tbl_studiensemester USING (studiensemester_kurzbz)
|
||||
WHERE tbl_prestudentstatus.status_kurzbz IN $RELEVANT_PRESTUDENT_STATUS
|
||||
AND person_id = ps.person_id
|
||||
AND prestudent_id <> ps_finished.prestudent_id
|
||||
AND tbl_studiensemester.start::date > sem_finished.start::date)
|
||||
)
|
||||
)
|
||||
)";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY CASE
|
||||
WHEN iss.status_kurzbz = '".IssuesLib::STATUS_NEU."' THEN 0
|
||||
WHEN iss.status_kurzbz = '".IssuesLib::STATUS_IN_BEARBEITUNG."' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
CASE
|
||||
WHEN fehlertyp_kurzbz = '".IssuesLib::ERRORTYPE_CODE."' THEN 0
|
||||
WHEN fehlertyp_kurzbz = '".IssuesLib::WARNINGTYPE_CODE."' THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
datum DESC, fehlercode, issue_id DESC";
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'app' => 'core',
|
||||
'datasetName' => 'issues',
|
||||
'filter_id' => $this->input->get('filter_id'),
|
||||
'tableUniqueId' => 'issues',
|
||||
'requiredPermissions' => 'admin',
|
||||
'datasetRepresentation' => 'tablesorter',
|
||||
'checkboxes' => 'issue_id',
|
||||
'columnsAliases' => array(
|
||||
'ID',
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlercode')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlercodeExtern')),
|
||||
ucfirst($this->p->t('global', 'datum')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'inhalt')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'inhaltExtern')),
|
||||
'PersonId',
|
||||
ucfirst($this->p->t('lehre', 'organisationseinheit')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlertyp')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlerstatus')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'verarbeitetVon')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'verarbeitetAm')),
|
||||
ucfirst($this->p->t('global', 'applikation')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'fehlertypcode')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'statuscode')),
|
||||
ucfirst($this->p->t('person', 'vorname')),
|
||||
ucfirst($this->p->t('person', 'nachname')),
|
||||
ucfirst($this->p->t('fehlermonitoring', 'hauptzustaendig'))
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
|
||||
if ($datasetRaw->{'Fehlercode extern'} == null)
|
||||
{
|
||||
$datasetRaw->{'Fehlercode extern'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'Inhalt'} == null)
|
||||
{
|
||||
$datasetRaw->{'Inhalt'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'Inhalt extern'} == null)
|
||||
{
|
||||
$datasetRaw->{'Inhalt extern'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'PersonId'} == null)
|
||||
{
|
||||
$datasetRaw->{'PersonId'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'OE'} == null)
|
||||
{
|
||||
$datasetRaw->{'OE'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'Verarbeitet am'} == null)
|
||||
{
|
||||
$datasetRaw->{'Verarbeitet am'} = '-';
|
||||
}
|
||||
|
||||
if ($datasetRaw->{'Verarbeitet von'} == null)
|
||||
{
|
||||
$datasetRaw->{'Verarbeitet von'} = '-';
|
||||
}
|
||||
|
||||
return $datasetRaw;
|
||||
},
|
||||
'markRow' => function($datasetRaw) {
|
||||
|
||||
$mark = '';
|
||||
|
||||
if ($datasetRaw->Statuscode == IssuesLib::STATUS_BEHOBEN)
|
||||
$mark = "text-success";
|
||||
elseif ($datasetRaw->Statuscode == IssuesLib::STATUS_NEU || $datasetRaw->Statuscode == IssuesLib::STATUS_IN_BEARBEITUNG)
|
||||
{
|
||||
if ($datasetRaw->Fehlertypcode == IssuesLib::ERRORTYPE_CODE)
|
||||
{
|
||||
$mark = "text-danger";
|
||||
}
|
||||
elseif ($datasetRaw->Fehlertypcode == IssuesLib::WARNINGTYPE_CODE)
|
||||
{
|
||||
$mark = "text-warning";
|
||||
}
|
||||
}
|
||||
|
||||
return $mark;
|
||||
}
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
// By default set the parameters to null
|
||||
$title = isset($title) ? $title : null;
|
||||
$refresh = isset($refresh) ? $refresh : null;
|
||||
$customCSSs = isset($customCSSs) ? $customCSSs : null;
|
||||
$customJSs = isset($customJSs) ? $customJSs : null;
|
||||
$phrases = isset($phrases) ? $phrases : null;
|
||||
@@ -44,8 +45,12 @@
|
||||
<head>
|
||||
<title><?php printPageTitle($title); ?></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<?php printRefreshMeta($refresh); ?>
|
||||
|
||||
<?php
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// CSS
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::HTML_NAME); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REQUIRED); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
|
||||
<?php
|
||||
$checked = '';
|
||||
if (${CheckboxWidget::VALUE_FIELD} === true)
|
||||
@@ -38,4 +39,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::MAX_VALUE); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REGEX); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
|
||||
>
|
||||
<?php
|
||||
$elements = ${DropdownWidget::WIDGET_DATA_ELEMENTS_ARRAY_NAME};
|
||||
@@ -72,3 +73,4 @@
|
||||
</div>
|
||||
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
<?php FilterWidget::loadViewSelectFilters(); ?>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<!-- Filter save options -->
|
||||
<div>
|
||||
<?php FilterWidget::loadViewSaveFilter(); ?>
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
<div class="up-down-border">
|
||||
|
||||
<br>
|
||||
<div>
|
||||
<span class="filter-span-label">
|
||||
<?php echo ucfirst($this->p->t('filter', 'filterHinzufuegen')); ?>:
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<select id="addFilter" class="drop-down-filters"></select>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="appliedFilters"></div>
|
||||
|
||||
<div class="margin-left-25">
|
||||
<span>
|
||||
<input id="applyFilter" type="button" value="<?php echo ucfirst($this->p->t('filter', 'filterApply')); ?>">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="appliedFilters"></div>
|
||||
|
||||
<div>
|
||||
<span class="filter-span-label">
|
||||
<?php echo ucfirst($this->p->t('filter', 'filterHinzufuegen')); ?>:
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<select id="addFilter" class="drop-down-filters"></select>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<input id="applyFilter" type="button" value="<?php echo ucfirst($this->p->t('global', 'hinzufuegen')); ?>">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -29,9 +29,11 @@
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::MAX_LENGTH); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REGEX); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
|
||||
><?php echo ${TextareaWidget::TEXT}; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
|
||||
|
||||
@@ -31,10 +31,12 @@
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::MAX_LENGTH); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::REGEX); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::TITLE); ?>
|
||||
<?php HTMLWidget::printAttribute(${HTMLWidget::HTML_ARG_NAME}, HTMLWidget::DISABLED, false); ?>
|
||||
value="<?php echo ${TextfieldWidget::VALUE}; ?>"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
<?php HTMLWidget::printEndBlock(${HTMLWidget::HTML_ARG_NAME}); ?>
|
||||
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
class HTMLWidget extends Widget
|
||||
{
|
||||
// The name of the array present in the data array given to the view that will render this widget
|
||||
const HTML_ARG_NAME = 'HTML';
|
||||
const HTML_ARG_NAME = 'HTML';
|
||||
const HTML_DEFAULT_VALUE = ''; // Default value of the html element
|
||||
const HTML_NAME = 'name'; // HTML name attribute
|
||||
const HTML_ID = 'id'; // HTML id attribute
|
||||
|
||||
// External block definition
|
||||
const EXTERNAL_BLOCK = 'externalBlock'; // External block name
|
||||
const EXTERNAL_START_BLOCK_HTML_TAG = '<div>'; // External block start tag
|
||||
const EXTERNAL_END_BLOCK_HTML_TAG = '</div>'; // External block end tag
|
||||
|
||||
// HTML attributes
|
||||
const LABEL = 'title';
|
||||
const HTML_NAME = 'name'; // HTML name attribute
|
||||
const HTML_ID = 'id'; // HTML id attribute
|
||||
|
||||
// External block definition
|
||||
const EXTERNAL_BLOCK = 'externalBlock'; // External block name
|
||||
const EXTERNAL_START_BLOCK_HTML_TAG = '<div>'; // External block start tag
|
||||
const EXTERNAL_END_BLOCK_HTML_TAG = '</div>'; // External block end tag
|
||||
|
||||
// HTML attributes
|
||||
const LABEL = 'title';
|
||||
const REGEX = 'regex';
|
||||
const TITLE = 'description';
|
||||
const REQUIRED = 'required-field';
|
||||
@@ -26,11 +26,12 @@ class HTMLWidget extends Widget
|
||||
const MAX_LENGTH = 'max-length';
|
||||
const MIN_LENGTH = 'min-length';
|
||||
const PLACEHOLDER = 'placeholder';
|
||||
const DISABLED = 'disabled';
|
||||
|
||||
/**
|
||||
* It gets also the htmlArgs array as parameter, it will be used to set the HTML properties
|
||||
*/
|
||||
public function __construct($name, $args = array(), $htmlArgs = array())
|
||||
/**
|
||||
* It gets also the htmlArgs array as parameter, it will be used to set the HTML properties
|
||||
*/
|
||||
public function __construct($name, $args = array(), $htmlArgs = array())
|
||||
{
|
||||
parent::__construct($name, $args);
|
||||
|
||||
@@ -38,11 +39,11 @@ class HTMLWidget extends Widget
|
||||
$this->_setHtmlProperties($htmlArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialising html properties, such as the id and name attributes of the HTML element
|
||||
*/
|
||||
private function _setHtmlProperties($htmlArgs)
|
||||
{
|
||||
/**
|
||||
* Initialising html properties, such as the id and name attributes of the HTML element
|
||||
*/
|
||||
private function _setHtmlProperties($htmlArgs)
|
||||
{
|
||||
// If $htmlArgs wasn't already stored in $this->_args
|
||||
if (!isset($this->_args[HTMLWidget::HTML_ARG_NAME]))
|
||||
{
|
||||
@@ -58,9 +59,9 @@ class HTMLWidget extends Widget
|
||||
$this->_args[HTMLWidget::HTML_ARG_NAME][$argName] = $argValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prints an attribute name and eventually also the value extracted from $htmlArgs
|
||||
* Set $isValuePresent to false the value should not be displayed
|
||||
*/
|
||||
@@ -113,3 +114,4 @@ class HTMLWidget extends Widget
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
*/
|
||||
class UDFWidget extends HTMLWidget
|
||||
{
|
||||
private $_requiredPermissions; // The required permissions to use this UDF widget
|
||||
|
||||
private $_schema; // Schema name
|
||||
private $_table; // Table name
|
||||
private $_primaryKeyName; // Primary key name
|
||||
@@ -26,26 +24,16 @@ class UDFWidget extends HTMLWidget
|
||||
|
||||
$this->_initUDFWidget($args); // checks parameters and initialize properties
|
||||
|
||||
// Let's start if it's allowed
|
||||
// NOTE: If it is NOT allowed then no data are loaded
|
||||
if ($this->udflib->isAllowed($this->_requiredPermissions))
|
||||
{
|
||||
$this->_startUDFWidget($args[UDFLib::UDF_UNIQUE_ID]);
|
||||
}
|
||||
$this->_startUDFWidget($args[UDFLib::UDF_UNIQUE_ID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the WidgetLib, it renders the HTML of the UDF
|
||||
*/
|
||||
public function display($widgetData)
|
||||
public function display($widgetData)
|
||||
{
|
||||
// Let's start if it's allowed
|
||||
// NOTE: If it is NOT allowed then no data are loaded
|
||||
if ($this->_ci->udflib->isAllowed($this->_requiredPermissions))
|
||||
{
|
||||
$this->_ci->udflib->displayUDFWidget($widgetData);
|
||||
}
|
||||
}
|
||||
$this->_ci->udflib->displayUDFWidget($widgetData);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
@@ -60,18 +48,11 @@ class UDFWidget extends HTMLWidget
|
||||
// If here then everything is ok
|
||||
|
||||
// Initialize class properties
|
||||
$this->_requiredPermissions = null;
|
||||
$this->_schema = null;
|
||||
$this->_table = null;
|
||||
$this->_primaryKeyName = null;
|
||||
$this->_primaryKeyValue = null;
|
||||
|
||||
// Retrieved the required permissions parameter if present
|
||||
if (isset($args[UDFLib::REQUIRED_PERMISSIONS_PARAMETER]))
|
||||
{
|
||||
$this->_requiredPermissions = $args[UDFLib::REQUIRED_PERMISSIONS_PARAMETER];
|
||||
}
|
||||
|
||||
// Retrieved the
|
||||
if (isset($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
{
|
||||
@@ -113,11 +94,6 @@ class UDFWidget extends HTMLWidget
|
||||
show_error('The parameter "'.UDFLib::UDF_UNIQUE_ID.'" must be specified');
|
||||
}
|
||||
|
||||
if (!isset($args[UDFLib::REQUIRED_PERMISSIONS_PARAMETER]))
|
||||
{
|
||||
show_error('The parameter "'.UDFLib::REQUIRED_PERMISSIONS_PARAMETER.'" must be specified');
|
||||
}
|
||||
|
||||
if (!isset($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
{
|
||||
show_error('The parameter "'.UDFLib::SCHEMA_ARG_NAME.'" must be specified');
|
||||
@@ -149,7 +125,6 @@ class UDFWidget extends HTMLWidget
|
||||
$this->udflib->setSession(
|
||||
array(
|
||||
UDFLib::UDF_UNIQUE_ID => $udfUniqueId, // table unique id
|
||||
UDFLib::REQUIRED_PERMISSIONS_PARAMETER => $this->_requiredPermissions, //
|
||||
UDFLib::SCHEMA_ARG_NAME => $this->_schema, //
|
||||
UDFLib::TABLE_ARG_NAME => $this->_table, //
|
||||
UDFLib::PRIMARY_KEY_NAME => $this->_primaryKeyName, //
|
||||
@@ -158,3 +133,4 @@ class UDFWidget extends HTMLWidget
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user