Bugzilla – Attachment 13258 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), 9.45 KB, created by
Kyle M Hall
on 2012-11-05 19:42:52 UTC
(
hide
)
Description:
Bug 9011 - Add the ability to store the last patron to return an item
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-11-05 19:42:52 UTC
Size:
9.45 KB
patch
obsolete
>From 613a06f35682cfac55ba59198d4b9dd7828a93a6 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 >Content-Type: text/plain; charset="utf-8" > >--- > C4/Circulation.pm | 4 ++++ > catalogue/moredetail.pl | 3 ++- > installer/data/mysql/kohastructure.sql | 4 ++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 16 ++++++++++++++++ > .../prog/en/modules/admin/preferences/opac.pref | 7 +++++++ > .../prog/en/modules/catalogue/moredetail.tt | 1 + > 7 files changed, 35 insertions(+), 1 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 5cbc211..72048b5 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1952,6 +1952,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/catalogue/moredetail.pl b/catalogue/moredetail.pl >index 66d731b..b8c1b99 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -193,7 +193,7 @@ foreach my $item (@items){ > $item->{borrowersurname} = $curr_borrower->{'surname'}; > } > } >- >+ > } > $template->param(count => $data->{'count'}, > subscriptionsnumber => $subscriptionsnumber, >@@ -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 29ee782..0e9d7b8 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) >@@ -791,6 +792,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; > > -- >@@ -1041,6 +1043,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) >@@ -1078,6 +1081,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 a4e4102..c236768 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -386,3 +386,4 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy > INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); > INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); >+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 7ab48ee..6058ae6 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6020,6 +6020,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.09.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 > > =head2 TableExists($table) >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 1a9fa09..1728d59 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 >@@ -498,6 +498,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..0270250 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -201,6 +201,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 %]">[% 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