From aa9d683c8f83452345d246259de89be54044f959 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 5 Dec 2023 14:19:37 +0100 Subject: [PATCH] Bug 35477: Show a warning when non-existent items are added to the waiting list Only messages "X new items added" or "No items added" were displayed. With this patch we will display: A warning with "No items added" A warning with "X new items added. Y items not found." when some items have not been added A messages "X new items added" when everything went well Signed-off-by: Matt Blenkinsop Signed-off-by: Victor Grousset/tuxayo --- .../components/Preservation/WaitingList.vue | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue index 6a7c43e4b8a..3a93c1f1433 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue @@ -135,13 +135,19 @@ export default { const PreservationStore = inject("PreservationStore") const { config } = PreservationStore - const { setMessage, setConfirmationDialog, loading, loaded } = - inject("mainStore") + const { + setMessage, + setWarning, + setConfirmationDialog, + loading, + loaded, + } = inject("mainStore") return { table, config, setMessage, + setWarning, setConfirmationDialog, loading, loaded, @@ -213,12 +219,24 @@ export default { client.waiting_list_items.createAll(items).then( result => { if (result.length) { - this.setMessage( - this.$__("%s new items added.").format( - result.length - ), - true - ) + if (result.length != items.length) { + this.setWarning( + this.$__( + "%s new items added. %s items not found." + ).format( + result.length, + items.length - result.length + ), + true + ) + } else { + this.setMessage( + this.$__("%s new items added.").format( + result.length + ), + true + ) + } this.last_items = result if (this.$refs.table) { this.$refs.table.redraw( @@ -228,7 +246,7 @@ export default { this.getCountWaitingListItems() } } else { - this.setMessage(this.$__("No items added")) + this.setWarning(this.$__("No items added")) } }, error => {} -- 2.34.1