@@ -, +, @@
---
C4/Circulation.pm | 10 ---------
C4/Items.pm | 3 ---
Koha/Account/Line.pm | 13 +++++++++++
admin/columns_settings.yml | 2 --
catalogue/moredetail.pl | 25 +++++++++++++++++++++
koha-tmpl/intranet-tmpl/prog/en/columns.def | 1 -
6 files changed, 38 insertions(+), 16 deletions(-)
--- a/C4/Circulation.pm
+++ a/C4/Circulation.pm
@@ -2458,8 +2458,6 @@ sub _FixAccountForLostAndReturned {
$accountline->discard_changes->accounttype('LR');
$accountline->store;
- ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
-
if ( defined $account and C4::Context->preference('AccountAutoReconcile') ) {
$account->reconcile_balance;
}
@@ -3664,15 +3662,7 @@ sub DeleteBranchTransferLimits {
sub ReturnLostItem{
my ( $borrowernumber, $itemnum ) = @_;
-
MarkIssueReturned( $borrowernumber, $itemnum );
- my $patron = Koha::Patrons->find( $borrowernumber );
- my $item = Koha::Items->find($itemnum);
- my $old_note = ($item->paidfor && ($item->paidfor ne q{})) ? $item->paidfor.' / ' : q{};
- my @datearr = localtime(time);
- my $date = ( 1900 + $datearr[5] ) . "-" . ( $datearr[4] + 1 ) . "-" . $datearr[3];
- my $bor = $patron->firstname . ' ' . $patron->surname . ' ' . $patron->cardnumber;
- ModItem({ paidfor => $old_note."Paid for by $bor $date" }, undef, $itemnum);
}
--- a/C4/Items.pm
+++ a/C4/Items.pm
@@ -390,7 +390,6 @@ sub _build_default_values_for_mod_marc {
materials => undef,
new_status => undef,
notforloan => 0,
- # paidfor => undef, # commented, see bug 12817
price => undef,
replacementprice => undef,
replacementpricedate => undef,
@@ -1569,7 +1568,6 @@ sub _koha_new_item {
itemnotes = ?,
itemnotes_nonpublic = ?,
holdingbranch = ?,
- paidfor = ?,
location = ?,
permanent_location = ?,
onloan = ?,
@@ -1613,7 +1611,6 @@ sub _koha_new_item {
$item->{'itemnotes'},
$item->{'itemnotes_nonpublic'},
$item->{'holdingbranch'},
- $item->{'paidfor'},
$item->{'location'},
$item->{'permanent_location'},
$item->{'onloan'},
--- a/Koha/Account/Line.pm
+++ a/Koha/Account/Line.pm
@@ -41,6 +41,19 @@ Koha::Account::Line - Koha accountline Object class
=cut
+=head3 patron
+
+Return the patron linked to this account line
+
+=cut
+
+sub patron {
+ my ( $self ) = @_;
+ my $rs = $self->_result->borrowernumber;
+ return unless $rs;
+ return Koha::Item->_new_from_dbic( $rs );
+}
+
=head3 item
Return the item linked to this account line if exists
--- a/admin/columns_settings.yml
+++ a/admin/columns_settings.yml
@@ -272,8 +272,6 @@ modules:
columnname: itemnotes_nonpublic
-
columnname: holdingbranch
- -
- columnname: paidfor
-
columnname: timestamp
-
--- a/catalogue/moredetail.pl
+++ a/catalogue/moredetail.pl
@@ -174,6 +174,31 @@ foreach my $item (@items){
$item->{status_advisory} = 1;
}
+ # Add paidfor info
+ if ( $item->{itemlost} ) {
+ my $accountlines = Koha::Account::Lines->search(
+ {
+ itemnumber => $item->{itemnumber},
+ accounttype => 'LOST',
+ status => [ undef, { '<>' => 'RETURNED' } ],
+ amountoutstanding => 0
+ },
+ {
+ order_by => { '-asc' => 'date' },
+ rows => 1
+ }
+ );
+
+ if ( my $accountline = $accountlines->next ) {
+ my $patron = $accountline->patron;
+ $item->{paidfor} =
+ $patron->firstname . " "
+ . $patron->surname . " "
+ . $patron->cardnumber . " "
+ . $accountline->date;
+ }
+ }
+
if (C4::Context->preference("IndependentBranches")) {
#verifying rights
my $userenv = C4::Context->userenv();
--- a/koha-tmpl/intranet-tmpl/prog/en/columns.def
+++ a/koha-tmpl/intranet-tmpl/prog/en/columns.def
@@ -92,7 +92,6 @@
Public note
Internal note
Current library
-Paid for (unused)
Timestamp
Shelving location
Permanent shelving location
--