diff --git a/application/config/constants.php b/application/config/constants.php
index ef4cdaf2c..f21b6c962 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -31,6 +31,13 @@ define('EXIT_VALIDATION_UDF_NOT_VALID_VAL', 17); // UDF validation has been fail
define('EXIT_AUTO_MIN', 1000); // lowest automatically-assigned error code
define('EXIT_AUTO_MAX', 2000); // highest automatically-assigned error code
+/*
+|--------------------------------------------------------------------------
+| General purpose
+|--------------------------------------------------------------------------
+*/
+define('BEGINNING_OF_TIME', '1970-01-01');
+
/*
|--------------------------------------------------------------------------
| Authentication constants
diff --git a/application/config/jqm.php b/application/config/jqm.php
new file mode 100644
index 000000000..43cc1c038
--- /dev/null
+++ b/application/config/jqm.php
@@ -0,0 +1,14 @@
+ array(
+ 'admin:rw',
+ 'developer:rw'
+ ),
+ 'OEHPayment' => 'developer:rw',
+ 'SAPPayment' => 'developer:rw'
+);
+
diff --git a/application/config/navigation.php b/application/config/navigation.php
index a89c259ee..84004b58e 100644
--- a/application/config/navigation.php
+++ b/application/config/navigation.php
@@ -109,6 +109,13 @@ $config['navigation_header'] = array(
'expand' => true,
'sort' => 20,
'requiredPermissions' => 'system/developer:r'
+ ),
+ 'jobsqueueviewer' => array(
+ 'link' => site_url('system/jq/JobsQueueViewer'),
+ 'description' => 'Jobs Queue Viewer',
+ 'expand' => true,
+ 'sort' => 20,
+ 'requiredPermissions' => 'system/developer:r'
)
)
)
diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php
index 2f6b928c7..4ba327a2f 100644
--- a/application/controllers/jobs/LehrauftragJob.php
+++ b/application/controllers/jobs/LehrauftragJob.php
@@ -20,31 +20,31 @@ class LehrauftragJob extends JOB_Controller
{
const BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN = 'lehre/lehrauftrag_erteilen';
const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
-
+
const LEHRAUFTRAG_ERTEILEN_URI = 'lehre/lehrauftrag/LehrauftragErteilen';
const LEHRAUFTRAG_AKZEPTIEREN_URI = '/lehre/lehrauftrag/LehrauftragAkzeptieren';
-
+
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
-
+
// Load models
$this->load->model('accounting/Vertrag_model', 'VertragModel');
$this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
-
+
// Load libraries
$this->load->library('PermissionLib');
-
+
// Load helpers
$this->load->helper('hlp_sancho_helper');
}
-
+
/**
* This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore.
* Receivers: Department-/Kompetenzfeldleiter
@@ -62,7 +62,7 @@ class LehrauftragJob extends JOB_Controller
foreach ($vertrag_arr as $vertrag)
{
$result = $this->VertragModel->getLehreinheitData($vertrag->vertrag_id, 'lehrveranstaltung_id, studiensemester_kurzbz');
-
+
if (hasData($result))
{
$obj = new StdClass();
@@ -72,7 +72,7 @@ class LehrauftragJob extends JOB_Controller
}
}
}
-
+
/**
* Build the data array to be used in the email. Data array is clustered as follows:
* Array
@@ -90,7 +90,7 @@ class LehrauftragJob extends JOB_Controller
foreach ($lehreinheit_data_arr as $lehreinheit_data)
{
$result = $this->_getLVData($lehreinheit_data->lehrveranstaltung_id);
-
+
if (hasData($result))
{
// Search if studiensemester exists in data_arr
@@ -102,12 +102,12 @@ class LehrauftragJob extends JOB_Controller
$data = array(
'studiensemester_kurzbz' => $lehreinheit_data->studiensemester_kurzbz
);
-
+
$data []= array(
'oe_kurzbz' => $result->retval[0]->oe_kurzbz,
'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung
);
-
+
// Add stg data to oe, start amount with 1
$data[0][] = array(
'stg_kz' => $result->retval[0]->studiengang_kz,
@@ -115,7 +115,7 @@ class LehrauftragJob extends JOB_Controller
'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung,
'amount' => 1
);
-
+
// Push to final data_arr
$data_arr []= $data;
}
@@ -124,7 +124,7 @@ class LehrauftragJob extends JOB_Controller
{
// Search if oe exists inside existing studiensemester of data_arr
$oe_index = array_search($result->retval[0]->oe_kurzbz, array_column($data_arr[$ss_index], 'oe_kurzbz'));
-
+
// If oe is new, add oe and stg to studiensemester
if ($oe_index === false)
{
@@ -132,7 +132,7 @@ class LehrauftragJob extends JOB_Controller
$data_arr[$ss_index][] = array(
'oe_kurzbz' => $result->retval[0]->oe_kurzbz,
'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung,
-
+
// Add stg data to oe, start amount with 1
array(
'stg_kz' => $result->retval[0]->studiengang_kz,
@@ -147,7 +147,7 @@ class LehrauftragJob extends JOB_Controller
{
// Search if stg exists inside existing oe of data_arr
$stg_index = array_search($result->retval[0]->studiengang_kz, array_column($data_arr[$ss_index][$oe_index], 'stg_kz'));
-
+
// If stg is new, add stg to oe, start amount with 1
if ($stg_index === false)
{
@@ -168,7 +168,7 @@ class LehrauftragJob extends JOB_Controller
}
}
}
-
+
/**
* Cluster data by uid of entitled mail receivers.
* Returning array is clustered as follows:
@@ -186,7 +186,7 @@ class LehrauftragJob extends JOB_Controller
* [amount] // amount of new ordered lehrauftraege of that stg
*/
$data_arr = $this->_clusterData_byReceiver($data_arr);
-
+
// Send email
if(!$this->_sendMail_toApprove($data_arr))
{
@@ -197,7 +197,7 @@ class LehrauftragJob extends JOB_Controller
$this->logError('Error when sending emails in job MailLehrauftragToApprove');
}
}
-
+
/**
* This daily job sends information about all lehr-/projektauftraege approved the day bofore.
* Receivers: lectors
@@ -208,7 +208,7 @@ class LehrauftragJob extends JOB_Controller
$this->VertragvertragsstatusModel->addSelect('vertrag_id, uid');
$this->VertragvertragsstatusModel->addOrder('uid');
$result = $this->VertragvertragsstatusModel->getApproved_fromDate('YESTERDAY');
-
+
/**
* Build the data array to be used in the email. Data array is clustered as follows:
* Array
@@ -228,10 +228,10 @@ class LehrauftragJob extends JOB_Controller
{
$studiensemester = $studiensemester[0]->vertragsstunden_studiensemester_kurzbz;
}
-
+
// Search if uid exists in data_arr
$uid_index = array_search($vertrag->uid, array_column($data_arr, 'uid'));
-
+
// If uid is new, add uid, studiensemester and start amount with 1
if ($uid_index === false)
{
@@ -249,7 +249,7 @@ class LehrauftragJob extends JOB_Controller
{
$data_arr[$uid_index]['studiensemester'] .= ' und '. $studiensemester;
}
-
+
// Increase amount +1
$data_arr[$uid_index]['amount']++;
}
@@ -266,11 +266,11 @@ class LehrauftragJob extends JOB_Controller
$this->logError('Error when sending emails in job MailLehrauftragToAccept');
}
}
-
+
//******************************************************************************************************************
// PRIVATE FUNCTIONS
//******************************************************************************************************************
-
+
/**
* Get data of given lehrveranstaltung.
* @param $lehrveranstaltung_id
@@ -286,7 +286,7 @@ class LehrauftragJob extends JOB_Controller
stg.typ AS "stg_typ",
stg.kurzbz AS "stg_kurzbz"
');
-
+
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung stpllv', 'lehrveranstaltung_id');
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan stpl', 'studienplan_id');
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung sto', 'studienordnung_id');
@@ -294,10 +294,10 @@ class LehrauftragJob extends JOB_Controller
$this->LehrveranstaltungModel->addJoin('public.tbl_organisationseinheit oe', 'ON oe.oe_kurzbz = tbl_lehrveranstaltung.oe_kurzbz');
$this->LehrveranstaltungModel->addOrder('stpllv.insertamum', 'DESC');
$this->LehrveranstaltungModel->addLimit(1);
-
+
return $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
}
-
+
/**
* Send Sancho eMail about ordered Lehrauftraege.
* @param $data_arr
@@ -310,12 +310,12 @@ class LehrauftragJob extends JOB_Controller
// Set mail recipients (department assistance/leader)
$to = $data['uid']. '@'. DOMAIN;
$html_table = $this->_renderData_LehrauftraegeToApprove($data);
-
+
// Prepare mail content
$content_data_arr = array(
'table' => $html_table
);
-
+
sendSanchoMail(
'LehrauftragNeueBestellungen',
$content_data_arr,
@@ -326,7 +326,7 @@ class LehrauftragJob extends JOB_Controller
);
}
}
-
+
/**
* Cluster the data array by entitled mail receiver.
* Returning array is clustered as follows:
@@ -409,7 +409,7 @@ class LehrauftragJob extends JOB_Controller
return $mail_data_arr;
}
-
+
/**
* Render the data array for the mail template returing a HTML table.
* @param $data_arr Data to be used in HTML table
@@ -425,11 +425,11 @@ class LehrauftragJob extends JOB_Controller
if (isset($studiensemester_container['studiensemester_kurzbz']))
{
$studiensemester = $studiensemester_container['studiensemester_kurzbz'];
-
+
// Link to LehrauftragErteilen
$url = site_url(self::LEHRAUFTRAG_ERTEILEN_URI).'?studiensemester='. $studiensemester;
}
-
+
// HTML table header
$html .= '
@@ -446,7 +446,7 @@ class LehrauftragJob extends JOB_Controller
'
;
-
+
// HTML table body
foreach ($studiensemester_container as $oe_container)
{
@@ -456,7 +456,7 @@ class LehrauftragJob extends JOB_Controller
{
$oe_bezeichnung = $oe_container['oe_bezeichnung'];
}
-
+
foreach ($oe_container as $stg_data)
{
if (is_array($stg_data)) // is_array 'trims' the outer associative keys [oe_kurzbz] and [oe_bezeichnung]
@@ -473,7 +473,7 @@ class LehrauftragJob extends JOB_Controller
}
}
}
-
+
// HTML table body end and link
$html .= '
@@ -484,10 +484,10 @@ class LehrauftragJob extends JOB_Controller
';
}
}
-
+
return $html;
}
-
+
/**
* Send Sancho eMail about ordered Lehrauftraege.
* @param $data_arr
@@ -499,24 +499,24 @@ class LehrauftragJob extends JOB_Controller
{
// Set mail recipient (lector)
$to = $data['uid']. '@'. DOMAIN;
-
+
// Link to LehrauftragAkzeptieren
$url = CIS_ROOT. 'cis/index.php?menu='.
CIS_ROOT. 'cis/menu.php?content_id=&content='.
CIS_ROOT. index_page(). self::LEHRAUFTRAG_AKZEPTIEREN_URI;
-
+
// Get first name
$first_name = '';
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$this->BenutzerModel->addSelect('vorname');
$this->BenutzerModel->addJoin('public.tbl_person', 'person_id');
$result = $this->BenutzerModel->loadWhere(array('uid' => $data['uid']));
-
+
if (hasData($result))
{
$first_name = $result->retval[0]->vorname;
}
-
+
// Prepare mail content
$content_data_arr = array(
'vorname' => $first_name,
@@ -524,7 +524,7 @@ class LehrauftragJob extends JOB_Controller
'anzahl' => $data['amount'],
'link' => anchor($url, 'Lehraufträge Übersicht')
);
-
+
sendSanchoMail(
'LehrauftragNeueErteilte',
$content_data_arr,
@@ -532,5 +532,6 @@ class LehrauftragJob extends JOB_Controller
'Neu erteilte Lehraufträge zum Annehmen bereit'
);
}
+ return true;
}
}
diff --git a/application/controllers/jobs/OneTimeMessages.php b/application/controllers/jobs/OneTimeMessages.php
index 39e0a946c..58bc1fb7c 100644
--- a/application/controllers/jobs/OneTimeMessages.php
+++ b/application/controllers/jobs/OneTimeMessages.php
@@ -27,11 +27,11 @@ class OneTimeMessages extends JOB_Controller
* - Status set as "Wartender"
* - The given study course type (b = bachelor, m = master)
* - The given semester (ex WS2020)
- * - How long since applicant (months)
+ * - How long since applicant (days)
* - The given template id to be used as message subject and body (vorlage_kurzbz)
* The sender of all the messages is specified by the parameter senderId (sender person_id)
*/
- public function sendMessageToApplicantsStillWaiting($senderId, $studyCourseType, $semester, $months, $messageTemplate)
+ public function sendMessageToApplicantsStillWaiting($senderId, $studyCourseType, $semester, $days, $messageTemplate)
{
$this->logInfo('Send message to applicants still waiting start');
@@ -47,13 +47,13 @@ class OneTimeMessages extends JOB_Controller
$dbModel = new DB_Model();
$dbPrestudents = $dbModel->execReadOnlyQuery(
- 'SELECT p.prestudent_id
+ 'SELECT distinct on(person_id) p.prestudent_id
FROM public.tbl_prestudent p
JOIN public.tbl_prestudentstatus ps USING (prestudent_id)
JOIN public.tbl_studiengang s USING (studiengang_kz)
WHERE ps.status_kurzbz = \'Wartender\'
AND ps.studiensemester_kurzbz = ?
- AND ps.datum <= NOW() - \''.$months.' months\'::interval
+ AND ps.datum <= NOW() - \''.$days.' days\'::interval
AND s.typ = ?
AND NOT EXISTS (
SELECT pp.person_id
diff --git a/application/controllers/lehre/Pruefungsprotokoll.php b/application/controllers/lehre/Pruefungsprotokoll.php
new file mode 100644
index 000000000..467a7dc71
--- /dev/null
+++ b/application/controllers/lehre/Pruefungsprotokoll.php
@@ -0,0 +1,232 @@
+ 'lehre/pruefungsbeurteilung:r',
+ 'Protokoll' => 'lehre/pruefungsbeurteilung:r',
+ 'saveProtokoll' => 'lehre/pruefungsbeurteilung:rw',
+ )
+ );
+
+ // Load models
+ $this->load->model('education/Abschlusspruefung_model', 'AbschlusspruefungModel');
+ $this->load->model('education/Abschlussbeurteilung_model', 'AbschlussbeurteilungModel');
+
+ $this->load->library('PermissionLib');
+ $this->load->library('AuthLib');
+
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'ui',
+ 'global',
+ 'person',
+ 'abschlusspruefung',
+ 'password',
+ 'lehre'
+ )
+ );
+
+ $this->_setAuthUID(); // sets property uid
+
+ $this->setControllerId(); // sets the controller id
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Public methods
+ public function index()
+ {
+ $this->load->library('WidgetLib');
+
+ // Protokolle anzeigen seit heute / letzte Woche / alle
+ $period = $this->input->post('period');
+ $period = (!is_null($period)) ? $period : 'today';
+
+ $data = array('period' => $period);
+
+ $this->load->view('lehre/pruefungsprotokollUebersicht.php', $data);
+ }
+
+ /**
+ * Show Pruefungsprotokoll.
+ */
+ public function Protokoll()
+ {
+ $abschlusspruefung_id = $this->input->get('abschlusspruefung_id');
+
+ if (!is_numeric($abschlusspruefung_id))
+ show_error('invalid abschlusspruefung');
+
+ $abschlusspruefung_saved = false;
+ $abschlusspruefung = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id);
+
+ if (isError($abschlusspruefung))
+ show_error(getError($abschlusspruefung));
+ else
+ {
+ $abschlusspruefung = getData($abschlusspruefung);
+ $abschlusspruefung_saved = isset($abschlusspruefung->protokoll) && isset($abschlusspruefung->abschlussbeurteilung_kurzbz);
+ }
+
+ $this->AbschlussbeurteilungModel->addOrder("sort", "ASC");
+ $this->AbschlussbeurteilungModel->addOrder("(CASE WHEN abschlussbeurteilung_kurzbz = 'ausgezeichnet' THEN 1
+ WHEN abschlussbeurteilung_kurzbz = 'gut' THEN 2
+ WHEN abschlussbeurteilung_kurzbz = 'bestanden' THEN 3
+ WHEN abschlussbeurteilung_kurzbz = 'angerechnet' THEN 4
+ ELSE 5
+ END
+ )");
+ $abschlussbeurteilung = $this->AbschlussbeurteilungModel->load();
+
+ if (isError($abschlussbeurteilung))
+ show_error(getError($abschlussbeurteilung));
+ else
+ $abschlussbeurteilung = getData($abschlussbeurteilung);
+
+ $language = getUserLanguage();
+
+ $data = array(
+ 'abschlusspruefung' => $abschlusspruefung,
+ 'abschlussbeurteilung' => $abschlussbeurteilung,
+ 'abschlusspruefung_saved' => $abschlusspruefung_saved,
+ 'language' => $language
+ );
+
+ $this->load->view('lehre/pruefungsprotokoll.php', $data);
+ }
+
+ /**
+ * Save Pruefungsprotokoll (including possible Freigabe)
+ */
+ public function saveProtokoll()
+ {
+ $abschlusspruefung_id = $this->input->post('abschlusspruefung_id');
+ $freigebendata = $this->input->post('freigebendata');
+ $protocoldata = $this->input->post('protocoldata');
+
+ if (isset($abschlusspruefung_id) && is_numeric($abschlusspruefung_id)
+ && isset($freigebendata['freigeben']) && isset($protocoldata))
+ {
+ // check permission
+ $berechtigt = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id);
+ if (isError($berechtigt))
+ $this->outputJsonError(getError($berechtigt));
+ else
+ {
+ $freigabe = $freigebendata['freigeben'] === 'true';
+
+ if ($freigabe)
+ {
+ // Verify password
+ if (isset($freigebendata['password']) && !isEmptyString($freigebendata['password']))
+ {
+ $password = $freigebendata['password'];
+ $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
+ if (isError($result))
+ {
+ return $this->outputJsonError($this->p->t('password', 'wrongPassword')); // exit if password is incorrect
+ }
+ }
+ else
+ {
+ return $this->outputJsonError($this->p->t('password', 'passwordMissing'));
+ }
+ }
+
+ $data = $this->_prepareAbschlusspruefungDataForSave($protocoldata, $freigabe);
+
+ $result = $this->AbschlusspruefungModel->update($abschlusspruefung_id, $data);
+
+ if (hasData($result))
+ {
+ $abschlusspruefung_id = getData($result);
+ $updateresult = array('abschlusspruefung_id' => $abschlusspruefung_id);
+ if ($freigabe)
+ $updateresult['freigabedatum'] = date_format(date_create($data['freigabedatum']), 'd.m.Y');
+
+ $this->outputJsonSuccess($updateresult);
+ }
+ else
+ $this->outputJsonError('Fehler beim Speichern des Prüfungsprotokolls');
+ }
+ }
+ else
+ $this->outputJsonError($this->p->t('ui', 'ungueltigeParameter'));
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ * 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');
+ }
+
+ /**
+ * Retrieves an Abschlussprüfung, with permission check
+ * permission: admin, assistance of study programe or Vorsitz of the Prüfung
+ * @param $abschlusspruefung_id
+ * @return object success or error
+ */
+ private function _getAbschlusspruefungBerechtigt($abschlusspruefung_id)
+ {
+ $result = error('Error when getting Abschlusspruefung');
+
+ if (isset($this->_uid))
+ {
+ $abschlusspruefung = $this->AbschlusspruefungModel->getAbschlusspruefung($abschlusspruefung_id);
+
+ if (hasData($abschlusspruefung))
+ {
+ $abschlusspruefung_data = getData($abschlusspruefung);
+ if ($this->permissionlib->isBerechtigt('admin') ||
+ (isset($abschlusspruefung_data->studiengang_kz) && $this->permissionlib->isBerechtigt('assistenz', 'suid', $abschlusspruefung_data->studiengang_kz))
+ || $this->_uid === $abschlusspruefung_data->uid_vorsitz)
+ $result = $abschlusspruefung;
+ else
+ $result = error('Permission denied');
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Prepares Abschlussprüfung for save in database, replaces '' with null, sets Freigabedatum
+ * @param $data
+ * @return array
+ */
+ private function _prepareAbschlusspruefungDataForSave($data, $freigabe)
+ {
+ $nullfields = array('uhrzeit', 'endezeit', 'abschlussbeurteilung_kurzbz', 'protokoll');
+ foreach ($data as $idx => $item)
+ {
+ if (in_array($idx, $nullfields) & $item === '')
+ $data[$idx] = null;
+ }
+
+ if ($freigabe === true)
+ $data['freigabedatum'] = date('Y-m-d');
+
+ return $data;
+ }
+}
diff --git a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php
index dade1fb21..b7140c7c3 100644
--- a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php
+++ b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php
@@ -52,7 +52,8 @@ class Lehrauftrag extends Auth_Controller
array(
'global',
'ui',
- 'lehre'
+ 'lehre',
+ 'table'
)
);
diff --git a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php
index 4fc0a879b..6ac2da887 100644
--- a/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php
+++ b/application/controllers/lehre/lehrauftrag/LehrauftragAkzeptieren.php
@@ -8,180 +8,196 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class LehrauftragAkzeptieren extends Auth_Controller
{
- const APP = 'lehrauftrag';
- const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/LehrauftragAkzeptieren'; // URL prefix for this controller
- const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
+ const APP = 'lehrauftrag';
+ const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/LehrauftragAkzeptieren'; // URL prefix for this controller
+ const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
- private $_uid; // uid of the logged user
+ private $_uid; // uid of the logged user
- /**
- * Constructor
- */
- public function __construct()
- {
- // Set required permissions
- parent::__construct(
- array(
- 'index' => 'lehre/lehrauftrag_akzeptieren:r',
- 'acceptLehrauftrag' => 'lehre/lehrauftrag_akzeptieren:rw',
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ // Set required permissions
+ parent::__construct(
+ array(
+ 'index' => 'lehre/lehrauftrag_akzeptieren:r',
+ 'acceptLehrauftrag' => 'lehre/lehrauftrag_akzeptieren:rw',
'checkInkludierteLehre' => 'lehre/lehrauftrag_akzeptieren:rw'
- )
- );
+ )
+ );
- // Load models
- $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
- $this->load->model('accounting/Vertrag_model', 'VertragModel');
- $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
- $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
- $this->load->model('codex/Bisverwendung_model', 'BisverwendungModel');
- $this->load->model('person/Benutzer_model', 'BenutzerModel');
+ // Load models
+ $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
+ $this->load->model('accounting/Vertrag_model', 'VertragModel');
+ $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
+ $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
+ $this->load->model('codex/Bisverwendung_model', 'BisverwendungModel');
+ $this->load->model('person/Benutzer_model', 'BenutzerModel');
- // Load libraries
- $this->load->library('WidgetLib');
- $this->load->library('PermissionLib');
- $this->load->library('AuthLib');
+ // Load libraries
+ $this->load->library('WidgetLib');
+ $this->load->library('PermissionLib');
+ $this->load->library('AuthLib');
- // Load helpers
- $this->load->helper('array');
- $this->load->helper('url');
+ // Load helpers
+ $this->load->helper('array');
+ $this->load->helper('url');
- // Load language phrases
- $this->loadPhrases(
- array(
- 'global',
- 'ui',
- 'lehre'
- )
- );
+ // Load language phrases
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'lehre',
+ 'password',
+ 'dms',
+ 'table'
+ )
+ );
- $this->_setAuthUID(); // sets property uid
+ $this->_setAuthUID(); // sets property uid
- $this->setControllerId(); // sets the controller id
- }
+ $this->setControllerId(); // sets the controller id
+ }
- // -----------------------------------------------------------------------------------------------------------------
- // Public methods
+ // -----------------------------------------------------------------------------------------------------------------
+ // Public methods
- /**
- * Main page of Lehrauftrag
- */
- public function index()
- {
- // Set studiensemester selected for studiengang dropdown
- $studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
- if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
- {
- $studiensemester = $this->StudiensemesterModel->getAktOrNextSemester();
- if (hasData($studiensemester))
- {
- $studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
- }
- elseif (isError($studiensemester))
- {
- show_error(getError($studiensemester));
- }
- }
+ /**
+ * Main page of Lehrauftrag
+ */
+ public function index()
+ {
+ // Set studiensemester selected for studiengang dropdown
+ $studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
+ if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
+ {
+ $studiensemester = $this->StudiensemesterModel->getAktOrNextSemester();
+ if (hasData($studiensemester))
+ {
+ $studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
+ }
+ elseif (isError($studiensemester))
+ {
+ show_error(getError($studiensemester));
+ }
+ }
- $view_data = array(
- 'studiensemester_selected' => $studiensemester_kurzbz
- );
+ // Check if user is external lector
+ $this->MitarbeiterModel->addJoin('public.tbl_benutzer', 'uid = mitarbeiter_uid');
+ $result = $this->MitarbeiterModel->loadWhere(array(
+ 'uid' => $this->_uid,
+ 'fixangestellt' => false,
+ 'personalnummer > ' => 0,
+ 'lektor' => true,
+ 'aktiv' => true
+ ));
+
+ $is_external_lector = hasData($result) ? true : false;
+
+ $view_data = array(
+ 'studiensemester_selected' => $studiensemester_kurzbz,
+ 'is_external_lector' => $is_external_lector
+ );
- $this->load->view('lehre/lehrauftrag/acceptLehrauftrag.php', $view_data);
- }
+ $this->load->view('lehre/lehrauftrag/acceptLehrauftrag.php', $view_data);
+ }
- /**
- * Set the contract status of Lehrauftrag to 'akzeptiert'.
- * Performed on ajax call.
- */
- public function acceptLehrauftrag()
- {
- // Verify password
- $password = $this->input->post('password');
- if (!isEmptyString($password))
- {
- $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
- if (isError($result))
- {
- return $this->outputJsonError('Passwort ist inkorrekt'); // exit if password is incorrect
- }
- }
- else
- {
+ /**
+ * Set the contract status of Lehrauftrag to 'akzeptiert'.
+ * Performed on ajax call.
+ */
+ public function acceptLehrauftrag()
+ {
+ // Verify password
+ $password = $this->input->post('password');
+ if (!isEmptyString($password))
+ {
+ $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
+ if (isError($result))
+ {
+ return $this->outputJsonError('Passwort ist inkorrekt'); // exit if password is incorrect
+ }
+ }
+ else
+ {
return $this->outputJsonError('Passwort fehlt');
- }
+ }
- // Loop through lehraufträge
- $lehrauftrag_arr = $this->input->post('selected_data');
+ // Loop through lehraufträge
+ $lehrauftrag_arr = $this->input->post('selected_data');
- if(is_array($lehrauftrag_arr))
- {
- foreach($lehrauftrag_arr as $lehrauftrag)
- {
- $vertrag_id = (!is_null($lehrauftrag['vertrag_id'])) ? $lehrauftrag['vertrag_id'] : null;
+ if(is_array($lehrauftrag_arr))
+ {
+ foreach($lehrauftrag_arr as $lehrauftrag)
+ {
+ $vertrag_id = (!is_null($lehrauftrag['vertrag_id'])) ? $lehrauftrag['vertrag_id'] : null;
- // Check if user is entitled to accept this Lehrauftrag
- // * first retrieve person_id of the contract
- $this->VertragModel->addSelect('person_id');
+ // Check if user is entitled to accept this Lehrauftrag
+ // * first retrieve person_id of the contract
+ $this->VertragModel->addSelect('person_id');
- if ($result = getData($this->VertragModel->load($vertrag_id)))
- {
- // * then find the uid of that contracts person_id
- $this->BenutzerModel->addSelect('uid');
+ if ($result = getData($this->VertragModel->load($vertrag_id)))
+ {
+ // * then find the uid of that contracts person_id
+ $this->BenutzerModel->addSelect('uid');
- if ($result = getData($this->BenutzerModel->getFromPersonId($result[0]->person_id)))
- {
- // * finally check uid of contract against the logged in user
+ if ($result = getData($this->BenutzerModel->getFromPersonId($result[0]->person_id)))
+ {
+ // * finally check uid of contract against the logged in user
$account_found = false;
- foreach($result as $row_accounts)
+ foreach ($result as $row_accounts)
{
- if($row_accounts->uid == $this->_uid)
+ if ($row_accounts->uid == $this->_uid)
{
$account_found = true;
}
}
- if (!$account_found)
- {
+ if (!$account_found)
+ {
return $this->outputJsonError('Sie haben keine Berechtigung für einen Vertrag');
- }
- }
- else
- {
+ }
+ }
+ else
+ {
return $this->outputJsonError('Fehler beim Laden der Benutzerdaten');
- }
- }
- else
- {
+ }
+ }
+ else
+ {
return $this->outputJsonError('Fehler beim Laden des Vertrags');
- }
+ }
- // Set status to accepted
- $result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $this->_uid, 'akzeptiert');
+ // Set status to accepted
+ $result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $this->_uid, 'akzeptiert');
- if ($result->retval)
- {
- $json []= array(
- 'row_index' => $lehrauftrag['row_index'],
- 'akzeptiert' => date('Y-m-d')
- );
- }
+ if ($result->retval)
+ {
+ $json []= array(
+ 'row_index' => $lehrauftrag['row_index'],
+ 'akzeptiert' => date('Y-m-d')
+ );
+ }
else
{
return $this->outputJsonError($result->retval);
}
- }
+ }
- // Output json to ajax
- if (isset($json) && !isEmptyArray($json))
- {
- $this->outputJsonSuccess($json);
- }
- }
+ // Output json to ajax
+ if (isset($json) && !isEmptyArray($json))
+ {
+ $this->outputJsonSuccess($json);
+ }
+ }
else
{
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
}
- }
+ }
/**
* Check if lectors latest Verwendung has inkludierte Lehre
@@ -189,7 +205,7 @@ class LehrauftragAkzeptieren extends Auth_Controller
* - inkludierte_lehre -1: fix employed lector -> has inkludierte Lehre (all inclusive)
* - inkludierte_lehre > 0: fix employed lector -> has inkludierte Lehre (value is amount of hours included)
*/
- public function checkInkludierteLehre()
+ public function checkInkludierteLehre()
{
$result = $this->BisverwendungModel->getLast($this->_uid, false);
@@ -203,17 +219,17 @@ class LehrauftragAkzeptieren extends Auth_Controller
}
}
- // -----------------------------------------------------------------------------------------------------------------
- // Private methods
+ // -----------------------------------------------------------------------------------------------------------------
+ // Private methods
- /**
- * Retrieve the UID of the logged user and checks if it is valid
- */
- private function _setAuthUID()
- {
- $this->_uid = getAuthUID();
+ /**
+ * 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');
- }
+ if (!$this->_uid) show_error('User authentification failed');
+ }
}
diff --git a/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php b/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php
index b339c81a4..64a2be69b 100644
--- a/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php
+++ b/application/controllers/lehre/lehrauftrag/LehrauftragErteilen.php
@@ -50,7 +50,8 @@ class LehrauftragErteilen extends Auth_Controller
array(
'global',
'ui',
- 'lehre'
+ 'lehre',
+ 'table'
)
);
diff --git a/application/controllers/system/FAS_UDF.php b/application/controllers/system/FAS_UDF.php
index cd78d64d2..febe266c7 100644
--- a/application/controllers/system/FAS_UDF.php
+++ b/application/controllers/system/FAS_UDF.php
@@ -7,60 +7,34 @@ class FAS_UDF extends Auth_Controller
const FAS_UDF_SESSION_NAME = 'fasUdfSessionName';
public function __construct()
- {
- parent::__construct(
+ {
+ parent::__construct(
array(
'index' => 'basis/person:r',
'saveUDF' => 'basis/person:rw'
)
);
-
+
$this->load->model('person/Person_model', 'PersonModel');
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
- }
+ }
/**
*
*/
public function index()
{
- $fasUdfSession = getSession(self::FAS_UDF_SESSION_NAME);
-
$person_id = $this->input->get('person_id');
- if (isset($fasUdfSession['person_id']))
- {
- if (!isset($person_id))
- {
- $person_id = $fasUdfSession['person_id'];
- }
- unset($fasUdfSession['person_id']);
- }
-
$prestudent_id = $this->input->get('prestudent_id');
- if (isset($fasUdfSession['prestudent_id']))
- {
- if (!isset($prestudent_id))
- {
- $prestudent_id = $fasUdfSession['prestudent_id'];
- }
- unset($fasUdfSession['prestudent_id']);
- }
- $result = null;
- if (isset($fasUdfSession['result']))
- {
- $result = clone $fasUdfSession['result'];
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', null);
- }
-
- $data = array('result' => $result);
+ $data = array();
if (isset($person_id) && is_numeric($person_id))
{
if ($this->PersonModel->hasUDF())
{
$personUdfs = $this->PersonModel->getUDFs($person_id);
- $personUdfs['person_id'] = $person_id;
+ $data['person_id'] = $person_id;
$data['personUdfs'] = $personUdfs;
}
}
@@ -70,61 +44,12 @@ class FAS_UDF extends Auth_Controller
if ($this->PrestudentModel->hasUDF())
{
$prestudentUdfs = $this->PrestudentModel->getUDFs($prestudent_id);
- $prestudentUdfs['prestudent_id'] = $prestudent_id;
+ $data['prestudent_id'] = $prestudent_id;
$data['prestudentUdfs'] = $prestudentUdfs;
}
}
$this->load->view('system/fas_udf', $data);
}
-
- /**
- *
- */
- public function saveUDF()
- {
- $udfs = $this->input->post();
- $validation = $this->_validate($udfs);
-
- $userdata = array(
- 'person_id' => $this->input->post('person_id'),
- 'prestudent_id' => $this->input->post('prestudent_id')
- );
-
- if (isSuccess($validation))
- {
- // Load model UDF_model
- $this->load->model('system/FAS_UDF_model', 'FASUDFModel');
-
- $result = $this->FASUDFModel->saveUDFs($udfs);
-
- $userdata['result'] = $result;
- }
- else
- {
- $userdata['result'] = $validation;
- }
-
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'person_id', $userdata['person_id']);
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'prestudent_id', $userdata['prestudent_id']);
- setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', $userdata['result']);
-
- redirect('system/FAS_UDF');
- }
-
- /**
- *
- */
- private function _validate($udfs)
- {
- $validation = error('person_id or prestudent_id is missing');
-
- if((isset($udfs['person_id']) && !(is_null($udfs['person_id'])) && ($udfs['person_id'] != ''))
- || (isset($udfs['prestudent_id']) && !(is_null($udfs['prestudent_id'])) && ($udfs['prestudent_id'] != '')))
- {
- $validation = success(true);
- }
-
- return $validation;
- }
}
+
diff --git a/application/controllers/system/LogsViewer.php b/application/controllers/system/LogsViewer.php
index 8caf9f3a7..4e39db5e3 100644
--- a/application/controllers/system/LogsViewer.php
+++ b/application/controllers/system/LogsViewer.php
@@ -35,7 +35,7 @@ class LogsViewer extends Auth_Controller
// Public methods
/**
- * Main page of the InfoCenter tool
+ * Everything has a beginning
*/
public function index()
{
diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php
index 287dbf515..43de8bb60 100644
--- a/application/controllers/system/infocenter/InfoCenter.php
+++ b/application/controllers/system/infocenter/InfoCenter.php
@@ -1337,7 +1337,7 @@ class InfoCenter extends Auth_Controller
show_error(getError($prestudentWithZgv));
}
- $zgvpruefung = $prestudentWithZgv->retval[0];
+ $zgvpruefung = getData($prestudentWithZgv);
if (isset($zgvpruefung->prestudentstatus))
{
@@ -1362,11 +1362,15 @@ class InfoCenter extends Auth_Controller
$zgvpruefung->isRtFreigegeben = false;
$zgvpruefung->isStgFreigegeben = false;
$zgvpruefung->sendStgFreigabeMsg = true;//wether Stgudiengangfreigabemessage can be sent (for "exceptions", Studiengänge with no message sending)
- $this->PrestudentstatusModel->addSelect('bestaetigtam, statusgrund_id, tbl_status_grund.bezeichnung_mehrsprachig AS bezeichnung_statusgrund');
- $this->PrestudentstatusModel->addJoin('public.tbl_status_grund', 'statusgrund_id', 'LEFT');
- $isFreigegeben = $this->PrestudentstatusModel->loadWhere(array('studiensemester_kurzbz' => $zgvpruefung->prestudentstatus->studiensemester_kurzbz,
- 'tbl_prestudentstatus.status_kurzbz' => self::INTERESSENTSTATUS, 'prestudent_id' => $prestudent->prestudent_id));
+ $isFreigegeben = null;
+ if (isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz))
+ {
+ $this->PrestudentstatusModel->addSelect('bestaetigtam, statusgrund_id, tbl_status_grund.bezeichnung_mehrsprachig AS bezeichnung_statusgrund');
+ $this->PrestudentstatusModel->addJoin('public.tbl_status_grund', 'statusgrund_id', 'LEFT');
+ $isFreigegeben = $this->PrestudentstatusModel->loadWhere(array('studiensemester_kurzbz' => $zgvpruefung->prestudentstatus->studiensemester_kurzbz,
+ 'tbl_prestudentstatus.status_kurzbz' => self::INTERESSENTSTATUS, 'prestudent_id' => $prestudent->prestudent_id));
+ }
if (hasData($isFreigegeben))
{
@@ -1537,9 +1541,10 @@ class InfoCenter extends Auth_Controller
show_error(getError($prestudent));
}
- $person_id = $prestudent->retval[0]->person_id;
- $studiengang_kurzbz = $prestudent->retval[0]->studiengang;
- $studiengang_bezeichnung = $prestudent->retval[0]->studiengangbezeichnung;
+ $prestudentdata = getData($prestudent);
+ $person_id = $prestudentdata->person_id;
+ $studiengang_kurzbz = $prestudentdata->studiengang;
+ $studiengang_bezeichnung = $prestudentdata->studiengangbezeichnung;
return array('person_id' => $person_id, 'studiengang_kurzbz' => $studiengang_kurzbz, 'studiengang_bezeichnung' => $studiengang_bezeichnung);
}
@@ -1582,7 +1587,8 @@ class InfoCenter extends Auth_Controller
private function _sendFreigabeMail($prestudent_id)
{
//get data
- $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id)->retval[0];
+ $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id);
+ $prestudent = getData($prestudent);
$prestudentstatus = $prestudent->prestudentstatus;
$person_id = $prestudent->person_id;
$person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval;
diff --git a/application/controllers/system/jq/JobsQueueManager.php b/application/controllers/system/jq/JobsQueueManager.php
new file mode 100644
index 000000000..e72607675
--- /dev/null
+++ b/application/controllers/system/jq/JobsQueueManager.php
@@ -0,0 +1,130 @@
+ 'admin:r',
+ 'addNewJobsToQueue' => 'admin:rw',
+ 'updateJobsQueue' => 'admin:rw'
+ )
+ );
+
+ // Loading config file jqm
+ $this->config->load('jqm');
+
+ // Loads JobsQueueLib
+ $this->load->library('JobsQueueLib');
+ // Loads permission lib
+ $this->load->library('PermissionLib');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * To get all the most recently added jobs using the given job type
+ */
+ public function getLastJobs()
+ {
+ $type = $this->input->get(JobsQueueLib::PROPERTY_TYPE);
+
+ $this->_checkPermissions($type);
+
+ $this->outputJson($this->jobsqueuelib->getLastJobs($type));
+ }
+
+ /**
+ * Add new jobs in the jobs queue with the given type
+ * jobs is an array of job objects
+ */
+ public function addNewJobsToQueue()
+ {
+ $type = $this->input->post(JobsQueueLib::PROPERTY_TYPE);
+ $jobs = $this->input->post(self::PARAM_JOBS);
+
+ $this->_checkPermissions($type);
+
+ // Otherwise convert jobs from json to php and call JobsQueueLib library
+ $this->outputJson($this->jobsqueuelib->addNewJobsToQueue($type, $this->_convertJobs($jobs)));
+ }
+
+ /**
+ * Add new jobs in the jobs queue with the given type
+ * jobs is an array of job objects
+ */
+ public function updateJobsQueue()
+ {
+ $type = $this->input->post(JobsQueueLib::PROPERTY_TYPE);
+ $jobs = $this->input->post(self::PARAM_JOBS);
+
+ $this->_checkPermissions($type);
+
+ // Otherwise convert jobs from json to php and call JobsQueueLib library
+ $this->outputJson($this->jobsqueuelib->updateJobsQueue($type, $this->_convertJobs($jobs)));
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ *
+ */
+ private function _checkPermissions($type)
+ {
+ // Checks if the caller has the permissions to add new jobs with the given type in the queue
+ if (!$this->permissionlib->isEntitled($this->config->item(self::JOB_TYPE_PERMISSIONS_WHITE_LIST), $type))
+ {
+ // Permissions NOT valid
+ $this->terminateWithJsonError('You are not allowed to access to this content');
+ }
+ }
+
+ /**
+ *
+ */
+ private function _convertJobs($jobs)
+ {
+ if (isEmptyArray($jobs)) return null; // if not a valid array then return null
+
+ $convertedJobsArray = array(); // returned values
+
+ // Loops through all the provided jobs
+ foreach ($jobs as $job)
+ {
+ $tmpObj = json_decode($job); // Try to decode json to php
+
+ // If decode was a success
+ if ($tmpObj != null)
+ {
+ $convertedJobsArray[] = $tmpObj; // then store the decoded object in the result array
+ }
+ else // otherwise
+ {
+ // Create a new object and store the error message in it
+ $tmpObj = new stdClass();
+ $tmpObj->{JobsQueueLib::PROPERTY_ERROR} = 'A not valid json was provided';
+
+ $convertedJobsArray[] = $tmpObj; // store this object into the result array
+ }
+ }
+
+ return $convertedJobsArray;
+ }
+}
diff --git a/application/controllers/system/jq/JobsQueueViewer.php b/application/controllers/system/jq/JobsQueueViewer.php
new file mode 100644
index 000000000..2698d79d1
--- /dev/null
+++ b/application/controllers/system/jq/JobsQueueViewer.php
@@ -0,0 +1,51 @@
+ 'system/developer:r'
+ )
+ );
+
+ // Loads WidgetLib
+ $this->load->library('WidgetLib');
+
+ // Loads JobsQueueLib
+ $this->load->library('JobsQueueLib');
+
+ // Loads phrases system
+ $this->loadPhrases(
+ array(
+ 'global',
+ 'ui',
+ 'filter'
+ )
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * Everything has a beginning
+ */
+ public function index()
+ {
+ $this->load->view('system/jq/jobsQueueViewer.php');
+ }
+}
diff --git a/application/controllers/widgets/Filters.php b/application/controllers/widgets/Filters.php
index b5cbc07ea..748272f09 100644
--- a/application/controllers/widgets/Filters.php
+++ b/application/controllers/widgets/Filters.php
@@ -4,7 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This controller operates between (interface) the JS (GUI) and the FilterWidgetLib (back-end)
- * Provides data to the ajax get calls about the filter
+ * Provides data to the ajax get calls about the filter widget
* Accepts ajax post calls to change the filter data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the FilterWidget has its
@@ -12,7 +12,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class Filters extends FHC_Controller
{
- const FILTER_UNIQUE_ID = 'filterUniqueId';
+ const FILTER_UNIQUE_ID = 'filterUniqueId'; // Name of the filter widget unique id
/**
* Calls the parent's constructor and loads the FilterWidgetLib
diff --git a/application/controllers/widgets/Tables.php b/application/controllers/widgets/Tables.php
index 21161ff9f..b3ea7d5a5 100644
--- a/application/controllers/widgets/Tables.php
+++ b/application/controllers/widgets/Tables.php
@@ -4,7 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* This controller operates between (interface) the JS (GUI) and the tablewidgetlib (back-end)
- * Provides data to the ajax get calls about the filter
+ * Provides data to the ajax get calls about the table widget
* Accepts ajax post calls to change the filter data
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the TableWidget has its
@@ -12,7 +12,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class Tables extends FHC_Controller
{
- const TABLE_UNIQUE_ID = 'tableUniqueId';
+ const TABLE_UNIQUE_ID = 'tableUniqueId'; // Name of the table widget unique id
/**
* Calls the parent's constructor and loads the tablewidgetlib
diff --git a/application/controllers/widgets/UDF.php b/application/controllers/widgets/UDF.php
new file mode 100644
index 000000000..5b4c45776
--- /dev/null
+++ b/application/controllers/widgets/UDF.php
@@ -0,0 +1,107 @@
+load->library('AuthLib');
+
+ // Loads the UDFLib with HTTP GET/POST parameters
+ $this->_loadUDFLib();
+
+ // Checks if the caller is allow to use this UDF widget
+ $this->_isAllowed();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * Save data about the current UDFs and the result will be written on the output in JSON format
+ */
+ public function saveUDFs()
+ {
+ $udfUniqueId = $this->input->post(self::UDF_UNIQUE_ID);
+ $udfs = $this->input->post(UDFLib::UDFS_ARG_NAME);
+
+ if (!isEmptyString($udfs))
+ {
+ $jsonDecodedUDF = json_decode($udfs);
+ if ($jsonDecodedUDF != null)
+ {
+ $this->outputJson($this->udflib->saveUDFs($udfUniqueId, $jsonDecodedUDF));
+ }
+ else
+ {
+ $this->outputJsonError('No valid JSON format for UDF values');
+ }
+ }
+ else
+ {
+ $this->outputJsonError('UDFUniqueId, schema, table name, primary key name and primary key value are mandatory paramenters');
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // 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
+ * an error message is printed
+ */
+ private function _loadUDFLib()
+ {
+ // If the parameter UDF_UNIQUE_ID is present in the HTTP GET or POST
+ if (isset($_GET[self::UDF_UNIQUE_ID]) || isset($_POST[self::UDF_UNIQUE_ID]))
+ {
+ // If it is present in the HTTP GET
+ if (isset($_GET[self::UDF_UNIQUE_ID]))
+ {
+ $udfUniqueId = $this->input->get(self::UDF_UNIQUE_ID); // is retrieved from the HTTP GET
+ }
+ elseif (isset($_POST[self::UDF_UNIQUE_ID])) // Else if it is present in the HTTP POST
+ {
+ $udfUniqueId = $this->input->post(self::UDF_UNIQUE_ID); // is retrieved from the HTTP POST
+ }
+
+ // Loads the UDFLib that contains all the used logic
+ $this->load->library('UDFLib');
+
+ $this->udflib->setUDFUniqueId($udfUniqueId);
+ }
+ else // Otherwise an error will be written in the output
+ {
+ $this->terminateWithJsonError('Parameter "'.self::UDF_UNIQUE_ID.'" not provided!');
+ }
+ }
+}
diff --git a/application/core/CLI_Controller.php b/application/core/CLI_Controller.php
index 79e2a1283..7e1e2a1ab 100644
--- a/application/core/CLI_Controller.php
+++ b/application/core/CLI_Controller.php
@@ -3,7 +3,8 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
- *
+ * This is the super class for all those controllers that can only be called from command line
+ * It provides also an helper to display the possible calls
*/
abstract class CLI_Controller extends FHC_Controller
{
@@ -15,9 +16,9 @@ abstract class CLI_Controller extends FHC_Controller
/**
* Constructor
*/
- public function __construct()
+ public function __construct()
{
- parent::__construct();
+ parent::__construct();
// Checks if the controller is called from command line
$this->_isAllowed();
@@ -103,3 +104,4 @@ abstract class CLI_Controller extends FHC_Controller
}
}
}
+
diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php
index ca760c662..4b89ae5bf 100644
--- a/application/core/DB_Model.php
+++ b/application/core/DB_Model.php
@@ -60,6 +60,20 @@ class DB_Model extends CI_Model
// ------------------------------------------------------------------------------------------
// Public methods
+ /**
+ * This method provides a way to setup a database model without declaring one that extends this class
+ */
+ public function setup($schema, $table, $primaryKey, $hasSequence = true)
+ {
+ //
+ if (!isEmptyString($schema) && !isEmptyString($table) && !isEmptyString($primaryKey) && is_bool($hasSequence))
+ {
+ $this->dbTable = $schema.'.'.$table;
+ $this->pk = $primaryKey;
+ $this->hasSequence = $hasSequence;
+ }
+ }
+
/**
* Insert Data into DB-Table
*
@@ -690,7 +704,7 @@ class DB_Model extends CI_Model
*/
public function hasUDF()
{
- if($this->fieldExists(UDFLib::COLUMN_NAME))
+ if ($this->fieldExists(UDFLib::COLUMN_NAME))
{
$resultUDFsDefinitions = $this->UDFModel->getUDFsDefinitions($this->dbTable);
if (hasData($resultUDFsDefinitions))
@@ -727,8 +741,8 @@ class DB_Model extends CI_Model
$cleanedQuery = trim(preg_replace('/\t|\n|\r|;/', '', $query)); //
//
- if (stripos($cleanedQuery, 'SELECT') == 0
- && (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
+ if (
+ (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false)
&& (stripos($cleanedQuery, 'UPDATE') > 0 || stripos($cleanedQuery, 'UPDATE') == false)
&& (stripos($cleanedQuery, 'CREATE') > 0 || stripos($cleanedQuery, 'CREATE') == false)
&& (stripos($cleanedQuery, 'DELETE') > 0 || stripos($cleanedQuery, 'DELETE') == false)
diff --git a/application/core/JOB_Controller.php b/application/core/JOB_Controller.php
index ea779b169..8b32ba0f5 100644
--- a/application/core/JOB_Controller.php
+++ b/application/core/JOB_Controller.php
@@ -3,26 +3,36 @@
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
- *
+ * This is the super class for a job.
+ * All the controllers that extends this class can only be called from command line.
+ * Provides utility methods to log into database
*/
abstract class JOB_Controller extends CLI_Controller
{
/**
* Constructor
*/
- public function __construct()
+ public function __construct()
{
- parent::__construct();
+ parent::__construct();
// Loads LogLib with different debug trace levels to get data of the job that extends this class
// It also specify parameters to set database fields
- $this->load->library('LogLib', array(
- 'classIndex' => 5,
- 'functionIndex' => 5,
- 'lineIndex' => 4,
- 'dbLogType' => 'job', // required
- 'dbExecuteUser' => 'Cronjob system'
- ));
+ $this->load->library(
+ 'LogLib',
+ array(
+ 'classIndex' => 5,
+ 'functionIndex' => 5,
+ 'lineIndex' => 4,
+ 'dbLogType' => 'job', // required
+ 'dbExecuteUser' => 'Cronjob system',
+ 'requestId' => 'JOB',
+ 'requestDataFormatter' => function($data) {
+ return json_encode($data);
+ }
+ ),
+ 'LogLibJob' // library alias case sensitive
+ );
}
//------------------------------------------------------------------------------------------------------------------
@@ -33,7 +43,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logInfo($response, $parameters = null)
{
- $this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters);
+ $this->_log(LogLib::INFO, $response, $parameters);
}
/**
@@ -41,7 +51,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logDebug($response, $parameters = null)
{
- $this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters);
+ $this->_log(LogLib::DEBUG, $response, $parameters);
}
/**
@@ -49,7 +59,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logWarning($response, $parameters = null)
{
- $this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters);
+ $this->_log(LogLib::WARNING, $response, $parameters);
}
/**
@@ -57,7 +67,7 @@ abstract class JOB_Controller extends CLI_Controller
*/
protected function logError($response, $parameters = null)
{
- $this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters);
+ $this->_log(LogLib::ERROR, $response, $parameters);
}
//------------------------------------------------------------------------------------------------------------------
@@ -66,7 +76,7 @@ abstract class JOB_Controller extends CLI_Controller
/**
* Writes a log to database
*/
- private function _log($level, $requestId, $response, $parameters)
+ private function _log($level, $response, $parameters)
{
$data = new stdClass();
@@ -76,17 +86,18 @@ abstract class JOB_Controller extends CLI_Controller
switch($level)
{
case LogLib::INFO:
- $this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO)));
+ $this->LogLibJob->logInfoDB($data);
break;
case LogLib::DEBUG:
- $this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG)));
+ $this->LogLibJob->logDebugDB($data);
break;
case LogLib::WARNING:
- $this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING)));
+ $this->LogLibJob->logWarningDB($data);
break;
case LogLib::ERROR:
- $this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR)));
+ $this->LogLibJob->logErrorDB($data);
break;
}
}
}
+
diff --git a/application/core/JQW_Controller.php b/application/core/JQW_Controller.php
new file mode 100644
index 000000000..72a2a972b
--- /dev/null
+++ b/application/core/JQW_Controller.php
@@ -0,0 +1,129 @@
+LogLibJob->setConfigs(
+ array(
+ 'dbExecuteUser' => 'Jobs queue system',
+ 'requestId' => 'JQW'
+ )
+ );
+
+ // Loads JobsQueueLib library
+ $this->load->library('JobsQueueLib');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Protected methods
+
+ /**
+ * To get all the most recently added jobs using the given job type
+ */
+ protected function getLastJobs($type)
+ {
+ $jobs = $this->jobsqueuelib->getLastJobs($type);
+
+ // If an error occurred then log it in database
+ if (isError($jobs)) $this->logError(getError($jobs), $type);
+
+ return $jobs;
+ }
+
+ /**
+ * To get all the jobs specified by the given parameters
+ */
+ protected function getJobsByTypeStatusInput($type, $status, $input)
+ {
+ $jobs = $this->jobsqueuelib->getJobsByTypeStatusInput($type, $status, $input);
+
+ // If an error occurred then log it in database
+ if (isError($jobs)) $this->logError(getError($jobs), array($type, $status, $input));
+
+ return $jobs;
+ }
+
+ /**
+ * Add new jobs in the jobs queue with the given type
+ * jobs is an array of job objects
+ */
+ protected function addNewJobsToQueue($type, $jobs)
+ {
+ $result = $this->jobsqueuelib->addNewJobsToQueue($type, $jobs);
+
+ // If an error occurred then log it in database
+ if (isError($result)) $this->logError(getError($result), $type);
+
+ return $result;
+ }
+
+ /**
+ * Updates jobs already present in the jobs queue
+ * jobs is an array of job objects
+ */
+ protected function updateJobsQueue($type, $jobs)
+ {
+ $result = $this->jobsqueuelib->updateJobsQueue($type, $jobs);
+
+ // If an error occurred then log it in database
+ if (isError($result)) $this->logError(getError($result), $type);
+
+ return $result;
+ }
+
+ /**
+ * Utility method to update the specified properties of the given jobs with the given values
+ */
+ protected function updateJobs($jobs, $properties, $values)
+ {
+ // If not valid arrays of properties and values arrays are not of the same size then exit
+ if (isEmptyArray($jobs) || isEmptyArray($properties) || isEmptyArray($values)) return;
+ if (count($properties) != count($values)) return;
+
+ // For each job
+ foreach ($jobs as $job)
+ {
+ // For each propery of the job
+ for ($pI = 0; $pI < count($properties); $pI++)
+ {
+ // If this property is present in the job object
+ if (property_exists($job, $properties[$pI]))
+ {
+ $job->{$properties[$pI]} = $values[$pI]; // set a new value
+ }
+ }
+ }
+ }
+
+ /**
+ * Utility method to generate a job with the given parameters and return it inside an array
+ * ready to be used by addNewJobsToQueue and updateJobsQueue
+ */
+ protected function generateJobs($status, $input)
+ {
+ $job = new stdClass();
+
+ $job->{JobsQueueLib::PROPERTY_STATUS} = $status;
+ $job->{JobsQueueLib::PROPERTY_INPUT} = $input;
+
+ return array($job);
+ }
+}
+
diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php
index 6a2675a04..a7eda8827 100644
--- a/application/helpers/hlp_common_helper.php
+++ b/application/helpers/hlp_common_helper.php
@@ -301,3 +301,45 @@ function isLogged()
return isset($ci->authlib) && $ci->authlib->getAuthObj() != null;
}
+
+/**
+ * Konvertiert Problematische Sonderzeichen in Strings fuer
+ * Accountnamen und EMail-Aliase
+ *
+ * @param $str
+ * @return bereinigter String
+ */
+function sanitizeProblemChars($str)
+{
+ $enc = 'UTF-8';
+
+ $acentos = array(
+ 'A' => '/À|Á|Â|Ã|Å/',
+ 'Ae' => '/Ä/',
+ 'a' => '/à|á|â|ã|å/',
+ 'ae'=> '/ä/',
+ 'C' => '/Ç/',
+ 'c' => '/ç/',
+ 'E' => '/È|É|Ê|Ë/',
+ 'e' => '/è|é|ê|ë/',
+ 'I' => '/Ì|Í|Î|Ï/',
+ 'i' => '/ì|í|î|ï/',
+ 'N' => '/Ñ/',
+ 'n' => '/ñ/',
+ 'O' => '/Ò|Ó|Ô|Õ/',
+ 'Oe' => '/Ö/',
+ 'o' => '/ò|ó|ô|õ/',
+ 'oe' => '/ö/',
+ 'U' => '/Ù|Ú|Û/',
+ 'Ue' => '/Ü/',
+ 'u' => '/ù|ú|û/',
+ 'ue' => '/ü/',
+ 'Y' => '/Ý/',
+ 'y' => '/ý|ÿ/',
+ 'a.' => '/ª/',
+ 'o.' => '/º/',
+ 'ss' => '/ß/'
+ );
+
+ return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc));
+}
diff --git a/application/helpers/hlp_header_helper.php b/application/helpers/hlp_header_helper.php
index 1a0d9dc49..f8bbb9ad2 100644
--- a/application/helpers/hlp_header_helper.php
+++ b/application/helpers/hlp_header_helper.php
@@ -69,6 +69,8 @@ function generateCSSsInclude($CSSs)
*/
function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
{
+ $user_language = getUserLanguage();
+
$toPrint = "\n";
$toPrint .= '
-
-
-
-
-
- ';
-
- $studiengang = new studiengang();
- $studiengang->getAll(null,null);
-
- $stg_arr = array();
- foreach ($studiengang->result as $row)
- $stg_arr[$row->studiengang_kz]=$row->kuerzel;
-
- $benutzer = new benutzer();
- if(!$benutzer->load($uid))
- die('Benutzer wurde nicht gefunden');
-
- echo ''.$p->t('tools/zahlungen').' - '.$benutzer->vorname.' '.$benutzer->nachname.' ';
-
- $konto = new konto();
- $konto->getBuchungstyp();
- $buchungstyp = array();
-
- foreach ($konto->result as $row)
- $buchungstyp[$row->buchungstyp_kurzbz]=$row->beschreibung;
-
- $konto = new konto();
- $konto->getBuchungen($benutzer->person_id);
- if(count($konto->result)>0)
- {
- echo '';
- echo '';
- echo '
- '.$p->t('global/datum').'
- '.$p->t('tools/zahlungstyp').'
- '.$p->t('lvplan/stg').'
- '.$p->t('global/studiensemester').'
- '.$p->t('tools/buchungstext').'
- '.$p->t('tools/betrag').'
- '.$p->t('tools/zahlungsbestaetigung').' ';
- echo ' ';
-
- foreach ($konto->result as $row)
- {
- $i=0; //Zaehler fuer Anzahl Gegenbuchungen
- $buchungsnummern='';
-
- if(!isset($row['parent']))
- continue;
- $betrag = $row['parent']->betrag;
-
-
- if(isset($row['childs']))
- {
- foreach ($row['childs'] as $key => $row_child)
- {
- $betrag += $row_child->betrag;
- $betrag = round($betrag, 2);
- $buchungsnummern .= ';'.$row['childs'][$key]->buchungsnr;
- $i = $key; //Zaehler auf letzten Gegenbuchungseintrag setzen
- }
- }
- else
- $buchungsnummern = $row['parent']->buchungsnr;
-
- if($betrag<0)
- $style='style="background-color: #FF8888;"';
- elseif($betrag>0)
- $style='style="background-color: #88DD88;"';
- else
- $style='';
-
- echo "";
- echo ''.date('d.m.Y',$datum_obj->mktime_fromdate(isset($row['childs'][$i])?$row['childs'][$i]->buchungsdatum:$row['parent']->buchungsdatum)).' ';
- echo ''.$buchungstyp[$row['parent']->buchungstyp_kurzbz].' ';
- echo ''.$stg_arr[$row['parent']->studiengang_kz].' ';
- echo ''.$row['parent']->studiensemester_kurzbz.' ';
-
- echo ''.$row['parent']->buchungstext.' ';
- echo '€ '.($betrag<0?'-':($betrag>0?'+':'')).sprintf('%.2f',abs($row['parent']->betrag)).' ';
- echo '';
- if($betrag>=0 && $row['parent']->betrag<=0)
- {
- echo ' ';
- }
- elseif($row['parent']->betrag>0)
- {
- //Auszahlung
- }
- else
- {
- echo 'buchungsnr.$getParam."','Zahlungsdetails','height=500,width=550,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes');return false;";
- echo '" href="#">'.$p->t('tools/offen').' (€ '.sprintf('%.2f',$betrag*-1).')';
-
- echo ' ';
- }
- echo ' ';
- }
- echo '
';
- }
- else
- {
- echo $p->t('tools/keineZahlungenVorhanden');
- }
- echo '';
-?>
+,
+ * Andreas Oesterreicher and
+ * Rudolf Hangl .
+ */
+
+ require_once('../../../config/cis.config.inc.php');
+ require_once('../../../config/global.config.inc.php');
+ require_once('../../../include/functions.inc.php');
+ require_once('../../../include/studiensemester.class.php');
+ require_once('../../../include/konto.class.php');
+ require_once('../../../include/person.class.php');
+ require_once('../../../include/benutzer.class.php');
+ require_once('../../../include/datum.class.php');
+ require_once('../../../include/studiengang.class.php');
+ require_once('../../../include/phrasen.class.php');
+ require_once('../../../include/benutzerberechtigung.class.php');
+
+ $sprache = getSprache();
+ $p = new phrasen($sprache);
+ $uid=get_uid();
+
+ if(isset($_GET['uid']))
+ {
+ // Administratoren duerfen die UID als Parameter uebergeben um die Zahlungen
+ // von anderen Personen anzuzeigen
+
+ $rechte = new benutzerberechtigung();
+ $rechte->getBerechtigungen($uid);
+ if($rechte->isBerechtigt('admin'))
+ {
+ $uid = $_GET['uid'];
+ $getParam = "&uid=" . $uid;
+ }
+ else
+ $getParam = "";
+ }
+ else
+ $getParam='';
+
+ if (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && !ZAHLUNGSBESTAETIGUNG_ANZEIGEN)
+ {
+ die('Um diese Seite anzuzeigen, ist ein entsprechender Eintrag in der Konfigurationsdatei nötig.');
+ }
+
+ $datum_obj = new datum();
+
+ echo '
+
+
+
+ '.$p->t('tools/zahlungen').'
+
+ ';
+
+ include('../../../include/meta/jquery.php');
+ include('../../../include/meta/jquery-tablesorter.php');
+
+echo '
+
+
+
+
+
+ ';
+
+ $studiengang = new studiengang();
+ $studiengang->getAll(null,null);
+
+ $stg_arr = array();
+ foreach ($studiengang->result as $row)
+ $stg_arr[$row->studiengang_kz]=$row->kuerzel;
+
+ $benutzer = new benutzer();
+ if(!$benutzer->load($uid))
+ die('Benutzer wurde nicht gefunden');
+
+ echo ''.$p->t('tools/zahlungen').' - '.$benutzer->vorname.' '.$benutzer->nachname.' ';
+
+ $konto = new konto();
+ $konto->getBuchungstyp();
+ $buchungstyp = array();
+
+ foreach ($konto->result as $row)
+ $buchungstyp[$row->buchungstyp_kurzbz]=$row->beschreibung;
+
+ $konto = new konto();
+ $konto->getBuchungen($benutzer->person_id);
+ if(count($konto->result)>0)
+ {
+ echo '';
+ echo '';
+ echo '
+ '.$p->t('global/datum').'
+ '.$p->t('tools/zahlungstyp').'
+ '.$p->t('lvplan/stg').'
+ '.$p->t('global/studiensemester').'
+ '.$p->t('tools/buchungstext').'
+ '.$p->t('tools/betrag').'
+ '.$p->t('tools/zahlungsbestaetigung').' ';
+ echo ' ';
+
+ foreach ($konto->result as $row)
+ {
+ $i=0; //Zaehler fuer Anzahl Gegenbuchungen
+ $count_studiengangszahlung = 0;
+ $buchungsnummern='';
+
+ // Für die FHTW sollen nur Zahlungsbestaetigungen von FHTW-Studien angezeigt werden. (Nicht von Lehrgaengen)
+ if (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE') && !ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE)
+ {
+ $is_lehrgang = $row['parent']->studiengang_kz < 0 ? true : false;
+ if ($is_lehrgang) continue;
+ }
+
+ if(!isset($row['parent']))
+ continue;
+ $betrag = $row['parent']->betrag;
+ $count_studiengangszahlung ++;
+
+ if(isset($row['childs']))
+ {
+ foreach ($row['childs'] as $key => $row_child)
+ {
+ $betrag += $row_child->betrag;
+ $betrag = round($betrag, 2);
+ $buchungsnummern = !empty($buchungsnummern) ? ';' : '';
+ $buchungsnummern .= $row['childs'][$key]->buchungsnr;
+ $i = $key; //Zaehler auf letzten Gegenbuchungseintrag setzen
+ }
+ }
+ else
+ $buchungsnummern = $row['parent']->buchungsnr;
+
+ if($betrag<0)
+ $style='style="background-color: #FF8888;"';
+ elseif($betrag>0)
+ $style='style="background-color: #88DD88;"';
+ else
+ $style='';
+
+ echo "";
+ echo ''.date('d.m.Y',$datum_obj->mktime_fromdate(isset($row['childs'][$i])?$row['childs'][$i]->buchungsdatum:$row['parent']->buchungsdatum)).' ';
+ echo ''.$buchungstyp[$row['parent']->buchungstyp_kurzbz].' ';
+ echo ''.$stg_arr[$row['parent']->studiengang_kz].' ';
+ echo ''.$row['parent']->studiensemester_kurzbz.' ';
+
+ echo ''.$row['parent']->buchungstext.' ';
+ echo '€ '.($betrag<0?'-':($betrag>0?'+':'')).sprintf('%.2f',abs($row['parent']->betrag)).' ';
+ echo '';
+ if($betrag>=0 && $row['parent']->betrag<=0)
+ {
+ echo ' ';
+ }
+ elseif($row['parent']->betrag>0)
+ {
+ //Auszahlung
+ }
+ else
+ {
+ echo 'buchungsnr.$getParam."','Zahlungsdetails','height=500,width=550,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=no,toolbar=no,location=no,menubar=no,dependent=yes');return false;";
+ echo '" href="#">'.$p->t('tools/offen').' (€ '.sprintf('%.2f',$betrag*-1).')';
+
+ echo ' ';
+ }
+ echo ' ';
+ }
+
+ // Wenn die Tabelle keine Eintraege hat, wird eine Tabellenzeile mit entsprechender Information angezeigt.
+ if ($count_studiengangszahlung == 0)
+ {
+ echo "" .$p->t('tools/keineZahlungenVorhanden'). " ";
+ }
+
+ echo '
';
+ }
+ else
+ {
+ echo $p->t('tools/keineZahlungenVorhanden');
+ }
+ echo '';
+?>
diff --git a/cis/private/profile/zahlungen_details.php b/cis/private/profile/zahlungen_details.php
index 650ee81c0..5b56bea8c 100644
--- a/cis/private/profile/zahlungen_details.php
+++ b/cis/private/profile/zahlungen_details.php
@@ -15,9 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
- * Authors: Martin Tatzber ,
+ * Authors: Martin Tatzber ,
*/
require_once('../../../config/cis.config.inc.php');
+require_once('../../../config/global.config.inc.php');
require_once('../../../include/functions.inc.php');
require_once('../../../include/konto.class.php');
require_once('../../../include/bankverbindung.class.php');
@@ -28,7 +29,7 @@ require_once('../../../include/benutzer.class.php');
require_once('../../../include/benutzerberechtigung.class.php');
require_once('../../../include/student.class.php');
require_once('../../../include/prestudent.class.php');
-
+
$uid = get_uid();
if(isset($_GET['uid']))
@@ -48,7 +49,7 @@ if(isset($_GET['uid']))
}
else
$getParam='';
-
+
$benutzer = new benutzer();
if(!$benutzer->load($uid))
die('Benutzer nicht gefunden');
@@ -88,7 +89,7 @@ $oe=new organisationseinheit();
$oe->load($studiengang->oe_kurzbz);
$konto->getBuchungstyp();
-$buchungstyp = array();
+$buchungstyp = array();
foreach ($konto->result as $row)
$buchungstyp[$row->buchungstyp_kurzbz]=$row->beschreibung;
@@ -153,7 +154,13 @@ if($bic!='')
'.$bic.'
';
}
-if($konto->zahlungsreferenz!='')
+if ($konto->zahlungsreferenz != ''
+ &&
+ (
+ !defined('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN')
+ || ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN == true
+ )
+)
{
echo '
@@ -189,7 +196,7 @@ foreach($addon->result as $a)
';
}
-
+
}
echo '