Bugzilla – Attachment 15117 Details for
Bug 9011
Add the ability to store the last patron to return an item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9011 - Add the ability to store the last patron to return an item
Bug-9011---Add-the-ability-to-store-the-last-patro.patch (text/plain), 10.90 KB, created by
Kyle M Hall (khall)
on 2013-02-06 18:10:44 UTC
(
hide
)
Description:
Bug 9011 - Add the ability to store the last patron to return an item
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-02-06 18:10:44 UTC
Size:
10.90 KB
patch
obsolete
>From 0ae76c6058e50f25c7f56344712299e1c9eb6cd0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 5 Nov 2012 14:35:23 -0500 >Subject: [PATCH] Bug 9011 - Add the ability to store the last patron to return an item > >--- > C4/Circulation.pm | 4 ++ > Koha/Template/Plugin/KohaBorrowers.pm | 44 ++++++++++++++++++++ > catalogue/moredetail.pl | 1 + > installer/data/mysql/kohastructure.sql | 4 ++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 15 +++++++ > .../prog/en/modules/admin/preferences/opac.pref | 7 +++ > .../prog/en/modules/catalogue/moredetail.tt | 2 + > 8 files changed, 78 insertions(+), 0 deletions(-) > create mode 100644 Koha/Template/Plugin/KohaBorrowers.pm > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 063a409..f661b91 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1962,6 +1962,10 @@ sub MarkIssueReturned { > WHERE borrowernumber = ? > AND itemnumber = ?"); > $sth_del->execute($borrowernumber, $itemnumber); >+ >+ if ( C4::Context->preference('StoreLastBorrower') ) { >+ $dbh->do("UPDATE items SET last_returned_by = ? WHERE itemnumber = ?", undef, ( $borrowernumber, $itemnumber ) ); >+ } > } > > =head2 _debar_user_on_return >diff --git a/Koha/Template/Plugin/KohaBorrowers.pm b/Koha/Template/Plugin/KohaBorrowers.pm >new file mode 100644 >index 0000000..e640976 >--- /dev/null >+++ b/Koha/Template/Plugin/KohaBorrowers.pm >@@ -0,0 +1,44 @@ >+package Koha::Template::Plugin::KohaBorrowers; >+ >+# Copyright ByWater Solutions 2013 >+ >+# 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 Modern::Perl; >+ >+use Template::Plugin; >+use base qw( Template::Plugin ); >+ >+use C4::Context; >+ >+=pod >+ >+This plugin contains TT helper functions related to borrowers >+ >+=cut >+ >+sub BorrowernumberToCardnumber { >+ my ( $self, $borrowernumber ) = @_; >+ >+ my $sql = "SELECT cardnumber FROM borrowers WHERE borrowernumber = ?"; >+ my $sth = C4::Context->dbh->prepare( $sql ); >+ $sth->execute( $borrowernumber ); >+ my ( $cardnumber ) = $sth->fetchrow_array(); >+ >+ return $cardnumber; >+} >+ >+1; >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index 66d731b..616ad5a 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -211,6 +211,7 @@ $template->param( > z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)), > subtitle => $subtitle, > hidepatronname => $hidepatronname, >+ StoreLastBorrower => C4::Context->preference('StoreLastBorrower'), > ); > $template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items ); > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index ed673da..d34a3d6 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -756,6 +756,7 @@ CREATE TABLE `deleteditems` ( > `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w) > `datelastborrowed` date default NULL, -- the date the item was last checked out > `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done) >+ `last_returned_by` int(11) DEFAULT NULL, -- the last borrower to return an item > `stack` tinyint(1) default NULL, > `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7) > `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4) >@@ -792,6 +793,7 @@ CREATE TABLE `deleteditems` ( > KEY `delitembibnoidx` (`biblionumber`), > KEY `delhomebranch` (`homebranch`), > KEY `delholdingbranch` (`holdingbranch`) >+ KEY `del_last_returned_by` (`last_returned_by`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > -- >@@ -1042,6 +1044,7 @@ CREATE TABLE `items` ( -- holdings/item information > `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w) > `datelastborrowed` date default NULL, -- the date the item was last checked out/issued > `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done) >+ `last_returned_by` int(11) DEFAULT NULL, -- the last borrower to return an item > `stack` tinyint(1) default NULL, > `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7) > `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4) >@@ -1080,6 +1083,7 @@ CREATE TABLE `items` ( -- holdings/item information > KEY `itemcallnumber` (`itemcallnumber`), > KEY `items_location` (`location`), > KEY `items_ccode` (`ccode`), >+ KEY `last_returned_by` (`last_returned_by`), > CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE, > CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 9032bfa..8fc7080 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -411,3 +411,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo'); > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo'); > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo'); >+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('StoreLastBorrower','0','','If ON, the last borrower to return an item will be stored in items.last_returned_by','YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ed922b8..dd1bccd 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6399,6 +6399,21 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.11.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("ALTER TABLE items ADD last_returned_by INT( 11 ) NULL DEFAULT NULL AFTER datelastseen"); >+ $dbh->do("ALTER TABLE items ADD INDEX ( last_returned_by )"); >+ $dbh->do("ALTER TABLE items ADD FOREIGN KEY ( last_returned_by ) REFERENCES borrowers ( borrowernumber )"); >+ >+ $dbh->do("ALTER TABLE deleteditems ADD last_returned_by INT( 11 ) NULL DEFAULT NULL AFTER datelastseen"); >+ $dbh->do("ALTER TABLE deleteditems ADD INDEX ( last_returned_by )"); >+ $dbh->do("ALTER TABLE deleteditems ADD FOREIGN KEY ( last_returned_by ) REFERENCES borrowers ( borrowernumber )"); >+ >+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('StoreLastBorrower','0','','If ON, the last borrower to return an item will be stored in items.last_returned_by','YesNo')"); >+ >+ print "Upgrade to $DBversion done ( Add syspref StoreLastBorrower )\n"; >+ SetVersion ($DBversion); >+} > > =head1 FUNCTIONS > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 300c6e1..dd5c0ed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -510,6 +510,13 @@ OPAC: > - pref: AnonymousPatron > class: integer > - as the Anonymous Patron (for anonymous suggestions and reading history) >+ - >+ - pref: StoreLastBorrower >+ default: 0 >+ choices: >+ yes: Store >+ no: "Don't store" >+ - the last patron to return an item. This setting is independent of opacreadinghistory/AnonymousPatron. > > Shelf Browser: > - >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 5234e28..58d5cbd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -1,3 +1,4 @@ >+[% USE KohaBorrowers %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › Item details for [% title %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -201,6 +202,7 @@ > > <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> >+ [% IF ( StoreLastBorrower && ITEM_DAT.last_returned_by ) %]<li><span class="label">Last returned by:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.last_returned_by %]">[% KohaBorrowers.BorrowernumberToCardnumber( ITEM_DAT.last_returned_by ) %]</a> </li>[% END %] > [% IF ( ITEM_DAT.card0 ) %]<li><span class="label">Last borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower0 %]">[% ITEM_DAT.card0 %]</a> </li>[% END %] > [% IF ( ITEM_DAT.card1 ) %]<li><span class="label">Previous borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower1 %]">[% ITEM_DAT.card1 %]</a> </li>[% END %] > [% IF ( ITEM_DAT.card2 ) %]<li><span class="label">Previous borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower2 %]">[% ITEM_DAT.card2 %]</a> </li>[% END %] >-- >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 9011
:
13258
|
15117
|
15200
|
16666
|
16763
|
16773
|
18676
|
20180
|
20181
|
20329
|
20342
|
20343
|
20344
|
22577
|
22578
|
22579
|
25866
|
25867
|
25868
|
25869
|
25870
|
25871
|
25872
|
25873
|
28923
|
28924
|
28925
|
29301
|
29745
|
29749
|
29750
|
29930
|
29931
|
30979
|
30993
|
30994
|
30995
|
30996
|
30997
|
30998
|
30999
|
32430
|
32431
|
32432
|
32433
|
32434
|
32435
|
32436
|
32437
|
32438
|
32439
|
32440
|
32441
|
32442
|
32443
|
32977
|
37113
|
37114
|
37115
|
37116
|
37117
|
38441
|
38442
|
38443
|
38444
|
38445
|
39812
|
39813
|
39814
|
39815
|
39816