Bugzilla – Attachment 174273 Details for
Bug 38010
Migrate vendors to Vue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38010: Reset basket view
Bug-38010-Reset-basket-view.patch (text/plain), 21.16 KB, created by
Matt Blenkinsop
on 2024-11-08 14:03:30 UTC
(
hide
)
Description:
Bug 38010: Reset basket view
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-11-08 14:03:30 UTC
Size:
21.16 KB
patch
obsolete
>From 50ada1b8b17cae42be3f4d11a6e5390a5fe60192 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Fri, 8 Nov 2024 13:08:20 +0000 >Subject: [PATCH] Bug 38010: Reset basket view > >--- > Koha/REST/V1/Acquisitions/Baskets.pm | 19 +- > api/v1/swagger/definitions/basket.yaml | 16 -- > .../swagger/paths/acquisitions_baskets.yaml | 12 - > .../prog/en/includes/vendor-menu.inc | 2 +- > .../js/vue/components/Islands/VendorMenu.vue | 7 +- > .../vue/components/Vendors/VendorBaskets.vue | 263 ------------------ > .../js/vue/components/Vendors/VendorList.vue | 4 +- > .../js/vue/components/Vendors/VendorShow.vue | 70 ++--- > .../prog/js/vue/routes/acquisitions.js | 7 - > 9 files changed, 30 insertions(+), 370 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorBaskets.vue > >diff --git a/Koha/REST/V1/Acquisitions/Baskets.pm b/Koha/REST/V1/Acquisitions/Baskets.pm >index 1f0326e646c..b7f39b81448 100644 >--- a/Koha/REST/V1/Acquisitions/Baskets.pm >+++ b/Koha/REST/V1/Acquisitions/Baskets.pm >@@ -18,9 +18,8 @@ package Koha::REST::V1::Acquisitions::Baskets; > use Modern::Perl; > > use Mojo::Base 'Mojolicious::Controller'; >-use Try::Tiny qw( catch try ); > >-use C4::Acquisition qw( CanUserManageBasket ); >+use Try::Tiny qw( catch try ); > > =head1 NAME > >@@ -66,25 +65,13 @@ Return a list of baskets > =cut > > sub list { >- my $c = shift->openapi->valid_input or return; >- my $patron = $c->stash('koha.user'); >+ my $c = shift->openapi->valid_input or return; > > return try { > >- my $baskets_rs = Koha::Acquisition::Baskets->new; >- my $baskets = $c->objects->search($baskets_rs); >- >- my $userflags = C4::Auth::getuserflags( $patron->flags, $patron->userid ); >- >- my @user_baskets; >- foreach my $basket (@$baskets) { >- my $success = CanUserManageBasket( $patron->unblessed, $basket, $userflags ); >- push @user_baskets, $basket if $success; >- } >- > return $c->render( > status => 200, >- openapi => \@user_baskets >+ openapi => $c->objects->search( Koha::Acquisition::Baskets->new ), > ); > } catch { > $c->unhandled_exception($_); >diff --git a/api/v1/swagger/definitions/basket.yaml b/api/v1/swagger/definitions/basket.yaml >index c1006a63d47..5b02068190a 100644 >--- a/api/v1/swagger/definitions/basket.yaml >+++ b/api/v1/swagger/definitions/basket.yaml >@@ -73,22 +73,6 @@ properties: > - string > - "null" > description: basket notes >- orders: >- type: array >- description: List of orderlines for the basket >- items: >- $ref: "order.yaml" >- creator: >- type: >- - object >- - "null" >- description: Creator for the basket >- $ref: "patron.yaml" >- basket_group: >- type: >- - object >- - "null" >- description: Basket group > create_items: > type: > - string >diff --git a/api/v1/swagger/paths/acquisitions_baskets.yaml b/api/v1/swagger/paths/acquisitions_baskets.yaml >index 277dcafc1ea..010b53af949 100644 >--- a/api/v1/swagger/paths/acquisitions_baskets.yaml >+++ b/api/v1/swagger/paths/acquisitions_baskets.yaml >@@ -14,18 +14,6 @@ > - $ref: "../swagger.yaml#/parameters/per_page" > - $ref: "../swagger.yaml#/parameters/q_param" > - $ref: "../swagger.yaml#/parameters/q_body" >- - name: x-koha-embed >- in: header >- required: false >- description: Embed list sent as a request header >- type: array >- items: >- type: string >- enum: >- - orders >- - creator >- - basket_group >- collectionFormat: csv > produces: > - application/json > responses: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc >index 5dfb9a75083..631692721e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc >@@ -1,7 +1,7 @@ > [% IF ( booksellerid ) %] > <div id="menu"> > <ul> >- [% IF ( CAN_user_acquisition_order_manage ) %]<li><a href="/cgi-bin/koha/vendors/[% booksellerid | uri %]/baskets">Baskets</a></li>[% END %] >+ [% IF ( CAN_user_acquisition_order_manage ) %]<li><a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=[% booksellerid | uri %]">Baskets</a></li>[% END %] > [% IF ( CAN_user_acquisition_group_manage ) %]<li><a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | uri %]">Basket groups</a></li>[% END %] > [% IF ( CAN_user_acquisition_contracts_manage ) %]<li><a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a></li>[% END %] > [% IF ( CAN_user_acquisition_issue_manage ) %]<li><a href="/cgi-bin/koha/acqui/vendor_issues.pl?booksellerid=[% booksellerid | uri %]">Vendor issues</a></li>[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue >index 2c76093e2c8..63c8d22f671 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue >@@ -7,9 +7,10 @@ > isUserPermitted('CAN_user_acquisition_order_manage') > " > > >- <a :href="`/cgi-bin/koha/vendors/${vendorId}/baskets`">{{ >- $__("Baskets") >- }}</a> >+ <a >+ :href="`/cgi-bin/koha/acqui/booksellers.pl?booksellerid=${vendorId}`" >+ >{{ $__("Baskets") }}</a >+ > > </li> > <li > v-if=" >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorBaskets.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorBaskets.vue >deleted file mode 100644 >index c896fbd65ce..00000000000 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorBaskets.vue >+++ /dev/null >@@ -1,263 +0,0 @@ >-<template> >- <div id="vendor_baskets"> >- <div v-if="parseInt(basketCount) > 0" class="page-section"> >- <KohaTable >- ref="table" >- v-bind="tableOptions" >- @addToBasket="addToBasket" >- @closeBasket="closeBasket" >- @uncertainPrices="uncertainPrices" >- ></KohaTable> >- </div> >- <div v-else class="alert alert-info"> >- {{ $__("There are no baskets defined") }} >- </div> >- </div> >-</template> >- >-<script> >-import { inject, ref } from "vue" >-import { storeToRefs } from "pinia" >-import KohaTable from "../KohaTable.vue" >- >-export default { >- setup() { >- const patronToHTML = $patron_to_html >- const formatDate = $date >- >- const vendorStore = inject("vendorStore") >- const { vendors } = storeToRefs(vendorStore) >- >- const { setConfirmationDialog, setMessage } = inject("mainStore") >- >- const table = ref() >- >- return { >- vendors, >- table, >- setConfirmationDialog, >- setMessage, >- escape_str, >- patronToHTML, >- formatDate, >- } >- }, >- data() { >- return { >- fp_config: flatpickr_defaults, >- initialized: false, >- tableOptions: { >- columns: this.getTableColumns(), >- options: { embed: "orders,creator,basket_group" }, >- url: () => this.tableURL(), >- add_filters: true, >- actions: { >- "-1": [ >- { >- addToBasket: { >- text: this.$__("Add to basket"), >- icon: "fa fa-plus", >- }, >- }, >- { >- closeBasket: { >- text: this.$__("Close basket"), >- icon: "fa fa-close", >- should_display: row => >- row.orders.length > 0 && !row.standing, >- }, >- }, >- { >- uncertainPrices: { >- text: this.$__("Uncertain prices"), >- icon: "fa fa-question", >- should_display: row => >- row.orders.filter(o => o.uncertain_price) >- .length > 0, >- }, >- }, >- ], >- }, >- }, >- } >- }, >- methods: { >- addToBasket({ basket_id }, dt, event) { >- event.preventDefault() >- location.href = >- "/cgi-bin/koha/acqui/basket.pl?basketno=" + basket_id >- }, >- closeBasket({ basket_id }, dt, event) { >- event.preventDefault() >- location.href = >- "/cgi-bin/koha/acqui/basket.pl?basketno=" + basket_id >- }, >- uncertainPrices({ basket_id }, dt, event) { >- event.preventDefault() >- location.href = >- "/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=" + >- basket_id + >- "&owner=1" >- }, >- tableURL() { >- let url = >- "/api/v1/acquisitions/baskets?q=" + >- JSON.stringify({ "me.vendor_id": this.vendorId }) >- return url >- }, >- getTableColumns() { >- const escape_str = this.escape_str >- const patronToHTML = this.patronToHTML >- const formatDate = this.formatDate >- >- return [ >- { >- title: __("Name"), >- data: "me.name:me.basket_id", >- searchable: true, >- orderable: true, >- render(data, type, row, meta) { >- const name = row.name ? row.name : __("Unnamed basket") >- return ( >- '<a href="/cgi-bin/koha/acqui/basket.pl?basketno=' + >- row.basket_id + >- '" class="show">' + >- escape_str(`${name} (#${row.basket_id})`) + >- "</a>" >- ) >- }, >- }, >- { >- title: __("Item count"), >- data: "name", >- searchable: false, >- orderable: true, >- >- render(data, type, row, meta) { >- let count = row.orders.length >- const cancelledOrders = row.orders.filter( >- o => o.status == "cancelled" >- ).length >- if (cancelledOrders) { >- count += >- " (" + cancelledOrders + __(" cancelled") + ")" >- } >- return count >- }, >- }, >- { >- title: __("Bibliographic record count"), >- data: "name", >- searchable: false, >- orderable: true, >- render(data, type, row, meta) { >- const recordCount = row.orders.reduce( >- (acc, order) => { >- if ( >- !acc.cancelledBibs.includes( >- order.biblio_id >- ) && >- order.status == "cancelled" >- ) { >- acc.cancelledBibs.push(order.biblio_id) >- } >- if (acc.bibNumbers.includes(order.biblio_id)) { >- return acc >- } >- acc.bibNumbers.push(order.biblio_id) >- return acc >- }, >- { >- bibNumbers: [], >- cancelledBibs: [], >- } >- ) >- let count = recordCount.bibNumbers.length >- if (recordCount.cancelledBibs.length) { >- count += >- " (" + >- recordCount.cancelledBibs.length + >- __(" cancelled") + >- ")" >- } >- return count >- }, >- }, >- { >- title: __("Items expected"), >- data: "name", >- searchable: false, >- orderable: true, >- render(data, type, row, meta) { >- return row.orders.filter( >- o => !o.date_received && !o.cancellation_date >- ).length >- }, >- }, >- { >- title: __("Created by"), >- data: "creator_id", >- searchable: false, >- orderable: true, >- render(data, type, row, meta) { >- return patronToHTML(row.creator) >- }, >- }, >- { >- title: __("Date"), >- data: "creation_date", >- searchable: false, >- orderable: true, >- render(data, type, row, meta) { >- return formatDate(row.creation_date) >- }, >- }, >- { >- title: __("Basket group"), >- data: "basket_group_id", >- searchable: false, >- orderable: true, >- render(data, type, row, meta) { >- return row.basket_group ? row.basket_group.name : "" >- }, >- }, >- { >- title: __("Internal note"), >- data: "note", >- searchable: false, >- orderable: true, >- }, >- { >- title: __("Closed"), >- data: "close_date", >- searchable: false, >- orderable: true, >- render(data, type, row, meta) { >- return formatDate(row.close_date) >- }, >- }, >- ] >- }, >- }, >- components: { KohaTable }, >- props: { >- basketCount: { >- type: String, >- default: "0", >- }, >- vendorId: { >- type: Number, >- }, >- }, >- name: "VendorBaskets", >- emits: ["select-vendor", "close"], >-} >-</script> >- >-<style scoped> >-.filters > label[for="by_mine_filter"], >-.filters > input[type="checkbox"], >-.filters > input[type="button"] { >- margin-left: 1rem; >-} >-</style> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue >index 8034454e51a..3fe26c8d8db 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue >@@ -238,9 +238,9 @@ export default { > orderable: false, > render(data, type, row, meta) { > return row.baskets.length >- ? '<a href="/cgi-bin/koha/vendors/' + >+ ? '<a href="/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' + > row.id + >- '/baskets" class="show">' + >+ '" class="show">' + > escape_str( > `${row.baskets.length} basket(s)` > ) + >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue >index 967329897c7..17707d0e7c8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue >@@ -47,36 +47,27 @@ > <h1> > {{ vendor.name }} > </h1> >- <template v-if="!basketView"> >- <div class="row"> >- <div class="col-sm-6"> >- <VendorDetails :vendor="vendor" :display="true" /> >- <VendorOrderingInformation >- :vendor="vendor" >- :display="true" >- /> >- <VendorInterfaces >- :vendor="vendor" >- v-if="vendor.interfaces.length > 0" >- :display="true" >- /> >- </div> >- <div class="col-sm-6"> >- <VendorContacts :vendor="vendor" :display="true" /> >- <VendorSubscriptions :vendor="vendor" /> >- </div> >+ <div class="row"> >+ <div class="col-sm-6"> >+ <VendorDetails :vendor="vendor" :display="true" /> >+ <VendorOrderingInformation :vendor="vendor" :display="true" /> >+ <VendorInterfaces >+ :vendor="vendor" >+ v-if="vendor.interfaces.length > 0" >+ :display="true" >+ /> > </div> >- <div >- class="page-section rows" >- v-if="vendor.contracts && vendor.contracts.length > 0" >- > >- <VendorContracts :vendor="vendor" /> >+ <div class="col-sm-6"> >+ <VendorContacts :vendor="vendor" :display="true" /> >+ <VendorSubscriptions :vendor="vendor" /> > </div> >- </template> >- <template v-if="basketView"> >- <h2>{{ $__("Baskets") }}</h2> >- <VendorBaskets :basketCount="basketCount" :vendorId="vendor.id" /> >- </template> >+ </div> >+ <div >+ class="page-section rows" >+ v-if="vendor.contracts && vendor.contracts.length > 0" >+ > >+ <VendorContracts :vendor="vendor" /> >+ </div> > </div> > </template> > >@@ -91,7 +82,6 @@ import VendorInterfaces from "./VendorInterfaces.vue" > import VendorContacts from "./VendorContacts.vue" > import VendorSubscriptions from "./VendorSubscriptions.vue" > import VendorContracts from "./VendorContracts.vue" >-import VendorBaskets from "./VendorBaskets.vue" > import DropdownButtons from "../DropdownButtons.vue" > > export default { >@@ -107,20 +97,11 @@ export default { > return { > vendor: null, > initialized: false, >- basketView: false, >- basketCount: null, > } > }, > beforeRouteEnter(to, from, next) { > next(vm => { >- if (to.path.includes("basket")) { >- vm.basketView = true >- vm.getVendor(to.params.vendor_id).then(() => >- vm.getBasketCount(to.params.vendor_id) >- ) >- } else { >- vm.getVendor(to.params.vendor_id) >- } >+ vm.getVendor(to.params.vendor_id) > }) > }, > methods: { >@@ -134,16 +115,6 @@ export default { > error => {} > ) > }, >- async getBasketCount(booksellerid) { >- const client = APIClient.acquisition >- await client.baskets.count({ booksellerid }).then( >- count => { >- this.basketCount = count >- this.initialized = true >- }, >- error => {} >- ) >- }, > }, > components: { > Toolbar, >@@ -155,7 +126,6 @@ export default { > VendorContacts, > VendorSubscriptions, > VendorContracts, >- VendorBaskets, > }, > name: "VendorShow", > } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/acquisitions.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/acquisitions.js >index d146b247798..ccc2987fa41 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/acquisitions.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/acquisitions.js >@@ -52,13 +52,6 @@ export const routes = [ > component: markRaw(VendorFormAdd), > title: $__("Edit vendor"), > }, >- { >- path: ":vendor_id/baskets", >- name: "VendorShowBaskets", >- component: markRaw(VendorShow), >- title: $__("Baskets"), >- alternateLeftMenu: "VendorMenu", >- }, > ], > }, > ], >-- >2.39.3 (Apple Git-146)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38010
:
174119
|
174120
|
174121
|
174122
|
174123
|
174124
|
174125
|
174126
|
174128
|
174129
|
174130
|
174131
|
174132
|
174133
|
174134
|
174135
|
174136
|
174137
|
174138
|
174139
|
174140
|
174141
|
174142
|
174143
|
174144
|
174145
|
174146
|
174147
|
174148
|
174151
|
174152
|
174153
|
174154
|
174155
|
174156
|
174157
|
174158
|
174159
|
174160
|
174161
|
174162
|
174163
|
174164
|
174165
|
174166
|
174167
|
174168
|
174169
|
174170
|
174171
|
174172
|
174173
|
174174
|
174175
|
174176
|
174177
|
174178
|
174179
|
174194
|
174196
|
174197
|
174198
|
174199
|
174200
|
174201
|
174202
|
174203
|
174204
|
174205
|
174206
|
174207
|
174208
|
174209
|
174210
|
174211
|
174212
|
174213
|
174214
|
174215
|
174216
|
174217
|
174218
|
174220
|
174221
|
174222
|
174223
|
174224
|
174225
|
174226
|
174248
|
174266
|
174267
|
174269
|
174270
|
174273
|
174327
|
174328
|
174329
|
174330
|
174331
|
174332
|
174333
|
174334
|
174335
|
174336
|
174337
|
174338
|
174339
|
174340
|
174341
|
174342
|
174343
|
174344
|
174345
|
174346
|
174347
|
174348
|
174349
|
174350
|
174351
|
174352
|
174353
|
174354
|
174355
|
174356
|
174357
|
174358
|
174359
|
174360
|
174603
|
175098
|
175099
|
175100
|
175101
|
175102
|
175103
|
175104
|
175105
|
175106
|
175107
|
175108
|
175109
|
175110
|
175111
|
175112
|
175113
|
175114
|
175115
|
175116
|
175117
|
175118
|
175119
|
175120
|
175121
|
175122
|
175123
|
175124
|
175125
|
175126
|
175127
|
175128
|
175129
|
175130
|
175131
|
175133
|
175134
|
175135
|
175136
|
175137
|
175167
|
175168
|
175170
|
175240
|
175241
|
175242
|
175243
|
175248
|
175249
|
175266
|
175791
|
175799
|
176547