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 30-36 Link Here
30
</head>
30
</head>
31
31
32
[% marcfield_tables = ['subscription', 'aqorders'] %]
32
[% marcfield_tables = ['subscription', 'aqorders'] %]
33
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages'] %]
33
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices', 'erm_licenses', 'erm_agreements', 'erm_packages', 'aqbooksellers'] %]
34
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
34
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
35
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
35
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
36
36
Lines 130-135 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
                            [% WRAPPER table_option value="aqbooksellers:vendor" %]<span>Vendors</span>[% END %]
133
                        [% END %]
134
                        [% END %]
134
                    </ul>
135
                    </ul>
135
                [% END %]
136
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/acquisition-api-client.js (-1 / +1 lines)
Lines 21-27 export class AcquisitionAPIClient { Link Here
21
                    endpoint: "vendors/" + id,
21
                    endpoint: "vendors/" + id,
22
                    headers: {
22
                    headers: {
23
                        "x-koha-embed":
23
                        "x-koha-embed":
24
                            "aliases,subscriptions+count,interfaces,contacts,contracts,baskets+count,invoices+count",
24
                            "aliases,subscriptions+count,interfaces,contacts,contracts,baskets+count,invoices+count,extended_attributes,+strings",
25
                    },
25
                    },
26
                }),
26
                }),
27
            getAll: (query, params) =>
27
            getAll: (query, params) =>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue (-1 / +13 lines)
Lines 15-20 Link Here
15
                    :verifyDiscountValue="verifyDiscountValue"
15
                    :verifyDiscountValue="verifyDiscountValue"
16
                    :discountValid="discountValid"
16
                    :discountValid="discountValid"
17
                />
17
                />
18
                <AdditionalFieldsEntry
19
                    resource_type="vendor"
20
                    :additional_field_values="vendor.extended_attributes"
21
                    @additional-fields-changed="additionalFieldsChanged"
22
                />
18
                <fieldset class="action">
23
                <fieldset class="action">
19
                    <ButtonSubmit />
24
                    <ButtonSubmit />
20
                    <router-link
25
                    <router-link
Lines 24-30 Link Here
24
                        >{{ $__("Cancel") }}</router-link
29
                        >{{ $__("Cancel") }}</router-link
25
                    >
30
                    >
26
                </fieldset>
31
                </fieldset>
27
            </form>
32
        </form>
28
        </div>
33
        </div>
29
    </div>
34
    </div>
30
</template>
35
</template>
Lines 37-42 import VendorDetails from "./VendorDetails.vue"; Link Here
37
import VendorContacts from "./VendorContacts.vue";
42
import VendorContacts from "./VendorContacts.vue";
38
import VendorOrderingInformation from "./VendorOrderingInformation.vue";
43
import VendorOrderingInformation from "./VendorOrderingInformation.vue";
39
import VendorInterfaces from "./VendorInterfaces.vue";
44
import VendorInterfaces from "./VendorInterfaces.vue";
45
import AdditionalFieldsEntry from "../AdditionalFieldsEntry.vue";
40
46
41
export default {
47
export default {
42
    data() {
48
    data() {
Lines 69-74 export default { Link Here
69
                aliases: [],
75
                aliases: [],
70
                contacts: [],
76
                contacts: [],
71
                interfaces: [],
77
                interfaces: [],
78
                extended_attributes: [],
72
            },
79
            },
73
            initialized: false,
80
            initialized: false,
74
            discountValid: true,
81
            discountValid: true,
Lines 136-141 export default { Link Here
136
            delete vendor.subscriptions;
143
            delete vendor.subscriptions;
137
            delete vendor.contracts;
144
            delete vendor.contracts;
138
            delete vendor.invoices_count;
145
            delete vendor.invoices_count;
146
            delete vendor._strings;
139
147
140
            if (!this.discountValid)
148
            if (!this.discountValid)
141
                errors.push(this.$__("Invalid discount value"));
149
                errors.push(this.$__("Invalid discount value"));
Lines 200-205 export default { Link Here
200
                this.vendor.discount
208
                this.vendor.discount
201
            );
209
            );
202
        },
210
        },
211
        additionalFieldsChanged(additionalFieldValues) {
212
            this.vendor.extended_attributes = additionalFieldValues;
213
        },
203
    },
214
    },
204
    components: {
215
    components: {
205
        ButtonSubmit,
216
        ButtonSubmit,
Lines 207-212 export default { Link Here
207
        VendorContacts,
218
        VendorContacts,
208
        VendorOrderingInformation,
219
        VendorOrderingInformation,
209
        VendorInterfaces,
220
        VendorInterfaces,
221
        AdditionalFieldsEntry,
210
    },
222
    },
211
    name: "VendorFormAdd",
223
    name: "VendorFormAdd",
212
};
224
};
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue (-2 / +84 lines)
Lines 17-22 Link Here
17
                @delete="doDelete"
17
                @delete="doDelete"
18
                @select="doSelect"
18
                @select="doSelect"
19
                @receive="doReceive"
19
                @receive="doReceive"
20
                :searchable_additional_fields="searchable_additional_fields"
21
                :searchable_av_options="searchable_av_options"
20
            ></KohaTable>
22
            ></KohaTable>
21
        </div>
23
        </div>
22
        <div v-else class="alert alert-info">
24
        <div v-else class="alert alert-info">
Lines 65-74 export default { Link Here
65
            vendor_count: 0,
67
            vendor_count: 0,
66
            initialized: false,
68
            initialized: false,
67
            searchTerm: null,
69
            searchTerm: null,
70
            searchable_av_options: [],
71
            searchable_additional_fields: [],
68
            tableOptions: {
72
            tableOptions: {
69
                columns: this.getTableColumns(),
73
                columns: this.getTableColumns(),
70
                options: {
74
                options: {
71
                    embed: "aliases,baskets+count,subscriptions+count,invoices+count",
75
                    embed: "aliases,baskets+count,subscriptions+count,invoices+count,extended_attributes,+strings",
72
                },
76
                },
73
                url: () => this.tableURL(),
77
                url: () => this.tableURL(),
74
                table_settings: this.vendorTableSettings,
78
                table_settings: this.vendorTableSettings,
Lines 117-123 export default { Link Here
117
    },
121
    },
118
    beforeRouteEnter(to, from, next) {
122
    beforeRouteEnter(to, from, next) {
119
        next(vm => {
123
        next(vm => {
120
            vm.getVendorCount().then(() => (vm.initialized = true));
124
            vm.getVendorCount().then(() =>
125
                vm
126
                    .getSearchableAdditionalFields()
127
                    .then(() =>
128
                        vm
129
                            .getSearchableAVOptions()
130
                            .then(() => (vm.initialized = true))
131
                    )
132
            );
121
            if (to.query.supplier) {
133
            if (to.query.supplier) {
122
                vm.searchTerm = to.query.supplier;
134
                vm.searchTerm = to.query.supplier;
123
            }
135
            }
Lines 275-280 export default { Link Here
275
                },
287
                },
276
            ];
288
            ];
277
        },
289
        },
290
        async getSearchableAdditionalFields() {
291
            const client = APIClient.additional_fields;
292
            await client.additional_fields.getAll("vendor").then(
293
                searchable_additional_fields => {
294
                    this.searchable_additional_fields =
295
                        searchable_additional_fields.filter(
296
                            field => field.searchable
297
                        );
298
                },
299
                error => {}
300
            );
301
        },
302
        async getSearchableAVOptions() {
303
            const client_av = APIClient.authorised_values;
304
            let av_cat_array = this.searchable_additional_fields
305
                .filter(field => field.authorised_value_category_name)
306
                .map(field => field.authorised_value_category_name);
307
308
            await client_av.values
309
                .getCategoriesWithValues([
310
                    ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')),
311
                ]) // unique
312
                .then(av_categories => {
313
                    av_cat_array.forEach(av_cat => {
314
                        let av_match = av_categories.find(
315
                            element => element.category_name == av_cat
316
                        );
317
                        this.searchable_av_options[av_cat] =
318
                            av_match.authorised_values.map(av => ({
319
                                value: av.value,
320
                                label: av.description,
321
                            }));
322
                    });
323
                });
324
        },
325
        async getSearchableAdditionalFields() {
326
            const client = APIClient.additional_fields;
327
            await client.additional_fields.getAll("vendor").then(
328
                searchable_additional_fields => {
329
                    this.searchable_additional_fields =
330
                        searchable_additional_fields.filter(
331
                            field => field.searchable
332
                        );
333
                },
334
                error => {}
335
            );
336
        },
337
        async getSearchableAVOptions() {
338
            const client_av = APIClient.authorised_values;
339
            let av_cat_array = this.searchable_additional_fields
340
                .filter(field => field.authorised_value_category_name)
341
                .map(field => field.authorised_value_category_name);
342
343
            await client_av.values
344
                .getCategoriesWithValues([
345
                    ...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')),
346
                ]) // unique
347
                .then(av_categories => {
348
                    av_cat_array.forEach(av_cat => {
349
                        let av_match = av_categories.find(
350
                            element => element.category_name == av_cat
351
                        );
352
                        this.searchable_av_options[av_cat] =
353
                            av_match.authorised_values.map(av => ({
354
                                value: av.value,
355
                                label: av.description,
356
                            }));
357
                    });
358
                });
359
        },
278
    },
360
    },
279
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
361
    components: { flatPickr, Toolbar, ToolbarButton, KohaTable },
280
    name: "VendorList",
362
    name: "VendorList",
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue (-1 / +9 lines)
Lines 86-91 Link Here
86
            <div class="col-sm-6">
86
            <div class="col-sm-6">
87
                <VendorContacts :vendor="vendor" :display="true" />
87
                <VendorContacts :vendor="vendor" :display="true" />
88
                <VendorSubscriptions :vendor="vendor" />
88
                <VendorSubscriptions :vendor="vendor" />
89
                <AdditionalFieldsDisplay
90
                    v-if="vendor._strings"
91
                    resource_type="vendor"
92
                    :additional_field_values="
93
                        vendor._strings.additional_field_values
94
                    "
95
                />
89
            </div>
96
            </div>
90
        </div>
97
        </div>
91
        <div
98
        <div
Lines 109-114 import VendorContacts from "./VendorContacts.vue"; Link Here
109
import VendorSubscriptions from "./VendorSubscriptions.vue";
116
import VendorSubscriptions from "./VendorSubscriptions.vue";
110
import VendorContracts from "./VendorContracts.vue";
117
import VendorContracts from "./VendorContracts.vue";
111
import DropdownButtons from "../DropdownButtons.vue";
118
import DropdownButtons from "../DropdownButtons.vue";
119
import AdditionalFieldsDisplay from "../AdditionalFieldsDisplay.vue";
112
120
113
export default {
121
export default {
114
    setup() {
122
    setup() {
Lines 181-186 export default { Link Here
181
        VendorContacts,
189
        VendorContacts,
182
        VendorSubscriptions,
190
        VendorSubscriptions,
183
        VendorContracts,
191
        VendorContracts,
192
        AdditionalFieldsDisplay,
184
        DropdownButtons,
193
        DropdownButtons,
185
    },
194
    },
186
    name: "VendorShow",
195
    name: "VendorShow",
187
- 

Return to bug 38262