[Patches] [PATCH] Bug 5358: Show cancelled orders in basket page
koha-patchbot at kohaaloha.com
koha-patchbot at kohaaloha.com
Mon Jan 2 23:05:02 NZDT 2012
From: Julian Maurice <julian.maurice at biblibre.com>
Date: Sat, 5 Nov 2011 15:05:48 +0530
Subject: [PATCH] Bug 5358: Show cancelled orders in basket page
---
C4/Acquisition.pm | 37 ++++++++++++++++
acqui/basket.pl | 6 +++
.../intranet-tmpl/prog/en/modules/acqui/basket.tt | 44 ++++++++++++++++++++
3 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 7127f24..2814977 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -54,6 +54,7 @@ BEGIN {
&GetOrderNumber &GetLateOrders &GetOrderFromItemnumber
&SearchOrder &GetHistory &GetRecentAcqui
&ModReceiveOrder &ModOrderBiblioitemNumber
+ &GetCancelledOrders
&NewOrderItem &ModOrderItem
@@ -1041,6 +1042,42 @@ sub ModOrderBiblioitemNumber {
$sth->execute( $biblioitemnumber, $ordernumber, $biblionumber );
}
+=head3 GetCancelledOrders
+
+ my @orders = GetCancelledOrders($basketno, $orderby);
+
+Returns cancelled orders for a basket
+
+=cut
+
+sub GetCancelledOrders {
+ my ( $basketno, $orderby ) = @_;
+
+ return () unless $basketno;
+
+ my $dbh = C4::Context->dbh;
+ my $query = "
+ SELECT biblio.*, biblioitems.*, aqorders.*, aqbudgets.*
+ FROM aqorders
+ LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id
+ LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber
+ LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber
+ WHERE basketno = ?
+ AND (datecancellationprinted IS NOT NULL
+ AND datecancellationprinted <> '0000-00-00')
+ ";
+
+ $orderby = "aqorders.datecancellationprinted desc, aqorders.timestamp desc"
+ unless $orderby;
+ $query .= " ORDER BY $orderby";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($basketno);
+ my $results = $sth->fetchall_arrayref( {} );
+
+ return @$results;
+}
+
+
#------------------------------------------------------------#
=head3 ModReceiveOrder
diff --git a/acqui/basket.pl b/acqui/basket.pl
index b836280..c528156 100755
--- a/acqui/basket.pl
+++ b/acqui/basket.pl
@@ -343,6 +343,11 @@ my $total_est_gste;
last;
}
+ my @cancelledorders = GetCancelledOrders($basketno);
+ foreach (@cancelledorders) {
+ $_->{'line_total'} = sprintf("%.2f", $_->{'ecost'} * $_->{'quantity'});
+ }
+
$template->param(
basketno => $basketno,
basketname => $basket->{'basketname'},
@@ -359,6 +364,7 @@ my $total_est_gste;
name => $bookseller->{'name'},
entrydate => C4::Dates->new($results[0]->{'entrydate'},'iso')->output,
books_loop => \@books_loop,
+ cancelledorders_loop => \@cancelledorders,
gist_rate => sprintf( "%.2f", $gist * 100 ) . '%',
total_rrp_gste => sprintf( "%.2f", $total_rrp_gste ),
total_est_gste => sprintf( "%.2f", $total_est_gste ),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
index 7bf1843..aaea6c0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
@@ -12,6 +12,7 @@
10: { sorter: false }
}
});
+ $("#cancelledorderst").tablesorter();
});
function confirm_close() {
var is_confirmed = confirm(_('Are you sure you want to close this basket?'));
@@ -332,6 +333,49 @@
[% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
[% END %]
</div>
+ [% IF (cancelledorders_loop) %]
+ <div id="cancelledorders">
+ <h2>Cancelled orders</h2>
+ <table id="cancelledorderst">
+ <thead>
+ <tr>
+ <th>Order</th>
+ <th>RRP</th>
+ <th>Est.</th>
+ <th>Qty.</th>
+ <th>Total</th>
+ <th>Fund</th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH order IN cancelledorders_loop %]
+ <tr style="color:grey">
+ <td>
+ <p>
+ [% IF ( order.order_received ) %] (rcvd)[% END %]
+ [% IF (order.title) %]
+ [% order.title |html %] by [% order.author %]<br />
+ [% ELSE %]
+ <em>Deleted bibliographic record, can't find title</em><br />
+ [% END %]
+ [% IF ( order.notes ) %] [% order.notes %][% END %]
+ [% IF ( order.isbn ) %] - [% order.isbn %][% END %]
+ [% IF ( order.issn ) %] - [% order.issn %][% END %]
+ [% IF ( order.publishercode ) %], [% order.publishercode %][% END %]
+ [% IF ( order.publicationyear ) %], [% order.publicationyear %][% END %]
+ </p>
+ </td>
+ <td><p>[% order.rrp %]</p></td>
+ <td><p>[% order.ecost %]</p></td>
+ <td><p>[% order.quantity %]</p></td>
+ <td><p>[% order.line_total %]</p></td>
+ <td><p>[% order.budget_name %]</p></td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ </div>
+ [% END %]
<br />
[% UNLESS ( closedate ) %]
[% INCLUDE 'acquisitions-add-to-basket.inc' %]
--
1.7.7.3
More information about the Patches
mailing list