Lines 1953-1969
sub AddReturn {
Link Here
|
1953 |
|
1953 |
|
1954 |
# case of a return of document (deal with issues and holdingbranch) |
1954 |
# case of a return of document (deal with issues and holdingbranch) |
1955 |
if ($doreturn) { |
1955 |
if ($doreturn) { |
1956 |
my $is_overdue; |
|
|
1957 |
die "The item is not issed and cannot be returned" unless $issue; # Just in case... |
1956 |
die "The item is not issed and cannot be returned" unless $issue; # Just in case... |
1958 |
$patron or warn "AddReturn without current borrower"; |
1957 |
$patron or warn "AddReturn without current borrower"; |
1959 |
$is_overdue = $issue->is_overdue( $return_date ); |
|
|
1960 |
|
1958 |
|
1961 |
if ($patron) { |
1959 |
if ($patron) { |
1962 |
eval { |
1960 |
eval { |
1963 |
MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy ); |
1961 |
MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy ); |
1964 |
}; |
1962 |
}; |
1965 |
unless ( $@ ) { |
1963 |
unless ( $@ ) { |
1966 |
if ( C4::Context->preference('CalculateFinesOnReturn') && $is_overdue && !$item->itemlost ) { |
1964 |
if ( C4::Context->preference('CalculateFinesOnReturn') && !$item->itemlost ) { |
1967 |
_CalculateAndUpdateFine( { issue => $issue, item => $item_unblessed, borrower => $patron_unblessed, return_date => $return_date } ); |
1965 |
_CalculateAndUpdateFine( { issue => $issue, item => $item_unblessed, borrower => $patron_unblessed, return_date => $return_date } ); |
1968 |
} |
1966 |
} |
1969 |
} else { |
1967 |
} else { |
Lines 2890-2896
sub AddRenewal {
Link Here
|
2890 |
my $schema = Koha::Database->schema; |
2888 |
my $schema = Koha::Database->schema; |
2891 |
$schema->txn_do(sub{ |
2889 |
$schema->txn_do(sub{ |
2892 |
|
2890 |
|
2893 |
if ( C4::Context->preference('CalculateFinesOnReturn') && $issue->is_overdue ) { |
2891 |
if ( C4::Context->preference('CalculateFinesOnReturn') ) { |
2894 |
_CalculateAndUpdateFine( { issue => $issue, item => $item_unblessed, borrower => $patron_unblessed } ); |
2892 |
_CalculateAndUpdateFine( { issue => $issue, item => $item_unblessed, borrower => $patron_unblessed } ); |
2895 |
} |
2893 |
} |
2896 |
_FixOverduesOnReturn( $borrowernumber, $itemnumber, undef, 'RENEWED' ); |
2894 |
_FixOverduesOnReturn( $borrowernumber, $itemnumber, undef, 'RENEWED' ); |
Lines 4139-4147
sub _CalculateAndUpdateFine {
Link Here
|
4139 |
: $issue->branchcode; |
4137 |
: $issue->branchcode; |
4140 |
|
4138 |
|
4141 |
my $date_returned = $return_date ? $return_date : dt_from_string(); |
4139 |
my $date_returned = $return_date ? $return_date : dt_from_string(); |
4142 |
|
4140 |
my ( $amount, $unitcounttotal, $unitcount ); |
4143 |
my ( $amount, $unitcounttotal, $unitcount ) = |
4141 |
if ( $issue->is_overdue($date_returned) ) { |
4144 |
C4::Overdues::CalcFine( $item, $borrower->{categorycode}, $control_branchcode, $datedue, $date_returned ); |
4142 |
( $amount, $unitcounttotal, $unitcount ) = |
|
|
4143 |
C4::Overdues::CalcFine( $item, $borrower->{categorycode}, |
4144 |
$control_branchcode, $datedue, $date_returned ); |
4145 |
} |
4146 |
else { |
4147 |
( $amount, $unitcounttotal, $unitcount ) = ( 0, 0, 0 ); |
4148 |
} |
4145 |
|
4149 |
|
4146 |
if ( C4::Context->preference('finesMode') eq 'production' ) { |
4150 |
if ( C4::Context->preference('finesMode') eq 'production' ) { |
4147 |
if ( $amount > 0 ) { |
4151 |
if ( $amount > 0 ) { |
4148 |
- |
|
|