Bugzilla – Attachment 77296 Details for
Bug 20661
Implement blocking errors for circulation scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20661: Shortcut circ scripts if a blocking error appeared
Bug-20661-Shortcut-circ-scripts-if-a-blocking-erro.patch (text/plain), 6.82 KB, created by
Marcel de Rooy
on 2018-07-27 06:49:00 UTC
(
hide
)
Description:
Bug 20661: Shortcut circ scripts if a blocking error appeared
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-07-27 06:49:00 UTC
Size:
6.82 KB
patch
obsolete
>From 2d40c6dbb01ed73d3303e80fa2b3a4fa913c9b21 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 25 Apr 2018 17:08:42 -0300 >Subject: [PATCH] Bug 20661: Shortcut circ scripts if a blocking error appeared >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >No test plan found ;) >But tested bookcount and request-article. >--- > C4/Output.pm | 15 ++++++----- > circ/bookcount.pl | 31 +++++++++++----------- > circ/request-article.pl | 3 +++ > .../prog/en/includes/blocking_errors.inc | 4 +++ > .../prog/en/modules/circ/bookcount.tt | 10 ++++--- > .../prog/en/modules/circ/request-article.tt | 3 +++ > 6 files changed, 41 insertions(+), 25 deletions(-) > >diff --git a/C4/Output.pm b/C4/Output.pm >index 39d9f9c..eef4506 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -50,7 +50,7 @@ BEGIN { > ); > push @EXPORT, qw( > &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers >- &output_and_exit_if_error >+ &output_and_exit_if_error &output_and_exit > ); > > } >@@ -338,14 +338,17 @@ sub output_and_exit_if_error { > } > } > >- if ( $error ) { >- $template->param( blocking_error => $error ); >- output_html_with_http_headers ( $query, $cookie, $template->output ); >- exit; >- } >+ output_and_exit( $query, $cookie, $template, $error ) if $error; > return; > } > >+sub output_and_exit { >+ my ( $query, $cookie, $template, $error ) = @_; >+ $template->param( blocking_error => $error ); >+ output_html_with_http_headers ( $query, $cookie, $template->output ); >+ exit; >+} >+ > sub parametrized_url { > my $url = shift || ''; # ie page.pl?ln={LANG} > my $vars = shift || {}; # ie { LANG => en } >diff --git a/circ/bookcount.pl b/circ/bookcount.pl >index 438d851..0d86946 100755 >--- a/circ/bookcount.pl >+++ b/circ/bookcount.pl >@@ -39,22 +39,6 @@ my $biblionumber = $input->param('biblionumber'); > my $biblio = Koha::Biblios->find( $biblionumber ); > 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); >- >-my $lastdate; >-my $count; >-if ( not $lastmove ) { >- $count = issuessince( $itm, 0 ); >-} else { >- $lastdate = $lastmove->{'datearrived'}; >- $count = issuessince( $itm, $lastdate ); >-} >- >-# make the page ... > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >@@ -67,6 +51,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+output_and_exit( $input, $cookie, $template, 'unknown_biblio') >+ unless $biblio; >+output_and_exit( $input, $cookie, $template, 'unknown_item') >+ unless $item; >+ >+my $lastdate; >+my $count; >+my $lastmove = lastmove($itm); >+if ( not $lastmove ) { >+ $count = issuessince( $itm, 0 ); >+} else { >+ $lastdate = $lastmove->{'datearrived'}; >+ $count = issuessince( $itm, $lastdate ); >+} >+ > my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed; > for my $library ( @$libraries ) { > $library->{selected} = 1 if $library->{branchcode} eq C4::Context->userenv->{branch}; >diff --git a/circ/request-article.pl b/circ/request-article.pl >index ea33b3e..3d598ec 100755 >--- a/circ/request-article.pl >+++ b/circ/request-article.pl >@@ -44,6 +44,9 @@ my $patron_cardnumber = $cgi->param('patron_cardnumber'); > my $patron_id = $cgi->param('patron_id'); > > my $biblio = Koha::Biblios->find($biblionumber); >+output_and_exit( $cgi, $cookie, $template, 'unknown_biblio') >+ unless $biblio; >+ > my $patron = > $patron_id ? Koha::Patrons->find($patron_id) > : $patron_cardnumber ? Koha::Patrons->find( { cardnumber => $patron_cardnumber } ) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc >index 4be8110..0ab6738 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc >@@ -3,6 +3,10 @@ > [% CASE 'unknown_patron' %] > <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div> > [% CASE 'cannot_see_patron_infos' %]You are not allowed to see the information of this patron. >+ [% CASE 'unknown_biblio' %] >+ <div class="dialog message">This bibliographic record does not exist.</div> >+ [% CASE 'unknown_item' %] >+ <div class="dialog message">This item does not exist.</div> > [% CASE %][% blocking_error %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt >index 2211a98..9ed1a66 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt >@@ -10,7 +10,11 @@ > [% INCLUDE 'header.inc' %] > [% INCLUDE 'circ-search.inc' %] > >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › Circulation statistics for [% title |html %]</div> >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> >+ [% UNLESS blocking_error %]› Circulation statistics for [% title |html %][% END %] >+</div> > > <div id="doc3" class="yui-t2"> > >@@ -18,8 +22,8 @@ > <div id="yui-main"> > <div class="yui-b"> > >-<h2> >-[% title |html %] [% IF ( author ) %] by [% author |html %][% END %]</h2> >+[% INCLUDE 'blocking_errors.inc' %] >+<h2>[% title |html %] [% IF ( author ) %] by [% author |html %][% END %]</h2> > <h3>Barcode [% barcode %]</h3> > <table> > <tr><th>Home library</th><th>Current library</th><th>Date arrived<br />at current library </th><th>Number of checkouts<br />since last transfer</th></tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >index 94d9b33..375b653 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >@@ -19,12 +19,15 @@ > <a href="/cgi-bin/koha/mainpage.pl">Home</a> > › > <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> >+ [% UNLESS blocking_error %] > › > <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">[% biblio.title | html %]</a> > › > Request article >+ [% END %] > </div> > >+ [% INCLUDE 'blocking_errors.inc' %] > <div id="doc3" class="yui-t2"> > <div id="bd"> > <div id="yui-main"> >-- >2.1.4
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 20661
:
74858
|
75209
| 77296 |
77297