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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4903-4909 sub _CanBookBeAutoRenewed { Link Here
4903
    }
4903
    }
4904
4904
4905
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4905
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4906
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4906
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4907
        my $amountoutstanding =
4907
        my $amountoutstanding =
4908
            C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
4908
            C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
4909
            ? $patron->account->balance
4909
            ? $patron->account->balance
(-)a/circ/renew.pl (-1 / +1 lines)
Lines 68-74 if ( $op eq 'cud-renew' && $barcode ) { Link Here
68
            $patron = $checkout->patron;
68
            $patron = $checkout->patron;
69
69
70
            $balance = $patron->account->balance;
70
            $balance = $patron->account->balance;
71
            my $amountlimit = C4::Context->preference("OPACFineNoRenewals");
71
            my $amountlimit = C4::Context->preference("FineNoRenewals");
72
72
73
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
73
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
74
                my $can_renew;
74
                my $can_renew;
(-)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 (-2 / +3 lines)
Lines 290-295 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
290
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
290
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
291
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
291
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
292
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
292
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
293
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
293
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
294
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
294
('ForcePasswordResetWhenSetByStaff','0',NULL,'Force a staff created patron account to reset its password after its first OPAC login.','YesNo'),
295
('ForcePasswordResetWhenSetByStaff','0',NULL,'Force a staff created patron account to reset its password after its first OPAC login.','YesNo'),
295
('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
296
('FRBRizeEditions','0','','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 504-511 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
504
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
505
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
505
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
506
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
506
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
507
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
507
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
508
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
508
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
509
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
509
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
510
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
510
('OPACFRBRizeEditions','0','','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'),
511
('OPACFRBRizeEditions','0','','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'),
511
('OpacHiddenItems','','','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'),
512
('OpacHiddenItems','','','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 496-502 Circulation: Link Here
496
                  blockitem: block renewing only for this item.
496
                  blockitem: block renewing only for this item.
497
                  block: block renewing for all the patron's items.
497
                  block: block renewing for all the patron's items.
498
        -
498
        -
499
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
499
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
500
            - pref: OPACFineNoRenewalsBlockAutoRenew
500
            - pref: OPACFineNoRenewalsBlockAutoRenew
501
              choices:
501
              choices:
502
                  1: block
502
                  1: block
Lines 561-566 Circulation: Link Here
561
                  open: "extend the loan period and set the checkout to be due at the library's open time."
561
                  open: "extend the loan period and set the checkout to be due at the library's open time."
562
                  close: "shorten the loan period and set the checkout to be due at the library's close time."
562
                  close: "shorten the loan period and set the checkout to be due at the library's close time."
563
                  ignore: "do not consider the library's opening hours."
563
                  ignore: "do not consider the library's opening hours."
564
        -
565
            - Only allow patrons or staff to renew items if patron has less than
566
            - pref: FineNoRenewals
567
              class: currency
568
            - [% local_currency %] in fines (leave blank to disable).
564
    Lost item policy:
569
    Lost item policy:
565
        -
570
        -
566
            - By default, set the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> value of an item to
571
            - 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 652-669 OPAC: Link Here
652
                  none: "NULL"
652
                  none: "NULL"
653
                  opacrenew: "'OPACRenew'"
653
                  opacrenew: "'OPACRenew'"
654
            - as branchcode to store in the statistics table for renewals done in the OPAC.
654
            - as branchcode to store in the statistics table for renewals done in the OPAC.
655
        -
656
            - Only allow patrons to renew their own checkouts on the OPAC if they have less than
657
            - pref: OPACFineNoRenewals
658
              class: currency
659
            - '[% local_currency %] in charges (leave blank to disable).'
660
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
661
        -
655
        -
662
            - pref: OPACFineNoRenewalsIncludeCredits
656
            - pref: OPACFineNoRenewalsIncludeCredits
663
              choices:
657
              choices:
664
                  1: Include
658
                  1: Include
665
                  0: "Don't include"
659
                  0: "Don't include"
666
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
660
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
667
        -
661
        -
668
            - pref: OpacHiddenItems
662
            - pref: OpacHiddenItems
669
              type: textarea
663
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1135-1141 Link Here
1135
1135
1136
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1136
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1137
1137
1138
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1138
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1139
        var fines = "[% fines | $Price %]";
1139
        var fines = "[% fines | $Price %]";
1140
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1140
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1141
1141
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 807-813 Link Here
807
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
807
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
808
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
808
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
809
809
810
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
810
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
811
        var fines = "[% fines | $Price %]";
811
        var fines = "[% fines | $Price %]";
812
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
812
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
813
813
(-)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 1349-1357 subtest "CanBookBeRenewed tests" => sub { Link Here
1349
                }
1349
                }
1350
            }
1350
            }
1351
        );
1351
        );
1352
        C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' );
1352
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1353
        C4::Context->set_preference( 'OPACFineNoRenewals',               '10' );
1353
        C4::Context->set_preference('FineNoRenewals','10');
1354
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' );
1354
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1355
        my $fines_amount = 5;
1355
        my $fines_amount = 5;
1356
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1356
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1357
        $account->add_debit(
1357
        $account->add_debit(
Lines 1363-1371 subtest "CanBookBeRenewed tests" => sub { Link Here
1363
                description => "Some fines"
1363
                description => "Some fines"
1364
            }
1364
            }
1365
        )->status('RETURNED')->store;
1365
        )->status('RETURNED')->store;
1366
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1366
        ( $renewokay, $error ) =
1367
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1367
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1368
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1368
        is( $error,     'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1369
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1369
1370
1370
        $account->add_debit(
1371
        $account->add_debit(
1371
            {
1372
            {
Lines 1376-1384 subtest "CanBookBeRenewed tests" => sub { Link Here
1376
                description => "Some fines"
1377
                description => "Some fines"
1377
            }
1378
            }
1378
        )->status('RETURNED')->store;
1379
        )->status('RETURNED')->store;
1379
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1380
        ( $renewokay, $error ) =
1381
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1380
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1382
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1381
        is( $error,     'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1383
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1382
1384
1383
        $account->add_debit(
1385
        $account->add_debit(
1384
            {
1386
            {
Lines 1389-1397 subtest "CanBookBeRenewed tests" => sub { Link Here
1389
                description => "Some fines"
1391
                description => "Some fines"
1390
            }
1392
            }
1391
        )->status('RETURNED')->store;
1393
        )->status('RETURNED')->store;
1392
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1394
        ( $renewokay, $error ) =
1393
        is( $renewokay, 0,                      'Do not renew, renewal is automatic' );
1395
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1394
        is( $error,     'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1396
        is( $renewokay, 0,                       'Do not renew, renewal is automatic' );
1397
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1395
1398
1396
        $account->add_credit(
1399
        $account->add_credit(
1397
            {
1400
            {
Lines 1405-1411 subtest "CanBookBeRenewed tests" => sub { Link Here
1405
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1408
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1406
        is(
1409
        is(
1407
            $error, 'auto_renew',
1410
            $error, 'auto_renew',
1408
            'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1411
            'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1409
        );
1412
        );
1410
1413
1411
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
1414
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
Lines 1413-1419 subtest "CanBookBeRenewed tests" => sub { Link Here
1413
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1416
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1414
        is(
1417
        is(
1415
            $error, 'auto_too_much_oweing',
1418
            $error, 'auto_too_much_oweing',
1416
            'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1419
            'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1417
        );
1420
        );
1418
1421
1419
        $dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
1422
        $dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
1420
- 

Return to bug 23415