From 262ca68784c41e948813bf24ca5f0725a023bef5 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sun, 12 Mar 2023 20:42:13 +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 | 11 +++++++++++ .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 75c9d7f19fd..818f383d2de 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -746,8 +746,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 905120ec9d4..1a367f28609 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -239,6 +239,17 @@ 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; + 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 707a5d7cf3f..c2fb054a661 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -791,6 +791,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:

@@ -800,6 +801,7 @@ Note that permanent location is a code, and location may be an authval. + [% FOREACH latestserial IN subscription.latestserials %] @@ -821,6 +823,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.20.1