Lines 36-41
use C4::Message;
Link Here
|
36 |
use C4::Debug; |
36 |
use C4::Debug; |
37 |
use C4::Branch; # GetBranches |
37 |
use C4::Branch; # GetBranches |
38 |
use C4::Log; # logaction |
38 |
use C4::Log; # logaction |
|
|
39 |
use C4::Overdues qw(CalcFine UpdateFine); |
39 |
|
40 |
|
40 |
use Data::Dumper; |
41 |
use Data::Dumper; |
41 |
use Koha::DateUtils; |
42 |
use Koha::DateUtils; |
Lines 1595-1611
sub AddReturn {
Link Here
|
1595 |
|
1596 |
|
1596 |
# case of a return of document (deal with issues and holdingbranch) |
1597 |
# case of a return of document (deal with issues and holdingbranch) |
1597 |
if ($doreturn) { |
1598 |
if ($doreturn) { |
|
|
1599 |
my $today = DateTime->now( time_zone => C4::Context->tz() ); |
1600 |
my $datedue = $issue->{date_due}; |
1598 |
$borrower or warn "AddReturn without current borrower"; |
1601 |
$borrower or warn "AddReturn without current borrower"; |
1599 |
my $circControlBranch; |
1602 |
my $circControlBranch; |
1600 |
if ($dropbox) { |
1603 |
if ($dropbox) { |
1601 |
# define circControlBranch only if dropbox mode is set |
1604 |
# define circControlBranch only if dropbox mode is set |
1602 |
# don't allow dropbox mode to create an invalid entry in issues (issuedate > today) |
1605 |
# don't allow dropbox mode to create an invalid entry in issues (issuedate > today) |
1603 |
# FIXME: check issuedate > returndate, factoring in holidays |
1606 |
# FIXME: check issuedate > returndate, factoring in holidays |
1604 |
#$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );; |
1607 |
#$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );; |
1605 |
$circControlBranch = _GetCircControlBranch($item,$borrower); |
1608 |
$circControlBranch = _GetCircControlBranch($item,$borrower); |
|
|
1609 |
$today->add(days => -1 ); |
1610 |
$issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $today ) == -1 ? 1 : 0; |
1606 |
} |
1611 |
} |
1607 |
|
|
|
1608 |
if ($borrowernumber) { |
1612 |
if ($borrowernumber) { |
|
|
1613 |
if($issue->{'overdue'}){ |
1614 |
my ( $amount, $type, $daycounttotal ) = C4::Overdues::CalcFine( $item, $borrower->{categorycode},$branch, $datedue, $today ); |
1615 |
my $type ||= q{}; |
1616 |
print STDERR "\n\nAMOUNT: $amount"; |
1617 |
if ( $amount > 0 ) { |
1618 |
C4::Overdues::UpdateFine( |
1619 |
$issue->{itemnumber}, |
1620 |
$issue->{borrowernumber}, |
1621 |
$amount, $type, output_pref($datedue) |
1622 |
); |
1623 |
} |
1624 |
} |
1609 |
MarkIssueReturned($borrowernumber, $item->{'itemnumber'}, $circControlBranch, '', $borrower->{'privacy'}); |
1625 |
MarkIssueReturned($borrowernumber, $item->{'itemnumber'}, $circControlBranch, '', $borrower->{'privacy'}); |
1610 |
$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right? This could be the borrower hash. |
1626 |
$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right? This could be the borrower hash. |
1611 |
} |
1627 |
} |
1612 |
- |
|
|