Bugzilla – Attachment 163278 Details for
Bug 31988
manager.pl is only user for "Catalog by item type" report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31988: Remove reports/itemtypes.plugin
Bug-31988-Remove-reportsitemtypesplugin.patch (text/plain), 11.96 KB, created by
Andrew Fuerste-Henry
on 2024-03-15 19:56:27 UTC
(
hide
)
Description:
Bug 31988: Remove reports/itemtypes.plugin
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2024-03-15 19:56:27 UTC
Size:
11.96 KB
patch
obsolete
>From f79adb2a0312e3638d5ca6be4ce06961fca471df Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 15 Mar 2024 10:12:41 +0100 >Subject: [PATCH] Bug 31988: Remove reports/itemtypes.plugin > >This "plugin system" is only used for the itemtypes report. We can >simply remove the reports/manager.pl script and this plugin in favor of >a dedicated report. > >Test plan: >Same behaviour expected before and after this patch > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org> >--- > .../prog/en/includes/reports-menu.inc | 2 +- > .../prog/en/modules/reports/itemtypes.tt | 4 +- > .../prog/en/modules/reports/reports-home.tt | 2 +- > reports/catalog_by_itemtype.pl | 99 +++++++++++++++++++ > reports/itemtypes.plugin | 85 ---------------- > reports/manager.pl | 53 ---------- > 6 files changed, 103 insertions(+), 142 deletions(-) > create mode 100755 reports/catalog_by_itemtype.pl > delete mode 100755 reports/itemtypes.plugin > delete mode 100755 reports/manager.pl > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >index 0c0ddab0966..cb6f892e5f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-menu.inc >@@ -52,7 +52,7 @@ > <ul> > <li><a href="/cgi-bin/koha/reports/itemslost.pl">Lost items</a></li> > <li><a href="/cgi-bin/koha/reports/orders_by_fund.pl">Orders by fund</a></li> >- <li><a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by item type</a></li> >+ <li><a href="/cgi-bin/koha/reports/catalog_by_itemtype.pl">Catalog by item type</a></li> > <li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li> > </ul> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >index 69c1169c1d7..abe60ce9124 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >@@ -27,7 +27,7 @@ > [% END %] > [% IF ( do_it ) %] > [% WRAPPER breadcrumb_item %] >- <a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by item type</a> >+ <a href="/cgi-bin/koha/reports/catalog_by_itemtype.pl">Catalog by item type</a> > [% END %] > [% WRAPPER breadcrumb_item bc_active= 1 %] > <span>Results</span> >@@ -75,7 +75,7 @@ > [% END %] > [% ELSE %] > <h1>View a count of items held at your library grouped by item type</h1> >- <form method="get" action="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes"> >+ <form method="get" action="/cgi-bin/koha/reports/catalog_by_itemtype.pl"> > <fieldset class="rows"> > <ol> > <li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >index caafc399de6..82d5b778887 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >@@ -94,7 +94,7 @@ > <ul> > <li><a href="/cgi-bin/koha/reports/itemslost.pl">Items lost</a></li> > <li><a href="/cgi-bin/koha/reports/orders_by_fund.pl">Orders by fund</a></li> >- <li><a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by item type</a></li> >+ <li><a href="/cgi-bin/koha/reports/catalog_by_itemtype.pl">Catalog by item type</a></li> > <li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li> > [% SET koha_version = Koha.Version %] > [% IF koha_version.development %] >diff --git a/reports/catalog_by_itemtype.pl b/reports/catalog_by_itemtype.pl >new file mode 100755 >index 00000000000..fcaf5f17ef5 >--- /dev/null >+++ b/reports/catalog_by_itemtype.pl >@@ -0,0 +1,99 @@ >+#!/usr/bin/perl >+ >+# Copyright 2000-2002 Katipo Communications >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use C4::Auth qw( get_template_and_user ); >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Output qw( output_html_with_http_headers ); >+ >+my $input = CGI->new; >+my $report_name = $input->param("report_name"); >+my $do_it = $input->param('do_it'); >+my $fullreportname = "reports/itemtypes.tt"; >+my @values = $input->multi_param("value"); >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => $fullreportname, >+ query => $input, >+ type => "intranet", >+ flagsrequired => { reports => '*' }, >+ } >+); >+$template->param( >+ do_it => $do_it, >+); >+if ($do_it) { >+ my $results = calculate( \@values ); >+ $template->param( mainloop => $results ); >+} >+output_html_with_http_headers $input, $cookie, $template->output; >+ >+sub calculate { >+ my ($parameters) = @_; >+ my @results = (); >+ my $branch = @$parameters[0]; >+ my $dbh = C4::Context->dbh; >+ my $sth; >+ if ( C4::Context->preference('item-level_itypes') ) { >+ $sth = $dbh->prepare( >+ q| >+ SELECT itemtypes.itemtype, description, COUNT(*) AS total >+ FROM itemtypes, items >+ WHERE items.itype=itemtypes.itemtype >+ | . ( $branch ? q| AND items.holdingbranch=? | : () ) . q| >+ GROUP BY itemtypes.itemtype, description, items.itype >+ ORDER BY itemtypes.description >+ | >+ ); >+ } else { >+ $sth = $dbh->prepare( >+ q| >+ SELECT itemtypes.itemtype, description, COUNT(*) AS total >+ FROM itemtypes, biblioitems, items >+ WHERE biblioitems.itemtype=itemtypes.itemtype >+ AND items.biblioitemnumber=biblioitems.biblioitemnumber >+ | . ( $branch ? q| AND items.holdingbranch=? | : () ) . q| >+ GROUP BY itemtypes.itemtype, description >+ ORDER BY itemtypes.description >+ | >+ ); >+ } >+ $sth->execute( $branch || () ); >+ my ( $itemtype, $description, $total ); >+ my $grantotal = 0; >+ my $count = 0; >+ while ( ( $itemtype, $description, $total ) = $sth->fetchrow ) { >+ my %line; >+ $line{itemtype} = $itemtype; >+ $line{count} = $total; >+ $grantotal += $total; >+ push @results, \%line; >+ $count++; >+ } >+ my @mainloop; >+ my %globalline; >+ $globalline{loopitemtype} = \@results; >+ $globalline{total} = $grantotal; >+ $globalline{branch} = $branch; >+ push @mainloop, \%globalline; >+ return \@mainloop; >+} >+ >+1; >diff --git a/reports/itemtypes.plugin b/reports/itemtypes.plugin >deleted file mode 100755 >index ec2c535182d..00000000000 >--- a/reports/itemtypes.plugin >+++ /dev/null >@@ -1,85 +0,0 @@ >-#!/usr/bin/perl >- >- >-# Copyright 2000-2002 Katipo Communications >-# >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use strict; >-use C4::Auth; >-use CGI qw ( -utf8 ); >-use C4::Context; >-use C4::Search; >-use C4::Output; >-use C4::Koha; >-=head1 >- >-=cut >- >-sub set_parameters { >- my ($template) = @_; >- return $template; >-} >- >-sub calculate { >- my ($parameters) = @_; >- my @results =(); >- my $branch = @$parameters[0]; >- my $dbh = C4::Context->dbh; >- my $sth; >- if ( C4::Context->preference('item-level_itypes') ) { >- $sth = $dbh->prepare( q| >- SELECT itemtypes.itemtype, description, COUNT(*) AS total >- FROM itemtypes, items >- WHERE items.itype=itemtypes.itemtype >- | . ( $branch ? q| AND items.holdingbranch=? | : () ) . q| >- GROUP BY itemtypes.itemtype, description, items.itype >- ORDER BY itemtypes.description >- |); >- } >- else { >- $sth = $dbh->prepare( q| >- SELECT itemtypes.itemtype, description, COUNT(*) AS total >- FROM itemtypes, biblioitems, items >- WHERE biblioitems.itemtype=itemtypes.itemtype >- AND items.biblioitemnumber=biblioitems.biblioitemnumber >- | . ( $branch ? q| AND items.holdingbranch=? | : () ) . q| >- GROUP BY itemtypes.itemtype, description >- ORDER BY itemtypes.description >- |); >- } >- $sth->execute($branch || ()); >- my ($itemtype, $description,$total); >- my $grantotal = 0; >- my $count = 0; >- while (($itemtype, $description,$total) = $sth->fetchrow) { >- my %line; >- $line{itemtype} = $itemtype; >- $line{count} = $total; >- $grantotal += $total; >- push @results,\%line; >- $count ++; >- } >- my @mainloop; >- my %globalline; >- $globalline{loopitemtype} = \@results; >- $globalline{total} = $grantotal; >- $globalline{branch} = $branch; >- push @mainloop,\%globalline; >- return \@mainloop; >-} >- >-1; >diff --git a/reports/manager.pl b/reports/manager.pl >deleted file mode 100755 >index ff174f00d33..00000000000 >--- a/reports/manager.pl >+++ /dev/null >@@ -1,53 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright 2000-2002 Katipo Communications >-# >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >-use CGI qw ( -utf8 ); >-use C4::Auth qw( get_template_and_user ); >-use C4::Context; >-use C4::Output qw( output_html_with_http_headers ); >- >- >-my $input = CGI->new; >-my $report_name=$input->param("report_name"); >-my $do_it=$input->param('do_it'); >-my $fullreportname = "reports/".$report_name.".tt"; >-my @values = $input->multi_param("value"); >-my ($template, $borrowernumber, $cookie) >- = get_template_and_user({template_name => $fullreportname, >- query => $input, >- type => "intranet", >- flagsrequired => {reports => '*'}, >- }); >-$template->param(do_it => $do_it, >- report_name => $report_name, >- ); >-my $cgidir = C4::Context->config('intranetdir')."/cgi-bin/reports/"; >-unless (-r $cgidir and -d $cgidir) { >- $cgidir = C4::Context->config('intranetdir')."/reports/"; >-} >-my $plugin = $cgidir.$report_name.".plugin"; >-require $plugin; >-if ($do_it) { >- my $results = calculate(\@values); >- $template->param(mainloop => $results); >-} else { >- $template = set_parameters($template); >-} >-output_html_with_http_headers $input, $cookie, $template->output; >-- >2.30.2
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 31988
:
163182
|
163277
|
163278
|
163307