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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 4439-4445 sub _CanBookBeAutoRenewed { Link Here
4439
    }
4439
    }
4440
4440
4441
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4441
    if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
4442
        my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
4442
        my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
4443
        my $amountoutstanding =
4443
        my $amountoutstanding =
4444
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4444
          C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
4445
          ? $patron->account->balance
4445
          ? $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 530-536 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
530
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
530
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
531
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
531
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
532
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
532
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
533
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in OPACFineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
533
('OPACFineNoRenewalsIncludeCredits','1',NULL,'If enabled the value specified in FineNoRenewals should include any unapplied account credits in the calculation','YesNo'),
534
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
534
('OPACShowOpenURL', '0', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
535
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
535
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
536
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
536
('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 588-605 OPAC: Link Here
588
                  none: "NULL"
588
                  none: "NULL"
589
                  opacrenew: "'OPACRenew'"
589
                  opacrenew: "'OPACRenew'"
590
            - as branchcode to store in the statistics table.
590
            - as branchcode to store in the statistics table.
591
        -
592
            - Only allow patrons to renew their own books on the OPAC if they have less than
593
            - pref: OPACFineNoRenewals
594
              class: currency
595
            - '[% local_currency %] in fines (leave blank to disable).
596
            - <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with fines from staff interface.'
597
        -
591
        -
598
            - pref: OPACFineNoRenewalsIncludeCredits
592
            - pref: OPACFineNoRenewalsIncludeCredits
599
              choices:
593
              choices:
600
                  1: Include
594
                  1: Include
601
                  0: "Don't include"
595
                  0: "Don't include"
602
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
596
            - outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
603
        -
597
        -
604
            - pref: OpacHiddenItems
598
            - pref: OpacHiddenItems
605
              type: textarea
599
              type: textarea
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +1 lines)
Lines 1090-1096 Link Here
1090
1090
1091
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1091
        [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
1092
1092
1093
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
1093
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
1094
        var fines = "[% fines | html %]";
1094
        var fines = "[% fines | html %]";
1095
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1095
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
1096
1096
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 893-899 Link Here
893
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
893
        table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
894
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
894
        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
895
895
896
        var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
896
        var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
897
        var fines = "[% fines | html %]";
897
        var fines = "[% fines | html %]";
898
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
898
        var MSG_CONFRIM_RENEW = _("The patron has a debt of %s.\n Are you sure you want to renew checkout(s)?").format(fines);
899
899
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 126-132 if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { Link Here
126
}
126
}
127
127
128
my $amountoutstanding = $patron->account->balance;
128
my $amountoutstanding = $patron->account->balance;
129
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
129
my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' );
130
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
130
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
131
my $amountoutstandingfornewal =
131
my $amountoutstandingfornewal =
132
  C4::Context->preference("OPACFineNoRenewalsIncludeCredit")
132
  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