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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 2823-2829 sub CanBookBeRenewed { Link Here
2823
            }
2823
            }
2824
2824
2825
            if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
2825
            if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
2826
                my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
2826
                my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
2827
                my $amountoutstanding =
2827
                my $amountoutstanding =
2828
                  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
2828
                  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
2829
                  ? $patron->account->balance
2829
                  ? $patron->account->balance
(-)a/circ/renew.pl (-1 / +1 lines)
Lines 69-75 if ($barcode) { Link Here
69
            $borrower = $issue->borrower();
69
            $borrower = $issue->borrower();
70
            my $patron = Koha::Patrons->find($borrower->borrowernumber);
70
            my $patron = Koha::Patrons->find($borrower->borrowernumber);
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 ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
74
            if ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
75
                my $can_renew;
75
                my $can_renew;
(-)a/installer/data/mysql/atomicupdate/Bug_23415-Rename_OPACFineNoRenewals.perl (+12 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
5
6
    $dbh->do(q{
7
        UPDATE systempreferences SET variable = "FineNoRenewals" where variable = "OPACFineNoRenewals";
8
    });
9
10
    # Always end with this (adjust the bug info)
11
    NewVersion( $DBversion, 23415, "Rename OPACFineNoRenewals");
12
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-3 / +3 lines)
Lines 218-223 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
218
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
218
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
219
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
219
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
220
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
220
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
221
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
221
('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'),
222
('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'),
222
('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
223
('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
223
('TaxRates','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'),
224
('TaxRates','0','','Default Goods and Services tax rate NOT in %, but in numeric form (0.12 for 12%), set to 0 to disable GST','Integer'),
Lines 338-344 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
338
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
339
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
339
('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'),
340
('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'),
340
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
341
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
341
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
342
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
342
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
343
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
343
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
344
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
344
('MaxSearchResultsItemsPerRecordStatusCheck','20','','Max number of items per record for which to check transit and hold status','Integer'),
345
('MaxSearchResultsItemsPerRecordStatusCheck','20','','Max number of items per record for which to check transit and hold status','Integer'),
Lines 407-413 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
407
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
408
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
408
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
409
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
409
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
410
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
410
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
411
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
411
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
412
('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'),
412
('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'),
413
('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'),
413
('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 492-498 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
492
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
492
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
493
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
493
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
494
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
494
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
495
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
495
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
496
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
496
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
497
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
497
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
498
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
498
('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 519-525 Circulation: Link Here
519
                  0: allow
519
                  0: allow
520
            - renewing of items.
520
            - renewing of items.
521
        -
521
        -
522
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
522
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
523
            - pref: OPACFineNoRenewalsBlockAutoRenew
523
            - pref: OPACFineNoRenewalsBlockAutoRenew
524
              choices:
524
              choices:
525
                  1: block
525
                  1: block
Lines 551-556 Circulation: Link Here
551
            - "<br />ccode: [NEWFIC,NULL,DVD]"
551
            - "<br />ccode: [NEWFIC,NULL,DVD]"
552
            - "<br />itype: [NEWBK,\"\"]"
552
            - "<br />itype: [NEWBK,\"\"]"
553
            - "<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."
553
            - "<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."
554
        -
555
            - Only allow patrons or staff to renew items if patron has less than
556
            - pref: FineNoRenewals
557
              class: currency
558
            - [% local_currency %] in fines (leave blank to disable).
554
    Checkin policy:
559
    Checkin policy:
555
        -
560
        -
556
            - pref: TrapHoldsOnOrder
561
            - pref: TrapHoldsOnOrder
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-7 / +1 lines)
Lines 597-614 OPAC: Link Here
597
                  none: "NULL"
597
                  none: "NULL"
598
                  opacrenew: "'OPACRenew'"
598
                  opacrenew: "'OPACRenew'"
599
            - as branchcode to store in the statistics table.
599
            - as branchcode to store in the statistics table.
600
        -
601
            - Only allow patrons to renew their own books on the OPAC if they have less than
602
            - pref: OPACFineNoRenewals
603
              class: currency
604
            - '[% local_currency %] in fines (leave blank to disable).
605
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with fines from staff interface.'
606
        -
600
        -
607
            - pref: OPACFineNoRenewalsIncludeCredits
601
            - pref: OPACFineNoRenewalsIncludeCredits
608
              choices:
602
              choices:
609
                  1: Include
603
                  1: Include
610
                  0: "Don't include"
604
                  0: "Don't include"
611
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
605
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
612
        -
606
        -
613
            - pref: OPACViewOthersSuggestions
607
            - pref: OPACViewOthersSuggestions
614
              choices:
608
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1212-1218 Link Here
1212
1212
1213
        [% UNLESS ( patron.borrowernumber ) %][% UNLESS ( borrowers ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
1213
        [% UNLESS ( patron.borrowernumber ) %][% UNLESS ( borrowers ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
1214
1214
1215
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1215
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1216
        var fines = "[% fines | html %]";
1216
        var fines = "[% fines | html %]";
1217
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1217
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1218
1218
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 965-971 Link Here
965
965
966
        columns_settings_issues_table = [% TablesSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
966
        columns_settings_issues_table = [% TablesSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
967
967
968
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
968
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
969
        var fines = "[% fines | html %]";
969
        var fines = "[% fines | html %]";
970
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
970
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
971
971
(-)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 1071-1077 subtest "CanBookBeRenewed tests" => sub { Link Here
1071
            }
1071
            }
1072
        );
1072
        );
1073
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1073
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1074
        C4::Context->set_preference('OPACFineNoRenewals','10');
1074
        C4::Context->set_preference('FineNoRenewals','10');
1075
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1075
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1076
        my $fines_amount = 5;
1076
        my $fines_amount = 5;
1077
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
1077
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
Lines 1087-1093 subtest "CanBookBeRenewed tests" => sub { Link Here
1087
        ( $renewokay, $error ) =
1087
        ( $renewokay, $error ) =
1088
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1088
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1089
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1089
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1090
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1090
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1091
1091
1092
        $account->add_debit(
1092
        $account->add_debit(
1093
            {
1093
            {
Lines 1101-1107 subtest "CanBookBeRenewed tests" => sub { Link Here
1101
        ( $renewokay, $error ) =
1101
        ( $renewokay, $error ) =
1102
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1102
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1103
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1103
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1104
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1104
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1105
1105
1106
        $account->add_debit(
1106
        $account->add_debit(
1107
            {
1107
            {
Lines 1115-1121 subtest "CanBookBeRenewed tests" => sub { Link Here
1115
        ( $renewokay, $error ) =
1115
        ( $renewokay, $error ) =
1116
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1116
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1117
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1117
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1118
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1118
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1119
1119
1120
        $account->add_credit(
1120
        $account->add_credit(
1121
            {
1121
            {
Lines 1128-1140 subtest "CanBookBeRenewed tests" => sub { Link Here
1128
        ( $renewokay, $error ) =
1128
        ( $renewokay, $error ) =
1129
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1129
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1130
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1130
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1131
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1131
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1132
1132
1133
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1133
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1134
        ( $renewokay, $error ) =
1134
        ( $renewokay, $error ) =
1135
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1135
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1136
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1136
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1137
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1137
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1138
1138
1139
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1139
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1140
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1140
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1141
- 

Return to bug 23415