Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'Bug4236' into ptfs-master

  • Loading branch information...
commit 73c33d7e0946b0ae8b24fe00c0a12a57048d84e1 2 parents f8a5f03 + 334636a
J. David Bavousett authored
Showing with 33 additions and 9 deletions.
  1. +23 −5 C4/Circulation.pm
  2. +2 −2 C4/Overdues.pm
  3. +8 −2 misc/cronjobs/fines.pl
View
28 C4/Circulation.pm
@@ -33,6 +33,7 @@ use C4::Accounts;
use C4::ItemCirculationAlertPreference;
use C4::Message;
use C4::Debug;
+use C4::Overdues;
use Date::Calc qw(
Today
Today_and_Now
@@ -1564,11 +1565,16 @@ sub AddReturn {
$messages->{'WasLost'} = 1;
}
- # fix up the overdues in accounts...
- if ($borrowernumber) {
- my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox);
- defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined
- }
+ # For claims-returned items, update the fine to be as-if they returned it for normal overdue
+ if ($issue->{'date_due'} && $issue->{'itemlost'} && $issue->{'itemlost'} == C4::Context->preference('ClaimsReturnedValue')){
+ my $datedue = C4::Dates->new($issue->{'date_due'},'iso');
+ my $due_str = $datedue->output();
+ my $today = C4::Dates->new();
+ my ($amt, $type, $daycounttotal, $daycount) =
+ C4::Overdues::CalcFine($issue, $borrower->{'categorycode'},$branch, undef, undef,$datedue, $today);
+ (defined $type) or $type= '';
+ C4::Overdues::UpdateFine($issue->{'itemnumber'},$issue->{'borrowernumber'},$amt, $type, $due_str) if ($amt > 0);
+ }
# find reserves.....
# if we don't have a reserve with the status W, we launch the Checkreserves routine
@@ -1606,6 +1612,18 @@ sub AddReturn {
logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'biblionumber'})
if C4::Context->preference("ReturnLog");
+
+ # fix up the overdues in accounts...
+ FixOverduesOnReturn( $borrower->{'borrowernumber'},
+ $issue->{'itemnumber'}, $exemptfine, $dropbox );
+
+ # find reserves.....
+ # if we don't have a reserve with the status W, we launch the Checkreserves routine
+ my ( $resfound, $resrec ) = C4::Reserves::CheckReserves( $issue->{'itemnumber'} );
+ if ($resfound) {
+ $resrec->{'ResFound'} = $resfound;
+ $messages->{'ResFound'} = $resrec;
+ }
# FIXME: make this comment intelligible.
#adding message if holdingbranch is non equal a userenv branch to return the document to homebranch
View
4 C4/Overdues.pm
@@ -121,14 +121,14 @@ sub Getoverdues {
my $statement;
if ( C4::Context->preference('item-level_itypes') ) {
$statement = "
- SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode
+ SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost
FROM issues
LEFT JOIN items USING (itemnumber)
WHERE date_due < CURDATE()
";
} else {
$statement = "
- SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode
+ SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost
FROM issues
LEFT JOIN items USING (itemnumber)
LEFT JOIN biblioitems USING (biblioitemnumber)
View
10 misc/cronjobs/fines.pl
@@ -77,7 +77,7 @@ BEGIN
CHECK {
@borrower_fields = qw(cardnumber categorycode surname firstname email phone address citystate);
- @item_fields = qw(itemnumber barcode date_due);
+ @item_fields = qw(itemnumber barcode date_due itemlost);
@other_fields = qw(type days_overdue fine);
$libname = C4::Context->preference('LibraryName');
$control = C4::Context->preference('CircControl');
@@ -139,6 +139,12 @@ INIT
($datedue_days <= $today_days) or next; # or it's not overdue, right?
+ my $claimret_item=0;
+ if ($data->[$i]->{'itemlost'} == C4::Context->preference('ClaimsReturnedValue')){ #this item is claims-returned, don't add more fines
+ $claimret_item=1;
+ }
+
+
$overdueItemsCounted++;
my ($amount,$type,$daycounttotal,$daycount)=
CalcFine($data->[$i], $borrower->{'categorycode'}, $branchcode,undef,undef, $datedue, $today);
@@ -146,7 +152,7 @@ INIT
(defined $type) or $type = '';
# Don't update the fine if today is a holiday.
# This ensures that dropbox mode will remove the correct amount of fine.
- if ($mode eq 'production' and ! $isHoliday) {
+ if ($mode eq 'production' and ! $isHoliday and ! $claimret_item) {
UpdateFine($data->[$i]->{'itemnumber'},$data->[$i]->{'borrowernumber'},$amount,$type,$due_str) if( $amount > 0 ) ;
}
my @cells = ();
Please sign in to comment.
Something went wrong with that request. Please try again.