Bug 38010: (QA follow-up) Fix new vendor form

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2025-01-15 15:10:42 +00:00 committed by Katrin Fischer
parent 7afe584dbc
commit e511d36482
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
4 changed files with 34 additions and 13 deletions

View File

@ -195,11 +195,15 @@ export default {
if (!this.vendor.aliases) {
this.vendor.aliases = [];
}
if (!this.newAlias) return;
this.vendor.aliases.push({ alias: this.newAlias });
this.newAlias = "";
},
removeAlias(e) {
this.vendor.aliases.splice(this.vendor.aliases.indexOf(e.alias), 1);
const aliasIndex = this.vendor.aliases
.map(e => e.alias)
.indexOf(e.alias);
this.vendor.aliases.splice(aliasIndex, 1);
},
},
components: {

View File

@ -114,13 +114,17 @@ export default {
delete vendor.physical;
delete vendor.subscriptions_count;
vendor.contacts = vendor.contacts.map(
({ id, booksellerid, ...requiredProperties }) =>
requiredProperties
vendor.contacts = this.checkContactOrInterface(
vendor.contacts.map(
({ id, booksellerid, ...requiredProperties }) =>
requiredProperties
)
);
vendor.interfaces = vendor.interfaces.map(
({ interface_id, vendor_id, ...requiredProperties }) =>
requiredProperties
vendor.interfaces = this.checkContactOrInterface(
vendor.interfaces.map(
({ interface_id, vendor_id, ...requiredProperties }) =>
requiredProperties
)
);
const client = APIClient.acquisition;
@ -142,6 +146,17 @@ export default {
);
}
},
checkContactOrInterface(array) {
return array.reduce((acc, curr) => {
const atLeastOneFieldFilled = Object.keys(curr).some(
key => curr[key]
);
if (atLeastOneFieldFilled) {
acc.push(curr);
}
return acc;
}, []);
},
},
components: {
ButtonSubmit,

View File

@ -58,10 +58,6 @@
>
<legend>
{{ $__("Interface details") }}
<a href="#" @click.prevent="deleteInterface(i)"
><i class="fa fa-trash"></i>
{{ $__("Remove this interface") }}</a
>
</legend>
<ol>
<li>
@ -131,6 +127,10 @@
/>
</li>
</ol>
<span class="btn btn-default" @click.prevent="deleteContact(i)"
><font-awesome-icon icon="trash" />
{{ $__("Delete interface") }}</span
>
</fieldset>
<span class="btn btn-default" @click="addInterface"
><font-awesome-icon icon="plus" />

View File

@ -186,7 +186,8 @@
<li>
<label for="discount">{{ $__("Discount") }}: </label>
<input
type="number"
type="text"
inputmode="numeric"
size="6"
id="discount"
name="discount"
@ -197,7 +198,8 @@
<li>
<label for="deliverytime">{{ $__("Delivery time") }}: </label>
<input
type="number"
type="text"
inputmode="numeric"
size="6"
id="deliverytime"
name="deliverytime"