Bugzilla – Attachment 109047 Details for
Bug 23166
Simplify code related to orders in catalogue/*detail.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23166: Remove filtering from controllers
Bug-23166-Remove-filtering-from-controllers.patch (text/plain), 8.53 KB, created by
Joonas Kylmälä
on 2020-08-24 20:55:23 UTC
(
hide
)
Description:
Bug 23166: Remove filtering from controllers
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2020-08-24 20:55:23 UTC
Size:
8.53 KB
patch
obsolete
>From 5855a47d42e192cbcae52927511118dc504c487b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 5 May 2020 15:27:28 +0200 >Subject: [PATCH] Bug 23166: Remove filtering from controllers >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > catalogue/ISBDdetail.pl | 21 --------------------- > catalogue/MARCdetail.pl | 26 ++------------------------ > catalogue/detail.pl | 12 ------------ > catalogue/imageviewer.pl | 21 --------------------- > catalogue/labeledMARCdetail.pl | 23 +---------------------- > catalogue/moredetail.pl | 22 +--------------------- > 6 files changed, 4 insertions(+), 121 deletions(-) > >diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl >index 8e1ea52caf..383c155bd2 100755 >--- a/catalogue/ISBDdetail.pl >+++ b/catalogue/ISBDdetail.pl >@@ -45,7 +45,6 @@ use C4::Biblio; > use C4::Items; > use C4::Serials; # CountSubscriptionFromBiblionumber > use C4::Search; # enabled_staff_search_views >-use C4::Acquisition qw(GetOrdersByBiblionumber); > > use Koha::Biblios; > use Koha::Patrons; >@@ -151,26 +150,6 @@ $template->param ( > biblio => $biblio, > ); > >-my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); >-my @deletedorders_using_biblio; >-my @orders_using_biblio; >- >-foreach my $myorder (@allorders_using_biblio) { >- my $basket = $myorder->{'basketno'}; >- if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ >- push @deletedorders_using_biblio, $myorder; >- } >- else { >- push @orders_using_biblio, $myorder; >- } >-} >- >-my $count_orders_using_biblio = scalar @orders_using_biblio ; >-$template->param (countorders => $count_orders_using_biblio); >- >-my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; >-$template->param (countdeletedorders => $count_deletedorders_using_biblio); >- > my $holds = $biblio->holds; > $template->param( holdcount => $holds->count ); > >diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl >index eb9553331a..1078dc2f5a 100755 >--- a/catalogue/MARCdetail.pl >+++ b/catalogue/MARCdetail.pl >@@ -341,31 +341,9 @@ $template->param ( > z3950_search_params => C4::Search::z3950_search_args($biblio), > C4::Search::enabled_staff_search_views, > searchid => scalar $query->param('searchid'), >- biblio => $biblio_object->unblessed, >+ biblio => $biblio_object, > ); > >-my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); >-my @deletedorders_using_biblio; >-my @orders_using_biblio; >- >-foreach my $myorder (@allorders_using_biblio) { >- my $basket = $myorder->{'basketno'}; >- if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ >- push @deletedorders_using_biblio, $myorder; >- } >- else { >- push @orders_using_biblio, $myorder; >- } >-} >- >-my $count_orders_using_biblio = scalar @orders_using_biblio ; >-$template->param (countorders => $count_orders_using_biblio); >- >-my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; >-$template->param (countdeletedorders => $count_deletedorders_using_biblio); >- >-$biblio = Koha::Biblios->find( $biblionumber ); >-my $holds = $biblio->holds; >-$template->param( holdcount => $holds->count ); >+$template->param( holdcount => $biblio_object->holds->count ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 4f1c44fd0d..37968dd02f 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -555,16 +555,4 @@ if ($StaffDetailItemSelection) { > > $template->param(biblio => $biblio); > >-my $orders = >- Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } ); >- >-$template->param( >- countorders => $orders->search( { >- datecancellationprinted => [ undef, '0000-00-00' ] >- } )->count, >- countdeletedorders => $orders->search( { >- datecancellationprinted => [ { '!=' => [ -and => ( undef, '0000-00-00' ) ] } ] >- } )->count, >-) if $orders->count; >- > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl >index 9efba1754a..0fe29a301b 100755 >--- a/catalogue/imageviewer.pl >+++ b/catalogue/imageviewer.pl >@@ -26,7 +26,6 @@ use C4::Items; > use C4::Output; > use C4::Images; > use C4::Search; >-use C4::Acquisition qw(GetOrdersByBiblionumber); > > use Koha::Biblios; > use Koha::Patrons; >@@ -87,26 +86,6 @@ $template->{VARS}->{'norequests'} = $norequests; > $template->param(C4::Search::enabled_staff_search_views); > $template->{VARS}->{'biblio'} = $biblio; > >-my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); >-my @deletedorders_using_biblio; >-my @orders_using_biblio; >- >-foreach my $myorder (@allorders_using_biblio) { >- my $basket = $myorder->{'basketno'}; >- if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ >- push @deletedorders_using_biblio, $myorder; >- } >- else { >- push @orders_using_biblio, $myorder; >- } >-} >- >-my $count_orders_using_biblio = scalar @orders_using_biblio ; >-$template->param (countorders => $count_orders_using_biblio); >- >-my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; >-$template->param (countdeletedorders => $count_deletedorders_using_biblio); >- > my $hold_count = $biblio ? $biblio->holds->count : 0; > $template->param( holdcount => $hold_count ); > >diff --git a/catalogue/labeledMARCdetail.pl b/catalogue/labeledMARCdetail.pl >index 8799a7f805..1269984570 100755 >--- a/catalogue/labeledMARCdetail.pl >+++ b/catalogue/labeledMARCdetail.pl >@@ -28,7 +28,6 @@ use C4::Biblio; > use C4::Items; > use C4::Search; # enabled_staff_search_views > use C4::Serials; >-use C4::Acquisition qw(GetOrdersByBiblionumber); > > use Koha::Biblios; > use Koha::BiblioFrameworks; >@@ -133,28 +132,8 @@ $template->param ( > searchid => scalar $query->param('searchid'), > ); > >-my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); >-my @deletedorders_using_biblio; >-my @orders_using_biblio; >- >-foreach my $myorder (@allorders_using_biblio) { >- my $basket = $myorder->{'basketno'}; >- if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ >- push @deletedorders_using_biblio, $myorder; >- } >- else { >- push @orders_using_biblio, $myorder; >- } >-} >- >-my $count_orders_using_biblio = scalar @orders_using_biblio ; >-$template->param (countorders => $count_orders_using_biblio); >- >-my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; >-$template->param (countdeletedorders => $count_deletedorders_using_biblio); >- > $biblio = Koha::Biblios->find( $biblionumber ); > my $holds = $biblio->holds; >-$template->param( holdcount => $holds->count ); >+$template->param( biblio => $biblio, holdcount => $holds->count ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index ea18505b45..0fc2559433 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -262,31 +262,11 @@ $template->param( > biblioitemnumber => $bi, > itemnumber => $itemnumber, > z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)), >- biblio => $biblio->unblessed, >+ biblio => $biblio, > ); > $template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items ); > $template->{'VARS'}->{'searchid'} = $query->param('searchid'); > >-my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); >-my @deletedorders_using_biblio; >-my @orders_using_biblio; >- >-foreach my $myorder (@allorders_using_biblio) { >- my $basket = $myorder->{'basketno'}; >- if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ >- push @deletedorders_using_biblio, $myorder; >- } >- else { >- push @orders_using_biblio, $myorder; >- } >-} >- >-my $count_orders_using_biblio = scalar @orders_using_biblio ; >-$template->param (countorders => $count_orders_using_biblio); >- >-my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; >-$template->param (countdeletedorders => $count_deletedorders_using_biblio); >- > my $holds = $biblio->holds; > $template->param( holdcount => $holds->count ); > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23166
:
90824
|
90825
|
90826
|
90827
|
90828
|
104365
|
104366
|
104367
|
104368
|
104369
|
104370
|
108991
|
108992
|
108993
|
108994
|
108995
|
108996
|
108997
|
108998
|
108999
|
109000
|
109001
|
109002
|
109019
|
109020
|
109021
|
109022
|
109023
|
109024
|
109025
|
109026
|
109037
|
109038
|
109039
|
109040
|
109041
|
109042
|
109043
|
109044
|
109045
|
109046
| 109047 |
109048
|
109049
|
109050
|
109058
|
109059