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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 5043-5049 sub _CanBookBeAutoRenewed { Link Here
5043
    }
5043
    }
5044
5044
5045
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
5045
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
5046
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
5046
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
5047
        my $amountoutstanding =
5047
        my $amountoutstanding =
5048
            C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
5048
            C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
5049
            ? $patron->account->balance
5049
            ? $patron->account->balance
(-)a/circ/renew.pl (-2 / +2 lines)
Lines 69-75 if ( $op eq 'cud-renew' && $barcode ) { Link Here
69
            my $borrowernumber = $patron->borrowernumber;
69
            my $borrowernumber = $patron->borrowernumber;
70
70
71
            $balance = $patron->account->balance;
71
            $balance = $patron->account->balance;
72
            my $amountlimit = C4::Context->preference("OPACFineNoRenewals");
72
            my $amountlimit = C4::Context->preference("FineNoRenewals");
73
73
74
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
74
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
75
                my $confirmations;
75
                my $confirmations;
Lines 142-148 if ( $op eq 'cud-renew' && $barcode ) { Link Here
142
        error               => $error,
142
        error               => $error,
143
        soonestrenewdate    => $soonest_renew_date,
143
        soonestrenewdate    => $soonest_renew_date,
144
        latestautorenewdate => $latest_auto_renew_date,
144
        latestautorenewdate => $latest_auto_renew_date,
145
        balance => $balance,
145
        balance             => $balance,
146
    );
146
    );
147
}
147
}
148
148
(-)a/installer/data/mysql/atomicupdate/bug_23415.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "23415",
5
    description => "Rename OPACFineNoRenewals",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{
12
            UPDATE systempreferences SET variable = "FineNoRenewals", explanation = "Fine limit above which user or staff cannot renew items" WHERE variable = "OPACFineNoRenewals";
13
        }
14
        );
15
16
        say $out "Updated system preference 'OPACFineNoRenewals'";
17
    },
18
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-3 / +4 lines)
Lines 299-304 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
299
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
299
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
300
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
300
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
301
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
301
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
302
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
302
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
303
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
303
('ForcePasswordResetWhenSetByStaff','0',NULL,'Force a staff created patron account to reset its password after its first OPAC login.','YesNo'),
304
('ForcePasswordResetWhenSetByStaff','0',NULL,'Force a staff created patron account to reset its password after its first OPAC login.','YesNo'),
304
('FRBRizeEditions','0',NULL,'If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
305
('FRBRizeEditions','0',NULL,'If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
Lines 513-522 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
513
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
514
('OPACDisplay856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','Choice'),
514
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd',NULL,'Define export options available on OPAC detail page.','multiple'),
515
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd',NULL,'Define export options available on OPAC detail page.','multiple'),
515
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
516
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
516
('OpacFavicon','',NULL,'Enter a complete URL to an image to replace the default Koha favicon on the OPAC','Free'),
517
('OpacFavicon','',NULL,'Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
517
('OPACFineNoRenewals','100',NULL,'Fine limit above which user cannot renew books via OPAC','Integer'),
518
('OPACFineNoRenewals','100',NULL,'Fine limit above which user cannot renew books via OPAC','Integer'),
518
('OPACFineNoRenewalsBlockAutoRenew','0',NULL,'Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
519
('OPACFineNoRenewalsBlockAutoRenew','0',NULL,'Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
519
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
520
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
520
('OPACFinesTab','1',NULL,'If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
521
('OPACFinesTab','1',NULL,'If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
521
('OPACFRBRizeEditions','0',NULL,'If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
522
('OPACFRBRizeEditions','0',NULL,'If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
522
('OpacHiddenItems','',NULL,'This syspref allows to define custom rules for hiding specific items at the OPAC. See https://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'),
523
('OpacHiddenItems','',NULL,'This syspref allows to define custom rules for hiding specific items at the OPAC. See https://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 509-515 Circulation: Link Here
509
                  blockitem: block renewing only for this item.
509
                  blockitem: block renewing only for this item.
510
                  block: block renewing for all the patron's items.
510
                  block: block renewing for all the patron's items.
511
        -
511
        -
512
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
512
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
513
            - pref: OPACFineNoRenewalsBlockAutoRenew
513
            - pref: OPACFineNoRenewalsBlockAutoRenew
514
              choices:
514
              choices:
515
                  1: block
515
                  1: block
Lines 574-579 Circulation: Link Here
574
                  open: "extend the loan period and set the checkout to be due at the library's open time."
574
                  open: "extend the loan period and set the checkout to be due at the library's open time."
575
                  close: "shorten the loan period and set the checkout to be due at the library's close time."
575
                  close: "shorten the loan period and set the checkout to be due at the library's close time."
576
                  ignore: "do not consider the library's opening hours."
576
                  ignore: "do not consider the library's opening hours."
577
        -
578
            - Only allow patrons or staff to renew items if patron has less than
579
            - pref: FineNoRenewals
580
              class: currency
581
            - [% local_currency %] in fines (leave blank to disable).
577
    Lost item policy:
582
    Lost item policy:
578
        -
583
        -
579
            - By default, set the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> value of an item to
584
            - By default, set the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> value of an item to
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-7 / +1 lines)
Lines 651-668 OPAC: Link Here
651
                  none: "NULL"
651
                  none: "NULL"
652
                  opacrenew: "'OPACRenew'"
652
                  opacrenew: "'OPACRenew'"
653
            - as branchcode to store in the statistics table for renewals done in the OPAC.
653
            - as branchcode to store in the statistics table for renewals done in the OPAC.
654
        -
655
            - Only allow patrons to renew their own checkouts on the OPAC if they have less than
656
            - pref: OPACFineNoRenewals
657
              class: currency
658
            - '[% local_currency %] in charges (leave blank to disable).'
659
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
660
        -
654
        -
661
            - pref: OPACFineNoRenewalsIncludeCredits
655
            - pref: OPACFineNoRenewalsIncludeCredits
662
              choices:
656
              choices:
663
                  1: Include
657
                  1: Include
664
                  0: "Don't include"
658
                  0: "Don't include"
665
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
659
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
666
        -
660
        -
667
            - pref: OpacHiddenItems
661
            - pref: OpacHiddenItems
668
              type: textarea
662
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1133-1139 Link Here
1133
1133
1134
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1134
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1135
1135
1136
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1136
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1137
        var fines = "[% fines | $Price %]";
1137
        var fines = "[% fines | $Price %]";
1138
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1138
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1139
1139
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 861-867 Link Here
861
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
861
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
862
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
862
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
863
863
864
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
864
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
865
        var fines = "[% fines | $Price %]";
865
        var fines = "[% fines | $Price %]";
866
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
866
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
867
867
(-)a/opac/opac-user.pl (-2 / +2 lines)
Lines 125-132 if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { Link Here
125
}
125
}
126
126
127
my $amountoutstanding = $patron->account->balance;
127
my $amountoutstanding = $patron->account->balance;
128
my $no_renewal_amt    = C4::Context->preference('OPACFineNoRenewals');
128
my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' );
129
$no_renewal_amt = undef unless looks_like_number($no_renewal_amt);
129
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
130
my $amountoutstandingfornewal =
130
my $amountoutstandingfornewal =
131
    C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
131
    C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
132
    ? $amountoutstanding
132
    ? $amountoutstanding
(-)a/t/db_dependent/Circulation.t (-13 / +15 lines)
Lines 1351-1359 subtest "CanBookBeRenewed tests" => sub { Link Here
1351
                }
1351
                }
1352
            }
1352
            }
1353
        );
1353
        );
1354
        C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' );
1354
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1355
        C4::Context->set_preference( 'OPACFineNoRenewals',               '10' );
1355
        C4::Context->set_preference('FineNoRenewals','10');
1356
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' );
1356
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1357
        my $fines_amount = 5;
1357
        my $fines_amount = 5;
1358
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1358
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1359
        $account->add_debit(
1359
        $account->add_debit(
Lines 1365-1373 subtest "CanBookBeRenewed tests" => sub { Link Here
1365
                description => "Some fines"
1365
                description => "Some fines"
1366
            }
1366
            }
1367
        )->status('RETURNED')->store;
1367
        )->status('RETURNED')->store;
1368
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1368
        ( $renewokay, $error ) =
1369
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1369
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1370
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1370
        is( $error,     'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1371
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1371
1372
1372
        $account->add_debit(
1373
        $account->add_debit(
1373
            {
1374
            {
Lines 1378-1386 subtest "CanBookBeRenewed tests" => sub { Link Here
1378
                description => "Some fines"
1379
                description => "Some fines"
1379
            }
1380
            }
1380
        )->status('RETURNED')->store;
1381
        )->status('RETURNED')->store;
1381
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1382
        ( $renewokay, $error ) =
1383
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1382
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1384
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1383
        is( $error,     'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1385
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1384
1386
1385
        $account->add_debit(
1387
        $account->add_debit(
1386
            {
1388
            {
Lines 1391-1399 subtest "CanBookBeRenewed tests" => sub { Link Here
1391
                description => "Some fines"
1393
                description => "Some fines"
1392
            }
1394
            }
1393
        )->status('RETURNED')->store;
1395
        )->status('RETURNED')->store;
1394
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1396
        ( $renewokay, $error ) =
1395
        is( $renewokay, 0,                      'Do not renew, renewal is automatic' );
1397
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1396
        is( $error,     'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1398
        is( $renewokay, 0,                       'Do not renew, renewal is automatic' );
1399
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1397
1400
1398
        $account->add_credit(
1401
        $account->add_credit(
1399
            {
1402
            {
Lines 1407-1413 subtest "CanBookBeRenewed tests" => sub { Link Here
1407
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1410
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1408
        is(
1411
        is(
1409
            $error, 'auto_renew',
1412
            $error, 'auto_renew',
1410
            'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1413
            'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1411
        );
1414
        );
1412
1415
1413
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
1416
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
Lines 1415-1421 subtest "CanBookBeRenewed tests" => sub { Link Here
1415
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1418
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1416
        is(
1419
        is(
1417
            $error, 'auto_too_much_oweing',
1420
            $error, 'auto_too_much_oweing',
1418
            'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1421
            'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1419
        );
1422
        );
1420
1423
1421
        $dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
1424
        $dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
1422
- 

Return to bug 23415