From 427a75b74bf6c4a05d422e926c5500b7a5d15f15 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 31 Mar 2022 12:41:18 +0200 Subject: [PATCH 01/10] =?UTF-8?q?added=20GUI=20for=20managing=20Issues=20Z?= =?UTF-8?q?ust=C3=A4ndigkeiten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/system/issues/Issues.php | 2 +- .../system/issues/IssuesZustaendigkeiten.php | 192 ++++++++ .../system/Fehlerzustaendigkeiten_model.php | 76 +++ .../system/issues/issuesZustaendigkeiten.php | 176 +++++++ .../issues/issuesZustaendigkeitenData.php | 84 ++++ public/css/issues/issuesZustaendigkeiten.css | 13 + public/js/issues/issuesZustaendigkeiten.js | 374 ++++++++++++++ system/dbupdate_3.3.php | 22 + system/filtersupdate.php | 23 + system/phrasesupdate.php | 460 ++++++++++++++++++ 10 files changed, 1421 insertions(+), 1 deletion(-) create mode 100644 application/controllers/system/issues/IssuesZustaendigkeiten.php create mode 100644 application/models/system/Fehlerzustaendigkeiten_model.php create mode 100644 application/views/system/issues/issuesZustaendigkeiten.php create mode 100644 application/views/system/issues/issuesZustaendigkeitenData.php create mode 100644 public/css/issues/issuesZustaendigkeiten.css create mode 100644 public/js/issues/issuesZustaendigkeiten.js diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index e0103cfec..d41210e22 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() diff --git a/application/controllers/system/issues/IssuesZustaendigkeiten.php b/application/controllers/system/issues/IssuesZustaendigkeiten.php new file mode 100644 index 000000000..0af1d5e89 --- /dev/null +++ b/application/controllers/system/issues/IssuesZustaendigkeiten.php @@ -0,0 +1,192 @@ + '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('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 + } + + 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; + } + + $oeRes = $this->FehlerzustaendigkeitenModel->getNonAssignedOes($fehlercode); + + if (isError($oeRes)) + { + $this->outputJsonError(getError($oeRes)); + return; + } + + $funktionRes = $this->FehlerzustaendigkeitenModel->getNonAssignedFunktionen($fehlercode); + + if (isError($funktionRes)) + { + $this->outputJsonError(getError($funktionRes)); + return; + } + + $result = array( + 'mitarbeiter' => getData($mitarbeiterRes), + 'oe_kurzbz' => getData($oeRes), + 'funktion' => getData($funktionRes), + ); + + $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/system/Fehlerzustaendigkeiten_model.php b/application/models/system/Fehlerzustaendigkeiten_model.php new file mode 100644 index 000000000..201e69e67 --- /dev/null +++ b/application/models/system/Fehlerzustaendigkeiten_model.php @@ -0,0 +1,76 @@ +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 Organisationseinheiten not assigned to a Fehler. + * @param $fehlercode + * @return object + */ + public function getNonAssignedOes($fehlercode) + { + $query = "SELECT oe_kurzbz, bezeichnung + FROM public.tbl_organisationseinheit oe + WHERE aktiv + AND NOT EXISTS ( + SELECT 1 FROM system.tbl_fehler_zustaendigkeiten + WHERE oe_kurzbz = oe.oe_kurzbz + AND fehlercode = ? + ) + ORDER BY bezeichnung"; + + return $this->execReadOnlyQuery($query, array($fehlercode)); + } + + /** + * Gets Funktionen not assigned to a Fehler. + * @param $fehlercode + * @return object + */ + public function getNonAssignedFunktionen($fehlercode) + { + $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 = ? + ) + ORDER BY funktion_kurzbz"; + + return $this->execReadOnlyQuery($query, array($fehlercode)); + } +} diff --git a/application/views/system/issues/issuesZustaendigkeiten.php b/application/views/system/issues/issuesZustaendigkeiten.php new file mode 100644 index 000000000..81e0f58f4 --- /dev/null +++ b/application/views/system/issues/issuesZustaendigkeiten.php @@ -0,0 +1,176 @@ +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') + ) +); +?> + + +
+ + widgetlib->widget('NavigationWidget'); ?> + +
+
+
+
+ +
+
+
+
+
+ + + + + + +
+ + + + + +
+
+
+
+
+ + + + + + + +
+ + + + + p->t('fehlermonitoring', 'oder') ?> +
+ +
+ + + + + +
+
+
+
+
+
+ +
+
+
+ load->view('system/issues/issuesZustaendigkeitenData.php'); ?> +
+ +
+
+ +
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/issues/issuesZustaendigkeitenData.php b/application/views/system/issues/issuesZustaendigkeitenData.php new file mode 100644 index 000000000..c844734cf --- /dev/null +++ b/application/views/system/issues/issuesZustaendigkeitenData.php @@ -0,0 +1,84 @@ + $query, + 'app' => 'core', + 'datasetName' => 'fehlerZustaendigkeiten', + 'filter_id' => $this->input->get('filter_id'), + 'tableUniqueId' => 'issuesZustaendigkeiten', + 'requiredPermissions' => 'admin', + 'datasetRepresentation' => 'tablesorter', + 'additionalColumns' => array(ucfirst($this->p->t('ui', 'loeschen'))), + 'columnsAliases' => array( + 'ID', + ucfirst($this->p->t('fehlermonitoring', 'fehlercode')), + ucfirst($this->p->t('fehlermonitoring', 'fehlercodeExtern')), + ucfirst($this->p->t('fehlermonitoring', 'fehlerkurzbz')), + ucfirst($this->p->t('fehlermonitoring', 'fehlertext')), + ucfirst($this->p->t('fehlermonitoring', 'fehlertyp')), + 'app', + 'PersonId', + ucfirst($this->p->t('person', 'vorname')), + ucfirst($this->p->t('person', 'nachname')), + ucfirst($this->p->t('fehlermonitoring', 'oeKurzbz')), + ucfirst($this->p->t('fehlermonitoring', 'oeBezeichnung')), + ucfirst($this->p->t('fehlermonitoring', 'funktionKurzbz')), + ucfirst($this->p->t('fehlermonitoring', 'funktionBeschreibung')) + ), + 'formatRow' => function($datasetRaw) { + + $datasetRaw->{ucfirst($this->p->t('ui', 'loeschen'))} = + ""; + + if ($datasetRaw->{'person_id'} == null) + { + $datasetRaw->{'person_id'} = '-'; + } + + if ($datasetRaw->{'vorname'} == null) + { + $datasetRaw->{'vorname'} = '-'; + } + + if ($datasetRaw->{'nachname'} == null) + { + $datasetRaw->{'nachname'} = '-'; + } + + if ($datasetRaw->{'oe_kurzbz'} == null) + { + $datasetRaw->{'oe_kurzbz'} = '-'; + } + + if ($datasetRaw->{'oe_bezeichnung'} == null) + { + $datasetRaw->{'oe_bezeichnung'} = '-'; + } + + if ($datasetRaw->{'funktion_kurzbz'} == null) + { + $datasetRaw->{'funktion_kurzbz'} = '-'; + } + + if ($datasetRaw->{'funktion_beschreibung'} == null) + { + $datasetRaw->{'funktion_beschreibung'} = '-'; + } + + return $datasetRaw; + } +); + +echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); diff --git a/public/css/issues/issuesZustaendigkeiten.css b/public/css/issues/issuesZustaendigkeiten.css new file mode 100644 index 000000000..456049f3e --- /dev/null +++ b/public/css/issues/issuesZustaendigkeiten.css @@ -0,0 +1,13 @@ +td.tableCellNoRightBorder { + border-right: 0 !important; +} + +td.tableCellNoLeftBorder { + border-left: 0 !important; +} + +#fehlercodeInfoCell { + vertical-align: middle; + font-size: 1.2em; + cursor: pointer; +} diff --git a/public/js/issues/issuesZustaendigkeiten.js b/public/js/issues/issuesZustaendigkeiten.js new file mode 100644 index 000000000..4a919f242 --- /dev/null +++ b/public/js/issues/issuesZustaendigkeiten.js @@ -0,0 +1,374 @@ +/** + * Javascript file for issues Zuständigkeiten page + */ + +const FEHLERAPP_DROPDOWN_ID = "fehlerappSelect"; +const FEHLERCODE_DROPDOWN_ID = "fehlercodeSelect"; +const MITARBEITER_AUTOCOMPLETE_ID = "mitarbeiterSelect"; +const MITARBEITER_HIDENFIELD_ID = "mitarbeiter_person_id"; +const ORGANISATIONSEINHEIT_DROPDOWN_ID = "oeSelect"; +const FUNKTION_DROPDOWN_ID = "funktionSelect"; + +var IssuesZustaendigkeiten = { + + mitarbeiterArr: [], + fehlercodesArr: [], + + getApps: function() + { + FHC_AjaxClient.ajaxCallGet( + 'system/issues/IssuesZustaendigkeiten/getApps', + null, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + // save loaded apps + let apps = FHC_AjaxClient.getData(data); + + // fill dropdown with apps + IssuesZustaendigkeiten._fillDropdown( + FEHLERAPP_DROPDOWN_ID, + "app", + apps, + null, + false, + "core" + ); + + // Initiate getting of fehlercodes with apps + IssuesZustaendigkeiten.getFehlercodes($("#"+FEHLERAPP_DROPDOWN_ID).val()); + } + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError(textStatus); + } + } + ); + }, + getFehlercodes: function(app) + { + FHC_AjaxClient.ajaxCallGet( + 'system/issues/IssuesZustaendigkeiten/getFehlercodes', + { + app: app + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + let fehlerCodesData = FHC_AjaxClient.getData(data); + + // save fehlercodes data for displaying info later + IssuesZustaendigkeiten.fehlercodesArr = fehlerCodesData; + + + // display fehlercodes in dropdown + let fehlerCodes = []; + + for (let i = 0; i < fehlerCodesData.length; i++) + { + let code = fehlerCodesData[i]; + + fehlerCodes.push( + { + fehlercode: code.fehlercode, + fullFehlerBezeichnung: code.fehlercode + ' - ' + code.fehler_kurzbz + } + ); + } + + IssuesZustaendigkeiten._fillDropdown( + FEHLERCODE_DROPDOWN_ID, + "fehlercode", + fehlerCodes, + "fullFehlerBezeichnung" + ); + + // initiate call for getting Zuständigkeiten + IssuesZustaendigkeiten.getNonAssignedZustaendigkeiten($("#"+FEHLERCODE_DROPDOWN_ID).val()); + } + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError(textStatus); + } + } + ); + }, + getNonAssignedZustaendigkeiten: function(fehlercode) + { + FHC_AjaxClient.ajaxCallGet( + 'system/issues/IssuesZustaendigkeiten/getNonAssignedZustaendigkeiten', + { + fehlercode: fehlercode + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + // save loaded data + let zustaendigkeitenData = FHC_AjaxClient.getData(data); + + // fill dropdowns with data + IssuesZustaendigkeiten._fillDropdown( + "oeSelect", + "oe_kurzbz", + zustaendigkeitenData.oe_kurzbz, + "bezeichnung", + true + ); + IssuesZustaendigkeiten._fillDropdown("funktionSelect", "funktion_kurzbz", zustaendigkeitenData.funktion, "beschreibung", true); + + // save Mitarbeiter in array + IssuesZustaendigkeiten.mitarbeiterArr = []; + + for (let i = 0; i < zustaendigkeitenData.mitarbeiter.length; i++) + { + let ma = zustaendigkeitenData.mitarbeiter[i]; + + IssuesZustaendigkeiten.mitarbeiterArr.push( + { + label: ma.nachname + " " + ma.vorname + " (" + ma.uid + ")", + id: ma.person_id + } + ); + } + + // fill autocomplete field with mitarbeiter data + IssuesZustaendigkeiten._fillAutocomplete( + MITARBEITER_AUTOCOMPLETE_ID, + MITARBEITER_HIDENFIELD_ID, + IssuesZustaendigkeiten.mitarbeiterArr + ); + + // set events to delete buttons + $(".deleteBtn").click( + function() + { + IssuesZustaendigkeiten.deleteZustaendigkeit($(this).prop("id")); + } + ) + } + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError(textStatus); + } + } + ); + + }, + addZustaendigkeit: function(data) + { + FHC_AjaxClient.ajaxCallPost( + 'system/issues/IssuesZustaendigkeiten/addZustaendigkeit', + data, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + // show message, reset input fields and reload data after Zuständigkeit added + FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t('fehlermonitoring', 'zustaendigkeitGespeichert')) + IssuesZustaendigkeiten._emptyInputFields(); + FHC_FilterWidget.reloadDataset(); + } + else + { + // show error if no data + let errorMsg = FHC_PhrasesLib.t('fehlermonitoring', 'zustaendigkeitGespeichertFehler'); + if (FHC_AjaxClient.isError(data)) + errorMsg += ": "+FHC_AjaxClient.getError(data); + FHC_DialogLib.alertError(errorMsg); + } + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError(textStatus); + } + } + ); + }, + deleteZustaendigkeit: function(fehlerzustaendigkeiten_id) + { + FHC_AjaxClient.ajaxCallPost( + 'system/issues/IssuesZustaendigkeiten/deleteZustaendigkeit', + { + fehlerzustaendigkeiten_id: fehlerzustaendigkeiten_id + }, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.hasData(data)) + { + FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t('fehlermonitoring', 'zustaendigkeitGeloescht')) + // reload dataset to see change + FHC_FilterWidget.reloadDataset(); + } + else + { + FHC_DialogLib.alertError(FHC_PhrasesLib.t('fehlermonitoring', 'zustaendigkeitGeloeschtFehler')); + } + }, + errorCallback: function(jqXHR, textStatus, errorThrown) { + FHC_DialogLib.alertError(textStatus); + } + } + ); + }, + _fillDropdown: function(dropdownId, valueName, data, textName, includeNoSelectionOption, defaultValue) + { + // by default, displayed text in dropdown is the value + if (!textName) + textName = valueName; + + // clear dropdown + $("#"+dropdownId).empty(); + + // optionally include default "no selection" value + if (includeNoSelectionOption === true) + $("#"+dropdownId).append(""); + + // fill dropdown with values + for (let i = 0; i < data.length; i++) + { + let val = data[i]; + // value selected by default + let selected = val === defaultValue ? " selected" : ""; + + // append option + $("#"+dropdownId).append(""); + } + }, + _fillAutocomplete: function(autocompleteId, idFieldId, source) + { + // jQuery ui autocomplete for employees + $("#"+autocompleteId).autocomplete( + { + source: source, + autoFocus: true, + select: function( event, ui ) { + // when autocmplete entry selected, display label text in autocomplete, fill hidden value field + $("#"+autocompleteId).val(ui.item.label); + $("#"+idFieldId).val(ui.item.id); + return false; + } + } + ); + }, + _toggleFieldDisability: function() + { + let oeDropdownEl = $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID); + let funktionDropdownEl = $("#"+FUNKTION_DROPDOWN_ID); + let maAutocompleteEl = $("#"+MITARBEITER_AUTOCOMPLETE_ID); + + // if Mitarbeiter is entered + if (maAutocompleteEl.val().length > 0) + { + // disable oe and funktion input + oeDropdownEl.prop('disabled', true); + oeDropdownEl.val(''); + funktionDropdownEl.prop('disabled', true); + } + else + { + // enable oe and funktion input if Mitarbeiter input empty + oeDropdownEl.prop('disabled', false); + funktionDropdownEl.prop('disabled', false); + } + + // if oe or funktion is entered + if (oeDropdownEl.val().length > 0 || funktionDropdownEl.val().length > 0) + { + // disable Mitarbeiter input + maAutocompleteEl.prop('disabled', true); + maAutocompleteEl.val(''); + } + else + { + // enable mitarbeiter input + maAutocompleteEl.prop('disabled', false); + } + }, + _emptyInputFields: function() + { + // clear all input fields + $("#"+MITARBEITER_AUTOCOMPLETE_ID).val(''); + $("#"+MITARBEITER_HIDENFIELD_ID).val(''); + $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID).val(''); + $("#"+FUNKTION_DROPDOWN_ID).val(''); + } +}; + +/** + * When JQuery is up + */ +$(document).ready(function() { + + // initiate cascade of getting data, first apps + IssuesZustaendigkeiten.getApps(); + + // get new fehlercodes each time app is changed + $("#"+FEHLERAPP_DROPDOWN_ID).change( + function() + { + IssuesZustaendigkeiten.getFehlercodes($("#"+FEHLERAPP_DROPDOWN_ID).val()); + } + ); + + // set events for disabling input fields + $("#"+MITARBEITER_AUTOCOMPLETE_ID).keyup(IssuesZustaendigkeiten._toggleFieldDisability); + $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID+", #"+FUNKTION_DROPDOWN_ID).change(IssuesZustaendigkeiten._toggleFieldDisability); + + // set event for adding a new Zuständigkeit + $("#assignZustaendigkeit").click( + function() + { + let data = { + fehlercode: $("#"+FEHLERCODE_DROPDOWN_ID).val() + } + + let mitarbeiter_person_id = $("#"+MITARBEITER_HIDENFIELD_ID).val(); + let oe_kurzbz = $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID).val(); + + // if person id set, send it, otherwise oe_kurzbz + if (mitarbeiter_person_id.length > 0) + data.mitarbeiter_person_id = mitarbeiter_person_id; + else if (oe_kurzbz.length > 0) + { + data.oe_kurzbz = oe_kurzbz + data.funktion_kurzbz = $("#"+FUNKTION_DROPDOWN_ID).val(); + } + + IssuesZustaendigkeiten.addZustaendigkeit(data); + } + ) + + // set event for showing info modal + $("#fehlercodeInfoCell").click( + function() + { + let fehlercode = $("#"+FEHLERCODE_DROPDOWN_ID).val(); + let fehlercodeData = {}; + + for (let i = 0; i < IssuesZustaendigkeiten.fehlercodesArr.length; i++) + { + let fc = IssuesZustaendigkeiten.fehlercodesArr[i]; + + if (fc.fehlercode === fehlercode) + { + fehlercodeData = fc; + break; + } + } + + if (!fehlercodeData) + return; + + $("#fehlerInfoLabel").text(fehlercodeData.fehlercode + " - " + fehlercodeData.fehler_kurzbz); + $("#fehlercodeInfo").text(fehlercodeData.fehlercode); + $("#fehlerkurzbzInfo").text(fehlercodeData.fehler_kurzbz); + $("#fehlertypInfo").text(fehlercodeData.fehlertyp_kurzbz); + $("#fehlercodeExternInfo").text(fehlercodeData.fehlercode_extern ? fehlercodeData.fehlercode_extern : '-'); + $("#fehlertextInfo").text(fehlercodeData.fehlertext); + + $("#fehlerInfo").modal("show"); + } + ) +}); diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index fa073bcba..02f097893 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5979,6 +5979,28 @@ if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_webservic } } +// ADD COLUMN insertamum to system.tbl_fehler_zustaendigkeiten +if(!@$db->db_query("SELECT insertamum FROM system.tbl_fehler_zustaendigkeiten LIMIT 1")) +{ + $qry = "ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD COLUMN insertamum timestamp DEFAULT now();"; + + if(!$db->db_query($qry)) + echo 'system.tbl_fehler_zustaendigkeiten '.$db->db_last_error().'
'; + else + echo '
Spalte insertamum in system.tbl_fehler_zustaendigkeiten hinzugefügt'; +} + +// ADD COLUMN insertvon to system.tbl_fehler_zustaendigkeiten +if(!@$db->db_query("SELECT insertvon FROM system.tbl_fehler_zustaendigkeiten LIMIT 1")) +{ + $qry = "ALTER TABLE system.tbl_fehler_zustaendigkeiten ADD COLUMN insertvon varchar(32);"; + + if(!$db->db_query($qry)) + echo 'system.tbl_fehler_zustaendigkeiten '.$db->db_last_error().'
'; + else + echo '
Spalte insertvon in system.tbl_fehler_zustaendigkeiten hinzugefügt'; +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 79b46b107..fd1174a76 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -1055,6 +1055,29 @@ $filters = array( } ', 'oe_kurzbz' => null, + ), + array( + 'app' => 'core', + 'dataset_name' => 'fehlerZustaendigkeiten', + 'filter_kurzbz' => 'fehlerZustaendigkeiten', + 'description' => '{Fehler Zustaendigkeiten}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "Fehler Zuständigkeiten", + "columns": [ + {"name": "fehlercode"}, + {"name": "person_id"}, + {"name": "vorname"}, + {"name": "nachname"}, + {"name": "oe_bezeichnung"}, + {"name": "funktion_beschreibung"} + ], + "filters": [] + } + ', + 'oe_kurzbz' => null ) ); diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 3b43a1ac0..14264dc6e 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -13715,6 +13715,466 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'fehlerZustaendigkeiten', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehler Zuständigkeiten", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Error Responsibilities", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigerMitarbeiter', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Mitarbeiter", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Employee", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'oder', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "oder", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "or", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'organisationseinheit', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Organisationseinheit", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Organisational Unit", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'funktion', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Funktion", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Function", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigkeitZuweisen', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Zuständigkeit zuweisen", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "assign", + 'description' => '', + 'insertvon' => 'Assign Responsibility' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'fehlerkurzbz', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehler Kurzbezeichnung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Error short name", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'fehlertext', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehlertext", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Error text", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'oeKurzbz', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Organisationseinheit Kurzbezeichung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Organisational Unit Short Name", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'oeBezeichnung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Organisationseinheit", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Organisational Unit", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'funktionKurzbz', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Funktion Kurzbezeichnung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Function Short Name", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'funktionBeschreibung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Funktion Beschreibung", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Function Description", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'fehlercodeFehlt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehlercode fehlt", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Error code missing", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'mitarbeiterUndOeFehlt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Mitarbeiter oder Organisationseinheit müssen gesetzt sein", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Employee or organisational unit must be set", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'nurOeOderMitarbeiterSetzen', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Mitarbeiter und Organisationseinheit dürfen nicht gleichzeitig gesetzt sein", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Employee and organisational unit cannot be both set", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'ungueltigeMitarbeiterId', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Mitarbeiter person Id ist ungültig", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Employee Id is invalid", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigkeitExistiert', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Zuständigkeit existiert bereits", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Assignment already exists", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'ungueltigeZustaendigkeitenId', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Ungültige Zuständigkeiten Id", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Invalid assignement id", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigkeitGespeichert', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Zuständigkeit gespeichert", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Assignment saved", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigkeitGespeichertFehler', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehler beim Speichern der Zuständigkeit", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Error when saving assignment", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigkeitGeloescht', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Zuständigkeit gelöscht", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Assignment deleted", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigkeitGeloeschtFehler', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Fehler beim Löschen der Zuständigkeit", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Assignment deleted", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'keineAuswahl', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "keine Auswahl", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "no selection", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'ui', From dcf00b04ce9cee432941e2eb23c4ed82e09692fe Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 31 Mar 2022 17:47:20 +0200 Subject: [PATCH 02/10] =?UTF-8?q?Fehler=20Zust=C3=A4ndigkeiten=20GUI:=20re?= =?UTF-8?q?moved=20double=20row=20for=20fehlertyp=20in=20fehler=20info=20m?= =?UTF-8?q?odal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/system/issues/issuesZustaendigkeiten.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/application/views/system/issues/issuesZustaendigkeiten.php b/application/views/system/issues/issuesZustaendigkeiten.php index 81e0f58f4..c22eaaee5 100644 --- a/application/views/system/issues/issuesZustaendigkeiten.php +++ b/application/views/system/issues/issuesZustaendigkeiten.php @@ -138,14 +138,6 @@ $this->load->view( - - - p->t('fehlermonitoring', 'fehlertyp')) ?> - - - - - p->t('fehlermonitoring', 'fehlercodeExtern')) ?> From df3cab593c4dcbf80bc30e4cd39b243f6811cc98 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 7 Apr 2022 12:40:46 +0200 Subject: [PATCH 03/10] fehlerzustaendigkeit phrase "zuweisen" was incorrectly defined --- system/phrasesupdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 14264dc6e..0203fa13a 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -13829,9 +13829,9 @@ array( ), array( 'sprache' => 'English', - 'text' => "assign", + 'text' => "Assign Responsibility", 'description' => '', - 'insertvon' => 'Assign Responsibility' + 'insertvon' => 'system' ) ) ), From f2ec48682b414a2b10c937f251bf84b31b28f206 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Sat, 9 Apr 2022 18:32:47 +0200 Subject: [PATCH 04/10] =?UTF-8?q?Fehler=20Zust=C3=A4ndigkeiten=20assignmen?= =?UTF-8?q?t=20page=20improvements:=20-=20added=20the=20page=20to=20naviga?= =?UTF-8?q?tion=20-=20added=20organisationseinheiten=20type=20to=20oe=20dr?= =?UTF-8?q?opdown=20-=20correct=20order=20of=20oe=20and=20funktion=20dropd?= =?UTF-8?q?own=20entries=20-=20bugfix:=20delete=20button=20was=20not=20sho?= =?UTF-8?q?wn=20when=20german=20language=20-=20mitarbeiter=20autocomplete?= =?UTF-8?q?=20search=20also=20works=20for=20"vorname=20nachname"=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config/navigation.php | 10 +++ .../system/issues/IssuesZustaendigkeiten.php | 2 +- .../system/Fehlerzustaendigkeiten_model.php | 6 +- .../issues/issuesZustaendigkeitenData.php | 4 +- public/js/issues/issuesZustaendigkeiten.js | 75 ++++++++++++++----- 5 files changed, 73 insertions(+), 24 deletions(-) diff --git a/application/config/navigation.php b/application/config/navigation.php index d76b8a7f2..5d0be2925 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -235,3 +235,13 @@ $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, + 'requiredPermissions' => array('admin:rw') + ) +); diff --git a/application/controllers/system/issues/IssuesZustaendigkeiten.php b/application/controllers/system/issues/IssuesZustaendigkeiten.php index 0af1d5e89..635fda2bc 100644 --- a/application/controllers/system/issues/IssuesZustaendigkeiten.php +++ b/application/controllers/system/issues/IssuesZustaendigkeiten.php @@ -108,7 +108,7 @@ class IssuesZustaendigkeiten extends Auth_Controller $result = array( 'mitarbeiter' => getData($mitarbeiterRes), - 'oe_kurzbz' => getData($oeRes), + 'oe' => getData($oeRes), 'funktion' => getData($funktionRes), ); diff --git a/application/models/system/Fehlerzustaendigkeiten_model.php b/application/models/system/Fehlerzustaendigkeiten_model.php index 201e69e67..75eb810ea 100644 --- a/application/models/system/Fehlerzustaendigkeiten_model.php +++ b/application/models/system/Fehlerzustaendigkeiten_model.php @@ -41,7 +41,7 @@ class Fehlerzustaendigkeiten_model extends DB_Model */ public function getNonAssignedOes($fehlercode) { - $query = "SELECT oe_kurzbz, bezeichnung + $query = "SELECT oe_kurzbz, bezeichnung, organisationseinheittyp_kurzbz FROM public.tbl_organisationseinheit oe WHERE aktiv AND NOT EXISTS ( @@ -49,7 +49,7 @@ class Fehlerzustaendigkeiten_model extends DB_Model WHERE oe_kurzbz = oe.oe_kurzbz AND fehlercode = ? ) - ORDER BY bezeichnung"; + ORDER BY organisationseinheittyp_kurzbz, bezeichnung"; return $this->execReadOnlyQuery($query, array($fehlercode)); } @@ -69,7 +69,7 @@ class Fehlerzustaendigkeiten_model extends DB_Model WHERE funktion_kurzbz = funk.funktion_kurzbz AND fehlercode = ? ) - ORDER BY funktion_kurzbz"; + ORDER BY beschreibung"; return $this->execReadOnlyQuery($query, array($fehlercode)); } diff --git a/application/views/system/issues/issuesZustaendigkeitenData.php b/application/views/system/issues/issuesZustaendigkeitenData.php index c844734cf..d4cedd192 100644 --- a/application/views/system/issues/issuesZustaendigkeitenData.php +++ b/application/views/system/issues/issuesZustaendigkeitenData.php @@ -19,7 +19,7 @@ $filterWidgetArray = array( 'tableUniqueId' => 'issuesZustaendigkeiten', 'requiredPermissions' => 'admin', 'datasetRepresentation' => 'tablesorter', - 'additionalColumns' => array(ucfirst($this->p->t('ui', 'loeschen'))), + 'additionalColumns' => array('Delete'), 'columnsAliases' => array( 'ID', ucfirst($this->p->t('fehlermonitoring', 'fehlercode')), @@ -38,7 +38,7 @@ $filterWidgetArray = array( ), 'formatRow' => function($datasetRaw) { - $datasetRaw->{ucfirst($this->p->t('ui', 'loeschen'))} = + $datasetRaw->{'Delete'} = ""; diff --git a/public/js/issues/issuesZustaendigkeiten.js b/public/js/issues/issuesZustaendigkeiten.js index 4a919f242..83b5005bc 100644 --- a/public/js/issues/issuesZustaendigkeiten.js +++ b/public/js/issues/issuesZustaendigkeiten.js @@ -1,18 +1,17 @@ /** - * Javascript file for issues Zuständigkeiten page + * Javascript file for Issues Zuständigkeiten assignment page */ const FEHLERAPP_DROPDOWN_ID = "fehlerappSelect"; const FEHLERCODE_DROPDOWN_ID = "fehlercodeSelect"; const MITARBEITER_AUTOCOMPLETE_ID = "mitarbeiterSelect"; -const MITARBEITER_HIDENFIELD_ID = "mitarbeiter_person_id"; +const MITARBEITER_HIDDENFIELD_ID = "mitarbeiter_person_id"; const ORGANISATIONSEINHEIT_DROPDOWN_ID = "oeSelect"; const FUNKTION_DROPDOWN_ID = "funktionSelect"; var IssuesZustaendigkeiten = { - mitarbeiterArr: [], - fehlercodesArr: [], + fehlercodesArr: [], // for saving received fehlercodes getApps: function() { @@ -62,7 +61,6 @@ var IssuesZustaendigkeiten = { // save fehlercodes data for displaying info later IssuesZustaendigkeiten.fehlercodesArr = fehlerCodesData; - // display fehlercodes in dropdown let fehlerCodes = []; @@ -109,36 +107,74 @@ var IssuesZustaendigkeiten = { // save loaded data let zustaendigkeitenData = FHC_AjaxClient.getData(data); - // fill dropdowns with data + let zustaendigkeiten = []; + + for (let i = 0; i < zustaendigkeitenData.oe.length; i++) + { + let zustaendigkeit = zustaendigkeitenData.oe[i]; + + zustaendigkeiten.push( + { + oe_kurzbz: zustaendigkeit.oe_kurzbz, + fullOeBezeichnung: zustaendigkeit.organisationseinheittyp_kurzbz + ' ' + zustaendigkeit.bezeichnung + } + ); + } + + // fill oe dropdown with data IssuesZustaendigkeiten._fillDropdown( "oeSelect", "oe_kurzbz", - zustaendigkeitenData.oe_kurzbz, - "bezeichnung", + zustaendigkeiten, + "fullOeBezeichnung", true ); - IssuesZustaendigkeiten._fillDropdown("funktionSelect", "funktion_kurzbz", zustaendigkeitenData.funktion, "beschreibung", true); - // save Mitarbeiter in array - IssuesZustaendigkeiten.mitarbeiterArr = []; + // fill funktion dropdown with data + IssuesZustaendigkeiten._fillDropdown( + "funktionSelect", + "funktion_kurzbz", + zustaendigkeitenData.funktion, + "beschreibung", + true + ); + + // save Mitarbeiter data for autocomplete field in array + let autocompleteMitarbeiterArr = []; for (let i = 0; i < zustaendigkeitenData.mitarbeiter.length; i++) { let ma = zustaendigkeitenData.mitarbeiter[i]; - IssuesZustaendigkeiten.mitarbeiterArr.push( + autocompleteMitarbeiterArr.push( { + vorname: ma.vorname, + nachname: ma.nachname, + uid: ma.uid, label: ma.nachname + " " + ma.vorname + " (" + ma.uid + ")", id: ma.person_id } ); } + // callback for searching source mitarbeiter array correctly + let sourceCallback = function(request, response) + { + // case insensitive matcher + var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); + + // match vorname nachname OR nachname vorname OR uid + response($.grep(autocompleteMitarbeiterArr, function (value) { + return matcher.test(value.nachname + ' '+value.vorname + ' ' + value.nachname) + || matcher.test(value.uid); + })); + } + // fill autocomplete field with mitarbeiter data IssuesZustaendigkeiten._fillAutocomplete( MITARBEITER_AUTOCOMPLETE_ID, - MITARBEITER_HIDENFIELD_ID, - IssuesZustaendigkeiten.mitarbeiterArr + MITARBEITER_HIDDENFIELD_ID, + sourceCallback ); // set events to delete buttons @@ -229,7 +265,8 @@ var IssuesZustaendigkeiten = { for (let i = 0; i < data.length; i++) { let val = data[i]; - // value selected by default + + // the value selected by default let selected = val === defaultValue ? " selected" : ""; // append option @@ -241,9 +278,11 @@ var IssuesZustaendigkeiten = { // jQuery ui autocomplete for employees $("#"+autocompleteId).autocomplete( { + // custom matcher source: source, autoFocus: true, - select: function( event, ui ) { + select: function(event, ui) + { // when autocmplete entry selected, display label text in autocomplete, fill hidden value field $("#"+autocompleteId).val(ui.item.label); $("#"+idFieldId).val(ui.item.id); @@ -290,7 +329,7 @@ var IssuesZustaendigkeiten = { { // clear all input fields $("#"+MITARBEITER_AUTOCOMPLETE_ID).val(''); - $("#"+MITARBEITER_HIDENFIELD_ID).val(''); + $("#"+MITARBEITER_HIDDENFIELD_ID).val(''); $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID).val(''); $("#"+FUNKTION_DROPDOWN_ID).val(''); } @@ -324,7 +363,7 @@ $(document).ready(function() { fehlercode: $("#"+FEHLERCODE_DROPDOWN_ID).val() } - let mitarbeiter_person_id = $("#"+MITARBEITER_HIDENFIELD_ID).val(); + let mitarbeiter_person_id = $("#"+MITARBEITER_HIDDENFIELD_ID).val(); let oe_kurzbz = $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID).val(); // if person id set, send it, otherwise oe_kurzbz From b6d61c510d01c1fccc6090102cf409667c9a335e Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Sat, 9 Apr 2022 19:11:42 +0200 Subject: [PATCH 05/10] checksystem: added columns insertamum and insertvon to system.tbl_fehler_zustaendigkeiten check array --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 02f097893..c5be68c80 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -6268,7 +6268,7 @@ $tabellen=array( "system.tbl_extensions" => array("extension_id","name","version","description","license","url","core_version","dependencies","enabled"), "system.tbl_fehler" => array("fehlercode","fehler_kurzbz","fehlercode_extern","fehlertext","fehlertyp_kurzbz","app"), "system.tbl_fehlertyp" => array("fehlertyp_kurzbz","bezeichnung_mehrsprachig"), - "system.tbl_fehler_zustaendigkeiten" => array("fehlerzustaendigkeiten_id","fehlercode","person_id","oe_kurzbz","funktion_kurzbz"), + "system.tbl_fehler_zustaendigkeiten" => array("fehlerzustaendigkeiten_id","fehlercode","person_id","oe_kurzbz","funktion_kurzbz", "insertamum", "insertvon"), "system.tbl_issue" => array("issue_id","fehlercode","fehlercode_extern","inhalt","inhalt_extern","person_id","oe_kurzbz","datum","verarbeitetvon","verarbeitetamum","status_kurzbz","behebung_parameter","insertvon","insertamum","updatevon","updateamum"), "system.tbl_issue_status" => array("status_kurzbz","bezeichnung_mehrsprachig"), "system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"), From 1f13c352a6ab27ca05e48fbdbef8a9e1e57c5e54 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 12 Apr 2022 12:04:13 +0200 Subject: [PATCH 06/10] Issues.php: moved variable declaration out of if clause (phpcs issue) --- application/controllers/system/issues/Issues.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index d41210e22..fc1fb56f1 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -153,7 +153,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)); From 4fe562cbe2e73bdfc463d887923cb6b77caa47bb Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 13 Apr 2022 20:08:08 +0200 Subject: [PATCH 07/10] =?UTF-8?q?Fehlerzust=C3=A4ndigkeiten=20and=20issues?= =?UTF-8?q?=20GUI=20improvements:=20-=20menu=20link=20opens=20in=20new=20t?= =?UTF-8?q?ab=20-=20controller=20id=20set=20for=20easier=20refresh=20-=20a?= =?UTF-8?q?dded=20person=20and=20oe=20Zust=C3=A4ndigkeiten=20to=20issues?= =?UTF-8?q?=20list=20-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config/navigation.php | 1 + .../controllers/system/issues/Issues.php | 3 +- .../system/issues/IssuesZustaendigkeiten.php | 1 + .../views/system/issues/issuesData.php | 91 +++++++++++++------ public/js/issues/issuesZustaendigkeiten.js | 2 +- system/filtersupdate.php | 8 +- system/phrasesupdate.php | 40 ++++++++ 7 files changed, 112 insertions(+), 34 deletions(-) diff --git a/application/config/navigation.php b/application/config/navigation.php index 5d0be2925..111e55c97 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -242,6 +242,7 @@ $config['navigation_menu']['system/issues/Issues/*'] = array( 'description' => 'Fehler Zuständigkeiten', 'icon' => 'cogs', 'sort' => 100, + 'target' => '_blank', 'requiredPermissions' => array('admin:rw') ) ); diff --git a/application/controllers/system/issues/Issues.php b/application/controllers/system/issues/Issues.php index fc1fb56f1..da92c251c 100644 --- a/application/controllers/system/issues/Issues.php +++ b/application/controllers/system/issues/Issues.php @@ -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; diff --git a/application/controllers/system/issues/IssuesZustaendigkeiten.php b/application/controllers/system/issues/IssuesZustaendigkeiten.php index 635fda2bc..fe546f735 100644 --- a/application/controllers/system/issues/IssuesZustaendigkeiten.php +++ b/application/controllers/system/issues/IssuesZustaendigkeiten.php @@ -39,6 +39,7 @@ class IssuesZustaendigkeiten extends Auth_Controller ); $this->_setAuthUID(); // sets property uid + $this->setControllerId(); // sets the controller id } public function index() diff --git a/application/views/system/issues/issuesData.php b/application/views/system/issues/issuesData.php index c9a1d3828..f45bab091 100644 --- a/application/views/system/issues/issuesData.php +++ b/application/views/system/issues/issuesData.php @@ -1,7 +1,9 @@ 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/public/js/issues/issuesZustaendigkeiten.js b/public/js/issues/issuesZustaendigkeiten.js index 83b5005bc..17d1ab101 100644 --- a/public/js/issues/issuesZustaendigkeiten.js +++ b/public/js/issues/issuesZustaendigkeiten.js @@ -71,7 +71,7 @@ var IssuesZustaendigkeiten = { fehlerCodes.push( { fehlercode: code.fehlercode, - fullFehlerBezeichnung: code.fehlercode + ' - ' + code.fehler_kurzbz + fullFehlerBezeichnung: code.fehlercode + (!code.fehler_kurzbz ? '' : ' - ' + code.fehler_kurzbz) } ); } diff --git a/system/filtersupdate.php b/system/filtersupdate.php index fd1174a76..644433213 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -926,7 +926,9 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "PersonId"}, - {"name": "Fehlerstatus"} + {"name": "Fehlerstatus"}, + {"name": "Person Zuständigkeiten"}, + {"name": "Organisationseinheit Zuständigkeiten"} ], "filters": [ { @@ -960,7 +962,9 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "PersonId"}, - {"name": "Fehlerstatus"} + {"name": "Fehlerstatus"}, + {"name": "Person Zuständigkeiten"}, + {"name": "Organisationseinheit Zuständigkeiten"} ], "filters": [ { diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 0203fa13a..40b6ece3e 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -14175,6 +14175,46 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigePersonen', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "zuständige Personen", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "responsible persons", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'fehlermonitoring', + 'phrase' => 'zustaendigeOrganisationseinheiten', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "zuständige Organisationseinheiten", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "responsible organisation units", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'ui', From 087006a7a58b9d699f942305656c18b1ecbf72e5 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 15 Apr 2022 21:14:42 +0200 Subject: [PATCH 08/10] =?UTF-8?q?bugfixes=20issues=20Zust=C3=A4ndigkeiten?= =?UTF-8?q?=20GUI:=20-=20all=20needed=20oe=20kurzbz=20are=20shown=20at=20a?= =?UTF-8?q?ny=20time=20for=20assignment=20-=20only=20functions=20not=20alr?= =?UTF-8?q?eady=20assigned=20are=20shown=20-=20funktion=20can=20only=20be?= =?UTF-8?q?=20entered=20after=20oe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/Fehlerzustaendigkeiten_model.php | 28 ++------ .../views/system/issues/issuesData.php | 2 +- public/js/issues/issuesZustaendigkeiten.js | 70 ++++++++++++++----- 3 files changed, 60 insertions(+), 40 deletions(-) diff --git a/application/models/system/Fehlerzustaendigkeiten_model.php b/application/models/system/Fehlerzustaendigkeiten_model.php index 75eb810ea..9277f3609 100644 --- a/application/models/system/Fehlerzustaendigkeiten_model.php +++ b/application/models/system/Fehlerzustaendigkeiten_model.php @@ -35,31 +35,12 @@ class Fehlerzustaendigkeiten_model extends DB_Model } /** - * Gets Organisationseinheiten not assigned to a Fehler. + * Gets Funktionen not assigned to a Fehler (over an organisational unit). * @param $fehlercode + * @param $oe_kurzbz * @return object */ - public function getNonAssignedOes($fehlercode) - { - $query = "SELECT oe_kurzbz, bezeichnung, organisationseinheittyp_kurzbz - FROM public.tbl_organisationseinheit oe - WHERE aktiv - AND NOT EXISTS ( - SELECT 1 FROM system.tbl_fehler_zustaendigkeiten - WHERE oe_kurzbz = oe.oe_kurzbz - AND fehlercode = ? - ) - ORDER BY organisationseinheittyp_kurzbz, bezeichnung"; - - return $this->execReadOnlyQuery($query, array($fehlercode)); - } - - /** - * Gets Funktionen not assigned to a Fehler. - * @param $fehlercode - * @return object - */ - public function getNonAssignedFunktionen($fehlercode) + public function getNonAssignedFunktionen($fehlercode, $oe_kurzbz) { $query = "SELECT funktion_kurzbz, beschreibung FROM public.tbl_funktion funk @@ -68,9 +49,10 @@ class Fehlerzustaendigkeiten_model extends DB_Model 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)); + 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 f45bab091..a3b011531 100644 --- a/application/views/system/issues/issuesData.php +++ b/application/views/system/issues/issuesData.php @@ -128,7 +128,7 @@ $filterWidgetArray = array( 'datasetName' => 'issues', 'filter_id' => $this->input->get('filter_id'), 'tableUniqueId' => 'issues', - 'requiredPermissions' => 'admin', + 'requiredPermissions' => 'system/issues_verwalten', 'datasetRepresentation' => 'tablesorter', 'checkboxes' => 'issue_id', 'columnsAliases' => array( diff --git a/public/js/issues/issuesZustaendigkeiten.js b/public/js/issues/issuesZustaendigkeiten.js index 17d1ab101..eec2f75cd 100644 --- a/public/js/issues/issuesZustaendigkeiten.js +++ b/public/js/issues/issuesZustaendigkeiten.js @@ -12,6 +12,7 @@ const FUNKTION_DROPDOWN_ID = "funktionSelect"; var IssuesZustaendigkeiten = { fehlercodesArr: [], // for saving received fehlercodes + oefunktionen: [], // for saving assigned oes and their funktionen getApps: function() { @@ -106,12 +107,14 @@ var IssuesZustaendigkeiten = { { // save loaded data let zustaendigkeitenData = FHC_AjaxClient.getData(data); + // save in object to display correct funktionen when oe is changed + IssuesZustaendigkeiten.oe_funktionen = zustaendigkeitenData.oe_funktionen; let zustaendigkeiten = []; - for (let i = 0; i < zustaendigkeitenData.oe.length; i++) + for (let i = 0; i < zustaendigkeitenData.oe_funktionen.length; i++) { - let zustaendigkeit = zustaendigkeitenData.oe[i]; + let zustaendigkeit = zustaendigkeitenData.oe_funktionen[i]; zustaendigkeiten.push( { @@ -131,13 +134,7 @@ var IssuesZustaendigkeiten = { ); // fill funktion dropdown with data - IssuesZustaendigkeiten._fillDropdown( - "funktionSelect", - "funktion_kurzbz", - zustaendigkeitenData.funktion, - "beschreibung", - true - ); + IssuesZustaendigkeiten._fillFunktionDropdown(); // save Mitarbeiter data for autocomplete field in array let autocompleteMitarbeiterArr = []; @@ -177,7 +174,7 @@ var IssuesZustaendigkeiten = { sourceCallback ); - // set events to delete buttons + // set events on delete buttons $(".deleteBtn").click( function() { @@ -248,6 +245,31 @@ var IssuesZustaendigkeiten = { } ); }, + _fillFunktionDropdown: function() + { + let funktionen = []; + let oe_kurzbz = $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID).val(); + + // get funktionen for selected oe (saved in js object) + for (let i = 0; i < IssuesZustaendigkeiten.oe_funktionen.length; i++) + { + let oe_funktion = IssuesZustaendigkeiten.oe_funktionen[i]; + + if (oe_funktion.oe_kurzbz === oe_kurzbz) + { + funktionen = oe_funktion.funktionen + break; + } + } + + IssuesZustaendigkeiten._fillDropdown( + "funktionSelect", + "funktion_kurzbz", + funktionen, + "beschreibung", + true + ); + }, _fillDropdown: function(dropdownId, valueName, data, textName, includeNoSelectionOption, defaultValue) { // by default, displayed text in dropdown is the value @@ -296,6 +318,7 @@ var IssuesZustaendigkeiten = { let oeDropdownEl = $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID); let funktionDropdownEl = $("#"+FUNKTION_DROPDOWN_ID); let maAutocompleteEl = $("#"+MITARBEITER_AUTOCOMPLETE_ID); + let maHiddenEl = $("#"+MITARBEITER_HIDDENFIELD_ID); // if Mitarbeiter is entered if (maAutocompleteEl.val().length > 0) @@ -307,22 +330,29 @@ var IssuesZustaendigkeiten = { } else { - // enable oe and funktion input if Mitarbeiter input empty + // otherwise enable oe and funktion input if Mitarbeiter input empty oeDropdownEl.prop('disabled', false); - funktionDropdownEl.prop('disabled', false); } // if oe or funktion is entered - if (oeDropdownEl.val().length > 0 || funktionDropdownEl.val().length > 0) + if (oeDropdownEl.val().length > 0) { // disable Mitarbeiter input maAutocompleteEl.prop('disabled', true); maAutocompleteEl.val(''); + maHiddenEl.val(''); + + // enable funktion input + funktionDropdownEl.prop('disabled', false); + IssuesZustaendigkeiten._fillFunktionDropdown(); } else { - // enable mitarbeiter input + // otherwise enable mitarbeiter input maAutocompleteEl.prop('disabled', false); + + // disable funktion input + funktionDropdownEl.prop('disabled', true); } }, _emptyInputFields: function() @@ -347,13 +377,21 @@ $(document).ready(function() { $("#"+FEHLERAPP_DROPDOWN_ID).change( function() { - IssuesZustaendigkeiten.getFehlercodes($("#"+FEHLERAPP_DROPDOWN_ID).val()); + IssuesZustaendigkeiten.getFehlercodes($(this).val()); + } + ); + + // get new zustaendigkeiten every time Fehlercode is changed + $("#"+FEHLERCODE_DROPDOWN_ID).change( + function() + { + IssuesZustaendigkeiten.getNonAssignedZustaendigkeiten($(this).val()); } ); // set events for disabling input fields $("#"+MITARBEITER_AUTOCOMPLETE_ID).keyup(IssuesZustaendigkeiten._toggleFieldDisability); - $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID+", #"+FUNKTION_DROPDOWN_ID).change(IssuesZustaendigkeiten._toggleFieldDisability); + $("#"+ORGANISATIONSEINHEIT_DROPDOWN_ID).change(IssuesZustaendigkeiten._toggleFieldDisability); // set event for adding a new Zuständigkeit $("#assignZustaendigkeit").click( From 3f40622af30da8786b8881d5bf353a29ed3db36d Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 15 Apr 2022 21:15:19 +0200 Subject: [PATCH 09/10] =?UTF-8?q?bugfixes=20issues=20Zust=C3=A4ndigkeiten?= =?UTF-8?q?=20GUI:=20-=20all=20needed=20oe=20kurzbz=20are=20shown=20at=20a?= =?UTF-8?q?ny=20time=20for=20assignment=20-=20funktion=20can=20only=20be?= =?UTF-8?q?=20entered=20after=20oe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/issues/IssuesZustaendigkeiten.php | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/application/controllers/system/issues/IssuesZustaendigkeiten.php b/application/controllers/system/issues/IssuesZustaendigkeiten.php index fe546f735..fd3e6192a 100644 --- a/application/controllers/system/issues/IssuesZustaendigkeiten.php +++ b/application/controllers/system/issues/IssuesZustaendigkeiten.php @@ -24,6 +24,8 @@ class IssuesZustaendigkeiten extends Auth_Controller $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'); @@ -91,7 +93,9 @@ class IssuesZustaendigkeiten extends Auth_Controller return; } - $oeRes = $this->FehlerzustaendigkeitenModel->getNonAssignedOes($fehlercode); + $this->OrganisationseinheitModel->addSelect('oe_kurzbz, bezeichnung, organisationseinheittyp_kurzbz'); + $this->OrganisationseinheitModel->addOrder('organisationseinheittyp_kurzbz, bezeichnung'); + $oeRes = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true)); if (isError($oeRes)) { @@ -99,7 +103,28 @@ class IssuesZustaendigkeiten extends Auth_Controller return; } - $funktionRes = $this->FehlerzustaendigkeitenModel->getNonAssignedFunktionen($fehlercode); + $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)) { @@ -109,8 +134,7 @@ class IssuesZustaendigkeiten extends Auth_Controller $result = array( 'mitarbeiter' => getData($mitarbeiterRes), - 'oe' => getData($oeRes), - 'funktion' => getData($funktionRes), + 'oe_funktionen' => $oe_funktionen ); $this->outputJsonSuccess($result); From 5522d97afe3cd208df5545e078b7ed6ee96e7199 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Fri, 15 Apr 2022 23:47:16 +0200 Subject: [PATCH 10/10] issuesZustaendigkeiten.js: fixed comments --- public/js/issues/issuesZustaendigkeiten.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/issues/issuesZustaendigkeiten.js b/public/js/issues/issuesZustaendigkeiten.js index eec2f75cd..605868295 100644 --- a/public/js/issues/issuesZustaendigkeiten.js +++ b/public/js/issues/issuesZustaendigkeiten.js @@ -330,11 +330,11 @@ var IssuesZustaendigkeiten = { } else { - // otherwise enable oe and funktion input if Mitarbeiter input empty + // otherwise enable oe input if Mitarbeiter input empty oeDropdownEl.prop('disabled', false); } - // if oe or funktion is entered + // if oe is entered if (oeDropdownEl.val().length > 0) { // disable Mitarbeiter input