View | Details | Raw Unified | Return to bug 24380
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +5 lines)
Lines 1973-1979 sub AddReturn { Link Here
1973
                MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy );
1973
                MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy );
1974
            };
1974
            };
1975
            unless ( $@ ) {
1975
            unless ( $@ ) {
1976
                if ( ( $return_date_specified || C4::Context->preference('CalculateFinesOnReturn') ) && !$item->itemlost ) {
1976
                my $calc_fine = C4::Context->preference('CalculateFinesOnReturn');
1977
                $calc_fine ||= $return_date_specified && C4::Context->preference('CalculateFinesOnBackdate');
1978
                $calc_fine &&= !$item->itemlost;
1979
1980
                if ( $calc_fine ) {
1977
                    _CalculateAndUpdateFine( { issue => $issue, item => $item->unblessed, borrower => $patron_unblessed, return_date => $return_date } );
1981
                    _CalculateAndUpdateFine( { issue => $issue, item => $item->unblessed, borrower => $patron_unblessed, return_date => $return_date } );
1978
                }
1982
                }
1979
            } else {
1983
            } else {
(-)a/installer/data/mysql/atomicupdate/bug_24380.perl (+9 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('CalculateFinesOnBackdate','1','','Switch to control if overdue fines are calculated on return when backdating','YesNo');
6
    });
7
8
    NewVersion( $DBversion, 24380, "Add syspref CalculateFinesOnBackdate");
9
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 108-113 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
108
('BranchTransferLimitsType','ccode','itemtype|ccode','When using branch transfer limits, choose whether to limit by itemtype or collection code.','Choice'),
108
('BranchTransferLimitsType','ccode','itemtype|ccode','When using branch transfer limits, choose whether to limit by itemtype or collection code.','Choice'),
109
('BrowseResultSelection','0',NULL,'Enable/Disable browsing search results fromt the bibliographic record detail page in staff client','YesNo'),
109
('BrowseResultSelection','0',NULL,'Enable/Disable browsing search results fromt the bibliographic record detail page in staff client','YesNo'),
110
('CalculateFinesOnReturn','1','','Switch to control if overdue fines are calculated on return or not','YesNo'),
110
('CalculateFinesOnReturn','1','','Switch to control if overdue fines are calculated on return or not','YesNo'),
111
('CalculateFinesOnBackdate','1','','Switch to control if overdue fines are calculated on return when backdating','YesNo'),
111
('CalendarFirstDayOfWeek','0','0|1|2|3|4|5|6','Select the first day of week to use in the calendar.','Choice'),
112
('CalendarFirstDayOfWeek','0','0|1|2|3|4|5|6','Select the first day of week to use in the calendar.','Choice'),
112
('CanMarkHoldsToPullAsLost','do_not_allow','do_not_allow|allow|allow_and_notify','Add a button to the "Holds to pull" screen to mark an item as lost and notify the patron.','Choice'),
113
('CanMarkHoldsToPullAsLost','do_not_allow','do_not_allow|allow|allow_and_notify','Add a button to the "Holds to pull" screen to mark an item as lost and notify the patron.','Choice'),
113
('canreservefromotherbranches','1','','With Independent branches on, can a user from one library place a hold on an item from another library','YesNo'),
114
('canreservefromotherbranches','1','','With Independent branches on, can a user from one library place a hold on an item from another library','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 546-551 Circulation: Link Here
546
            - calculate and update overdue charges when an item is returned.
546
            - calculate and update overdue charges when an item is returned.
547
            - "<br /><strong>NOTE: If you are doing hourly loans then you should have this on.</strong>"
547
            - "<br /><strong>NOTE: If you are doing hourly loans then you should have this on.</strong>"
548
            - "<br /><strong>NOTE: This system preference requires FinesMode to be set to 'Calculate and charge.'</strong>"
548
            - "<br /><strong>NOTE: This system preference requires FinesMode to be set to 'Calculate and charge.'</strong>"
549
        -
550
            - pref: CalculateFinesOnBackdate
551
              choices:
552
                  yes: Do
553
                  no: "Don't"
554
            - calculate and update overdue charges when an item is returned with a backdated return date.
549
        -
555
        -
550
            - pref: UpdateItemLocationOnCheckin
556
            - pref: UpdateItemLocationOnCheckin
551
              type: textarea
557
              type: textarea
(-)a/t/db_dependent/Circulation/Returns.t (-2 / +2 lines)
Lines 402-408 subtest 'BranchTransferLimitsType' => sub { Link Here
402
subtest 'Backdated returns should reduce fine if needed' => sub {
402
subtest 'Backdated returns should reduce fine if needed' => sub {
403
    plan tests => 1;
403
    plan tests => 1;
404
404
405
    t::lib::Mocks::mock_preference( "CalculateFinesOnReturn", 0 );
405
    t::lib::Mocks::mock_preference( "CalculateFinesOnReturn",   0 );
406
    t::lib::Mocks::mock_preference( "CalculateFinesOnBackdate", 1 );
406
407
407
    my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
408
    my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
408
    my $item = $builder->build_object(
409
    my $item = $builder->build_object(
409
- 

Return to bug 24380