Bugzilla – Attachment 90331 Details for
Bug 22563
Convert lost handling to use 'status' instead of multiple accounttypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22563: Update lost handling to use accountline.status
Bug-22563-Update-lost-handling-to-use-accountlines.patch (text/plain), 7.84 KB, created by
Martin Renvoize (ashimema)
on 2019-06-05 12:54:20 UTC
(
hide
)
Description:
Bug 22563: Update lost handling to use accountline.status
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-06-05 12:54:20 UTC
Size:
7.84 KB
patch
obsolete
>From 7786f1d810f5e0b371ba884bf4011ac66c6157ef Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 22 Mar 2019 16:28:52 +0000 >Subject: [PATCH] Bug 22563: Update lost handling to use accountline.status > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Circulation.pm | 11 +++-- > Koha/Account.pm | 2 +- > .../prog/en/includes/accounts.inc | 41 +++++++++---------- > .../en/modules/reports/cash_register_stats.tt | 2 +- > .../bootstrap/en/includes/account-table.inc | 3 +- > reports/cash_register_stats.pl | 4 +- > 6 files changed, 32 insertions(+), 31 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 53f5810070..92c9b59030 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2391,7 +2391,9 @@ sub _FixOverduesOnReturn { > > &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]); > >-Calculates the charge for a book lost and returned. >+Finds the most recent lost item charge for this item and refunds the borrower >+appropriatly, taking into account any payments or writeoffs already applied >+against the charge. > > Internal function, not exported, called only by AddReturn. > >@@ -2408,7 +2410,8 @@ sub _FixAccountForLostAndReturned { > my $accountlines = Koha::Account::Lines->search( > { > itemnumber => $itemnumber, >- accounttype => { -in => [ 'LOST', 'W' ] }, >+ accounttype => 'LOST', >+ status => [ undef, { '<>' => 'RETURNED' } ] > }, > { > order_by => { -desc => [ 'date', 'accountlines_id' ] } >@@ -2454,8 +2457,8 @@ sub _FixAccountForLostAndReturned { > $credit->apply( { debits => $accountlines->reset } ); > } > >- # Manually set the accounttype >- $accountline->discard_changes->accounttype('LR'); >+ # Update the account status >+ $accountline->discard_changes->status('RETURNED'); > $accountline->store; > > ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } ); >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 9e80112042..2330d5153e 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -721,7 +721,7 @@ our $offset_type = { > our $account_type_credit = { > 'credit' => 'C', > 'forgiven' => 'FOR', >- 'lost_item_return' => 'CR', >+ 'lost_item_return' => 'LOST_RETURN', > 'payment' => 'Pay', > 'writeoff' => 'W' > }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >index 9b17ba0c4c..dfce02b6fe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >@@ -1,26 +1,25 @@ > [%- BLOCK account_type_description -%] > [%- SWITCH account.accounttype -%] >- [%- CASE 'Pay' -%]<span>Payment >- [%- CASE 'Pay00' -%]<span>Payment (cash via SIP2) >- [%- CASE 'Pay01' -%]<span>Payment (VISA via SIP2) >- [%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2) >- [%- CASE 'N' -%]<span>New card >- [%- CASE 'OVERDUE' -%]<span>Fine >- [%- CASE 'A' -%]<span>Account management fee >- [%- CASE 'M' -%]<span>Sundry >- [%- CASE 'LOST' -%]<span>Lost item >- [%- CASE 'W' -%]<span>Writeoff >- [%- CASE 'HE' -%]<span>Hold waiting too long >- [%- CASE 'Rent' -%]<span>Rental fee >- [%- CASE 'FOR' -%]<span>Forgiven >- [%- CASE 'LR' -%]<span>Lost item fee refund >- [%- CASE 'PF' -%]<span>Lost item processing fee >- [%- CASE 'PAY' -%]<span>Payment >- [%- CASE 'WO' -%]<span>Writeoff >- [%- CASE 'C' -%]<span>Credit >- [%- CASE 'CR' -%]<span>Credit >- [%- CASE 'Res' -%]<span>Hold fee >- [%- CASE -%]<span>[% account.accounttype | html %] >+ [%- CASE 'Pay' -%]<span>Payment >+ [%- CASE 'Pay00' -%]<span>Payment (cash via SIP2) >+ [%- CASE 'Pay01' -%]<span>Payment (VISA via SIP2) >+ [%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2) >+ [%- CASE 'N' -%]<span>New card >+ [%- CASE 'OVERDUE' -%]<span>Fine >+ [%- CASE 'A' -%]<span>Account management fee >+ [%- CASE 'M' -%]<span>Sundry >+ [%- CASE 'LOST' -%]<span>Lost item >+ [%- CASE 'W' -%]<span>Writeoff >+ [%- CASE 'HE' -%]<span>Hold waiting too long >+ [%- CASE 'Rent' -%]<span>Rental fee >+ [%- CASE 'FOR' -%]<span>Forgiven >+ [%- CASE 'PF' -%]<span>Lost item processing fee >+ [%- CASE 'PAY' -%]<span>Payment >+ [%- CASE 'WO' -%]<span>Writeoff >+ [%- CASE 'C' -%]<span>Credit >+ [%- CASE 'LOST_RETURN' -%]<span>Lost item fee refund >+ [%- CASE 'Res' -%]<span>Hold fee >+ [%- CASE -%]<span>[% account.accounttype | html %] > [%- END -%] > [%- PROCESS account_status_description account=account -%]</span> > [%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >index 1aca2fb209..88f6a8dc73 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt >@@ -211,7 +211,7 @@ > <span>Account management fee</span> > [% ELSIF loopresul.accounttype == "M" %] > <span>Sundry</span> >- [% ELSIF loopresul.accounttype == "L" || loopresul.accounttype == "LR" %] >+ [% ELSIF loopresul.accounttype == "LOST" %] > <span>Lost item</span> > [% ELSIF loopresul.accounttype == "N" %] > <span>New card</span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >index b339085448..8235962d20 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >@@ -43,12 +43,11 @@ > [% CASE 'HE' %]Hold waiting too long > [% CASE 'Rent' %]Rental fee > [% CASE 'FOR' %]Forgiven >- [% CASE 'LR' %]Lost item fee refund > [% CASE 'PF' %]Lost item processing fee > [% CASE 'PAY' %]Payment > [% CASE 'WO' %]Writeoff > [% CASE 'C' %]Credit >- [% CASE 'CR' %]Credit >+ [% CASE 'LOST_RETURN' %]Lost item fee refund > [%-CASE 'Res' %]Hold fee > [% CASE %][% ACCOUNT_LINE.accounttype | html %] > [%- END -%] >diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl >index b030f6684e..33922b803f 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -118,11 +118,11 @@ if ($do_it) { > $row->{date} = dt_from_string($row->{date}, 'sql'); > > push (@loopresult, $row); >- if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^LR$|^Pay$/)){ >+ if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^Pay$/)){ > pop @loopresult; > next; > } >- if($row->{accounttype} =~ /^C$|^CR$|^LR$/){ >+ if($row->{accounttype} =~ /^C$|^CR$/){ > $grantotal -= abs($row->{amount}); > $row->{amount} = '-' . $row->{amount}; > }elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){ >-- >2.20.1
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 22563
:
86913
|
86914
|
87092
|
87093
|
87094
|
87637
|
87638
|
87639
|
87640
|
87641
|
87642
|
87801
|
87802
|
87803
|
87804
|
87805
|
87806
|
88279
|
88280
|
88281
|
88282
|
88283
|
88284
|
88285
|
88323
|
88324
|
88325
|
88326
|
88327
|
88328
|
88720
|
88721
|
88722
|
88723
|
88724
|
88725
|
89462
|
89463
|
89464
|
89465
|
89466
|
89467
|
90221
|
90222
|
90223
|
90224
|
90225
|
90226
|
90227
|
90307
|
90308
|
90309
|
90310
|
90311
|
90312
|
90330
|
90331
|
90332
|
90333
|
90334
|
90335
|
90632
|
90637
|
90667
|
91338
|
91339
|
91340
|
91341
|
91342
|
91343
|
91344
|
91345
|
91346
|
91347
|
91348