From 4d5ef18f2ba68bc4c2ddb8f4b849d860c993b23f Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 13 Dec 2021 19:25:18 +0000 Subject: [PATCH] Bug 23450: Display serial and subscription price in biblio detail page The 'Subscription' tab should display: - Total subscription price (based on what's set in the linked order) - Serial price based on what's set in the 952$g (items.price) Test plan: 1. Create a subscription - Tick the 'Create an item record when receiving this serial' radiobutton 2. Create an order, linking it to a subscription, set: - Quantity: 2 - Vendor price: 3 3. Receive the serial 4. Set the 952$g (normal purchase price) as 5 5. Visit the biblio detail page 6. View the 'Subscription' tab and confirm that: 'Total subscription cost is: 6.00' 'Issue price' in the table is 5.00 Sponsored-By: Brimbank Library, Australia --- C4/Serials.pm | 4 +++- catalogue/detail.pl | 12 ++++++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index d840bf24b7..edc2a2865b 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -778,8 +778,10 @@ sub GetLatestSerials { my $dbh = C4::Context->dbh; my $statuses = join( ',', ( ARRIVED, MISSING_STATUSES ) ); - my $strsth = "SELECT serialid,serialseq, status, planneddate, publisheddate, notes + my $strsth = "SELECT serial.serialid,serialseq, status, planneddate, publisheddate, notes, price FROM serial + INNER JOIN serialitems ON (serial.serialid=serialitems.serialid) + INNER JOIN items ON (serialitems.itemnumber=items.itemnumber) WHERE subscriptionid = ? AND status IN ($statuses) ORDER BY publisheddate DESC LIMIT 0,$limit diff --git a/catalogue/detail.pl b/catalogue/detail.pl index bc28f29cc1..91cedd412e 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -192,6 +192,18 @@ foreach my $subscription (@subscriptions) { $cell{staffdisplaycount} = $serials_to_display; $cell{latestserials} = GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display ); + + # Get subscription price + my $order = Koha::Acquisition::Orders->search( + { + subscriptionid => $subscription->{subscriptionid}, + } + )->next->unblessed; + if ( $order->{unitprice_tax_included} > 0 ) { + $cell{price} = $order->{quantity} * $order->{unitprice_tax_included}; + } else { + $cell{price} = $order->{quantity} * $order->{ecost_tax_included}; + } push @subs, \%cell; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 684a082ffa..8284df5578 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -709,6 +709,7 @@ Note that permanent location is a code, and location may be an authval. [% IF ( subscription.subscriptionnotes ) %]

[% subscription.subscriptionnotes | html | html_line_break %]

[% END %] [% IF ( subscription.missinglist ) %]

Missing issues: [% subscription.missinglist | html %]

[% END %] [% IF ( subscription.librariannote ) %]

([% subscription.librariannote | html %])

[% END %] + [% IF ( subscription.price ) %]

Total cost of the subscription is: [% subscription.price | $Price %]

[% END %] [% IF ( subscription.latestserials ) %]

The [% subscription.staffdisplaycount | html %] latest issues related to this subscription:

@@ -718,6 +719,7 @@ Note that permanent location is a code, and location may be an authval. + [% FOREACH latestserial IN subscription.latestserials %] @@ -739,6 +741,7 @@ Note that permanent location is a code, and location may be an authval. [% IF ( latestserial.status8 ) %]Stopped[% END %] + [% END %]
Date published Status NoteIssue Price
[% latestserial.notes | html %][% latestserial.price | $Price %]
-- 2.11.0