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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4984-4990 sub _CanBookBeAutoRenewed { Link Here
4984
    }
4984
    }
4985
4985
4986
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4986
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4987
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4987
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4988
        my $amountoutstanding =
4988
        my $amountoutstanding =
4989
            C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
4989
            C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
4990
            ? $patron->account->balance
4990
            ? $patron->account->balance
(-)a/circ/renew.pl (-1 / +1 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;
(-)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 294-299 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
294
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
294
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
295
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
295
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
296
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
296
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
297
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
297
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
298
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
298
('ForcePasswordResetWhenSetByStaff','0',NULL,'Force a staff created patron account to reset its password after its first OPAC login.','YesNo'),
299
('ForcePasswordResetWhenSetByStaff','0',NULL,'Force a staff created patron account to reset its password after its first OPAC login.','YesNo'),
299
('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'),
300
('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 507-514 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
507
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
508
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
508
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
509
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
509
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
510
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
510
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
511
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
511
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
512
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
512
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
513
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
513
('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'),
514
('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'),
514
('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'),
515
('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 1132-1138 Link Here
1132
1132
1133
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1133
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1134
1134
1135
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1135
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1136
        var fines = "[% fines | $Price %]";
1136
        var fines = "[% fines | $Price %]";
1137
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1137
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1138
1138
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 813-819 Link Here
813
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
813
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
814
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
814
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
815
815
816
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
816
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
817
        var fines = "[% fines | $Price %]";
817
        var fines = "[% fines | $Price %]";
818
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
818
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
819
819
(-)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 1352-1360 subtest "CanBookBeRenewed tests" => sub { Link Here
1352
                }
1352
                }
1353
            }
1353
            }
1354
        );
1354
        );
1355
        C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' );
1355
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1356
        C4::Context->set_preference( 'OPACFineNoRenewals',               '10' );
1356
        C4::Context->set_preference('FineNoRenewals','10');
1357
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' );
1357
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1358
        my $fines_amount = 5;
1358
        my $fines_amount = 5;
1359
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1359
        my $account      = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
1360
        $account->add_debit(
1360
        $account->add_debit(
Lines 1366-1374 subtest "CanBookBeRenewed tests" => sub { Link Here
1366
                description => "Some fines"
1366
                description => "Some fines"
1367
            }
1367
            }
1368
        )->status('RETURNED')->store;
1368
        )->status('RETURNED')->store;
1369
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1369
        ( $renewokay, $error ) =
1370
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1370
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1371
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1371
        is( $error,     'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1372
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1372
1373
1373
        $account->add_debit(
1374
        $account->add_debit(
1374
            {
1375
            {
Lines 1379-1387 subtest "CanBookBeRenewed tests" => sub { Link Here
1379
                description => "Some fines"
1380
                description => "Some fines"
1380
            }
1381
            }
1381
        )->status('RETURNED')->store;
1382
        )->status('RETURNED')->store;
1382
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1383
        ( $renewokay, $error ) =
1384
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1383
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1385
        is( $renewokay, 1,            'Renew, even if renewal is automatic' );
1384
        is( $error,     'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1386
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1385
1387
1386
        $account->add_debit(
1388
        $account->add_debit(
1387
            {
1389
            {
Lines 1392-1400 subtest "CanBookBeRenewed tests" => sub { Link Here
1392
                description => "Some fines"
1394
                description => "Some fines"
1393
            }
1395
            }
1394
        )->status('RETURNED')->store;
1396
        )->status('RETURNED')->store;
1395
        ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
1397
        ( $renewokay, $error ) =
1396
        is( $renewokay, 0,                      'Do not renew, renewal is automatic' );
1398
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1397
        is( $error,     'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1399
        is( $renewokay, 0,                       'Do not renew, renewal is automatic' );
1400
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1398
1401
1399
        $account->add_credit(
1402
        $account->add_credit(
1400
            {
1403
            {
Lines 1408-1414 subtest "CanBookBeRenewed tests" => sub { Link Here
1408
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1411
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1409
        is(
1412
        is(
1410
            $error, 'auto_renew',
1413
            $error, 'auto_renew',
1411
            'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1414
            'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1412
        );
1415
        );
1413
1416
1414
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
1417
        C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
Lines 1416-1422 subtest "CanBookBeRenewed tests" => sub { Link Here
1416
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1419
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1417
        is(
1420
        is(
1418
            $error, 'auto_too_much_oweing',
1421
            $error, 'auto_too_much_oweing',
1419
            'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1422
            'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
1420
        );
1423
        );
1421
1424
1422
        $dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
1425
        $dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
1423
- 

Return to bug 23415