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 209-214 paths: Link Here
209
    $ref: ./paths/config_smtp_servers.yaml#/~1config~1smtp_servers
211
    $ref: ./paths/config_smtp_servers.yaml#/~1config~1smtp_servers
210
  "/config/smtp_servers/{smtp_server_id}":
212
  "/config/smtp_servers/{smtp_server_id}":
211
    $ref: "./paths/config_smtp_servers.yaml#/~1config~1smtp_servers~1{smtp_server_id}"
213
    $ref: "./paths/config_smtp_servers.yaml#/~1config~1smtp_servers~1{smtp_server_id}"
214
  /erm/config:
215
    $ref: ./paths/erm_config.yaml#/~1erm~1config
212
  /erm/agreements:
216
  /erm/agreements:
213
    $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements
217
    $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements
214
  "/erm/agreements/{agreement_id}":
218
  "/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 / +11 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
            <Breadcrumb />
4
            <Breadcrumb />
5
            <Help />
5
            <Help />
Lines 48-54 Link Here
48
                                    <li>
48
                                    <li>
49
                                        <ul>
49
                                        <ul>
50
                                            <li
50
                                            <li
51
                                                v-for="provider in sysprefs.ERMProviders"
51
                                                v-for="provider in config
52
                                                    .settings.ERMProviders"
52
                                                :key="provider"
53
                                                :key="provider"
53
                                            >
54
                                            >
54
                                                <router-link
55
                                                <router-link
Lines 138-150 export default { Link Here
138
139
139
        const ERMStore = inject("ERMStore")
140
        const ERMStore = inject("ERMStore")
140
141
141
        const { sysprefs } = storeToRefs(ERMStore)
142
        const { config } = storeToRefs(ERMStore)
142
143
143
        return {
144
        return {
144
            vendorStore,
145
            vendorStore,
145
            AVStore,
146
            AVStore,
146
            ERMStore,
147
            ERMStore,
147
            sysprefs,
148
            config,
148
            setError,
149
            setError,
149
            loading,
150
            loading,
150
            loaded,
151
            loaded,
Lines 217-239 export default { Link Here
217
                    })
218
                    })
218
            )
219
            )
219
220
220
            promises.push(
221
                sysprefs_client.sysprefs.get("ERMProviders").then(
222
                    providers => {
223
                        this.sysprefs.ERMProviders = providers.value.split(",")
224
                    },
225
                    error => {}
226
                )
227
            )
228
            return Promise.all(promises)
221
            return Promise.all(promises)
229
        }
222
        }
230
223
231
        const sysprefs_client = APIClient.sysprefs
224
        const client = APIClient.erm
232
        sysprefs_client.sysprefs
225
        client.config
233
            .get("ERMModule")
226
            .get()
234
            .then(value => {
227
            .then(config => {
235
                this.sysprefs.ERMModule = value.value
228
                this.config = config
236
                if (this.sysprefs.ERMModule != 1) {
229
                if (this.config.settings.ERMModule != 1) {
237
                    return this.setError(
230
                    return this.setError(
238
                        this.$__(
231
                        this.$__(
239
                            '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'
232
                            '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'
(-)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