Bugzilla – Attachment 74858 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 scripts if a blocking error appeared
Bug-20661-Shortcut-scripts-if-a-blocking-error-app.patch (text/plain), 6.57 KB, created by
Jonathan Druart
on 2018-04-25 20:08:57 UTC
(
hide
)
Description:
Bug 20661: Shortcut scripts if a blocking error appeared
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-04-25 20:08:57 UTC
Size:
6.57 KB
patch
obsolete
>From 08949e9c0be9935c698500d0f9c3e36ade22c40f 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 scripts if a blocking error appeared > >--- > 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 | 7 ++++- > .../prog/en/modules/circ/request-article.tt | 3 +++ > 6 files changed, 40 insertions(+), 23 deletions(-) > >diff --git a/C4/Output.pm b/C4/Output.pm >index 39d9f9cd21..eef4506e87 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 438d85126e..0d869464cc 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 ea33b3ee5a..3d598ecf59 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 4be8110e46..0ab6738260 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 2211a986cd..464049ebf8 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"> > >@@ -20,6 +24,7 @@ > > <h2> > [% title |html %] [% IF ( author ) %] by [% author |html %][% END %]</h2> >+[% INCLUDE 'blocking_errors.inc' %] > <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 ca1aa1b109..dc5b3d5a99 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.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 20661
:
74858
|
75209
|
77296
|
77297