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

(-)a/Koha/REST/V1/ERM.pm (+22 lines)
Lines 31-36 Koha::REST::V1::Acquisitions::Funds Link Here
31
31
32
=head2 Class methods
32
=head2 Class methods
33
33
34
=head3 config
35
36
Return the configuration options needed for the ERM Vue app
37
38
=cut
39
40
sub config {
41
    my $c = shift->openapi->valid_input or return;
42
    return $c->render(
43
        status => 200,
44
        openapi => {
45
            settings => {
46
                ERMModule => C4::Context->preference('ERMModule'),
47
                ERMProviders => [split ',', C4::Context->preference('ERMProviders')]
48
            },
49
            #permissions => {
50
            #    erm =>
51
            #}
52
        },
53
    )
54
}
55
34
=head3 list_users
56
=head3 list_users
35
57
36
Return the list of possible ERM' users
58
Return the list of possible ERM' users
(-)a/api/v1/swagger/definitions/erm_config.yaml (+7 lines)
Line 0 Link Here
1
---
2
type: object
3
properties:
4
  settings:
5
    type: object
6
    description: List of sysprefs used for the ERM module
7
additionalProperties: false
(-)a/api/v1/swagger/paths/erm_config.yaml (+38 lines)
Line 0 Link Here
1
---
2
/erm/config:
3
  get:
4
    x-mojo-to: ERM#config
5
    operationId: getERMconfig
6
    description: This resource returns a list of options needed for the ERM Vue app
7
    summary: get the ERM config
8
    tags:
9
      - ERM
10
    produces:
11
      - application/json
12
    responses:
13
      200:
14
        description: The ERM config
15
        schema:
16
          $ref: "../swagger.yaml#/definitions/erm_config"
17
      400:
18
        description: Bad request
19
        schema:
20
          $ref: "../swagger.yaml#/definitions/error"
21
      403:
22
        description: Access forbidden
23
        schema:
24
          $ref: "../swagger.yaml#/definitions/error"
25
      500:
26
        description: |
27
          Internal server error. Possible `error_code` attribute values:
28
29
          * `internal_server_error`
30
        schema:
31
          $ref: "../swagger.yaml#/definitions/error"
32
      503:
33
        description: Under maintenance
34
        schema:
35
          $ref: "../swagger.yaml#/definitions/error"
36
    x-koha-authorization:
37
      permissions:
38
        erm: 1
(-)a/api/v1/swagger/swagger.yaml (+4 lines)
Lines 34-39 definitions: Link Here
34
    $ref: ./definitions/credit.yaml
34
    $ref: ./definitions/credit.yaml
35
  debit:
35
  debit:
36
    $ref: ./definitions/debit.yaml
36
    $ref: ./definitions/debit.yaml
37
  erm_config:
38
    $ref: ./definitions/erm_config.yaml
37
  erm_agreement:
39
  erm_agreement:
38
    $ref: ./definitions/erm_agreement.yaml
40
    $ref: ./definitions/erm_agreement.yaml
39
  erm_eholdings_title:
41
  erm_eholdings_title:
Lines 211-216 paths: Link Here
211
    $ref: ./paths/config_smtp_servers.yaml#/~1config~1smtp_servers
213
    $ref: ./paths/config_smtp_servers.yaml#/~1config~1smtp_servers
212
  "/config/smtp_servers/{smtp_server_id}":
214
  "/config/smtp_servers/{smtp_server_id}":
213
    $ref: "./paths/config_smtp_servers.yaml#/~1config~1smtp_servers~1{smtp_server_id}"
215
    $ref: "./paths/config_smtp_servers.yaml#/~1config~1smtp_servers~1{smtp_server_id}"
216
  /erm/config:
217
    $ref: ./paths/erm_config.yaml#/~1erm~1config
214
  /erm/agreements:
218
  /erm/agreements:
215
    $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements
219
    $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements
216
  "/erm/agreements/{agreement_id}":
220
  "/erm/agreements/{agreement_id}":
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesList.vue (-3 / +3 lines)
Lines 82-88 export default { Link Here
82
        const { get_lib_from_av, map_av_dt_filter } = AVStore
82
        const { get_lib_from_av, map_av_dt_filter } = AVStore
83
83
84
        const ERMStore = inject("ERMStore")
84
        const ERMStore = inject("ERMStore")
85
        const { sysprefs } = ERMStore
85
        const { config } = ERMStore
86
86
87
        const table = ref()
87
        const table = ref()
88
        const filters = reactive({
88
        const filters = reactive({
Lines 98-104 export default { Link Here
98
            get_lib_from_av,
98
            get_lib_from_av,
99
            escape_str,
99
            escape_str,
100
            map_av_dt_filter,
100
            map_av_dt_filter,
101
            sysprefs,
101
            config,
102
            table,
102
            table,
103
        }
103
        }
104
    },
104
    },
Lines 168-174 export default { Link Here
168
            this.show_table = true
168
            this.show_table = true
169
            this.local_count_packages = null
169
            this.local_count_packages = null
170
170
171
            if (this.sysprefs.ERMProviders.includes("local")) {
171
            if (this.config.ERMProviders.includes("local")) {
172
                const client = APIClient.erm
172
                const client = APIClient.erm
173
                const query = this.filters
173
                const query = this.filters
174
                    ? {
174
                    ? {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue (-3 / +3 lines)
Lines 85-91 export default { Link Here
85
        const { get_lib_from_av } = AVStore
85
        const { get_lib_from_av } = AVStore
86
86
87
        const ERMStore = inject("ERMStore")
87
        const ERMStore = inject("ERMStore")
88
        const { sysprefs } = ERMStore
88
        const { config } = ERMStore
89
89
90
        const table = ref()
90
        const table = ref()
91
        const filters = reactive({
91
        const filters = reactive({
Lines 99-105 export default { Link Here
99
            av_title_publication_types,
99
            av_title_publication_types,
100
            get_lib_from_av,
100
            get_lib_from_av,
101
            escape_str,
101
            escape_str,
102
            sysprefs,
102
            config,
103
            table,
103
            table,
104
        }
104
        }
105
    },
105
    },
Lines 179-185 export default { Link Here
179
                        "/api/v1/erm/eholdings/ebsco/titles"
179
                        "/api/v1/erm/eholdings/ebsco/titles"
180
                    )
180
                    )
181
                }
181
                }
182
                if (this.sysprefs.ERMProviders.includes("local")) {
182
                if (this.config.ERMProviders.includes("local")) {
183
                    const client = APIClient.erm
183
                    const client = APIClient.erm
184
184
185
                    const q = this.filters
185
                    const q = this.filters
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue (-18 / +10 lines)
Lines 1-5 Link Here
1
<template>
1
<template>
2
    <div v-if="initialized && sysprefs.ERMModule == 1">
2
    <div v-if="initialized && config.settings.ERMModule == 1">
3
        <div id="sub-header">
3
        <div id="sub-header">
4
            <Breadcrumbs />
4
            <Breadcrumbs />
5
            <Help />
5
            <Help />
Lines 49-61 export default { Link Here
49
49
50
        const ERMStore = inject("ERMStore")
50
        const ERMStore = inject("ERMStore")
51
51
52
        const { sysprefs } = storeToRefs(ERMStore)
52
        const { config } = storeToRefs(ERMStore)
53
53
54
        return {
54
        return {
55
            vendorStore,
55
            vendorStore,
56
            AVStore,
56
            AVStore,
57
            ERMStore,
57
            ERMStore,
58
            sysprefs,
58
            config,
59
            setError,
59
            setError,
60
            loading,
60
            loading,
61
            loaded,
61
            loaded,
Lines 128-150 export default { Link Here
128
                    })
128
                    })
129
            )
129
            )
130
130
131
            promises.push(
132
                sysprefs_client.sysprefs.get("ERMProviders").then(
133
                    providers => {
134
                        this.sysprefs.ERMProviders = providers.value.split(",")
135
                    },
136
                    error => {}
137
                )
138
            )
139
            return Promise.all(promises)
131
            return Promise.all(promises)
140
        }
132
        }
141
133
142
        const sysprefs_client = APIClient.sysprefs
134
        const client = APIClient.erm
143
        sysprefs_client.sysprefs
135
        client.config
144
            .get("ERMModule")
136
            .get()
145
            .then(value => {
137
            .then(config => {
146
                this.sysprefs.ERMModule = value.value
138
                this.config = config
147
                if (this.sysprefs.ERMModule != 1) {
139
                if (this.config.settings.ERMModule != 1) {
148
                    return this.setError(
140
                    return this.setError(
149
                        this.$__(
141
                        this.$__(
150
                            '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'
142
                            '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'
Lines 164-170 export default { Link Here
164
            const eHoldings = navigationTree.find(
156
            const eHoldings = navigationTree.find(
165
                element => element.path === "/cgi-bin/koha/erm/eholdings"
157
                element => element.path === "/cgi-bin/koha/erm/eholdings"
166
            )
158
            )
167
            const providers = this.sysprefs.ERMProviders
159
            const providers = this.config.settings.ERMProviders
168
            eHoldings.children = eHoldings.children.filter(element =>
160
            eHoldings.children = eHoldings.children.filter(element =>
169
                providers
161
                providers
170
                    .map(provider => `${eHoldings.path}/${provider}`)
162
                    .map(provider => `${eHoldings.path}/${provider}`)
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js (+9 lines)
Lines 7-12 export class ERMAPIClient extends HttpClient { Link Here
7
        });
7
        });
8
    }
8
    }
9
9
10
    get config() {
11
        return {
12
            get: () =>
13
                this.get({
14
                    endpoint: "config",
15
                }),
16
        };
17
    }
18
10
    get agreements() {
19
    get agreements() {
11
        return {
20
        return {
12
            get: id =>
21
            get: id =>
(-)a/t/cypress/integration/ERM/Agreements_spec.ts (-7 / +2 lines)
Lines 122-134 describe("Agreement CRUD operations", () => { Link Here
122
        cy.title().should("eq", "Koha staff interface");
122
        cy.title().should("eq", "Koha staff interface");
123
        cy.intercept(
123
        cy.intercept(
124
            "GET",
124
            "GET",
125
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule",
125
            "/api/v1/erm/config",
126
            '{"value":"1"}'
126
            '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
127
        );
128
        cy.intercept(
129
            "GET",
130
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders",
131
            '{"value":"local"}'
132
        );
127
        );
133
    });
128
    });
134
129
(-)a/t/cypress/integration/ERM/Dialog_spec.ts (-7 / +2 lines)
Lines 27-39 describe("Dialog operations", () => { Link Here
27
        cy.title().should("eq", "Koha staff interface");
27
        cy.title().should("eq", "Koha staff interface");
28
        cy.intercept(
28
        cy.intercept(
29
            "GET",
29
            "GET",
30
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule",
30
            "/api/v1/erm/config",
31
            '{"value":"1"}'
31
            '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
32
        );
33
        cy.intercept(
34
            "GET",
35
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders",
36
            '{"value":"local"}'
37
        );
32
        );
38
    });
33
    });
39
34
(-)a/t/cypress/integration/ERM/Licenses_spec.ts (-7 / +2 lines)
Lines 38-50 describe("License CRUD operations", () => { Link Here
38
        cy.title().should("eq", "Koha staff interface");
38
        cy.title().should("eq", "Koha staff interface");
39
        cy.intercept(
39
        cy.intercept(
40
            "GET",
40
            "GET",
41
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule",
41
            "/api/v1/erm/config",
42
            '{"value":"1"}'
42
            '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
43
        );
44
        cy.intercept(
45
            "GET",
46
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders",
47
            '{"value":"local"}'
48
        );
43
        );
49
    });
44
    });
50
45
(-)a/t/cypress/integration/ERM/Packages_spec.ts (-7 / +2 lines)
Lines 29-41 describe("Package CRUD operations", () => { Link Here
29
        cy.title().should("eq", "Koha staff interface");
29
        cy.title().should("eq", "Koha staff interface");
30
        cy.intercept(
30
        cy.intercept(
31
            "GET",
31
            "GET",
32
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule",
32
            "/api/v1/erm/config",
33
            '{"value":"1"}'
33
            '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
34
        );
35
        cy.intercept(
36
            "GET",
37
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders",
38
            '{"value":"local"}'
39
        );
34
        );
40
    });
35
    });
41
36
(-)a/t/cypress/integration/ERM/Searchbar_spec.ts (-7 / +2 lines)
Lines 6-18 describe("Searchbar header changes", () => { Link Here
6
        cy.title().should("eq", "Koha staff interface");
6
        cy.title().should("eq", "Koha staff interface");
7
        cy.intercept(
7
        cy.intercept(
8
            "GET",
8
            "GET",
9
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule",
9
            "/api/v1/erm/config",
10
            '{"value":"1"}'
10
            '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
11
        );
12
        cy.intercept(
13
            "GET",
14
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders",
15
            '{"value":"local"}'
16
        );
11
        );
17
    });
12
    });
18
13
(-)a/t/cypress/integration/ERM/Titles_spec.ts (-8 / +2 lines)
Lines 23-35 describe("Title CRUD operations", () => { Link Here
23
        cy.title().should("eq", "Koha staff interface");
23
        cy.title().should("eq", "Koha staff interface");
24
        cy.intercept(
24
        cy.intercept(
25
            "GET",
25
            "GET",
26
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule",
26
            "/api/v1/erm/config",
27
            '{"value":"1"}'
27
            '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}'
28
        );
29
        cy.intercept(
30
            "GET",
31
            "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders",
32
            '{"value":"local"}'
33
        );
28
        );
34
    });
29
    });
35
30
36
- 

Return to bug 33606