Bugzilla – Attachment 150199 Details for
Bug 33490
Agreements - Filter by expired results in error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33490: Rollback computed
Bug-33490-Rollback-computed.patch (text/plain), 4.22 KB, created by
Jonathan Druart
on 2023-04-25 12:47:32 UTC
(
hide
)
Description:
Bug 33490: Rollback computed
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-25 12:47:32 UTC
Size:
4.22 KB
patch
obsolete
>From 494e5a1c03974383b002cbd9fc1f6bfd80241e1d Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 21 Apr 2023 11:42:05 +0000 >Subject: [PATCH] Bug 33490: Rollback computed > >Use a watch instead > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../js/vue/components/ERM/AgreementsList.vue | 54 +++++++++---------- > 1 file changed, 27 insertions(+), 27 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >index 54271a09bad..7d8df42c1ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >@@ -52,7 +52,7 @@ > <script> > import flatPickr from "vue-flatpickr-component" > import Toolbar from "./AgreementsToolbar.vue" >-import { inject, ref, reactive, computed } from "vue" >+import { inject, ref, reactive } from "vue" > import { APIClient } from "../../fetch/api-client.js" > import { storeToRefs } from "pinia" > import { build_url } from "../../composables/datatables" >@@ -70,29 +70,10 @@ export default { > > const table = ref() > >- const expiration_date = ref() >- const by_expired = ref(false) >- const by_mine = ref(false) >- > const filters = reactive({ >- by_expired, >- max_expiration_date: computed({ >- get() { >- if (by_expired.value) { >- if (!expiration_date.value) { >- expiration_date.value = new Date() >- .toISOString() >- .substring(0, 10) >- } >- return expiration_date.value >- } >- return "" >- }, >- set(new_date) { >- expiration_date.value = new_date >- }, >- }), >- by_mine, >+ by_expired: false, >+ max_expiration_date: "", >+ by_mine: false, > }) > return { > vendors, >@@ -111,6 +92,8 @@ export default { > this.filters.by_expired = > this.$route.query.by_expired === "true" || false > this.filters.by_mine = this.$route.query.by_mine || false >+ this.filters.max_expiration_date = >+ this.$route.query.max_expiration_date || "" > > let filters = this.filters > >@@ -224,6 +207,9 @@ export default { > this.$emit("select-agreement", agreement.agreement_id) > this.$emit("close") > }, >+ get_today_date: function () { >+ return new Date().toISOString().substring(0, 10) >+ }, > table_url: function () { > let url = "/api/v1/erm/agreements" > if (this.filters.by_expired) >@@ -233,13 +219,18 @@ export default { > }, > filter_table: async function () { > if (!this.embedded) { >- let filters = Object.assign({}, this.filters) >- if (!filters.by_expired) { >- filters.max_expiration_date = null >+ if ( >+ this.filters.by_expired && >+ !this.filters.max_expiration_date >+ ) { >+ this.filters.max_expiration_date = this.get_today_date() >+ } >+ if (!this.filters.by_expired) { >+ this.filters.max_expiration_date = "" > } > let new_route = build_url( > "/cgi-bin/koha/erm/agreements", >- filters >+ this.filters > ) > this.$router.push(new_route) > } >@@ -342,6 +333,15 @@ export default { > this.getAgreementCount().then(() => (this.initialized = true)) > } > }, >+ watch: { >+ "filters.by_expired": function (newVal, oldVal) { >+ if (newVal) { >+ this.filters.max_expiration_date = this.get_today_date() >+ } else { >+ this.filters.max_expiration_date = "" >+ } >+ }, >+ }, > components: { flatPickr, Toolbar, KohaTable }, > props: { > embedded: { >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33490
:
149519
|
149521
|
149522
|
149523
|
149603
|
149604
|
149615
|
149643
|
149652
|
149661
|
149672
|
149673
|
149674
|
149675
|
149676
|
150038
|
150039
|
150040
|
150048
|
150194
|
150195
|
150196
|
150197
|
150198
| 150199 |
150200
|
150201