Bugzilla – Attachment 26193 Details for
Bug 9481
charge not showing fines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9481 - charge not showing fines
0001-Bug-9481-charge-not-showing-fines.patch (text/plain), 4.33 KB, created by
Rafal Kopaczka
on 2014-03-12 15:38:29 UTC
(
hide
)
Description:
Bug 9481 - charge not showing fines
Filename:
MIME Type:
Creator:
Rafal Kopaczka
Created:
2014-03-12 15:38:29 UTC
Size:
4.33 KB
patch
obsolete
>From 3ddb4218ada2bb96ce7d8e7e4874d462dc4c0a00 Mon Sep 17 00:00:00 2001 >From: Rafal Kopaczka <rkk0@poczta.onet.pl> >Date: Wed, 12 Mar 2014 15:54:34 +0100 >Subject: [PATCH] Bug 9481 - charge not showing fines On 'Check out' and > 'Details' screens in patron record fines for item aren't > showing. Added new soubroutine to sum up all outstanding > charges by borrower for this item including all historical > issues and rent charges. Previous routine gets charge > amount from system preferences instead of amount > outstanding. > >To test: >1/ Check out items with past due date >2/ Run fines.pl script (ensure finesMode is set to Calculate and Charge) >3/ Verify on Fines->Pay Fines screen that fines where calculated >correct. >4/ Go to Patron record, charge column on Details and Check out screen >should be 0 or rental charge amount only. But total amount row display right >number, same as in pay fines screen. >4/ Apply patch. >5/ Now charges on display and check out screen shows all outstanding >fees for each item. >--- > C4/Overdues.pm | 20 ++++++++++++++++++++ > circ/circulation.pl | 5 +++-- > members/moremember.pl | 9 +++++---- > 3 files changed, 28 insertions(+), 6 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index af83e0f..be0e0aa 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -45,6 +45,7 @@ BEGIN { > &AmountNotify > &UpdateFine > &GetFine >+ &GetItemCharges > > &CheckItemNotify > &GetOverduesForBranch >@@ -658,6 +659,25 @@ sub GetFine { > return 0; > } > >+=head2 GetItemCharges >+ >+ $charges = GetItemCharges( $borrowernumber, $itemnumber ) >+ Gets fines and issue charge for item from accountlines. Icluding all outstanding amount for specific item, >+ also from previous issue of this item. >+ >+=cut >+ >+sub GetItemCharges { >+ my ( $borrowernumber, $itemnumber ) = @_; >+ >+ my $dbh = C4::Context->dbh(); >+ >+ my $query = "SELECT SUM(amountoutstanding) FROM accountlines WHERE borrowernumber = ? AND itemnumber = ? "; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( $borrowernumber, $itemnumber ); >+ return $sth->fetchrow_arrayref()->[0]; >+} >+ > =head2 NumberNotifyId > > (@notify) = &NumberNotifyId($borrowernumber); >diff --git a/circ/circulation.pl b/circ/circulation.pl >index cdc40e3..131fe35 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -41,6 +41,7 @@ use C4::Context; > use CGI::Session; > use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::Borrower::Debarments qw(GetDebarments); >+use C4::Overdues qw/GetItemCharges/; > use Koha::DateUtils; > > use Date::Calc qw( >@@ -478,8 +479,8 @@ sub build_issue_data { > # set itemtype per item-level_itype syspref - FIXME this is an ugly hack > $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'}; > >- ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges( >- $it->{'itemnumber'}, $it->{'borrowernumber'} >+ $it->{'charge'} = GetItemCharges( >+ $it->{'borrowernumber'}, $it->{'itemnumber'} > ); > $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); > my ($can_renew, $can_renew_error) = CanBookBeRenewed( >diff --git a/members/moremember.pl b/members/moremember.pl >index e794efa..e7ac52a 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -52,6 +52,7 @@ use C4::Form::MessagingPreferences; > use List::MoreUtils qw/uniq/; > use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::Borrower::Debarments qw(GetDebarments); >+use C4::Overdues qw(GetItemCharges); > #use Smart::Comments; > #use Data::Dumper; > use DateTime; >@@ -502,11 +503,11 @@ sub build_issue_data { > } > } > >- #find the charge for an item >- my ( $charge, $itemtype ) = >- GetIssuingCharges( $issue->{itemnumber}, $borrowernumber ); >+ #find all charges for an item >+ my $charge = GetItemCharges( $borrowernumber, $issue->{itemnumber} ); > >- my $itemtypeinfo = getitemtypeinfo($itemtype); >+ my $getiteminfo = GetBiblioFromItemNumber( $issue->{'itemnumber'} ); >+ my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} ); > $row{'itemtype_description'} = $itemtypeinfo->{description}; > $row{'itemtype_image'} = $itemtypeinfo->{imageurl}; > >-- >1.7.10.4 >
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 9481
:
14816
|
14817
|
26193
|
26457
|
26674
|
26675
|
26684
|
26685
|
36739
|
36740
|
36742
|
36787
|
36848