Bugzilla – Attachment 11827 Details for
Bug 8688
Add a recall button to the biblio record details page.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add a recall button to the biblio record details page.
0001-Add-a-recall-button-to-the-biblio-record-details-pag.patch (text/plain), 7.03 KB, created by
Frédérick Capovilla
on 2012-08-24 19:03:14 UTC
(
hide
)
Description:
Add a recall button to the biblio record details page.
Filename:
MIME Type:
Creator:
Frédérick Capovilla
Created:
2012-08-24 19:03:14 UTC
Size:
7.03 KB
patch
obsolete
>From 9bc51839e05ff211dcfcb21e047a77b9f93c0506 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= <frederick.capovilla@libeo.com> >Date: Fri, 24 Aug 2012 14:29:25 -0400 >Subject: [PATCH 1/2] Add a recall button to the biblio record details page. > >The recall button sends an email to the user who currently has the item >in his possession, telling him to return the item as soon as possible. > >Patch sponsored by the CCSR ( http://www.ccsr.qc.ca ) >--- > catalogue/detail.pl | 4 + > circ/send_recall_notice.pl | 65 ++++++++++++++++++++ > .../prog/en/modules/catalogue/detail.tt | 47 ++++++++++++++ > 3 files changed, 116 insertions(+), 0 deletions(-) > create mode 100644 circ/send_recall_notice.pl > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index d110740..c14c20d 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -174,6 +174,7 @@ my $shelflocations = GetKohaAuthorisedValues('items.location', $fw); > my $collections = GetKohaAuthorisedValues('items.ccode' , $fw); > my $copynumbers = GetKohaAuthorisedValues('items.copynumber', $fw); > my (@itemloop, %itemfields); >+my $items_checked_out = 0; > my $norequests = 1; > my $authvalcode_items_itemlost = GetAuthValCode('items.itemlost',$fw); > my $authvalcode_items_damaged = GetAuthValCode('items.damaged', $fw); >@@ -184,6 +185,8 @@ foreach my $item (@items) { > > $item->{homebranch} = GetBranchName($item->{homebranch}); > >+ $items_checked_out++ if $item->{'onloan'}; >+ > # can place holds defaults to yes > $norequests = 0 unless ( ( $item->{'notforloan'} > 0 ) || ( $item->{'itemnotforloan'} > 0 ) ); > >@@ -328,6 +331,7 @@ foreach ( keys %{$dat} ) { > > $template->param( > itemloop => \@itemloop, >+ items_checked_out => $items_checked_out, > biblionumber => $biblionumber, > ($analyze? 'analyze':'detailview') =>1, > subscriptions => \@subs, >diff --git a/circ/send_recall_notice.pl b/circ/send_recall_notice.pl >new file mode 100644 >index 0000000..0444baa >--- /dev/null >+++ b/circ/send_recall_notice.pl >@@ -0,0 +1,65 @@ >+#!/usr/bin/perl >+ >+# Author : Frédérick Capovilla, 2011 - SYS-TECH >+# >+# 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 2 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, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use C4::Message; >+use C4::Circulation; >+use C4::Items; >+use C4::Auth; >+use CGI; >+use CGI::Cookie; >+ >+my $input = new CGI; >+my $itemnumber = $input->param('itemnumber'); >+ >+# Check the user's permissions >+my %cookies = fetch CGI::Cookie; >+my $sessid = $cookies{'CGISESSID'}->value || $input->param('CGISESSID'); >+my ($auth_status, $auth_sessid) = C4::Auth::check_cookie_auth($sessid, {"circulate_remaining_permissions" => '1'}); >+if ($auth_status ne "ok") { >+ print $input->header; >+ print "UNAUTHORIZED"; >+ exit 0; >+} >+ >+# Generate the message >+ >+my $borrower = C4::Circulation::GetItemIssue($itemnumber); >+my $item = C4::Items::GetItem($itemnumber); >+ >+my $letter = C4::Letters::GetPreparedLetter( >+ 'module' => 'circulation', >+ 'letter_code' => 'RECALL', >+ 'tables' => { >+ 'biblio' => $item->{biblionumber}, >+ 'biblioitems' => $item->{biblionumber}, >+ 'items' => $itemnumber, >+ 'borrowers' => $borrower->{borrowernumber}, >+ 'branches' => $item->{homebranch}, >+ }, >+); >+ >+# Try to add the message to the message queue. >+if( C4::Letters::EnqueueLetter({letter => $letter, borrowernumber => $borrower->{borrowernumber}, message_transport_type => 'email'}) ) { >+ print $input->header; >+ print "SUCCESS"; >+} >+ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 4f00524..fb91fd5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -42,6 +42,44 @@ function verify_images() { > [% IF ( AmazonEnabled ) %]$(window).load(function() { > verify_images(); > });[% END %] >+ >+ >+//AJAX call to send a recall notice to the user who currently has the item. >+function recall_item(itemnumber) { >+ var button = $("#recall_"+itemnumber); >+ >+ if(!confirm(_('A request for the immediate return of the item will be sent to the user who currently has it in its possession.\n\nAre you sure you want to send a recall notice?'))) { >+ return; >+ } >+ >+ //Disable the button to prevent spamming >+ button.attr("disabled",true); >+ >+ $.ajax({ >+ url: '/cgi-bin/koha/circ/send_recall_notice.pl', >+ type: 'POST', >+ dataType: 'text', >+ data: {itemnumber: itemnumber}, >+ success: function(msg){ >+ if(msg == "SUCCESS") { >+ button.attr("value",_("Recall sent")); >+ } >+ else if(msg == "UNAUTHORIZED") { >+ alert(_("Failed to send the recall notice:")+"\n"+_("You do not have the required permissions to do this action.")+" (circulate_remaining_permissions)"); >+ button.attr("disabled",false); >+ } >+ else { >+ alert(_("Failed to send the recall notice:")+"\n"+msg); >+ button.attr("disabled",false); >+ } >+ }, >+ error: function(request,status){ >+ alert(_("Failed to send the recall notice:")+"\n"+status); >+ button.attr("disabled",false); >+ } >+ }); >+} >+ > //]]> > </script> > </head> >@@ -285,6 +323,7 @@ function verify_images() { > [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th>Spine label</th>[% END %] > [% IF ( hostrecords ) %]<th>Host records</th>[% END %] > [% IF ( analyze ) %]<th>Used in</th><th></th>[% END %] >+ [% IF ( items_checked_out ) %]<th>Recall</th>[% END %] > </tr> > [% FOREACH itemloo IN itemloop %] > <tr> >@@ -421,6 +460,14 @@ function verify_images() { > <td><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=[% itemloo.biblionumber %]&hostitemnumber=[% itemloo.itemnumber %]">Create analytics</a></td> > [% END %] > >+ [% IF ( items_checked_out ) %] >+ <td> >+ [% IF ( itemloo.onloan ) %] >+ <input type="button" id="recall_[% itemloo.itemnumber %]" name="recall_[% itemloo.itemnumber %]" value="Recall" onclick="recall_item([% itemloo.itemnumber %]);" /> >+ [% END %] >+ </td> >+ [% END %] >+ > </tr> > [% END %] > </table> >-- >1.7.2.5 >
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 8688
:
11827
|
11828
|
11913
|
11914
|
11915
|
11916
|
17740
|
36741
|
38111
|
38118
|
38119
|
39169
|
39170
|
39171
|
39172
|
39173
|
46155
|
46158