diff --git a/application/controllers/system/issues/IssuesKonfiguration.php b/application/controllers/system/issues/IssuesKonfiguration.php
index f6b3ff556..a19a2a93b 100644
--- a/application/controllers/system/issues/IssuesKonfiguration.php
+++ b/application/controllers/system/issues/IssuesKonfiguration.php
@@ -18,7 +18,8 @@ class IssuesKonfiguration extends Auth_Controller
'getApps' => 'admin:r',
'getFehlerKonfigurationByApp' => 'admin:r',
'saveFehlerKonfiguration' => 'admin:rw',
- 'deleteKonfiguration' => 'admin:rw'
+ 'deleteKonfiguration' => 'admin:rw',
+ 'deleteKonfigurationsWerte' => 'admin:rw'
)
);
@@ -204,6 +205,73 @@ class IssuesKonfiguration extends Auth_Controller
$this->outputJson($result);
}
+ /**
+ * Deletes values of a Konfiguration.
+ */
+ public function deleteKonfigurationsWerte()
+ {
+ $konfigurationstyp_kurzbz = $this->input->post('konfigurationstyp_kurzbz');
+ $fehlercode = $this->input->post('fehlercode');
+ $konfigurationsWert = $this->input->post('konfigurationsWert');
+
+ // check if Konfigurationstyp correctly passed
+ if (isEmptyString($konfigurationstyp_kurzbz)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'ungueltigerKonfigurationstyp'));
+
+ // check if fehlercode correctly passed
+ if (isEmptyString($fehlercode)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlercodeFehlt'));
+
+ // separate by semicolon if multiple values passed
+ $konfigurationsWert = explode(';', $konfigurationsWert);
+
+ // check if konfiguration already set for the fehlercode
+ $this->FehlerkonfigurationModel->addSelect('konfiguration');
+ $fehlerkonfigurationRes = $this->FehlerkonfigurationModel->loadWhere(
+ array(
+ 'konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz,
+ 'fehlercode' => $fehlercode
+ )
+ );
+
+ if (!hasData($fehlerkonfigurationRes)) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerFehlerKonfigurationLaden'));
+
+ // if konfiguration exists, update values
+ if (hasData($fehlerkonfigurationRes))
+ {
+ $fehlerkonfiguration = getData($fehlerkonfigurationRes);
+
+ $existingKonf = json_decode($fehlerkonfiguration[0]->konfiguration);
+
+ if (!$existingKonf) $this->terminateWithJsonError($this->p->t('fehlermonitoring', 'fehlerJsonDekodierung'));
+
+ if (!is_array($existingKonf)) $existingKonf = array($existingKonf);
+
+ $newKonfArr = array_values(array_diff($existingKonf, $konfigurationsWert));
+
+ // if no konfiguration values left, delete whole entry
+ if (isEmptyArray($newKonfArr))
+ {
+ $this->outputJson(
+ $this->FehlerkonfigurationModel->delete(
+ array('konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz, 'fehlercode' => $fehlercode)
+ )
+ );
+ }
+ else
+ {
+ $newKonf = json_encode($newKonfArr);
+ if (!$newKonf) $this->terminateWithJsonError("error when encoding JSON");
+
+ // if there are still values, delete only part of the konfiguration
+ $this->outputJson(
+ $this->FehlerkonfigurationModel->update(
+ array('konfigurationstyp_kurzbz' => $konfigurationstyp_kurzbz, 'fehlercode' => $fehlercode),
+ array('konfiguration' => $newKonf, 'updateamum' => 'NOW()', 'updatevon' => $this->_uid)
+ )
+ );
+ }
+ }
+ }
+
/**
* Deletes a Konfiguration.
*/
diff --git a/application/views/system/issues/issuesKonfiguration.php b/application/views/system/issues/issuesKonfiguration.php
index 8b07157d2..dbd62a26a 100644
--- a/application/views/system/issues/issuesKonfiguration.php
+++ b/application/views/system/issues/issuesKonfiguration.php
@@ -82,6 +82,9 @@ $this->load->view(
+
diff --git a/public/js/issues/issuesKonfiguration.js b/public/js/issues/issuesKonfiguration.js
index 9e0ebaf4d..f2e7aa5c3 100644
--- a/public/js/issues/issuesKonfiguration.js
+++ b/public/js/issues/issuesKonfiguration.js
@@ -144,6 +144,34 @@ var IssuesKonfiguration = {
}
);
},
+ deleteKonfigurationsWerte: function(konfigurationstyp_kurzbz, fehlercode, konfigurationsWert)
+ {
+ FHC_AjaxClient.ajaxCallPost(
+ 'system/issues/IssuesKonfiguration/deleteKonfigurationsWerte',
+ {
+ konfigurationstyp_kurzbz: konfigurationstyp_kurzbz,
+ fehlercode: fehlercode,
+ konfigurationsWert: konfigurationsWert
+ },
+ {
+ successCallback: function(data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.hasData(data))
+ {
+ FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t('fehlermonitoring', 'konfigurationGeloescht'))
+ // reload dataset to see change
+ IssuesKonfiguration._reloadKonfigurationOverview();
+ }
+ else
+ {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t('fehlermonitoring', 'konfigurationGeloeschtFehler'));
+ }
+ },
+ errorCallback: function(jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(textStatus);
+ }
+ }
+ );
+ },
deleteKonfiguration: function(konfigurationstyp_kurzbz, fehlercode)
{
FHC_AjaxClient.ajaxCallPost(
@@ -229,7 +257,7 @@ $(document).ready(function() {
}
);
- // get new fehlercodes each time app is changed
+ // set assign configuration event
$("#assignKonfiguration").click(
function()
{
@@ -241,6 +269,18 @@ $(document).ready(function() {
}
);
+ // set delete configuration event
+ $("#deleteKonfiguration").click(
+ function()
+ {
+ IssuesKonfiguration.deleteKonfigurationsWerte(
+ $("#"+FEHLERKONFIGURATIONSTYP_DROPDOWN_ID).val(),
+ $("#"+FEHLERCODE_DROPDOWN_ID).val(),
+ $("#konfigurationsWert").val()
+ );
+ }
+ );
+
// set events for showing info modals
$("#fehlercodeInfoIcon").click(
function()
diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php
index 0bc748c80..28735e07f 100644
--- a/system/phrasesupdate.php
+++ b/system/phrasesupdate.php
@@ -17897,7 +17897,7 @@ array(
),
array(
'sprache' => 'English',
- 'text' => 'Invalid configuration value for data type {1}, special characters not allowed',
+ 'text' => 'Invalid configuration value for data type {0}, special characters not allowed',
'description' => '',
'insertvon' => 'system'
)
@@ -18123,6 +18123,26 @@ array(
)
)
),
+ array(
+ 'app' => 'core',
+ 'category' => 'fehlermonitoring',
+ 'phrase' => 'konfigurationswertLoeschen',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => 'Konfigurationswert(e) löschen',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Delete configuration value(s)',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
);