From 50ada1b8b17cae42be3f4d11a6e5390a5fe60192 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop 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 ) %] - - - - - 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 - ? '' + + '" 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 @@

{{ vendor.name }}

- - + +
+ +
@@ -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)