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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt (-2 / +3 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 130-136 Link Here
130
                        [% IF CAN_user_acquisition_order_manage %]
130
                        [% IF CAN_user_acquisition_order_manage %]
131
                            [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
131
                            [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
132
                            [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
132
                            [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
133
                        [% END %]
133
                            [% WRAPPER table_option value="aqbooksellers:vendor" %]<span>Vendors</span>[% END %]
134
                [% END %]
134
                    </ul>
135
                    </ul>
135
                [% END %]
136
                [% END %]
136
                [% IF CAN_user_erm %]
137
                [% IF CAN_user_erm %]
(-)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 64-69 export default { Link Here
64
                aliases: [],
70
                aliases: [],
65
                contacts: [],
71
                contacts: [],
66
                interfaces: [],
72
                interfaces: [],
73
                extended_attributes: [],
67
            },
74
            },
68
            initialized: false,
75
            initialized: false,
69
        }
76
        }
Lines 113-118 export default { Link Here
113
            }
120
            }
114
            delete vendor.physical
121
            delete vendor.physical
115
            delete vendor.subscriptions_count
122
            delete vendor.subscriptions_count
123
            delete vendor._strings
116
124
117
            vendor.contacts = vendor.contacts.map(
125
            vendor.contacts = vendor.contacts.map(
118
                ({ id, booksellerid, ...requiredProperties }) =>
126
                ({ id, booksellerid, ...requiredProperties }) =>
Lines 142-147 export default { Link Here
142
                )
150
                )
143
            }
151
            }
144
        },
152
        },
153
        additionalFieldsChanged(additionalFieldValues) {
154
            this.vendor.extended_attributes = additionalFieldValues
155
        },
145
    },
156
    },
146
    components: {
157
    components: {
147
        ButtonSubmit,
158
        ButtonSubmit,
Lines 149-154 export default { Link Here
149
        VendorContacts,
160
        VendorContacts,
150
        VendorOrderingInformation,
161
        VendorOrderingInformation,
151
        VendorInterfaces,
162
        VendorInterfaces,
163
        AdditionalFieldsEntry,
152
    },
164
    },
153
    name: "VendorFormAdd",
165
    name: "VendorFormAdd",
154
}
166
}
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue (-2 / +49 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
                @edit="goToResourceEdit"
17
                @edit="goToResourceEdit"
16
                @delete="doResourceDelete"
18
                @delete="doResourceDelete"
17
                @receive="doReceive"
19
                @receive="doReceive"
Lines 66-75 export default { Link Here
66
            vendor_count: 0,
68
            vendor_count: 0,
67
            initialized: false,
69
            initialized: false,
68
            searchTerm: null,
70
            searchTerm: null,
71
            searchable_av_options: [],
72
            searchable_additional_fields: [],
69
            tableOptions: {
73
            tableOptions: {
70
                columns: this.getTableColumns(),
74
                columns: this.getTableColumns(),
71
                options: {
75
                options: {
72
                    embed: "aliases,baskets,subscriptions+count,invoices",
76
                    embed: "aliases,baskets,subscriptions+count,invoices,extended_attributes,+strings",
73
                },
77
                },
74
                url: () => this.tableURL(),
78
                url: () => this.tableURL(),
75
                add_filters: true,
79
                add_filters: true,
Lines 120-126 export default { Link Here
120
    },
124
    },
121
    beforeRouteEnter(to, from, next) {
125
    beforeRouteEnter(to, from, next) {
122
        next(vm => {
126
        next(vm => {
123
            vm.getVendorCount().then(() => (vm.initialized = true))
127
            vm.getVendorCount().then(() =>
128
                vm
129
                    .getSearchableAdditionalFields()
130
                    .then(() =>
131
                        vm
132
                            .getSearchableAVOptions()
133
                            .then(() => (vm.initialized = true))
134
                    )
135
            )
124
            if (to.query.supplier) {
136
            if (to.query.supplier) {
125
                vm.searchTerm = to.query.supplier
137
                vm.searchTerm = to.query.supplier
126
            }
138
            }
Lines 230-235 export default { Link Here
230
                },
242
                },
231
            ]
243
            ]
232
        },
244
        },
245
        async getSearchableAdditionalFields() {
246
            const client = APIClient.additional_fields
247
            await client.additional_fields.getAll("vendor").then(
248
                searchable_additional_fields => {
249
                    this.searchable_additional_fields =
250
                        searchable_additional_fields.filter(
251
                            field => field.searchable
252
                        )
253
                },
254
                error => {}
255
            )
256
        },
257
        async getSearchableAVOptions() {
258
            const client_av = APIClient.authorised_values
259
            let av_cat_array = this.searchable_additional_fields
260
                .filter(field => field.authorised_value_category_name)
261
                .map(field => field.authorised_value_category_name)
262
263
            await client_av.values
264
                .getCategoriesWithValues([
265
                    ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')),
266
                ]) // unique
267
                .then(av_categories => {
268
                    av_cat_array.forEach(av_cat => {
269
                        let av_match = av_categories.find(
270
                            element => element.category_name == av_cat
271
                        )
272
                        this.searchable_av_options[av_cat] =
273
                            av_match.authorised_values.map(av => ({
274
                                value: av.value,
275
                                label: av.description,
276
                            }))
277
                    })
278
                })
279
        },
233
    },
280
    },
234
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
281
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
235
    name: "VendorList",
282
    name: "VendorList",
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue (+9 lines)
Lines 57-62 Link Here
57
            <div class="col-sm-6">
57
            <div class="col-sm-6">
58
                <VendorContacts :vendor="vendor" :display="true" />
58
                <VendorContacts :vendor="vendor" :display="true" />
59
                <VendorSubscriptions :vendor="vendor" />
59
                <VendorSubscriptions :vendor="vendor" />
60
                <AdditionalFieldsDisplay
61
                    v-if="vendor._strings"
62
                    resource_type="vendor"
63
                    :additional_field_values="
64
                        vendor._strings.additional_field_values
65
                    "
66
                />
60
            </div>
67
            </div>
61
        </div>
68
        </div>
62
        <div
69
        <div
Lines 80-85 import VendorContacts from "./VendorContacts.vue" Link Here
80
import VendorSubscriptions from "./VendorSubscriptions.vue"
87
import VendorSubscriptions from "./VendorSubscriptions.vue"
81
import VendorContracts from "./VendorContracts.vue"
88
import VendorContracts from "./VendorContracts.vue"
82
import DropdownButtons from "../DropdownButtons.vue"
89
import DropdownButtons from "../DropdownButtons.vue"
90
import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue"
83
import VendorResource from "./VendorResource.vue"
91
import VendorResource from "./VendorResource.vue"
84
92
85
export default {
93
export default {
Lines 126-131 export default { Link Here
126
        VendorContacts,
134
        VendorContacts,
127
        VendorSubscriptions,
135
        VendorSubscriptions,
128
        VendorContracts,
136
        VendorContracts,
137
        AdditionalFieldsDisplay,
129
        DropdownButtons,
138
        DropdownButtons,
130
    },
139
    },
131
    name: "VendorShow",
140
    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