View | Details | Raw Unified | Return to bug 9011
Collapse All | Expand All

(-)a/C4/Circulation.pm (+4 lines)
Lines 2004-2009 sub MarkIssueReturned { Link Here
2004
                                  WHERE borrowernumber = ?
2004
                                  WHERE borrowernumber = ?
2005
                                  AND itemnumber = ?");
2005
                                  AND itemnumber = ?");
2006
    $sth_del->execute($borrowernumber, $itemnumber);
2006
    $sth_del->execute($borrowernumber, $itemnumber);
2007
2008
    if ( C4::Context->preference('StoreLastBorrower') ) {
2009
        $dbh->do("UPDATE items SET last_returned_by = ? WHERE itemnumber = ?", undef, ( $borrowernumber, $itemnumber ) );
2010
    }
2007
}
2011
}
2008
2012
2009
=head2 _debar_user_on_return
2013
=head2 _debar_user_on_return
(-)a/Koha/Template/Plugin/KohaBorrowers.pm (+44 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::KohaBorrowers;
2
3
# Copyright ByWater Solutions 2013
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Template::Plugin;
23
use base qw( Template::Plugin );
24
25
use C4::Context;
26
27
=pod
28
29
This plugin contains TT helper functions related to borrowers
30
31
=cut
32
33
sub BorrowernumberToCardnumber {
34
    my ( $self, $borrowernumber ) = @_;
35
36
    my $sql = "SELECT cardnumber FROM borrowers WHERE borrowernumber = ?";
37
    my $sth = C4::Context->dbh->prepare( $sql );
38
    $sth->execute( $borrowernumber );
39
    my ( $cardnumber ) = $sth->fetchrow_array();
40
41
    return $cardnumber;
42
}
43
44
1;
(-)a/catalogue/moredetail.pl (+1 lines)
Lines 212-217 $template->param( Link Here
212
    z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
212
    z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
213
    subtitle            => $subtitle,
213
    subtitle            => $subtitle,
214
    hidepatronname      => $hidepatronname,
214
    hidepatronname      => $hidepatronname,
215
    StoreLastBorrower   => C4::Context->preference('StoreLastBorrower'),
215
);
216
);
216
$template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items );
217
$template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items );
217
$template->{'VARS'}->{'searchid'} = $query->param('searchid');
218
$template->{'VARS'}->{'searchid'} = $query->param('searchid');
(-)a/installer/data/mysql/kohastructure.sql (+4 lines)
Lines 863-868 CREATE TABLE `deleteditems` ( Link Here
863
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
863
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
864
  `datelastborrowed` date default NULL, -- the date the item was last checked out
864
  `datelastborrowed` date default NULL, -- the date the item was last checked out
865
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
865
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
866
  `last_returned_by` int(11) DEFAULT NULL, -- the last borrower to return an item
866
  `stack` tinyint(1) default NULL,
867
  `stack` tinyint(1) default NULL,
867
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
868
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
868
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
869
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
Lines 900-905 CREATE TABLE `deleteditems` ( Link Here
900
  KEY `delhomebranch` (`homebranch`),
901
  KEY `delhomebranch` (`homebranch`),
901
  KEY `delholdingbranch` (`holdingbranch`),
902
  KEY `delholdingbranch` (`holdingbranch`),
902
  KEY `itype_idx` (`itype`)
903
  KEY `itype_idx` (`itype`)
904
  KEY `del_last_returned_by` (`last_returned_by`)
903
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
905
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
904
906
905
--
907
--
Lines 1156-1161 CREATE TABLE `items` ( -- holdings/item information Link Here
1156
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
1158
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
1157
  `datelastborrowed` date default NULL, -- the date the item was last checked out/issued
1159
  `datelastborrowed` date default NULL, -- the date the item was last checked out/issued
1158
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
1160
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
1161
  `last_returned_by` int(11) DEFAULT NULL, -- the last borrower to return an item
1159
  `stack` tinyint(1) default NULL,
1162
  `stack` tinyint(1) default NULL,
1160
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
1163
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
1161
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
1164
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
Lines 1195-1200 CREATE TABLE `items` ( -- holdings/item information Link Here
1195
  KEY `items_location` (`location`),
1198
  KEY `items_location` (`location`),
1196
  KEY `items_ccode` (`ccode`),
1199
  KEY `items_ccode` (`ccode`),
1197
  KEY `itype_idx` (`itype`),
1200
  KEY `itype_idx` (`itype`),
1201
  KEY `last_returned_by` (`last_returned_by`),
1198
  CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1202
  CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1199
  CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1203
  CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1200
  CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
1204
  CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 351-356 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
351
('staffClientBaseURL','',NULL,'Specify the base URL of the staff client','free'),
351
('staffClientBaseURL','',NULL,'Specify the base URL of the staff client','free'),
352
('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the Staff client','Integer'),
352
('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the Staff client','Integer'),
353
('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'),
353
('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'),
354
('StoreLastBorrower','0','','If ON, the last borrower to return an item will be stored in items.last_returned_by','YesNo'),
354
('SubfieldsToUseWhenPrefill','','','Define a list of subfields to use when prefilling items (separated by space)','Free'),
355
('SubfieldsToUseWhenPrefill','','','Define a list of subfields to use when prefilling items (separated by space)','Free'),
355
('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free'),
356
('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free'),
356
('SubscriptionHistory','simplified','simplified|full','Define the display preference for serials issue history in OPAC','Choice'),
357
('SubscriptionHistory','simplified','simplified|full','Define the display preference for serials issue history in OPAC','Choice'),
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 7595-7600 if ( CheckVersion($DBversion) ) { Link Here
7595
    SetVersion($DBversion);
7595
    SetVersion($DBversion);
7596
}
7596
}
7597
7597
7598
$DBversion = "3.13.00.XXX";
7599
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
7600
   $dbh->do("ALTER TABLE items ADD last_returned_by INT( 11 ) NULL DEFAULT NULL AFTER datelastseen");
7601
   $dbh->do("ALTER TABLE items ADD INDEX ( last_returned_by )");
7602
7603
   $dbh->do("ALTER TABLE deleteditems ADD last_returned_by INT( 11 ) NULL DEFAULT NULL AFTER datelastseen");
7604
   $dbh->do("ALTER TABLE deleteditems ADD INDEX ( last_returned_by )");
7605
7606
   $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')");
7607
7608
   print "Upgrade to $DBversion done ( Add syspref StoreLastBorrower )\n";
7609
   SetVersion ($DBversion);
7610
}
7598
7611
7599
=head1 FUNCTIONS
7612
=head1 FUNCTIONS
7600
7613
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 551-556 OPAC: Link Here
551
                  track: "Track"
551
                  track: "Track"
552
                  no: "Don't track"
552
                  no: "Don't track"
553
            - links that patrons click on
553
            - links that patrons click on
554
        -
555
            - pref: StoreLastBorrower
556
              default: 0
557
              choices:
558
                  yes: Store
559
                  no: "Don't store"
560
            - the last patron to return an item. This setting is independent of opacreadinghistory/AnonymousPatron.
554
561
555
    Shelf Browser:
562
    Shelf Browser:
556
        -
563
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (+2 lines)
Lines 1-3 Link Here
1
[% USE KohaBorrowers %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Catalog &rsaquo; Item details for [% title %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title>
3
<title>Koha &rsaquo; Catalog &rsaquo; Item details for [% title %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 212-217 Link Here
212
213
213
                <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END %]&nbsp;</li>
214
                <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END %]&nbsp;</li>
214
                <li><span class="label">Last borrowed:</span>[% IF (ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% END %]&nbsp;</li>
215
                <li><span class="label">Last borrowed:</span>[% IF (ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% END %]&nbsp;</li>
216
                [% 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>&nbsp;</li>[% END %]
215
                [% 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>&nbsp;</li>[% END %]
217
                [% 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>&nbsp;</li>[% END %]
216
                [% 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>&nbsp;</li>[% END %]
218
                [% 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>&nbsp;</li>[% END %]
217
                [% 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>&nbsp;</li>[% END %]
219
                [% 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>&nbsp;</li>[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt (+2 lines)
Lines 62-67 Link Here
62
            <input type="submit" value="Immediate deletion" onclick="return confirmDelete(MSG_CONFIRM_AGAIN);" />
62
            <input type="submit" value="Immediate deletion" onclick="return confirmDelete(MSG_CONFIRM_AGAIN);" />
63
        </form>
63
        </form>
64
    [% END %]
64
    [% END %]
65
66
        [% IF StoreLastBorrower %]<p>Please note, the last person to return an item is tracked for the management of items returned damaged.</p>[% END %]
65
    </div>
67
    </div>
66
</div>
68
</div>
67
</div>
69
</div>
(-)a/opac/opac-privacy.pl (-1 / +1 lines)
Lines 68-73 $template->param( 'Ask_data' => '1', Link Here
68
                    'firstname' => $borr->{'firstname'},
68
                    'firstname' => $borr->{'firstname'},
69
                    'surname' => $borr->{'surname'},
69
                    'surname' => $borr->{'surname'},
70
                    'privacyview' => 1,
70
                    'privacyview' => 1,
71
    'StoreLastBorrower' => C4::Context->preference('StoreLastBorrower'),
71
);
72
);
72
73
73
output_html_with_http_headers $query, $cookie, $template->output;
74
output_html_with_http_headers $query, $cookie, $template->output;
74
- 

Return to bug 9011