Bugzilla – Attachment 150197 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: Improve max date handling
Bug-33490-Improve-max-date-handling.patch (text/plain), 4.01 KB, created by
Jonathan Druart
on 2023-04-25 12:47:26 UTC
(
hide
)
Description:
Bug 33490: Improve max date handling
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-25 12:47:26 UTC
Size:
4.01 KB
patch
obsolete
>From b3f0eea6c3e772524c56e871ef13ab0b722b36da Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 14 Apr 2023 11:09:33 +0200 >Subject: [PATCH] Bug 33490: Improve max date handling > >It fixes: >1. /agreements?by_expired=true do no longer explode >2. Fill date with today's date when we setup the component and when we >hit "filter" > >However there are a couple of things totally wrong: >1. We should not need is_fp_disabled, we could be able to use > :disabled="!filters.by_expired" >in the template, but it does not work >2. We should not need to deal with filters.max_expiration_date the "old >JS way", but should use a Vue computed value instead. I've failed at >that > >I think those 2 problems have the same root, the way we deal with >filters in data() is wrong, and we may be loosing the ref at some point. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../js/vue/components/ERM/AgreementsList.vue | 29 ++++++++++++++----- > 1 file changed, 21 insertions(+), 8 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 d7c9f82a1ee..da59bb5743c 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 >@@ -9,12 +9,14 @@ > id="expired_filter" > v-model="filters.by_expired" > @keyup.enter="filter_table" >+ @change="updateMaxExpirationDate($event)" > /> > {{ $__("on") }} > <flat-pickr > id="max_expiration_date_filter" >- v-model="filters.max_expiration_date" >+ v-model="this.filters.max_expiration_date" > :config="fp_config" >+ :disabled="is_fp_disabled" > /> > > <label for="by_mine_filter">{{ $__("Show mine only") }}:</label> >@@ -90,15 +92,17 @@ export default { > }, > data: function () { > this.filters = { >- by_expired: this.$route.query.by_expired || false, >+ by_expired: this.$route.query.by_expired === "true" || false, > max_expiration_date: this.$route.query.max_expiration_date || "", > by_mine: this.$route.query.by_mine || false, > } > let filters = this.filters >+ this.updateMaxExpirationDate() // Set date to today if empty > > let logged_in_user = this.logged_in_user > return { > fp_config: flatpickr_defaults, >+ is_fp_disabled: !filters.by_expired, > agreement_count: 0, > initialized: false, > tableOptions: { >@@ -214,12 +218,7 @@ export default { > return url > }, > filter_table: async function () { >- if (this.filters.by_expired) { >- if (!this.filters.max_expiration_date) >- this.filters.max_expiration_date = new Date() >- .toISOString() >- .substring(0, 10) >- } >+ this.updateMaxExpirationDate() > if (!this.embedded) { > let new_route = build_url( > "/cgi-bin/koha/erm/agreements", >@@ -229,6 +228,20 @@ export default { > } > this.$refs.table.redraw(this.table_url()) > }, >+ updateMaxExpirationDate: function (event) { >+ if (event) { >+ this.is_fp_disabled = !event.target.checked >+ } >+ if ( >+ this.filters.by_expired && >+ (!this.filters.max_expiration_date || >+ this.filters.max_expiration_date === "") >+ ) { >+ this.filters.max_expiration_date = new Date() >+ .toISOString() >+ .substring(0, 10) >+ } >+ }, > getTableColumns: function () { > let get_lib_from_av = this.get_lib_from_av > let escape_str = this.escape_str >-- >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