From 8573ae7be9cc74f56452e447df502dd5a72d5e62 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 21 Mar 2022 16:00:47 +0000 Subject: [PATCH] Bug 28082: Add acquisitions toolbar to vendors on vendor search page This patch makes a number of changes to the vendor search/view template in order to make it work better in different contexts: - Add a vendor-specific toolbar under each vendor search result. This gives instant access to the options for a new basket, new contract, vendor edit, or to receive shipments. A delete button will appear if available. - Add a summary of the number of baskets and subscriptions. This helps the user know if there are closed baskets and whether an outstanding subscription might be blocking the option to delete. Each number is linked to the view of those entries. - Indicate whether a vendor is inactive. The vendor name appears in a different color when it is inactve and is labeled as such. To test, apply the patch and rebuild the staff interface CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - To test you should have multiple vendors in your system, some active and some inactive. Add some baskets and subscriptions to one or more if necessary. - Go to Acquisitions and submit an empty vendor search to show all vendors. - Verify that the page looks correct and that all controls work as expected. - Open the basket view for a single vendor and compare the two views. Signed-off-by: Aleisha Amohia Signed-off-by: Katrin Fischer --- acqui/booksellers.pl | 3 + acqui/supplier.pl | 4 +- .../prog/css/src/staff-global.scss | 31 ++++---- .../prog/en/includes/acquisitions-toolbar.inc | 21 +++--- .../prog/en/modules/acqui/booksellers.tt | 72 +++++++++++++------ .../prog/en/modules/acqui/supplier.tt | 1 + .../prog/en/modules/acqui/uncertainprice.tt | 1 + koha-tmpl/intranet-tmpl/prog/js/acq.js | 9 +++ 8 files changed, 91 insertions(+), 51 deletions(-) diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 51de25d82b..f2a7f56b1f 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -92,6 +92,7 @@ if ( $supplier_count == 1 ) { supplier_name => $suppliers[0]->name, booksellerid => $suppliers[0]->id, basketcount => $suppliers[0]->baskets->count, + subscriptionscount => $suppliers[0]->subscriptions->count, active => $suppliers[0]->active, ); } @@ -149,6 +150,8 @@ for my $vendor (@suppliers) { booksellerid => $vendor->id, name => $vendor->name, active => $vendor->active, + basketcount => $vendor->baskets->count, + subscriptioncount => $vendor->subscriptions->count, }; } diff --git a/acqui/supplier.pl b/acqui/supplier.pl index af8fce7135..0e3570780a 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -89,8 +89,8 @@ if ( $op eq 'display' ) { ); } elsif ( $op eq 'delete' ) { # no further message needed for the user - # the DELETE button only appears in the template if basketcount == 0 - if ( $supplier->baskets->count == 0 ) { + # the DELETE button only appears in the template if basketcount == 0 AND subscriptioncount == 0 + if ( $supplier->baskets->count == 0 && $supplier->subscriptions->count == 0) { Koha::Acquisition::Booksellers->find($booksellerid)->delete; } print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl'); diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 61e41e4a94..5c4dee0aa4 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2714,28 +2714,23 @@ td { } #acqui_order_supplierlist { - > div { - &.supplier { - border: 1px solid #EEEEEE; - margin: .5em; - padding: 1em; + .supplier { + &+.supplier { + border-top: 1px solid #EEEEEE; + margin-top: 1em; } + } - > div { - > .baskets { - margin-top: .5em; - } - } + .suppliername { + display: inline-block; + margin: .5em 1em .5em 0; - > span { - &.action { - margin-left: 5em; - } + &.inactive { + color: #888; - &.suppliername { - display: inline; - font-size: 1.7em; - margin-bottom: .5em; + a:link, + a:visited { + color: #888; } } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc index 8191a021ff..294a777629 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -1,12 +1,5 @@ [% INCLUDE 'blocking_errors.inc' %] -
[% IF ( booksellerid ) %]
@@ -26,12 +19,20 @@
[% IF ( CAN_user_acquisition_vendors_manage ) %] - + [% UNLESS ( basketcount OR subscriptioncount ) %] - +
+
+ + + +
+
[% END %] [% END %] - [% IF CAN_user_acquisition_order_receive && basketcount %] + [% IF CAN_user_acquisition_order_receive && basketcount && active %] [% END %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt index 5741784be0..c1e5fc8af0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -57,11 +57,11 @@ [% END %]

- [% END %] - [% IF ( allbaskets ) %] - Show active baskets only - [% ELSE %] - Show all baskets + [% IF ( allbaskets ) %] + Show active baskets only + [% ELSE %] + Show all baskets + [% END %] [% END %] [% UNLESS booksellerid %] | Show active vendors onlyShow all vendors @@ -73,25 +73,49 @@ [% ELSE %]
[% END %] - - [% IF (supplier.name) %] - [% supplier.name | html %] + [% IF ( supplier.active ) %] +

+ [% ELSE %] +

+ [% END %] + + [% IF (supplier.name) %] + [% supplier.name | html %] + [% ELSE %] + NO NAME + [% END %] + + + [% IF ( !supplier.active ) %](inactive)[% END %] +

+ + [% IF ( count > 1 ) %] + [% supplier.basketcount | html %] [% tn('basket', 'baskets', supplier.basketcount) | $raw %], [% ELSE %] - NO NAME + [% supplier.basketcount | html %] [% tn('basket', 'baskets', supplier.basketcount) | $raw %], [% END %] - - - [% IF ( CAN_user_acquisition_order_manage ) %] - [% IF ( supplier.active ) %] - New basket - [% ELSE %] - (inactive) - [% END %] + [% IF supplier.subscriptioncount > 0 %] + + [% supplier.subscriptioncount | html %] [% tn('subscription', 'subscriptions', supplier.subscriptioncount) | $raw %] + + [% ELSE %] + [% supplier.subscriptioncount | html %] [% tn('subscription', 'subscriptions', supplier.subscriptioncount) | $raw %] [% END %] - [% IF ( supplier.loop_basket.size ) %] - Receive shipment - [% END %] + [% IF ( count == 1 ) %] + [% IF ( supplier.basketcount > 0 ) %] +
+ [% IF ( allbaskets ) %] + Show active baskets only + [% ELSE %] + Show all baskets + [% END %] +
+ [% END %] + [% ELSE %] + [% INCLUDE "acquisitions-toolbar.inc" booksellerid=supplier.booksellerid active=supplier.active basketcount=supplier.loop_basket.size basketcount=supplier.basketcount subscriptioncount=supplier.subscriptioncount %] + [% END %] +
[% IF ( supplier.loop_basket.size ) %] @@ -195,7 +219,13 @@
[% ELSE %] -

No pending baskets

+

+ No pending baskets. + [% IF ( supplier.basketcount > 0 && count > 1 ) %] + View all baskets. + [% END %] +

+ [% END %][%# IF ( supplier.loop_basket.size ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index d15842a45e..0131c0341b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -431,6 +431,7 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/acquisitions-menu.js") | $raw %] [% Asset.js("lib/hc-sticky.js") | $raw %] + [% Asset.js("js/acq.js") | $raw %] [% INCLUDE 'datatables.inc' %]