From 01cdc326945ebb17e2e79a3124f16c2eb8abea0d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Jul 2025 13:19:16 +0200 Subject: [PATCH] Bug 38201: Do not freeze the app if ERMModule is turned off (cherry picked from commit 75ed8ac404797514dc5ed615c3b1e21b6abf58ae) Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- .../prog/js/vue/components/ERM/Main.vue | 1 + t/cypress/integration/ERM/Main.ts | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 t/cypress/integration/ERM/Main.ts diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue index 7395855511..c7d35b1648 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue @@ -89,6 +89,7 @@ export default { client.config.get().then(result => { config.value = result; if (config.value.settings.ERMModule != 1) { + loaded(); return setError( $__( "The e-resource management module is disabled, turn on ERMModule to use it" diff --git a/t/cypress/integration/ERM/Main.ts b/t/cypress/integration/ERM/Main.ts new file mode 100644 index 0000000000..58dc5b90dc --- /dev/null +++ b/t/cypress/integration/ERM/Main.ts @@ -0,0 +1,39 @@ +describe("Main component - pref off", () => { + beforeEach(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.intercept( + "GET", + "/api/v1/erm/config", + '{"settings":{"ERMModule":"0","ERMProviders":["local"]}}' + ); + }); + + it("Home", () => { + cy.visit("/cgi-bin/koha/erm/erm.pl"); + cy.get(".main .sidebar_menu").should("not.exist"); + cy.get(".main div[class='alert alert-warning']").contains( + "The e-resource management module is disabled, turn on ERMModule to use it" + ); + cy.get(".main div[class='alert alert-warning'] a").click(); + cy.url().should("match", /\/cgi-bin\/koha\/admin\/preferences.pl/); + }); +}); + +describe("Main component - pref on", () => { + beforeEach(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.intercept( + "GET", + "/api/v1/erm/config", + '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}' + ); + }); + + it("Home", () => { + cy.visit("/cgi-bin/koha/erm/erm.pl"); + cy.get(".main .sidebar_menu").should("exist"); + cy.get(".main div[class='alert alert-warning']").should("not.exist"); + }); +});