Bug 38201: Do not freeze the app if ERMModule is turned off

(cherry picked from commit 75ed8ac404797514dc5ed615c3b1e21b6abf58ae)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-07-04 13:19:16 +02:00 committed by Lucas Gass
parent da4dc4a66d
commit 01cdc32694
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 40 additions and 0 deletions

View File

@ -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 <a href='/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ERMModule'>ERMModule</a> to use it"

View File

@ -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");
});
});