From 427a75b74bf6c4a05d422e926c5500b7a5d15f15 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 31 Mar 2022 12:41:18 +0200 Subject: [PATCH] =?UTF-8?q?added=20GUI=20for=20managing=20Issues=20Zust?= =?UTF-8?q?=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',