diff --git a/application/config/navigation.php b/application/config/navigation.php index d415e9332..033a65f86 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -245,3 +245,14 @@ $config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array( 'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r') ) ); + +$config['navigation_menu']['system/issues/Issues/*'] = array( + 'fehlerzustaendigkeiten' => array( + 'link' => site_url('system/issues/IssuesZustaendigkeiten'), + 'description' => 'Fehler Zuständigkeiten', + 'icon' => 'cogs', + 'sort' => 100, + 'target' => '_blank', + 'requiredPermissions' => array('admin:rw') + ) +); diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index 7f5754595..f1974c8a5 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -359,7 +359,7 @@ class LehrauftragJob extends JOB_Controller for ($i = 0; $i < $data_len; $i++) { // Get all users entitled by organisational unit - $result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz']); + $result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz'], 'suid'); if ($berechtigung_arr = getData($result)) { diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index e0103cfec..da92c251c 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -6,7 +6,7 @@ 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 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() @@ -39,6 +39,7 @@ class Issues extends Auth_Controller ); $this->_setAuthUID(); // sets property uid + $this->setControllerId(); // sets the controller id } public function index() @@ -127,7 +128,7 @@ class Issues extends Auth_Controller { $all_funktionen_oe_kurzbz[$benutzerfunktion->oe_kurzbz][] = $benutzerfunktion->funktion_kurzbz; - // separate oes for the funktion needed for displaying issues + // separate oes for the additional funktion which enables displaying issues if ($benutzerfunktion->funktion_kurzbz == self::FUNKTION_KURZBZ) { $oe_kurzbz_for_funktion[] = $benutzerfunktion->oe_kurzbz; @@ -153,7 +154,9 @@ class Issues extends Auth_Controller } // add oes for which there is the "manage issues" Berechtigung - if (!$oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ)) + $oe_kurzbz_berechtigt = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_KURZBZ); + + if (!$oe_kurzbz_berechtigt) show_error('No permission or error when checking permissions'); $all_oe_kurzbz_berechtigt = array_unique(array_merge($oe_kurzbz_for_funktion, $oe_kurzbz_berechtigt)); diff --git a/application/controllers/system/issues/IssuesZustaendigkeiten.php b/application/controllers/system/issues/IssuesZustaendigkeiten.php new file mode 100644 index 000000000..fd3e6192a --- /dev/null +++ b/application/controllers/system/issues/IssuesZustaendigkeiten.php @@ -0,0 +1,217 @@ + 'admin:r', + 'getApps' => 'admin:r', + 'getFehlercodes' => 'admin:r', + 'getNonAssignedZustaendigkeiten' => 'admin:r', + 'addZustaendigkeit' => 'admin:rw', + 'deleteZustaendigkeit' => 'admin:rw' + ) + ); + + // Load libraries + $this->load->library('IssuesLib'); + $this->load->library('WidgetLib'); + + // Load models + $this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); + $this->load->model('system/Fehler_model', 'FehlerModel'); + $this->load->model('system/Fehler_model', 'FehlerModel'); + $this->load->model('system/Fehlerzustaendigkeiten_model', 'FehlerzustaendigkeitenModel'); + + $this->loadPhrases( + array( + 'global', + 'ui', + 'filter', + 'lehre', + 'person', + 'fehlermonitoring' + ) + ); + + $this->_setAuthUID(); // sets property uid + $this->setControllerId(); // sets the controller id + } + + public function index() + { + $this->load->view("system/issues/issuesZustaendigkeiten.php"); + } + + /** + * Loads all Apps to which Fehler exist. + */ + public function getApps() + { + $this->FehlerModel->addDistinct(); + $this->FehlerModel->addSelect('app'); + $this->FehlerModel->addOrder('app'); + + $appRes = $this->FehlerModel->load(); + + $this->outputJson($appRes); + } + + /** + * Gets all fehlercodes, optionally by app. + */ + public function getFehlercodes() + { + $app = $this->input->get('app'); + + //$this->FehlerModel->addSelect('fehlercode, fehler_kurzbz, fehlertext, fehlertyp_kurzbz'); + $this->FehlerModel->addOrder('fehlercode'); + + $fehlerRes = isset($app) ? $this->FehlerModel->loadWhere(array('app' => $app)) : $this->FehlerModel->load(); + + $this->outputJson($fehlerRes); + } + + /** + * Gets all Mitarbeiter, Organisationseinheiten, Funktionen not assigned to a Fehler yet. + */ + public function getNonAssignedZustaendigkeiten() + { + $fehlercode = $this->input->get('fehlercode'); + + $mitarbeiterRes = $this->FehlerzustaendigkeitenModel->getNonAssignedMitarbeiter($fehlercode); + + if (isError($mitarbeiterRes)) + { + $this->outputJsonError(getError($mitarbeiterRes)); + return; + } + + $this->OrganisationseinheitModel->addSelect('oe_kurzbz, bezeichnung, organisationseinheittyp_kurzbz'); + $this->OrganisationseinheitModel->addOrder('organisationseinheittyp_kurzbz, bezeichnung'); + $oeRes = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true)); + + if (isError($oeRes)) + { + $this->outputJsonError(getError($oeRes)); + return; + } + + $oe_funktionen = array(); + + if (hasData($oeRes)) + { + $oes = getData($oeRes); + + foreach ($oes as $oe) + { + $oe->funktionen = array(); + $funktionRes = $this->FehlerzustaendigkeitenModel->getNonAssignedFunktionen($fehlercode, $oe->oe_kurzbz); + + if (isError($funktionRes)) + { + $this->outputJsonError(getError($oeRes)); + return; + } + + $funktionData = getData($funktionRes); + $oe->funktionen = $funktionData; + $oe_funktionen[] = $oe; + } + } + + if (isError($funktionRes)) + { + $this->outputJsonError(getError($funktionRes)); + return; + } + + $result = array( + 'mitarbeiter' => getData($mitarbeiterRes), + 'oe_funktionen' => $oe_funktionen + ); + + $this->outputJsonSuccess($result); + } + + /** + * Adds a Zuständigkeit after performing error checks. + */ + public function addZustaendigkeit() + { + $fehlercode = $this->input->post('fehlercode'); + $mitarbeiter_person_id = $this->input->post('mitarbeiter_person_id'); + $oe_kurzbz = $this->input->post('oe_kurzbz'); + $funktion_kurzbz = $this->input->post('funktion_kurzbz'); + + if (isEmptyString($fehlercode)) + $this->outputJsonError($this->p->t('fehlermonitoring', 'fehlercodeFehlt')); + elseif (isEmptyString($mitarbeiter_person_id) && isEmptyString($oe_kurzbz)) + $this->outputJsonError($this->p->t('fehlermonitoring', 'mitarbeiterUndOeFehlt')); + elseif (!isEmptyString($mitarbeiter_person_id) && !isEmptyString($oe_kurzbz)) + $this->outputJsonError($this->p->t('fehlermonitoring', 'nurOeOderMitarbeiterSetzen')); + elseif (isset($mitarbeiter_person_id) && !is_numeric($mitarbeiter_person_id)) + $this->outputJsonError($this->p->t('fehlermonitoring', 'ungueltigeMitarbeiterId')); + else + { + $data = array( + 'fehlercode' => $fehlercode + ); + + if (!isEmptyString($mitarbeiter_person_id)) + $data['person_id'] = $mitarbeiter_person_id; + + if (!isEmptyString($oe_kurzbz)) + $data['oe_kurzbz'] = $oe_kurzbz; + + if (!isEmptyString($funktion_kurzbz)) + $data['funktion_kurzbz'] = $funktion_kurzbz; + + $zustaendigkeitExistsRes = $this->FehlerzustaendigkeitenModel->loadWhere($data); + + if (isError($zustaendigkeitExistsRes)) + $this->outputJsonError(getError($zustaendigkeitExistsRes)); + elseif (hasData($zustaendigkeitExistsRes)) + $this->outputJsonError($this->p->t('fehlermonitoring', 'zustaendigkeitExistiert')); + else + { + $data['insertvon'] = $this->_uid; + + $this->outputJson($this->FehlerzustaendigkeitenModel->insert($data)); + } + } + } + + /** + * Deletes a Zuständigkeit. + */ + public function deleteZustaendigkeit() + { + $fehlerzustaendigkeiten_id = $this->input->post('fehlerzustaendigkeiten_id'); + + // check if Id correctly passed + if (!isset($fehlerzustaendigkeiten_id) || !is_numeric($fehlerzustaendigkeiten_id)) + { + $this->outputJsonError($this->p->t('fehlermonitoring', 'ungueltigeZustaendigkeitenId')); + return; + } + + $this->outputJson($this->FehlerzustaendigkeitenModel->delete($fehlerzustaendigkeiten_id)); + } + + /** + * 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'); + } +} diff --git a/application/models/accounting/Vertragvertragsstatus_model.php b/application/models/accounting/Vertragvertragsstatus_model.php index 609394321..78a065540 100644 --- a/application/models/accounting/Vertragvertragsstatus_model.php +++ b/application/models/accounting/Vertragvertragsstatus_model.php @@ -135,7 +135,7 @@ class Vertragvertragsstatus_model extends DB_Model /** * Get all contracts, where the status had been set to 'bestellt' on given date - * @param string $string_date e.g. '01.11.2019' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW' + * @param string $string_date e.g. 'YYYY-MM-DD' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW' * @param bool $further_processed If true, ALL ordered contracts of that day are retrieved, even if they were * were ALSO approved/accepted/cancelled (further processed) on that same day. * @return array diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 6bf9fc2c0..173cec529 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -321,8 +321,18 @@ class Person_model extends DB_Model JOIN public.tbl_status USING(status_kurzbz) WHERE status_kurzbz = 'Abbrecher' ) - "; - return $this->execQuery($qry, array($person_id, $person_id)); + UNION + + SELECT p2.person_id + FROM tbl_person p1 + INNER JOIN ( + SELECT vorname, nachname, gebdatum, person_id + FROM tbl_person + ) p2 + ON (p1.vorname = p2.vorname AND p1.nachname = p2.nachname AND p1.gebdatum = p2.gebdatum) + WHERE p1.person_id != p2.person_id AND (p1.person_id = ?)"; + + return $this->execQuery($qry, array($person_id, $person_id, $person_id)); } } diff --git a/application/models/system/Benutzerrolle_model.php b/application/models/system/Benutzerrolle_model.php index 765ad9bd4..0714a1f8f 100644 --- a/application/models/system/Benutzerrolle_model.php +++ b/application/models/system/Benutzerrolle_model.php @@ -43,7 +43,7 @@ class Benutzerrolle_model extends DB_Model * @param null $oe_kurzbz * @return array */ - public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null) + public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null, $art = null) { $params = array(); $query = ' @@ -62,6 +62,12 @@ class Benutzerrolle_model extends DB_Model $params[] = $oe_kurzbz; } + if (!is_null($art)) + { + $query .= ' AND art = ?'; + $params[] = $art; + } + return $this->execQuery($query, $params); } } diff --git a/application/models/system/Fehlerzustaendigkeiten_model.php b/application/models/system/Fehlerzustaendigkeiten_model.php new file mode 100644 index 000000000..9277f3609 --- /dev/null +++ b/application/models/system/Fehlerzustaendigkeiten_model.php @@ -0,0 +1,58 @@ +dbTable = 'system.tbl_fehler_zustaendigkeiten'; + $this->pk = 'fehlerzustaendigkeiten_id'; + } + + /** + * Gets active Mitarbeiter not assigned to a Fehler. + * @param $fehlercode + * @return object + */ + public function getNonAssignedMitarbeiter($fehlercode) + { + $query = "SELECT person_id, ben.uid, vorname, nachname, titelpre, titelpost, personalnummer + FROM public.tbl_mitarbeiter + JOIN public.tbl_benutzer ben ON tbl_mitarbeiter.mitarbeiter_uid = ben.uid + JOIN public.tbl_person pers USING (person_id) + WHERE ben.aktiv + AND NOT EXISTS ( + SELECT 1 FROM system.tbl_fehler_zustaendigkeiten + WHERE person_id = pers.person_id + AND fehlercode = ? + ) + ORDER BY nachname, vorname, uid"; + + return $this->execReadOnlyQuery($query, array($fehlercode)); + } + + /** + * Gets Funktionen not assigned to a Fehler (over an organisational unit). + * @param $fehlercode + * @param $oe_kurzbz + * @return object + */ + public function getNonAssignedFunktionen($fehlercode, $oe_kurzbz) + { + $query = "SELECT funktion_kurzbz, beschreibung + FROM public.tbl_funktion funk + WHERE aktiv + AND NOT EXISTS ( + SELECT 1 FROM system.tbl_fehler_zustaendigkeiten + WHERE funktion_kurzbz = funk.funktion_kurzbz + AND fehlercode = ? + AND oe_kurzbz = ? + ) + ORDER BY beschreibung"; + + return $this->execReadOnlyQuery($query, array($fehlercode, $oe_kurzbz)); + } +} diff --git a/application/views/system/issues/issuesData.php b/application/views/system/issues/issuesData.php index c9a1d3828..a3b011531 100644 --- a/application/views/system/issues/issuesData.php +++ b/application/views/system/issues/issuesData.php @@ -1,7 +1,9 @@ 'issues', 'filter_id' => $this->input->get('filter_id'), 'tableUniqueId' => 'issues', - 'requiredPermissions' => 'admin', + 'requiredPermissions' => 'system/issues_verwalten', 'datasetRepresentation' => 'tablesorter', 'checkboxes' => 'issue_id', 'columnsAliases' => array( @@ -132,7 +149,9 @@ $filterWidgetArray = array( ucfirst($this->p->t('fehlermonitoring', 'statuscode')), ucfirst($this->p->t('person', 'vorname')), ucfirst($this->p->t('person', 'nachname')), - ucfirst($this->p->t('fehlermonitoring', 'hauptzustaendig')) + ucfirst($this->p->t('fehlermonitoring', 'hauptzustaendig')), + ucfirst($this->p->t('fehlermonitoring', 'zustaendigePersonen')), + ucfirst($this->p->t('fehlermonitoring', 'zustaendigeOrganisationseinheiten')) ), 'formatRow' => function($datasetRaw) { @@ -171,6 +190,18 @@ $filterWidgetArray = array( $datasetRaw->{'Verarbeitet von'} = '-'; } + if ($datasetRaw->{'Person Zuständigkeiten'} == null) + { + $datasetRaw->{'Person Zuständigkeiten'} = '-'; + } + + if ($datasetRaw->{'Organisationseinheit Zuständigkeiten'} == null) + { + $datasetRaw->{'Organisationseinheit Zuständigkeiten'} = '-'; + } + + + return $datasetRaw; }, 'markRow' => function($datasetRaw) { diff --git a/application/views/system/issues/issuesZustaendigkeiten.php b/application/views/system/issues/issuesZustaendigkeiten.php new file mode 100644 index 000000000..c22eaaee5 --- /dev/null +++ b/application/views/system/issues/issuesZustaendigkeiten.php @@ -0,0 +1,168 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Fehler Zuständigkeiten', + '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/issuesZustaendigkeiten.css', 'public/css/sbadmin2/tablesort_bootstrap.css'), + 'customJSs' => array('public/js/issues/issuesZustaendigkeiten.js', 'public/js/bootstrapper.js') + ) +); +?> + +
+| + + + | ++ + + | ++ |
| + + + + | +
+ p->t('fehlermonitoring', 'oder') ?>
+ + + |
+ + + + | ++ + + | +
| '; - $html_user_daten.=''; - $html_user_daten.=' - - - '; - $html_user_daten.='Informationen per Mail senden'; - $html_user_daten.=' - - - - '; - $html_user_daten.=''; - $html_user_daten.=' | '; - $html_user_daten.='
| StudentIn |
- Studiengang: $stgbez - Semester: $semester - Verband: $verband - Gruppe: $gruppe - Matrikelnummer: $matrikelnr"; - $html_user_daten.=' | ';
- }
- else if ($lekt_num_rows==1)
- {
- $html_user_daten.='
| Lektor | Kurzzeichen: '.$kurzbz.' Standort: '.$ort.' '.($tel!=''?'Telefon TW: '.$vorwahl.' '.$tel:'').' | ';
- }*/
$html_user_daten.='
| Mindestens nächsten 2 Einheiten frei |
| Derzeit frei |
| Raum derzeit besetzt |
| Raum derzeit besetzt / gesperrt |
Zeit korr. Funktion:alle_raum_informationen ".$row->beginn_show." wird zu ".$lastShowEnde."
"; $row->time_beginn=$lastEnde; } @@ -1900,7 +1750,7 @@ function uid_read_mitarbeiter_oder_student($db,$uid) // Wenn kein Mitarbeiter pruefen ob Student $qry="SELECT uid,person_id,anrede,titelpre,vorname,vornamen,nachname,aktiv FROM campus.vw_student where uid=".$db->db_add_param(trim($uid), FHC_STRING)." LIMIT 1 ; "; if(!$result=$db->db_query($qry)) - die('Probleme beim Lesen der Studierenden '.$db->db_last_error()); + die('Probleme beim Lesen der Studierenden '); if ($num_rows_stunde=$db->db_num_rows($result)) { while($rows = $db->db_fetch_object($result)) @@ -1976,7 +1826,7 @@ function read_create_html_news($db,$fachbereich_kurzbz,$studiengang_kz,$semester { if(defined('CIS_INFOSCREEN_NEWS_ANZEIGEN') && CIS_INFOSCREEN_NEWS_ANZEIGEN==false) return ''; - + // ------------------------------------------------------------------------------------------ // Lesen Newstickerzeilen // ------------------------------------------------------------------------------------------ diff --git a/cis/infoterminal/informationsbildschirm.php b/cis/infoterminal/informationsbildschirm.php index caf174846..75cabdc62 100644 --- a/cis/infoterminal/informationsbildschirm.php +++ b/cis/infoterminal/informationsbildschirm.php @@ -169,21 +169,22 @@ echo ' echo ''; if($infoscreen_id!='' && isset($content[$aktuellerContentIdx])) { - echo '
+
+ |
+
| '.$ip.' | +