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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4486-4492 sub _CanBookBeAutoRenewed { Link Here
4486
    }
4486
    }
4487
4487
4488
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4488
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4489
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4489
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4490
        my $amountoutstanding =
4490
        my $amountoutstanding =
4491
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4491
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4492
          ? $patron->account->balance
4492
          ? $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-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 237-242 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
237
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
237
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
238
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
238
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
239
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
239
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines).  Requires accruefines cronjob.','Choice'),
240
('FineNoRenewals','100','','Fine limit above which user or staff cannot renew items','Integer'),
240
('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'),
241
('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'),
241
('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
242
('GDPR_Policy','','Enforced|Permissive|Disabled','General Data Protection Regulation - policy', 'Choice'),
242
('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'),
243
('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 360-366 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
360
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
361
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
361
('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'),
362
('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'),
362
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
363
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
363
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than OPACFineNoRenewals','YesNo'),
364
('OPACFineNoRenewalsBlockAutoRenew','0','','Block/Allow auto renewals if the patron owe more than FineNoRenewals','YesNo'),
364
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
365
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
365
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
366
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
366
('MaxSearchResultsItemsPerRecordStatusCheck','20','','Max number of items per record for which to check transit and hold status','Integer'),
367
('MaxSearchResultsItemsPerRecordStatusCheck','20','','Max number of items per record for which to check transit and hold status','Integer'),
Lines 430-436 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
430
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
431
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd','','Define export options available on OPAC detail page.','multiple'),
431
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
432
('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes'),
432
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
433
('OpacFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','free'),
433
('OPACFineNoRenewals','100','','Fine limit above which user cannot renew books via OPAC','Integer'),
434
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
434
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
435
('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'),
435
('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'),
436
('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'),
436
('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 515-521 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
515
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
515
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
516
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
516
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
517
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
517
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
518
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
518
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
519
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
519
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
520
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
520
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
521
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
521
('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 534-540 Circulation: Link Here
534
                  0: allow
534
                  0: allow
535
            - renewing of items from the staff interface and via the <code>misc/cronjobs/automatic_renewals.pl</code> cronjob.
535
            - renewing of items from the staff interface and via the <code>misc/cronjobs/automatic_renewals.pl</code> cronjob.
536
        -
536
        -
537
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
537
            - If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
538
            - pref: OPACFineNoRenewalsBlockAutoRenew
538
            - pref: OPACFineNoRenewalsBlockAutoRenew
539
              choices:
539
              choices:
540
                  1: block
540
                  1: block
Lines 566-571 Circulation: Link Here
566
            - "<br />ccode: [NEWFIC,NULL,DVD]"
566
            - "<br />ccode: [NEWFIC,NULL,DVD]"
567
            - "<br />itype: [NEWBK,\"\"]"
567
            - "<br />itype: [NEWBK,\"\"]"
568
            - "<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."
568
            - "<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."
569
        -
570
            - Only allow patrons or staff to renew items if patron has less than
571
            - pref: FineNoRenewals
572
              class: currency
573
            - [% local_currency %] in fines (leave blank to disable).
569
    Checkin policy:
574
    Checkin policy:
570
        -
575
        -
571
            - pref: TrapHoldsOnOrder
576
            - pref: TrapHoldsOnOrder
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-7 / +1 lines)
Lines 593-610 OPAC: Link Here
593
                  none: "NULL"
593
                  none: "NULL"
594
                  opacrenew: "'OPACRenew'"
594
                  opacrenew: "'OPACRenew'"
595
            - as branchcode to store in the statistics table.
595
            - as branchcode to store in the statistics table.
596
        -
597
            - Only allow patrons to renew their own books on the OPAC if they have less than
598
            - pref: OPACFineNoRenewals
599
              class: currency
600
            - '[% local_currency %] in fines (leave blank to disable).
601
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with fines from staff interface.'
602
        -
596
        -
603
            - pref: OPACFineNoRenewalsIncludeCredits
597
            - pref: OPACFineNoRenewalsIncludeCredits
604
              choices:
598
              choices:
605
                  1: Include
599
                  1: Include
606
                  0: "Don't include"
600
                  0: "Don't include"
607
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
601
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
608
        -
602
        -
609
            - pref: OPACViewOthersSuggestions
603
            - pref: OPACViewOthersSuggestions
610
              choices:
604
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1076-1082 Link Here
1076
1076
1077
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1077
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1078
1078
1079
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1079
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1080
        var fines = "[% fines | html %]";
1080
        var fines = "[% fines | html %]";
1081
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1081
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1082
1082
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 876-882 Link Here
876
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
876
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
877
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
877
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
878
878
879
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
879
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
880
        var fines = "[% fines | html %]";
880
        var fines = "[% fines | html %]";
881
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
881
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
882
882
(-)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 1072-1078 subtest "CanBookBeRenewed tests" => sub { Link Here
1072
            }
1072
            }
1073
        );
1073
        );
1074
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1074
        C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
1075
        C4::Context->set_preference('OPACFineNoRenewals','10');
1075
        C4::Context->set_preference('FineNoRenewals','10');
1076
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1076
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1077
        my $fines_amount = 5;
1077
        my $fines_amount = 5;
1078
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
1078
        my $account = Koha::Account->new({patron_id => $renewing_borrowernumber});
Lines 1088-1094 subtest "CanBookBeRenewed tests" => sub { Link Here
1088
        ( $renewokay, $error ) =
1088
        ( $renewokay, $error ) =
1089
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1089
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1090
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1090
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1091
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
1091
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
1092
1092
1093
        $account->add_debit(
1093
        $account->add_debit(
1094
            {
1094
            {
Lines 1102-1108 subtest "CanBookBeRenewed tests" => sub { Link Here
1102
        ( $renewokay, $error ) =
1102
        ( $renewokay, $error ) =
1103
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1103
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1104
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1104
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1105
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
1105
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
1106
1106
1107
        $account->add_debit(
1107
        $account->add_debit(
1108
            {
1108
            {
Lines 1116-1122 subtest "CanBookBeRenewed tests" => sub { Link Here
1116
        ( $renewokay, $error ) =
1116
        ( $renewokay, $error ) =
1117
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1117
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1118
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1118
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1119
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
1119
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
1120
1120
1121
        $account->add_credit(
1121
        $account->add_credit(
1122
            {
1122
            {
Lines 1129-1141 subtest "CanBookBeRenewed tests" => sub { Link Here
1129
        ( $renewokay, $error ) =
1129
        ( $renewokay, $error ) =
1130
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1130
          CanBookBeRenewed( $renewing_borrowernumber, $item_to_auto_renew->itemnumber );
1131
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1131
        is( $renewokay, 0, 'Do not renew, renewal is automatic' );
1132
        is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1132
        is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1133
1133
1134
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
1134
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','0');
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, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1138
        is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredit=1, patron has 15 debt, 5 credit'  );
1139
1139
1140
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1140
        $dbh->do('DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber);
1141
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1141
        C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
1142
- 

Return to bug 23415