Bug 23415: Rename OPACFineNoRenewals
OPACFineNoRenewals no longer applies just to OPAC. To avoid confusion rename it as FineNoRenewals and also rename all occurences in code. To test, confirm everything works as described in previous test plans. Also prove t/db_dependent/Circulation.t Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
2589c5ef9d
commit
00350eacb4
|
|
@ -5043,7 +5043,7 @@ sub _CanBookBeAutoRenewed {
|
|||
}
|
||||
|
||||
if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
|
||||
my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
|
||||
my $fine_no_renewals = C4::Context->preference("FineNoRenewals");
|
||||
my $amountoutstanding =
|
||||
C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
|
||||
? $patron->account->balance
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ if ( $op eq 'cud-renew' && $barcode ) {
|
|||
my $borrowernumber = $patron->borrowernumber;
|
||||
|
||||
$balance = $patron->account->balance;
|
||||
my $amountlimit = C4::Context->preference("OPACFineNoRenewals");
|
||||
my $amountlimit = C4::Context->preference("FineNoRenewals");
|
||||
|
||||
if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
|
||||
my $confirmations;
|
||||
|
|
@ -142,7 +142,7 @@ if ( $op eq 'cud-renew' && $barcode ) {
|
|||
error => $error,
|
||||
soonestrenewdate => $soonest_renew_date,
|
||||
latestautorenewdate => $latest_auto_renew_date,
|
||||
balance => $balance,
|
||||
balance => $balance,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "23415",
|
||||
description => "Rename OPACFineNoRenewals",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
$dbh->do(
|
||||
q{
|
||||
UPDATE systempreferences SET variable = "FineNoRenewals", explanation = "Fine limit above which user or staff cannot renew items" WHERE variable = "OPACFineNoRenewals";
|
||||
}
|
||||
);
|
||||
|
||||
say $out "Updated system preference 'OPACFineNoRenewals'";
|
||||
},
|
||||
};
|
||||
|
|
@ -293,6 +293,7 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
|
|||
('FeeOnChangePatronCategory','1'),
|
||||
('FilterBeforeOverdueReport','0'),
|
||||
('FilterSearchResultsByLoggedInBranch','0'),
|
||||
('FineNoRenewals','100'),
|
||||
('FineNotifyAtCheckin','0'),
|
||||
('FinePaymentAutoPopup','0'),
|
||||
('finesCalendar','noFinesWhenClosed'),
|
||||
|
|
@ -514,7 +515,6 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
|
|||
('OpacExportOptions','bibtex,dc,marcxml,marc8,utf8,marcstd,mods,ris,isbd'),
|
||||
('OPACFallback', 'prog'),
|
||||
('OpacFavicon',''),
|
||||
('OPACFineNoRenewals','100'),
|
||||
('OPACFineNoRenewalsBlockAutoRenew','0'),
|
||||
('OPACFineNoRenewalsIncludeCredits','1'),
|
||||
('OPACFinesTab','1'),
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ Circulation:
|
|||
blockitem: block renewing only for this item.
|
||||
block: block renewing for all the patron's items.
|
||||
-
|
||||
- If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a>,
|
||||
- If a patron owes more than the value of <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a>,
|
||||
- pref: OPACFineNoRenewalsBlockAutoRenew
|
||||
choices:
|
||||
1: block
|
||||
|
|
@ -574,6 +574,11 @@ Circulation:
|
|||
open: "extend the loan period and set the checkout to be due at the library's open time."
|
||||
close: "shorten the loan period and set the checkout to be due at the library's close time."
|
||||
ignore: "do not consider the library's opening hours."
|
||||
-
|
||||
- Only allow patrons or staff to renew items if patron has less than
|
||||
- pref: FineNoRenewals
|
||||
class: currency
|
||||
- [% local_currency %] in fines (leave blank to disable).
|
||||
Lost item policy:
|
||||
-
|
||||
- By default, set the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> value of an item to
|
||||
|
|
|
|||
|
|
@ -651,18 +651,12 @@ OPAC:
|
|||
none: "NULL"
|
||||
opacrenew: "'OPACRenew'"
|
||||
- as branchcode to store in the statistics table for renewals done in the OPAC.
|
||||
-
|
||||
- Only allow patrons to renew their own checkouts on the OPAC if they have less than
|
||||
- pref: OPACFineNoRenewals
|
||||
class: currency
|
||||
- '[% local_currency %] in charges (leave blank to disable).'
|
||||
- <br /><strong>NOTE:</strong> If set, confirmation dialog is shown when renewing for patron with charges from staff interface.'
|
||||
-
|
||||
- pref: OPACFineNoRenewalsIncludeCredits
|
||||
choices:
|
||||
1: Include
|
||||
0: "Don't include"
|
||||
- outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACFineNoRenewals">OPACFineNoRenewals</a> rule to patrons.
|
||||
- outstanding/unapplied credits when applying the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=FineNoRenewals">FineNoRenewals</a> rule to patrons.
|
||||
-
|
||||
- pref: OpacHiddenItems
|
||||
type: textarea
|
||||
|
|
|
|||
|
|
@ -1133,7 +1133,7 @@
|
|||
|
||||
[% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
|
||||
|
||||
var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
|
||||
var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
|
||||
var fines = "[% fines | $Price %]";
|
||||
var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\nAre you sure you want to renew checkout(s)?").format(fines);
|
||||
|
||||
|
|
|
|||
|
|
@ -861,7 +861,7 @@
|
|||
CAN_user_circulate_manage_bookings = [% CAN_user_circulate_manage_bookings | $raw %]
|
||||
patron_borrowernumber = [% patron.borrowernumber | $raw %]
|
||||
|
||||
var amountlimit = "[% Koha.Preference('OPACFineNoRenewals') | html %]";
|
||||
var amountlimit = "[% Koha.Preference('FineNoRenewals') | html %]";
|
||||
var fines = "[% fines | $Price %]";
|
||||
var MSG_CONFIRM_RENEW = _("The patron has a debt of %s\n Are you sure you want to renew checkout(s)?").format(fines);
|
||||
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
|
|||
}
|
||||
|
||||
my $amountoutstanding = $patron->account->balance;
|
||||
my $no_renewal_amt = C4::Context->preference('OPACFineNoRenewals');
|
||||
$no_renewal_amt = undef unless looks_like_number($no_renewal_amt);
|
||||
my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' );
|
||||
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
|
||||
my $amountoutstandingfornewal =
|
||||
C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
|
||||
? $amountoutstanding
|
||||
|
|
|
|||
|
|
@ -1351,9 +1351,9 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
}
|
||||
}
|
||||
);
|
||||
C4::Context->set_preference( 'OPACFineNoRenewalsBlockAutoRenew', '1' );
|
||||
C4::Context->set_preference( 'OPACFineNoRenewals', '10' );
|
||||
C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '1' );
|
||||
C4::Context->set_preference('OPACFineNoRenewalsBlockAutoRenew','1');
|
||||
C4::Context->set_preference('FineNoRenewals','10');
|
||||
C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','1');
|
||||
my $fines_amount = 5;
|
||||
my $account = Koha::Account->new( { patron_id => $renewing_borrowernumber } );
|
||||
$account->add_debit(
|
||||
|
|
@ -1365,9 +1365,10 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
description => "Some fines"
|
||||
}
|
||||
)->status('RETURNED')->store;
|
||||
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
|
||||
( $renewokay, $error ) =
|
||||
CanBookBeRenewed( $renewing_borrower_obj, $issue );
|
||||
is( $renewokay, 1, 'Renew, even if renewal is automatic' );
|
||||
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 5' );
|
||||
is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
|
||||
|
||||
$account->add_debit(
|
||||
{
|
||||
|
|
@ -1378,9 +1379,10 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
description => "Some fines"
|
||||
}
|
||||
)->status('RETURNED')->store;
|
||||
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
|
||||
( $renewokay, $error ) =
|
||||
CanBookBeRenewed( $renewing_borrower_obj, $issue );
|
||||
is( $renewokay, 1, 'Renew, even if renewal is automatic' );
|
||||
is( $error, 'auto_renew', 'Can auto renew, OPACFineNoRenewals=10, patron has 10' );
|
||||
is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
|
||||
|
||||
$account->add_debit(
|
||||
{
|
||||
|
|
@ -1391,9 +1393,10 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
description => "Some fines"
|
||||
}
|
||||
)->status('RETURNED')->store;
|
||||
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue );
|
||||
is( $renewokay, 0, 'Do not renew, renewal is automatic' );
|
||||
is( $error, 'auto_too_much_oweing', 'Cannot auto renew, OPACFineNoRenewals=10, patron has 15' );
|
||||
( $renewokay, $error ) =
|
||||
CanBookBeRenewed( $renewing_borrower_obj, $issue );
|
||||
is( $renewokay, 0, 'Do not renew, renewal is automatic' );
|
||||
is( $error, 'auto_too_much_oweing', 'Cannot auto renew, FineNoRenewals=10, patron has 15' );
|
||||
|
||||
$account->add_credit(
|
||||
{
|
||||
|
|
@ -1407,7 +1410,7 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
is( $renewokay, 1, 'Renew, even if renewal is automatic' );
|
||||
is(
|
||||
$error, 'auto_renew',
|
||||
'Can auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
|
||||
'Can auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
|
||||
);
|
||||
|
||||
C4::Context->set_preference( 'OPACFineNoRenewalsIncludeCredits', '0' );
|
||||
|
|
@ -1415,7 +1418,7 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
is( $renewokay, 0, 'Do not renew, renewal is automatic' );
|
||||
is(
|
||||
$error, 'auto_too_much_oweing',
|
||||
'Cannot auto renew, OPACFineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
|
||||
'Cannot auto renew, FineNoRenewals=10, OPACFineNoRenewalsIncludeCredits=1, patron has 15 debt, 5 credit'
|
||||
);
|
||||
|
||||
$dbh->do( 'DELETE FROM accountlines WHERE borrowernumber=?', undef, $renewing_borrowernumber );
|
||||
|
|
|
|||
Loading…
Reference in New Issue