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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4432-4438 sub _CanBookBeAutoRenewed { Link Here
4432
    }
4432
    }
4433
4433
4434
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4434
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4435
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4435
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4436
        my $amountoutstanding =
4436
        my $amountoutstanding =
4437
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4437
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4438
          ? $patron->account->balance
4438
          ? $patron->account->balance
(-)a/circ/renew.pl (-1 / +1 lines)
Lines 67-73 if ($barcode) { Link Here
67
            $borrower = $issue->patron();
67
            $borrower = $issue->patron();
68
            my $patron = Koha::Patrons->find($borrower->borrowernumber);
68
            my $patron = Koha::Patrons->find($borrower->borrowernumber);
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 ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
72
            if ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
73
                my $can_renew;
73
                my $can_renew;
(-)a/installer/data/mysql/atomicupdate/bug_23415.pl (+16 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(q{
11
            UPDATE systempreferences SET variable = "FineNoRenewals", explanation = "Fine limit above which user or staff cannot renew items" WHERE variable = "OPACFineNoRenewals";
12
        });
13
14
        say $out "Updated system preference 'OPACFineNoRenewals'";
15
    },
16
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-3 / +3 lines)
Lines 249-254 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
249
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
249
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
250
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
250
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
251
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
251
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
252
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
252
('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'),
253
('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'),
253
('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
254
('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
254
('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'),
255
('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 373-379 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
373
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
374
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
374
('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'),
375
('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'),
375
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
376
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
376
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
377
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
377
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
378
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
378
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
379
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
379
('MaxSearchResultsItemsPerRecordStatusCheck','20','','Max number of items per record for which to check transit and hold status','Integer'),
380
('MaxSearchResultsItemsPerRecordStatusCheck','20','','Max number of items per record for which to check transit and hold status','Integer'),
Lines 445-451 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
445
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
446
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
446
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
447
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
447
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
448
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
448
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
449
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
449
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
450
('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'),
450
('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'),
451
('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'),
451
('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'),
Lines 529-535 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
529
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
529
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
530
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
530
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
531
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
531
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
532
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
532
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
533
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
533
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
534
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
534
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
535
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
535
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 529-535 Circulation: Link Here
529
                  blockitem: block renewing only for this item.
529
                  blockitem: block renewing only for this item.
530
                  block: block renewing for all the patron's items.
530
                  block: block renewing for all the patron's items.
531
        -
531
        -
532
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
532
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
533
            - pref: OPACFineNoRenewalsBlockAutoRenew
533
            - pref: OPACFineNoRenewalsBlockAutoRenew
534
              choices:
534
              choices:
535
                  1: block
535
                  1: block
Lines 561-566 Circulation: Link Here
561
            - "<br />ccode: [NEWFIC,NULL,DVD]"
561
            - "<br />ccode: [NEWFIC,NULL,DVD]"
562
            - "<br />itype: [NEWBK,\"\"]"
562
            - "<br />itype: [NEWBK,\"\"]"
563
            - "<br /> <strong>NOTE:</strong> The word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field."
563
            - "<br /> <strong>NOTE:</strong> The word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field."
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
    Checkin policy:
569
    Checkin policy:
565
        -
570
        -
566
            - pref: TrapHoldsOnOrder
571
            - pref: TrapHoldsOnOrder
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-7 / +1 lines)
Lines 580-597 OPAC: Link Here
580
                  none: "NULL"
580
                  none: "NULL"
581
                  opacrenew: "'OPACRenew'"
581
                  opacrenew: "'OPACRenew'"
582
            - as branchcode to store in the statistics table.
582
            - as branchcode to store in the statistics table.
583
        -
584
            - Only allow patrons to renew their own books on the OPAC if they have less than
585
            - pref: OPACFineNoRenewals
586
              class: currency
587
            - '[% local_currency %] in fines (leave blank to disable).
588
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with fines from staff interface.'
589
        -
583
        -
590
            - pref: OPACFineNoRenewalsIncludeCredits
584
            - pref: OPACFineNoRenewalsIncludeCredits
591
              choices:
585
              choices:
592
                  1: Include
586
                  1: Include
593
                  0: "Don't include"
587
                  0: "Don't include"
594
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
588
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
595
        -
589
        -
596
            - pref: OpacHiddenItems
590
            - pref: OpacHiddenItems
597
              type: textarea
591
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1089-1095 Link Here
1089
1089
1090
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1090
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1091
1091
1092
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1092
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1093
        var fines = "[% fines | html %]";
1093
        var fines = "[% fines | html %]";
1094
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1094
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1095
1095
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 892-898 Link Here
892
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
892
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
893
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
893
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
894
894
895
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
895
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
896
        var fines = "[% fines | html %]";
896
        var fines = "[% fines | html %]";
897
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
897
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
898
898
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 125-131 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("OPACFineNoRenewalsIncludeCredit")
131
  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
(-)a/t/db_dependent/Circulation.t (-7 / +6 lines)
Lines 1091-1097 subtest "CanBookBeRenewed tests" => sub { Link Here
1091
            }
1091
            }
1092
        );
1092
        );
1093
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1093
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1094
        C4::Context->set_preference('OPACFineNoRenewals','10');
1094
        C4::Context->set_preference('FineNoRenewals','10');
1095
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1095
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1096
        my $fines_amount = 5;
1096
        my $fines_amount = 5;
1097
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
1097
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
Lines 1107-1113 subtest "CanBookBeRenewed tests" => sub { Link Here
1107
        ( $renewokay, $error ) =
1107
        ( $renewokay, $error ) =
1108
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1108
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1109
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1109
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1110
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1110
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1111
1111
1112
        $account->add_debit(
1112
        $account->add_debit(
1113
            {
1113
            {
Lines 1121-1127 subtest "CanBookBeRenewed tests" => sub { Link Here
1121
        ( $renewokay, $error ) =
1121
        ( $renewokay, $error ) =
1122
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1122
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1123
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1123
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1124
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1124
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1125
1125
1126
        $account->add_debit(
1126
        $account->add_debit(
1127
            {
1127
            {
Lines 1135-1141 subtest "CanBookBeRenewed tests" => sub { Link Here
1135
        ( $renewokay, $error ) =
1135
        ( $renewokay, $error ) =
1136
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1136
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1137
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1137
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1138
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1138
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1139
1139
1140
        $account->add_credit(
1140
        $account->add_credit(
1141
            {
1141
            {
Lines 1148-1160 subtest "CanBookBeRenewed tests" => sub { Link Here
1148
        ( $renewokay, $error ) =
1148
        ( $renewokay, $error ) =
1149
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1149
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1150
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1150
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1151
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1151
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1152
1152
1153
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1153
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1154
        ( $renewokay, $error ) =
1154
        ( $renewokay, $error ) =
1155
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1155
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1156
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1156
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1157
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1157
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1158
1158
1159
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1159
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1160
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1160
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1161
- 

Return to bug 23415