Bug 38201: Fix for inverse boolean checks

We currently check for if a boolean is true but have no way of checking for a falsy value, this patch adds a fix for that

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Matt Blenkinsop 2025-03-28 11:36:37 +00:00 committed by Lucas Gass
parent 89cb2adf0c
commit a3b77a7c0d
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 22 additions and 4 deletions

View File

@ -44,13 +44,19 @@ export default {
acc[key] = this.resource;
}
if (prop.hasOwnProperty("resourceProperty")) {
let propertyValue;
if (prop.resourceProperty.includes(".")) {
acc[key] = this.accessNestedProperty(
propertyValue = this.accessNestedProperty(
prop.resourceProperty,
this.resource
);
} else {
acc[key] = this.resource[prop.resourceProperty];
propertyValue = this.resource[prop.resourceProperty];
}
if (Object.keys(prop).length === 1) {
acc[key] = propertyValue;
} else {
prop.value = propertyValue;
}
}
if (key === "relationshipStrings") {
@ -72,8 +78,19 @@ export default {
}
if (key === "disabled") {
const currentValue = acc[key];
acc[key] = !!currentValue;
if (
typeof prop === "object" &&
prop.hasOwnProperty("qualifier")
) {
let currentValue = prop.value;
if (prop.qualifier === "!") {
currentValue = !currentValue;
}
acc[key] = !!currentValue;
} else {
const currentValue = acc[key];
acc[key] = !!currentValue;
}
}
if (prop.type === "filter") {

View File

@ -796,6 +796,7 @@ export default {
componentProps: {
disabled: {
resourceProperty: "by_expired",
qualifier: "!",
},
},
value: "",