From 529434cab891a8b76b3792e12e359f8c8b171519 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 17 May 2013 19:01:06 +0200 Subject: [PATCH 1/2] Bug 9824: Followup for removing filter Adds allbaskets parameter to GetBasketsInfosByBookseller. (Only used in booksellers.pl now) Normally, all 'active' baskets are shown. With allbaskets=1 all baskets :) In the template I had to rename a loop var supplier to supplier1 to resolve name conflict between template vars. In the template I added the string: Cancel filter. Note that this string is already translated: msgid "Cancel filter" msgstr "" Hope this helps. Signed-off-by: Katrin Fischer Undoing the filter works and I checked that the string gets translated with the po files in current master. So this is almost perfect, only we can't apply the filters again and the link remains 'cancel' when we already did. Sending a follow-up trying to fix this. Signed-off-by: Jared Camins-Esakov --- C4/Acquisition.pm | 12 +++++++----- acqui/booksellers.pl | 3 ++- .../prog/en/modules/acqui/booksellers.tt | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 2bbb21c7d4..a570a7358b 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -578,7 +578,7 @@ Returns in a arrayref of hashref all about booksellers baskets, plus: =cut sub GetBasketsInfosByBookseller { - my ($supplierid) = @_; + my ($supplierid, $allbaskets) = @_; return unless $supplierid; @@ -595,10 +595,12 @@ sub GetBasketsInfosByBookseller { ) AS expected_items FROM aqbasket LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno - WHERE booksellerid = ? AND ( aqorders.quantity > aqorders.quantityreceived OR quantityreceived IS NULL) - AND datecancellationprinted IS NULL - GROUP BY aqbasket.basketno - }; + WHERE booksellerid = ?}; + if(!$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({}); diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index f6c7b2e928..118034bc5b 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -75,6 +75,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( #parameters my $supplier = $query->param('supplier'); my $booksellerid = $query->param('booksellerid'); +my $allbaskets= $query->param('allbaskets')||0; my @suppliers; if ($booksellerid) { @@ -106,7 +107,7 @@ my $userbranch = $userenv->{branch}; my $loop_suppliers = []; for my $vendor (@suppliers) { - my $baskets = GetBasketsInfosByBookseller( $vendor->{id} ); + my $baskets = GetBasketsInfosByBookseller( $vendor->{id}, $allbaskets ); my $loop_basket = []; 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 9aaf34e539..40642313ba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -56,12 +56,13 @@ $(document).ready(function() { [% UNLESS (count == 1) %]

Choose a vendor in the list to jump directly to the right place.

[% END %] +

Cancel filter

[% FOREACH supplier IN loop_suppliers %]
From 7acdcb7e2aedf2ff202c009ce053de6dff54e840 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 17 May 2013 21:12:05 +0200 Subject: [PATCH 2/2] Bug 9824: Make it possible to apply/cancel switch Using another existing string 'Apply filter' we are now able to cancel the filter... and apply it... and cancel it again... and so on. Signed-off-by: Owen Leonard Signed-off-by: Jared Camins-Esakov --- acqui/booksellers.pl | 1 + .../intranet-tmpl/prog/en/modules/acqui/booksellers.tt | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 118034bc5b..6db0bad527 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -151,5 +151,6 @@ $template->param( supplier => ( $booksellerid || $supplier ), count => $supplier_count, ); +$template->{VARS}->{'allbaskets'} = $allbaskets; output_html_with_http_headers $query, $cookie, $template->output; 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 40642313ba..006980c28d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -62,7 +62,13 @@ $(document).ready(function() {

[% END %] -

Cancel filter

+

+ [% IF ( allbaskets ) %] + Apply filter + [% ELSE %] + Cancel filter + [% END %] +

[% FOREACH supplier IN loop_suppliers %]