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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4601-4607 sub _CanBookBeAutoRenewed { Link Here
4601
    }
4601
    }
4602
4602
4603
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4603
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4604
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4604
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4605
        my $amountoutstanding =
4605
        my $amountoutstanding =
4606
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4606
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4607
          ? $patron->account->balance
4607
          ? $patron->account->balance
(-)a/circ/renew.pl (-1 / +1 lines)
Lines 67-73 if ($barcode) { Link Here
67
            $patron = $checkout->patron;
67
            $patron = $checkout->patron;
68
68
69
            $balance = $patron->account->balance;
69
            $balance = $patron->account->balance;
70
            my $amountlimit = C4::Context->preference("OPACFineNoRenewals");
70
            my $amountlimit = C4::Context->preference("FineNoRenewals");
71
71
72
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
72
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
73
                my $can_renew;
73
                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 271-276 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
271
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
271
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
272
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
272
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
273
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
273
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
274
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
274
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
275
('ForceLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
275
('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'),
276
('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'),
276
('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'),
277
('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 474-481 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
474
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
475
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
475
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
476
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
476
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
477
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
477
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
478
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
478
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
479
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
479
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
480
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
480
('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'),
481
('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'),
481
('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'),
482
('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 513-519 Circulation: Link Here
513
                  blockitem: block renewing only for this item.
513
                  blockitem: block renewing only for this item.
514
                  block: block renewing for all the patron's items.
514
                  block: block renewing for all the patron's items.
515
        -
515
        -
516
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
516
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
517
            - pref: OPACFineNoRenewalsBlockAutoRenew
517
            - pref: OPACFineNoRenewalsBlockAutoRenew
518
              choices:
518
              choices:
519
                  1: block
519
                  1: block
Lines 571-576 Circulation: Link Here
571
            - This is a list of value pairs. When an item is checked out, if the not for loan value on the left matches the items not for loan value
571
            - This is a list of value pairs. When an item is checked out, if the not for loan value on the left matches the items not for loan value
572
            - "it will be updated to the right-hand value. For example, '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan."
572
            - "it will be updated to the right-hand value. For example, '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan."
573
            - Each pair of values should be on a separate line.
573
            - Each pair of values should be on a separate line.
574
        -
575
            - Only allow patrons or staff to renew items if patron has less than
576
            - pref: FineNoRenewals
577
              class: currency
578
            - [% local_currency %] in fines (leave blank to disable).
574
    Checkin policy:
579
    Checkin policy:
575
        -
580
        -
576
            - pref: TrapHoldsOnOrder
581
            - pref: TrapHoldsOnOrder
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-7 / +1 lines)
Lines 591-608 OPAC: Link Here
591
                  none: "NULL"
591
                  none: "NULL"
592
                  opacrenew: "'OPACRenew'"
592
                  opacrenew: "'OPACRenew'"
593
            - as branchcode to store in the statistics table.
593
            - as branchcode to store in the statistics table.
594
        -
595
            - Only allow patrons to renew their own books on the OPAC if they have less than
596
            - pref: OPACFineNoRenewals
597
              class: currency
598
            - '[% local_currency %] in charges (leave blank to disable).'
599
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
600
        -
594
        -
601
            - pref: OPACFineNoRenewalsIncludeCredits
595
            - pref: OPACFineNoRenewalsIncludeCredits
602
              choices:
596
              choices:
603
                  1: Include
597
                  1: Include
604
                  0: "Don't include"
598
                  0: "Don't include"
605
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
599
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
606
        -
600
        -
607
            - pref: OpacHiddenItems
601
            - pref: OpacHiddenItems
608
              type: textarea
602
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1006-1012 Link Here
1006
1006
1007
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1007
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1008
1008
1009
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1009
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1010
        var fines = "[% fines | html %]";
1010
        var fines = "[% fines | html %]";
1011
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1011
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1012
1012
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 730-736 Link Here
730
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
730
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
731
        table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
731
        table_settings_holds_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'holds-table', 'json' ) | $raw %]
732
732
733
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
733
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
734
        var fines = "[% fines | html %]";
734
        var fines = "[% fines | html %]";
735
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
735
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
736
736
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 127-133 if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { Link Here
127
}
127
}
128
128
129
my $amountoutstanding = $patron->account->balance;
129
my $amountoutstanding = $patron->account->balance;
130
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
130
my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' );
131
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
131
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
132
my $amountoutstandingfornewal =
132
my $amountoutstandingfornewal =
133
  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
133
  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
(-)a/t/db_dependent/Circulation.t (-7 / +6 lines)
Lines 1184-1190 subtest "CanBookBeRenewed tests" => sub { Link Here
1184
            }
1184
            }
1185
        );
1185
        );
1186
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1186
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1187
        C4::Context->set_preference('OPACFineNoRenewals','10');
1187
        C4::Context->set_preference('FineNoRenewals','10');
1188
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1188
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1189
        my $fines_amount = 5;
1189
        my $fines_amount = 5;
1190
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
1190
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
Lines 1200-1206 subtest "CanBookBeRenewed tests" => sub { Link Here
1200
        ( $renewokay, $error ) =
1200
        ( $renewokay, $error ) =
1201
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1201
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1202
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1202
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1203
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1203
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1204
1204
1205
        $account->add_debit(
1205
        $account->add_debit(
1206
            {
1206
            {
Lines 1214-1220 subtest "CanBookBeRenewed tests" => sub { Link Here
1214
        ( $renewokay, $error ) =
1214
        ( $renewokay, $error ) =
1215
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1215
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1216
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1216
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1217
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1217
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1218
1218
1219
        $account->add_debit(
1219
        $account->add_debit(
1220
            {
1220
            {
Lines 1228-1234 subtest "CanBookBeRenewed tests" => sub { Link Here
1228
        ( $renewokay, $error ) =
1228
        ( $renewokay, $error ) =
1229
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1229
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1230
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1230
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1231
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1231
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1232
1232
1233
        $account->add_credit(
1233
        $account->add_credit(
1234
            {
1234
            {
Lines 1241-1253 subtest "CanBookBeRenewed tests" => sub { Link Here
1241
        ( $renewokay, $error ) =
1241
        ( $renewokay, $error ) =
1242
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1242
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1243
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1243
        is( $renewokay, 1, 'Renew, even if renewal is automatic' );
1244
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1244
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1245
1245
1246
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1246
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1247
        ( $renewokay, $error ) =
1247
        ( $renewokay, $error ) =
1248
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1248
          CanBookBeRenewed( $renewing_borrower_obj, $issue );
1249
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1249
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1250
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1250
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1251
1251
1252
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1252
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1253
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1253
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1254
- 

Return to bug 23415