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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4675-4681 sub _CanBookBeAutoRenewed { Link Here
4675
    }
4675
    }
4676
4676
4677
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4677
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4678
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4678
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4679
        my $amountoutstanding =
4679
        my $amountoutstanding =
4680
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4680
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4681
          ? $patron->account->balance
4681
          ? $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 280-285 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
280
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
280
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
281
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
281
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
282
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
282
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
283
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
283
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
284
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
284
('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'),
285
('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'),
285
('GenerateAuthorityField667', 'Machine generated authority record', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records', 'free'),
286
('GenerateAuthorityField667', 'Machine generated authority record', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records', 'free'),
Lines 483-490 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
483
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
484
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
484
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
485
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
485
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
486
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
486
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
487
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
487
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
488
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
488
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
489
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
489
('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'),
490
('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'),
490
('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'),
491
('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://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 497-503 Circulation: Link Here
497
                  blockitem: block renewing only for this item.
497
                  blockitem: block renewing only for this item.
498
                  block: block renewing for all the patron's items.
498
                  block: block renewing for all the patron's items.
499
        -
499
        -
500
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
500
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
501
            - pref: OPACFineNoRenewalsBlockAutoRenew
501
            - pref: OPACFineNoRenewalsBlockAutoRenew
502
              choices:
502
              choices:
503
                  1: block
503
                  1: block
Lines 562-567 Circulation: Link Here
562
                  open: "extend the loan period and set the checkout to be due at the library's open time."
562
                  open: "extend the loan period and set the checkout to be due at the library's open time."
563
                  close: "shorten the loan period and set the checkout to be due at the library's close time."
563
                  close: "shorten the loan period and set the checkout to be due at the library's close time."
564
                  ignore: "do not consider the library's opening hours."
564
                  ignore: "do not consider the library's opening hours."
565
        -
566
            - Only allow patrons or staff to renew items if patron has less than
567
            - pref: FineNoRenewals
568
              class: currency
569
            - [% local_currency %] in fines (leave blank to disable).
565
    Lost item policy:
570
    Lost item policy:
566
        -
571
        -
567
            - By default, set the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> value of an item to
572
            - 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 612-629 OPAC: Link Here
612
                  none: "NULL"
612
                  none: "NULL"
613
                  opacrenew: "'OPACRenew'"
613
                  opacrenew: "'OPACRenew'"
614
            - as branchcode to store in the statistics table.
614
            - as branchcode to store in the statistics table.
615
        -
616
            - Only allow patrons to renew their own checkouts on the OPAC if they have less than
617
            - pref: OPACFineNoRenewals
618
              class: currency
619
            - '[% local_currency %] in charges (leave blank to disable).'
620
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
621
        -
615
        -
622
            - pref: OPACFineNoRenewalsIncludeCredits
616
            - pref: OPACFineNoRenewalsIncludeCredits
623
              choices:
617
              choices:
624
                  1: Include
618
                  1: Include
625
                  0: "Don't include"
619
                  0: "Don't include"
626
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
620
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
627
        -
621
        -
628
            - pref: OpacHiddenItems
622
            - pref: OpacHiddenItems
629
              type: textarea
623
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1045-1051 Link Here
1045
1045
1046
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1046
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1047
1047
1048
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1048
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1049
        var fines = "[% fines | $Price %]";
1049
        var fines = "[% fines | $Price %]";
1050
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1050
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
1051
1051
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 782-788 Link Here
782
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
782
        CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
783
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
783
        patron_borrowernumber = [% patron.borrowernumber | $raw %]
784
784
785
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
785
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
786
        var fines = "[% fines | $Price %]";
786
        var fines = "[% fines | $Price %]";
787
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
787
        var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
788
788
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 122-128 if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { Link Here
122
}
122
}
123
123
124
my $amountoutstanding = $patron->account->balance;
124
my $amountoutstanding = $patron->account->balance;
125
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
125
my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' );
126
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
126
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
127
my $amountoutstandingfornewal =
127
my $amountoutstandingfornewal =
128
  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
128
  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
(-)a/t/db_dependent/Circulation.t (-7 / +6 lines)
Lines 1290-1296 subtest "CanBookBeRenewed tests" => sub { Link Here
1290
            }
1290
            }
1291
        );
1291
        );
1292
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1292
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1293
        C4::Context->set_preference('OPACFineNoRenewals','10');
1293
        C4::Context->set_preference('FineNoRenewals','10');
1294
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1294
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1295
        my $fines_amount = 5;
1295
        my $fines_amount = 5;
1296
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
1296
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
Lines 1306-1312 subtest "CanBookBeRenewed tests" => sub { Link Here
1306
        ( $renewokay, $error ) =
1306
        ( $renewokay, $error ) =
1307
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1307
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1308
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1308
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1309
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1309
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1310
1310
1311
        $account->add_debit(
1311
        $account->add_debit(
1312
            {
1312
            {
Lines 1320-1326 subtest "CanBookBeRenewed tests" => sub { Link Here
1320
        ( $renewokay, $error ) =
1320
        ( $renewokay, $error ) =
1321
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1321
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1322
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1322
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1323
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1323
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1324
1324
1325
        $account->add_debit(
1325
        $account->add_debit(
1326
            {
1326
            {
Lines 1334-1340 subtest "CanBookBeRenewed tests" => sub { Link Here
1334
        ( $renewokay, $error ) =
1334
        ( $renewokay, $error ) =
1335
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1335
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1336
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1336
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1337
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1337
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1338
1338
1339
        $account->add_credit(
1339
        $account->add_credit(
1340
            {
1340
            {
Lines 1347-1359 subtest "CanBookBeRenewed tests" => sub { Link Here
1347
        ( $renewokay, $error ) =
1347
        ( $renewokay, $error ) =
1348
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1348
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1349
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1349
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1350
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1350
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1351
1351
1352
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1352
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1353
        ( $renewokay, $error ) =
1353
        ( $renewokay, $error ) =
1354
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1354
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1355
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1355
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1356
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1356
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1357
1357
1358
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1358
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1359
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1359
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1360
- 

Return to bug 23415