Bugzilla – Attachment 73192 Details for
Bug 19943
Koha::Biblio - Remove GetBiblioItemData
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19943: Gentle error handling for bookcount.pl
Bug-19943-Gentle-error-handling-for-bookcountpl.patch (text/plain), 3.79 KB, created by
Jonathan Druart
on 2018-03-23 15:32:56 UTC
(
hide
)
Description:
Bug 19943: Gentle error handling for bookcount.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-03-23 15:32:56 UTC
Size:
3.79 KB
patch
obsolete
>From 88fb04d180f5251d3c150e31d767616f08796964 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 9 Mar 2018 10:51:53 -0300 >Subject: [PATCH] Bug 19943: Gentle error handling for bookcount.pl > >This patch tests the required parameters and redirects with a 400 HTTP >code if parameters are invalid. > >It also removes the need for the passed biblioitemnumber which is not >used at all. > >A (now) useless sub is removed too. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > circ/bookcount.pl | 22 ++++++++-------------- > .../prog/en/modules/catalogue/moredetail.tt | 2 +- > 2 files changed, 9 insertions(+), 15 deletions(-) > >diff --git a/circ/bookcount.pl b/circ/bookcount.pl >index 3d20aac540..438d85126e 100755 >--- a/circ/bookcount.pl >+++ b/circ/bookcount.pl >@@ -34,12 +34,14 @@ use Koha::Libraries; > > my $input = new CGI; > my $itm = $input->param('itm'); >-my $bi = $input->param('bi'); > my $biblionumber = $input->param('biblionumber'); > >-my $idata = itemdatanum($itm); > my $biblio = Koha::Biblios->find( $biblionumber ); >-die "No valid biblionumber passed" unless $biblio; # FIXME A bit rude! >+my $item = Koha::Items->find( $itm ); >+ >+if ( !defined $biblio or !defined $item ) { >+ print $input->redirect("/cgi-bin/koha/errors/400.pl"); >+} > > my $lastmove = lastmove($itm); > >@@ -76,10 +78,9 @@ $template->param( > biblionumber => $biblionumber, > title => $biblio->title, > author => $biblio->author, >- barcode => $idata->{'barcode'}, >- biblioitemnumber => $bi, >- homebranch => $idata->{homebranch}, >- holdingbranch => $idata->{holdingbranch}, >+ barcode => $item->barcode, >+ homebranch => $item->homebranch, >+ holdingbranch => $item->holdingbranch, > lastdate => $lastdate ? $lastdate : 0, > count => $count, > libraries => $libraries, >@@ -88,13 +89,6 @@ $template->param( > output_html_with_http_headers $input, $cookie, $template->output; > exit; > >-sub itemdatanum { >- my ($itemnumber) = @_; >- my $sth = C4::Context->dbh->prepare("SELECT * FROM items WHERE itemnumber=?"); >- $sth->execute($itemnumber); >- return $sth->fetchrow_hashref; >-} >- > sub lastmove { > my ($itemnumber) = @_; > my $dbh = C4::Context->dbh; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index 3fb7856d59..ad8aefbb9a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -223,7 +223,7 @@ > </li> > [% END %] > >- <li><span class="label">Total checkouts:</span>[% IF ( ITEM_DAT.issues ) %][% ITEM_DAT.issues %][% ELSE %]0[% END %] (<a href="/cgi-bin/koha/circ/bookcount.pl?&biblionumber=[% ITEM_DAT.biblionumber %]&bi=[% ITEM_DAT.biblioitemnumber %]&itm=[% ITEM_DAT.itemnumber %]">View item's checkout history</a>)</li> >+ <li><span class="label">Total checkouts:</span>[% IF ( ITEM_DAT.issues ) %][% ITEM_DAT.issues %][% ELSE %]0[% END %] (<a href="/cgi-bin/koha/circ/bookcount.pl?&biblionumber=[% ITEM_DAT.biblionumber %]&itm=[% ITEM_DAT.itemnumber %]">View item's checkout history</a>)</li> > > <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END %] </li> > <li><span class="label">Last borrowed:</span>[% IF (ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% END %] </li> >-- >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 19943
:
70384
|
70385
|
70386
|
72568
|
72569
|
72570
|
72593
|
72594
|
72595
|
72596
|
73189
|
73190
|
73191
| 73192 |
73194
|
73198
|
73199
|
73200