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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt (-1 / +2 lines)
Lines 24-30 Link Here
24
</head>
24
</head>
25
25
26
[% marcfield_tables = ['subscription', 'aqorders'] %]
26
[% marcfield_tables = ['subscription', 'aqorders'] %]
27
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages'] %]
27
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages', 'aqbooksellers'] %]
28
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
28
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
29
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
29
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
30
30
Lines 125-130 Link Here
125
                [% IF CAN_user_acquisition_order_manage %]
125
                [% IF CAN_user_acquisition_order_manage %]
126
                    [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
126
                    [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
127
                    [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
127
                    [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
128
                    [% WRAPPER table_option value="aqbooksellers:vendor" %]<span>Vendors</span>[% END %]
128
                [% END %]
129
                [% END %]
129
                [% IF CAN_user_acquisition_edit_invoices %]
130
                [% IF CAN_user_acquisition_edit_invoices %]
130
                    [% WRAPPER table_option value="aqinvoices" %]<span>Invoices</span>[% END %]
131
                    [% WRAPPER table_option value="aqinvoices" %]<span>Invoices</span>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue (+12 lines)
Lines 11-16 Link Here
11
                <VendorContacts :vendor="vendor" />
11
                <VendorContacts :vendor="vendor" />
12
                <VendorInterfaces :vendor="vendor" />
12
                <VendorInterfaces :vendor="vendor" />
13
                <VendorOrderingInformation :vendor="vendor" />
13
                <VendorOrderingInformation :vendor="vendor" />
14
                <AdditionalFieldsEntry
15
                    resource_type="vendor"
16
                    :additional_field_values="vendor.extended_attributes"
17
                    @additional-fields-changed="additionalFieldsChanged"
18
                />
14
                <fieldset class="action">
19
                <fieldset class="action">
15
                    <ButtonSubmit />
20
                    <ButtonSubmit />
16
                    <router-link
21
                    <router-link
Lines 33-38 import VendorDetails from "./VendorDetails.vue" Link Here
33
import VendorContacts from "./VendorContacts.vue"
38
import VendorContacts from "./VendorContacts.vue"
34
import VendorOrderingInformation from "./VendorOrderingInformation.vue"
39
import VendorOrderingInformation from "./VendorOrderingInformation.vue"
35
import VendorInterfaces from "./VendorInterfaces.vue"
40
import VendorInterfaces from "./VendorInterfaces.vue"
41
import AdditionalFieldsEntry from "../AdditionalFieldsEntry.vue"
36
42
37
export default {
43
export default {
38
    data() {
44
    data() {
Lines 66-71 export default { Link Here
66
                aliases: [],
72
                aliases: [],
67
                contacts: [],
73
                contacts: [],
68
                interfaces: [],
74
                interfaces: [],
75
                extended_attributes: [],
69
            },
76
            },
70
            initialized: false,
77
            initialized: false,
71
        }
78
        }
Lines 118-123 export default { Link Here
118
            }
125
            }
119
            delete vendor.physical
126
            delete vendor.physical
120
            delete vendor.subscriptions_count
127
            delete vendor.subscriptions_count
128
            delete vendor._strings
121
129
122
            vendor.contacts = vendor.contacts.map(
130
            vendor.contacts = vendor.contacts.map(
123
                ({ id, booksellerid, ...requiredProperties }) =>
131
                ({ id, booksellerid, ...requiredProperties }) =>
Lines 153-158 export default { Link Here
153
                )
161
                )
154
            }
162
            }
155
        },
163
        },
164
        additionalFieldsChanged(additionalFieldValues) {
165
            this.vendor.extended_attributes = additionalFieldValues
166
        },
156
    },
167
    },
157
    components: {
168
    components: {
158
        ButtonSubmit,
169
        ButtonSubmit,
Lines 160-165 export default { Link Here
160
        VendorContacts,
171
        VendorContacts,
161
        VendorOrderingInformation,
172
        VendorOrderingInformation,
162
        VendorInterfaces,
173
        VendorInterfaces,
174
        AdditionalFieldsEntry,
163
    },
175
    },
164
    name: "VendorFormAdd",
176
    name: "VendorFormAdd",
165
}
177
}
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue (-2 / +51 lines)
Lines 12-17 Link Here
12
            <KohaTable
12
            <KohaTable
13
                ref="table"
13
                ref="table"
14
                v-bind="tableOptions"
14
                v-bind="tableOptions"
15
                :searchable_additional_fields="searchable_additional_fields"
16
                :searchable_av_options="searchable_av_options"
15
                @show="goToResourceShow"
17
                @show="goToResourceShow"
16
                @edit="goToResourceEdit"
18
                @edit="goToResourceEdit"
17
                @delete="doResourceDelete"
19
                @delete="doResourceDelete"
Lines 68-76 export default { Link Here
68
            vendor_count: 0,
70
            vendor_count: 0,
69
            initialized: false,
71
            initialized: false,
70
            searchTerm: null,
72
            searchTerm: null,
73
            searchable_av_options: [],
74
            searchable_additional_fields: [],
71
            tableOptions: {
75
            tableOptions: {
72
                columns: this.getTableColumns(),
76
                columns: this.getTableColumns(),
73
                options: { embed: "aliases,baskets,subscriptions+count" },
77
                options: {
78
                    embed: "aliases,baskets,subscriptions+count,extended_attributes,+strings",
79
                },
74
                url: () => this.tableURL(),
80
                url: () => this.tableURL(),
75
                add_filters: true,
81
                add_filters: true,
76
                filters_options: {
82
                filters_options: {
Lines 117-123 export default { Link Here
117
    },
123
    },
118
    beforeRouteEnter(to, from, next) {
124
    beforeRouteEnter(to, from, next) {
119
        next(vm => {
125
        next(vm => {
120
            vm.getVendorCount().then(() => (vm.initialized = true))
126
            vm.getVendorCount().then(() =>
127
                vm
128
                    .getSearchableAdditionalFields()
129
                    .then(() =>
130
                        vm
131
                            .getSearchableAVOptions()
132
                            .then(() => (vm.initialized = true))
133
                    )
134
            )
121
            if (to.query.supplier) {
135
            if (to.query.supplier) {
122
                vm.searchTerm = to.query.supplier
136
                vm.searchTerm = to.query.supplier
123
            }
137
            }
Lines 231-236 export default { Link Here
231
                },
245
                },
232
            ]
246
            ]
233
        },
247
        },
248
        async getSearchableAdditionalFields() {
249
            const client = APIClient.additional_fields
250
            await client.additional_fields.getAll("vendor").then(
251
                searchable_additional_fields => {
252
                    this.searchable_additional_fields =
253
                        searchable_additional_fields.filter(
254
                            field => field.searchable
255
                        )
256
                },
257
                error => {}
258
            )
259
        },
260
        async getSearchableAVOptions() {
261
            const client_av = APIClient.authorised_values
262
            let av_cat_array = this.searchable_additional_fields
263
                .filter(field => field.authorised_value_category_name)
264
                .map(field => field.authorised_value_category_name)
265
266
            await client_av.values
267
                .getCategoriesWithValues([
268
                    ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')),
269
                ]) // unique
270
                .then(av_categories => {
271
                    av_cat_array.forEach(av_cat => {
272
                        let av_match = av_categories.find(
273
                            element => element.category_name == av_cat
274
                        )
275
                        this.searchable_av_options[av_cat] =
276
                            av_match.authorised_values.map(av => ({
277
                                value: av.value,
278
                                label: av.description,
279
                            }))
280
                    })
281
                })
282
        },
234
    },
283
    },
235
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
284
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
236
    name: "VendorList",
285
    name: "VendorList",
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue (+9 lines)
Lines 75-80 Link Here
75
            <div class="col-sm-6">
75
            <div class="col-sm-6">
76
                <VendorContacts :vendor="vendor" :display="true" />
76
                <VendorContacts :vendor="vendor" :display="true" />
77
                <VendorSubscriptions :vendor="vendor" />
77
                <VendorSubscriptions :vendor="vendor" />
78
                <AdditionalFieldsDisplay
79
                    v-if="vendor._strings"
80
                    resource_type="vendor"
81
                    :additional_field_values="
82
                        vendor._strings.additional_field_values
83
                    "
84
                />
78
            </div>
85
            </div>
79
        </div>
86
        </div>
80
        <div
87
        <div
Lines 98-103 import VendorContacts from "./VendorContacts.vue" Link Here
98
import VendorSubscriptions from "./VendorSubscriptions.vue"
105
import VendorSubscriptions from "./VendorSubscriptions.vue"
99
import VendorContracts from "./VendorContracts.vue"
106
import VendorContracts from "./VendorContracts.vue"
100
import DropdownButtons from "../DropdownButtons.vue"
107
import DropdownButtons from "../DropdownButtons.vue"
108
import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue"
101
import VendorResource from "./VendorResource.vue"
109
import VendorResource from "./VendorResource.vue"
102
110
103
export default {
111
export default {
Lines 144-149 export default { Link Here
144
        VendorContacts,
152
        VendorContacts,
145
        VendorSubscriptions,
153
        VendorSubscriptions,
146
        VendorContracts,
154
        VendorContracts,
155
        AdditionalFieldsDisplay,
147
        DropdownButtons,
156
        DropdownButtons,
148
    },
157
    },
149
    name: "VendorShow",
158
    name: "VendorShow",
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js (-2 / +1 lines)
Lines 14-20 export class AcquisitionAPIClient extends HttpClient { Link Here
14
                    endpoint: "vendors/" + id,
14
                    endpoint: "vendors/" + id,
15
                    headers: {
15
                    headers: {
16
                        "x-koha-embed":
16
                        "x-koha-embed":
17
                            "aliases,subscriptions+count,interfaces,contacts,contracts",
17
                            "aliases,subscriptions+count,interfaces,contacts,contracts,extended_attributes,+strings",
18
                    },
18
                    },
19
                }),
19
                }),
20
            getAll: (query, params) =>
20
            getAll: (query, params) =>
21
- 

Return to bug 38262