From 303b7486c1444f240fa0c5ee0e38d6894b7e2e30 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 13 Apr 2023 18:12:13 +0100 Subject: [PATCH] Bug 33490: Make url consistent This ensures we populate the max_expiration_date param on the browser url for consistency with selected dates. --- .../prog/js/vue/components/ERM/AgreementsList.vue | 6 ++++++ t/cypress/integration/Agreements_spec.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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 a20d406fc2..7af607daa2 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 @@ -217,6 +217,12 @@ export default { }, filter_table: async function () { if (this.before_route_entered) { + if (this.filters.by_expired) { + if (!this.filters.max_expiration_date) + this.filters.max_expiration_date = new Date() + .toISOString() + .substring(0, 10) + } let new_route = build_url( "/cgi-bin/koha/erm/agreements", this.filters diff --git a/t/cypress/integration/Agreements_spec.ts b/t/cypress/integration/Agreements_spec.ts index 5bfd27fae3..2127737e8d 100644 --- a/t/cypress/integration/Agreements_spec.ts +++ b/t/cypress/integration/Agreements_spec.ts @@ -177,7 +177,7 @@ describe("Agreement CRUD operations", () => { .its('request.url') .should('include', 'max_expiration_date='+dates["today_iso"]); // Defaults to today cy.get("#max_expiration_date_filter").should("have.value", dates["today_iso"]); // Input box reflects default - cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true"); // Browser url also updated + cy.url().should('include', "/cgi-bin/koha/erm/agreements?by_expired=true&max_expiration_date="+dates["today_iso"]); // Browser url also updated // Now test that the url for this particular state works cy.visit("/cgi-bin/koha/erm/agreements?by_expired=true"); -- 2.40.0