From 1bb32f5f865aaebbd82d22138e95cb9aa68bfa89 Mon Sep 17 00:00:00 2001 From: Hugo Zigha Date: Tue, 31 Oct 2023 11:10:39 +0100 Subject: [PATCH] MT#58605 CSC Administrative subscriber cannot create Seats or Group if ext_range_min specified in Customer prefs Change-Id: I29bd4411256331a986a3d63e673983ca503951fa --- .../pages/PbxConfiguration/CscPbxGroupAddForm.vue | 5 ++--- .../pages/PbxConfiguration/CscPbxSeatAddForm.vue | 6 ++---- src/helpers/validation.js | 10 +++++----- src/pages/CscPagePbxGroupDetails.vue | 3 +-- src/pages/CscPagePbxSeatDetails.vue | 5 ++--- src/store/pbx.js | 10 +++++----- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue b/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue index c1efabb6..eb7b1da3 100644 --- a/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue +++ b/src/components/pages/PbxConfiguration/CscPbxGroupAddForm.vue @@ -154,8 +154,7 @@ import { minValue, maxValue, maxLength, - numeric, - between + numeric } from '@vuelidate/validators' import { inRange } from 'src/helpers/validation' import CscObjectSpinner from '../../CscObjectSpinner' @@ -203,7 +202,7 @@ export default { maxLength: maxLength(64), numeric, isInRange: function (value) { - return inRange(value, this.getMinAllowedExtension, this.getMaxAllowedExtension, between) + return inRange(value, this.getMinAllowedExtension, this.getMaxAllowedExtension) } }, huntTimeout: { diff --git a/src/components/pages/PbxConfiguration/CscPbxSeatAddForm.vue b/src/components/pages/PbxConfiguration/CscPbxSeatAddForm.vue index e6f31079..a020e213 100644 --- a/src/components/pages/PbxConfiguration/CscPbxSeatAddForm.vue +++ b/src/components/pages/PbxConfiguration/CscPbxSeatAddForm.vue @@ -32,7 +32,6 @@ clearable dense hide-bottom-space - hide-hint :error="v$.data.extension.$errors.length > 0" :error-message="extensionErrorMessage" :disable="loading" @@ -201,8 +200,7 @@ import { import { required, maxLength, - numeric, - between + numeric } from '@vuelidate/validators' import { inRange } from 'src/helpers/validation' import CscInput from 'components/form/CscInput' @@ -256,7 +254,7 @@ export default { numeric, maxLength: maxLength(64), isInRange: function (value) { - return inRange(value, this.getMinAllowedExtension, this.getMaxAllowedExtension, between) + return inRange(value, this.getMinAllowedExtension, this.getMaxAllowedExtension) } }, password: { diff --git a/src/helpers/validation.js b/src/helpers/validation.js index 866e66cc..d67a1e7c 100644 --- a/src/helpers/validation.js +++ b/src/helpers/validation.js @@ -22,14 +22,14 @@ export function isPhone (value) { return /^\+[0-9]?()[0-9](\s|\S)(\d[0-9]{9})$/.test(value) } -export function inRange (value, min, max, between) { +export function inRange (value, min, max) { value = Number(value) - if (min && max == null) { + if (min >= 0 && max == null) { return min <= value - } else if (min == null && max) { + } else if (min < 0 && max) { return max >= value - } else if (min && max) { - return between(min, max)(value) + } else if (min >= 0 && max) { + return min <= value && max >= value } else { return true } diff --git a/src/pages/CscPagePbxGroupDetails.vue b/src/pages/CscPagePbxGroupDetails.vue index 272f0906..19bb5dd0 100644 --- a/src/pages/CscPagePbxGroupDetails.vue +++ b/src/pages/CscPagePbxGroupDetails.vue @@ -242,7 +242,6 @@