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

(-)a/C4/Circulation.pm (+4 lines)
Lines 1952-1957 sub MarkIssueReturned { Link Here
1952
                                  WHERE borrowernumber = ?
1952
                                  WHERE borrowernumber = ?
1953
                                  AND itemnumber = ?");
1953
                                  AND itemnumber = ?");
1954
    $sth_del->execute($borrowernumber, $itemnumber);
1954
    $sth_del->execute($borrowernumber, $itemnumber);
1955
    
1956
    if ( C4::Context->preference('StoreLastBorrower') ) {
1957
        $dbh->do("UPDATE items SET last_returned_by = ? WHERE itemnumber = ?", undef, ( $borrowernumber, $itemnumber ) );
1958
    }
1955
}
1959
}
1956
1960
1957
=head2 _debar_user_on_return
1961
=head2 _debar_user_on_return
(-)a/catalogue/moredetail.pl (-1 / +2 lines)
Lines 193-199 foreach my $item (@items){ Link Here
193
            $item->{borrowersurname} = $curr_borrower->{'surname'};
193
            $item->{borrowersurname} = $curr_borrower->{'surname'};
194
        }
194
        }
195
    }
195
    }
196
196
    
197
}
197
}
198
$template->param(count => $data->{'count'},
198
$template->param(count => $data->{'count'},
199
	subscriptionsnumber => $subscriptionsnumber,
199
	subscriptionsnumber => $subscriptionsnumber,
Lines 211-216 $template->param( Link Here
211
    z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
211
    z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
212
    subtitle            => $subtitle,
212
    subtitle            => $subtitle,
213
    hidepatronname      => $hidepatronname,
213
    hidepatronname      => $hidepatronname,
214
    StoreLastBorrower   => C4::Context->preference('StoreLastBorrower'),
214
);
215
);
215
$template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items );
216
$template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items );
216
217
(-)a/installer/data/mysql/kohastructure.sql (+4 lines)
Lines 756-761 CREATE TABLE `deleteditems` ( Link Here
756
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
756
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
757
  `datelastborrowed` date default NULL, -- the date the item was last checked out
757
  `datelastborrowed` date default NULL, -- the date the item was last checked out
758
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
758
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
759
  `last_returned_by` int(11) DEFAULT NULL, -- the last borrower to return an item
759
  `stack` tinyint(1) default NULL,
760
  `stack` tinyint(1) default NULL,
760
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
761
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
761
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
762
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
Lines 791-796 CREATE TABLE `deleteditems` ( Link Here
791
  KEY `delitembibnoidx` (`biblionumber`),
792
  KEY `delitembibnoidx` (`biblionumber`),
792
  KEY `delhomebranch` (`homebranch`),
793
  KEY `delhomebranch` (`homebranch`),
793
  KEY `delholdingbranch` (`holdingbranch`)
794
  KEY `delholdingbranch` (`holdingbranch`)
795
  KEY `del_last_returned_by` (`last_returned_by`)  
794
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
796
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
795
797
796
--
798
--
Lines 1041-1046 CREATE TABLE `items` ( -- holdings/item information Link Here
1041
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
1043
  `replacementpricedate` date default NULL, -- the date the price is effective from (MARC21 952$w)
1042
  `datelastborrowed` date default NULL, -- the date the item was last checked out/issued
1044
  `datelastborrowed` date default NULL, -- the date the item was last checked out/issued
1043
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
1045
  `datelastseen` date default NULL, -- the date the item was last see (usually the last time the barcode was scanned or inventory was done)
1046
  `last_returned_by` int(11) DEFAULT NULL, -- the last borrower to return an item
1044
  `stack` tinyint(1) default NULL,
1047
  `stack` tinyint(1) default NULL,
1045
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
1048
  `notforloan` tinyint(1) NOT NULL default 0, -- authorized value defining why this item is not for loan (MARC21 952$7)
1046
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
1049
  `damaged` tinyint(1) NOT NULL default 0, -- authorized value defining this item as damaged (MARC21 952$4)
Lines 1078-1083 CREATE TABLE `items` ( -- holdings/item information Link Here
1078
  KEY `itemcallnumber` (`itemcallnumber`),
1081
  KEY `itemcallnumber` (`itemcallnumber`),
1079
  KEY `items_location` (`location`),
1082
  KEY `items_location` (`location`),
1080
  KEY `items_ccode` (`ccode`),
1083
  KEY `items_ccode` (`ccode`),
1084
  KEY `last_returned_by` (`last_returned_by`),
1081
  CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1085
  CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
1082
  CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1086
  CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
1083
  CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
1087
  CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 386-388 INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy Link Here
386
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');
386
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');
387
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');
387
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');
388
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');
388
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');
389
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');
(-)a/installer/data/mysql/updatedatabase.pl (+16 lines)
Lines 6020-6025 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6020
   SetVersion ($DBversion);
6020
   SetVersion ($DBversion);
6021
}
6021
}
6022
6022
6023
$DBversion = "3.09.00.XXX";
6024
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6025
   $dbh->do("ALTER TABLE items ADD last_returned_by INT( 11 ) NULL DEFAULT NULL AFTER datelastseen");
6026
   $dbh->do("ALTER TABLE items ADD INDEX ( last_returned_by )");
6027
   $dbh->do("ALTER TABLE items ADD FOREIGN KEY ( last_returned_by ) REFERENCES  borrowers ( borrowernumber )");
6028
6029
   $dbh->do("ALTER TABLE deleteditems ADD last_returned_by INT( 11 ) NULL DEFAULT NULL AFTER datelastseen");
6030
   $dbh->do("ALTER TABLE deleteditems ADD INDEX ( last_returned_by )");
6031
   $dbh->do("ALTER TABLE deleteditems ADD FOREIGN KEY ( last_returned_by ) REFERENCES  borrowers ( borrowernumber )");
6032
   
6033
   $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')");
6034
   
6035
   print "Upgrade to $DBversion done ( Add syspref StoreLastBorrower )\n";
6036
   SetVersion ($DBversion);
6037
}
6038
6023
=head1 FUNCTIONS
6039
=head1 FUNCTIONS
6024
6040
6025
=head2 TableExists($table)
6041
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 498-503 OPAC: Link Here
498
            - pref: AnonymousPatron
498
            - pref: AnonymousPatron
499
              class: integer
499
              class: integer
500
            - as the Anonymous Patron (for anonymous suggestions and reading history)
500
            - as the Anonymous Patron (for anonymous suggestions and reading history)
501
        -
502
            - pref: StoreLastBorrower
503
              default: 0
504
              choices:
505
                  yes: Store
506
                  no: "Don't store"
507
            - the last patron to return an item. This setting is independent of opacreadinghistory/AnonymousPatron.
501
508
502
    Shelf Browser:
509
    Shelf Browser:
503
        -
510
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (-1 / +1 lines)
Lines 201-206 Link Here
201
201
202
                <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END %]&nbsp;</li>
202
                <li><span class="label">Last seen:</span>[% IF ( ITEM_DAT.datelastseen ) %][% ITEM_DAT.datelastseen | $KohaDates %] [%END %]&nbsp;</li>
203
                <li><span class="label">Last borrowed:</span>[% IF (ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% END %]&nbsp;</li>
203
                <li><span class="label">Last borrowed:</span>[% IF (ITEM_DAT.datelastborrowed ) %][% ITEM_DAT.datelastborrowed | $KohaDates %][% END %]&nbsp;</li>
204
                [% 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>&nbsp;</li>[% END %]
204
                [% 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 %]
205
                [% 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 %]
205
                [% 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 %]
206
                [% 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 %]
206
                [% 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 %]
207
                [% 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 %]
207
- 

Return to bug 9011