Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGregory Chalenko <gregory.chalenko@zabbix.com>2021-05-06 13:44:05 +0300
committerGregory Chalenko <gregory.chalenko@zabbix.com>2021-05-06 13:44:05 +0300
commita2f7e2edc8eb3cf1941f5a2e63fad11437fd06d3 (patch)
treec1acf26f3373ba58d4b6128f96d401a3155116ab /ui
parent7cf7ed1dd9ff722cef0d55bb2a6d64750ea5042c (diff)
A.F....... [ZBXNEXT-114,ZBXNEXT-6572] fixed undefined index
Diffstat (limited to 'ui')
-rw-r--r--ui/app/controllers/CControllerPopupValueMapUpdate.php7
-rw-r--r--ui/include/classes/api/services/CValueMap.php2
2 files changed, 5 insertions, 4 deletions
diff --git a/ui/app/controllers/CControllerPopupValueMapUpdate.php b/ui/app/controllers/CControllerPopupValueMapUpdate.php
index 1608182614a..cdf8d2388dd 100644
--- a/ui/app/controllers/CControllerPopupValueMapUpdate.php
+++ b/ui/app/controllers/CControllerPopupValueMapUpdate.php
@@ -100,7 +100,7 @@ class CControllerPopupValueMapUpdate extends CController {
return false;
}
- if (array_key_exists($value, $type_uniq[$type])) {
+ if ($type != VALUEMAP_MAPPING_TYPE_DEFAULT && array_key_exists($value, $type_uniq[$type])) {
error(_s('Incorrect value for field "%1$s": %2$s.', _('Value'),
_s('value %1$s already exists', '('.$value.')'))
);
@@ -108,7 +108,7 @@ class CControllerPopupValueMapUpdate extends CController {
return false;
}
- $type_values[$type][$value] = true;
+ $type_uniq[$type][$value] = true;
if ($type == VALUEMAP_MAPPING_TYPE_REGEXP
&& @preg_match('/'.str_replace('/', '\/', $value).'/', '') === false) {
@@ -146,7 +146,8 @@ class CControllerPopupValueMapUpdate extends CController {
$this->getInputs($data, ['valuemapid', 'name', 'mappings', 'edit']);
foreach ($data['mappings'] as $mapping) {
- if ($mapping['value'] === '' && $mapping['newvalue'] === '') {
+ if ($mapping['type'] != VALUEMAP_MAPPING_TYPE_DEFAULT &&
+ $mapping['value'] === '' && $mapping['newvalue'] === '') {
continue;
}
diff --git a/ui/include/classes/api/services/CValueMap.php b/ui/include/classes/api/services/CValueMap.php
index c95f7f92ce5..be3356b54dd 100644
--- a/ui/include/classes/api/services/CValueMap.php
+++ b/ui/include/classes/api/services/CValueMap.php
@@ -534,7 +534,7 @@ class CValueMap extends CApiService {
_('should be empty')
));
}
- elseif (array_key_exists($value, $type_uniq[$type])) {
+ elseif ($type != VALUEMAP_MAPPING_TYPE_DEFAULT && array_key_exists($value, $type_uniq[$type])) {
$error = _s('value %1$s already exists', '(value)=('.$value.')');
}