Bug 11243: update vendor list to also display canceled bib counts
Same as previous patch but for the biblios count.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7ca9168385)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
489f3c1cc3
commit
dd45012706
|
|
@ -632,7 +632,7 @@ sub GetBasketsInfosByBookseller {
|
|||
return unless $supplierid;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = qq{
|
||||
my $query = q{
|
||||
SELECT aqbasket.*,
|
||||
SUM(aqorders.quantity) AS total_items,
|
||||
SUM(
|
||||
|
|
@ -648,14 +648,30 @@ sub GetBasketsInfosByBookseller {
|
|||
FROM aqbasket
|
||||
LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno
|
||||
WHERE booksellerid = ?};
|
||||
if(!$allbaskets) {
|
||||
|
||||
unless ( $allbaskets ) {
|
||||
$query.=" AND (closedate IS NULL OR (aqorders.quantity > aqorders.quantityreceived AND datecancellationprinted IS NULL))";
|
||||
}
|
||||
$query.=" GROUP BY aqbasket.basketno";
|
||||
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute($supplierid);
|
||||
return $sth->fetchall_arrayref({});
|
||||
my $baskets = $sth->fetchall_arrayref({});
|
||||
|
||||
# Retrieve the number of biblios cancelled
|
||||
my $cancelled_biblios = $dbh->selectall_hashref( q|
|
||||
SELECT COUNT(DISTINCT(biblionumber)) AS total_biblios_cancelled, aqbasket.basketno
|
||||
FROM aqbasket
|
||||
LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno
|
||||
WHERE booksellerid = ?
|
||||
AND aqorders.orderstatus = 'cancelled'
|
||||
GROUP BY aqbasket.basketno
|
||||
|, 'basketno', {}, $supplierid );
|
||||
map {
|
||||
$_->{total_biblios_cancelled} = $cancelled_biblios->{$_->{basketno}}{total_biblios_cancelled} || 0
|
||||
} @$baskets;
|
||||
|
||||
return $baskets;
|
||||
}
|
||||
|
||||
=head3 GetBasketUsers
|
||||
|
|
|
|||
|
|
@ -122,7 +122,12 @@ $(document).ready(function() {
|
|||
([% basket.total_items_cancelled %] cancelled)
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% basket.total_biblios %]</td>
|
||||
<td>
|
||||
[% basket.total_biblios %]
|
||||
[% IF basket.total_biblios_cancelled %]
|
||||
([% basket.total_biblios_cancelled %] cancelled)
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% basket.expected_items %]</td>
|
||||
<td>
|
||||
[% basket.authorisedby_firstname %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue