View | Details | Raw Unified | Return to bug 33408
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt (-5 lines)
Lines 33-45 Link Here
33
        const eholdings_packages_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'packages', 'json' ) | $raw %];
33
        const eholdings_packages_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'packages', 'json' ) | $raw %];
34
        const eholdings_titles_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'titles', 'json' ) | $raw %];
34
        const eholdings_titles_table_settings = [% TablesSettings.GetTableSettings( 'erm', 'eholdings', 'titles', 'json' ) | $raw %];
35
35
36
        const ERMProviders  = "[% Koha.Preference('ERMProviders') | html %]";
37
        const erm_providers = ERMProviders.split(',');
38
39
        const max_allowed_packet = [% To.json(max_allowed_packet) | $raw %];
36
        const max_allowed_packet = [% To.json(max_allowed_packet) | $raw %];
40
37
41
        const ERMModule = [% IF Koha.Preference('ERMModule') %]true[% ELSE %]false[% END %];
42
43
        const logged_in_user_lists = [% To.json(logged_in_user.virtualshelves.unblessed) | $raw %];
38
        const logged_in_user_lists = [% To.json(logged_in_user.virtualshelves.unblessed) | $raw %];
44
39
45
        const logged_in_user = [% To.json(logged_in_user.unblessed) | $raw %];
40
        const logged_in_user = [% To.json(logged_in_user.unblessed) | $raw %];
(-)a/t/cypress/support/commands.js (-32 lines)
Lines 39-72 Cypress.Commands.add('login', (username, password) => { Link Here
39
    cy.get("#password").type(pass)
39
    cy.get("#password").type(pass)
40
    cy.get("#submit-button").click()
40
    cy.get("#submit-button").click()
41
})
41
})
42
43
Cypress.Commands.add('set_ERM_sys_pref_value', (enable) => {
44
    cy.visit('/cgi-bin/koha/admin/admin-home.pl')
45
    cy.get("h4").contains("Global system preferences").click();
46
    cy.get("a[title^=E-resource]").contains("E-resource management").click();
47
    cy.get('#pref_ERMModule').then(($select) => {
48
        // Only enable if currently disabled, or only disable if currently enabled
49
        let sys_pref_value = $select.find(":selected").text().trim();
50
        if (enable && sys_pref_value == 'Disable' || !enable && sys_pref_value == 'Enable') {
51
            cy.get("#pref_ERMModule").select(enable ? 'Enable' : 'Disable');
52
            cy.get(".save-all").first().click();
53
            Cypress.env("current_ERM_Module_sys_pref_value", enable);
54
            cy.wait(500); // Cypress is too fast!
55
        }
56
    })
57
})
58
59
Cypress.Commands.add('fetch_initial_ERM_sys_pref_value', () => {
60
    cy.login();
61
    cy.visit('/cgi-bin/koha/admin/admin-home.pl')
62
    cy.get("h4").contains("Global system preferences").click();
63
    cy.get("a[title^=E-resource]").contains("E-resource management").click();
64
    cy.get('#pref_ERMModule').then(($select) => {
65
        Cypress.env('initial_ERM_Module_sys_pref_value', $select.find(":selected").text().trim() == 'Enable');
66
    })
67
})
68
69
Cypress.Commands.add('reset_initial_ERM_sys_pref_value', () => {
70
    cy.login();
71
    cy.set_ERM_sys_pref_value(Cypress.env("initial_ERM_Module_sys_pref_value"));
72
})
73
- 

Return to bug 33408