Bugzilla – Attachment 90228 Details for
Bug 19919
Writing off a Lost Item Fee marks as "Paid for by patron"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19919: Stop using paidfor altogether
Bug-19919-Stop-using-paidfor-altogether.patch (text/plain), 6.72 KB, created by
Kyle M Hall (khall)
on 2019-05-31 11:09:25 UTC
(
hide
)
Description:
Bug 19919: Stop using paidfor altogether
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-05-31 11:09:25 UTC
Size:
6.72 KB
patch
obsolete
>From eb5dd863720570d9fae725a038f55281e59d6777 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 3 May 2019 15:44:35 +0100 >Subject: [PATCH] Bug 19919: Stop using paidfor altogether > >This patch removed references to setting and getting the items.paidfor >field. Where it was used for display, in moredetail.pl, we replace it >with a query on the accountlines. > >Test plan: >1) Apply patch >2) Pay off a LOST item >3) Check for the associated display of 'Paidfor?:' on the itemdetails >page >4) Writeoff a LOST item >5) Check that a 'Paidfor?:' is not displayed on the itemdetails page. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Circulation.pm | 10 ------ > C4/Items.pm | 3 -- > Koha/Account/Line.pm | 13 +++++++ > admin/columns_settings.yml | 2 -- > catalogue/moredetail.pl | 38 +++++++++++++++++++++ > koha-tmpl/intranet-tmpl/prog/en/columns.def | 1 - > 6 files changed, 51 insertions(+), 16 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 10b9575517..8144fdd200 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2463,8 +2463,6 @@ sub _FixAccountForLostAndReturned { > $accountline->discard_changes->status('RETURNED'); > $accountline->store; > >- ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } ); >- > if ( defined $account and C4::Context->preference('AccountAutoReconcile') ) { > $account->reconcile_balance; > } >@@ -3669,15 +3667,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); > } > > >diff --git a/C4/Items.pm b/C4/Items.pm >index 15b61f0005..0618117775 100644 >--- a/C4/Items.pm >+++ b/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'}, >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 54ca0a3063..de8848c6c1 100644 >--- a/Koha/Account/Line.pm >+++ b/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::Patron->_new_from_dbic( $rs ); >+} >+ > =head3 item > > Return the item linked to this account line if exists >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index f484ed95ce..9dd7821000 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -272,8 +272,6 @@ modules: > columnname: itemnotes_nonpublic > - > columnname: holdingbranch >- - >- columnname: paidfor > - > columnname: timestamp > - >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index e8736ff398..57647ed097 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -174,6 +174,44 @@ 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 => { '-desc' => 'date' }, >+ rows => 1 >+ } >+ ); >+ >+ if ( my $accountline = $accountlines->next ) { >+ my $payment_offsets = Koha::Account::Offsets->search( >+ { >+ debit_id => $accountline->id, >+ credit_id => { '!=' => undef }, # it is not the debit itself >+ type => { '!=' => [ 'Writeoff', 'Forgiven' ] }, >+ amount => { '<' => 0 } # credits are negative on the DB >+ }, >+ { order_by => { '-desc' => 'created_on' } } >+ ); >+ >+ if ($payment_offsets->count) { >+ my $patron = $accountline->patron; >+ my $payment_offset = $payment_offsets->next; >+ $item->{paidfor} = >+ $patron->firstname . " " >+ . $patron->surname . " " >+ . $patron->cardnumber . " " >+ . $payment_offset->created_on; >+ } >+ } >+ } >+ > if (C4::Context->preference("IndependentBranches")) { > #verifying rights > my $userenv = C4::Context->userenv(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/columns.def b/koha-tmpl/intranet-tmpl/prog/en/columns.def >index 05112eb704..ffbfae0628 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/columns.def >+++ b/koha-tmpl/intranet-tmpl/prog/en/columns.def >@@ -92,7 +92,6 @@ > <field name="items.itemnotes">Public note</field> > <field name="items.itemnotes_nonpublic">Internal note</field> > <field name="items.holdingbranch">Current library</field> >-<field name="items.paidfor">Paid for (unused)</field> > <field name="items.timestamp">Timestamp</field> > <field name="items.location">Shelving location</field> > <field name="items.permanent_location">Permanent shelving location</field> >-- >2.20.1 (Apple Git-117)
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 19919
:
70293
|
89320
|
89356
|
89459
|
89472
|
89794
|
89814
|
89815
|
89816
|
89817
|
90228
|
90229
|
90230