Bug 23415: Fix QA issues
Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
parent
f2b7a744b8
commit
e06e59bee4
|
|
@ -3281,7 +3281,7 @@ sub CanBookBeRenewed {
|
|||
{
|
||||
return ( 0, 'overdue' );
|
||||
} elsif ( $finesblockrenewing && $balance > $finesblockrenewing && !$allowfineoverriderenewing ) {
|
||||
return ( 0, 'too_much_oweing');
|
||||
return ( 0, 'too_much_oweing' );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,12 +95,11 @@ if ( $op eq 'cud-renew' && $barcode ) {
|
|||
);
|
||||
}
|
||||
|
||||
if ( $error && ($error eq 'too_much_oweing' or $error eq 'auto_too_much_oweing') ) {
|
||||
if ( $error && ( $error eq 'too_much_oweing' or $error eq 'auto_too_much_oweing' ) ) {
|
||||
if ($override_debt) {
|
||||
$can_renew = 1;
|
||||
$error = undef;
|
||||
}
|
||||
else {
|
||||
$error = undef;
|
||||
} else {
|
||||
$balance = $patron->account->balance;
|
||||
$template->param( balance => $balance );
|
||||
$can_renew = 0;
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ Circulation:
|
|||
- 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).
|
||||
- '[% 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
|
||||
|
|
|
|||
|
|
@ -1135,7 +1135,8 @@
|
|||
|
||||
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);
|
||||
var MSG_CONFIRM_RENEW = _("The patron has a debt of %s").format(fines);
|
||||
MSG_CONFIRM_RENEW += _("Are you sure you want to renew checkout(s)?");
|
||||
|
||||
// On-site checkout
|
||||
function toggle_onsite_checkout(){
|
||||
|
|
|
|||
|
|
@ -140,11 +140,12 @@
|
|||
</form>
|
||||
[% END %]
|
||||
[% ELSIF error == "too_much_oweing" %]
|
||||
|
||||
<li>The patron has a debt of [% balance | $Price %].</li>
|
||||
<form method="post" action="/cgi-bin/koha/circ/renew.pl">
|
||||
<input type="hidden" name="barcode" value="[% item.barcode | html %]"/>
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="barcode" value="[% item.barcode | html %]" />
|
||||
<input type="hidden" name="override_debt" value="1" />
|
||||
<input type="hidden" name="op" value="cud-renew" />
|
||||
<button type="submit" class="approve"><i class="fa fa-check"></i>Renew checkout(s)</button>
|
||||
</form>
|
||||
[% ELSIF error == "on_reserve" %]
|
||||
|
|
@ -173,7 +174,6 @@
|
|||
<p>Item cannot be renewed because it's an onsite checkout</p>
|
||||
[% ELSIF error == 'recalled' %]
|
||||
<p>This item has been recalled.</p>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
[% error | html %]
|
||||
|
|
|
|||
|
|
@ -863,7 +863,8 @@
|
|||
|
||||
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);
|
||||
var MSG_CONFIRM_RENEW = _("The patron has a debt of %s").format(fines);
|
||||
MSG_CONFIRM_RENEW += _("Are you sure you want to renew checkout(s)?");
|
||||
|
||||
function uncheck_sibling(me){
|
||||
nodename=me.getAttribute("name");
|
||||
|
|
|
|||
|
|
@ -503,13 +503,12 @@ function LoadIssuesTable() {
|
|||
|
||||
span_style = "display: none";
|
||||
span_class = "renewals-allowed";
|
||||
} else if (
|
||||
oObj.can_renew_error == "too_much_oweing"
|
||||
) {
|
||||
} else if (oObj.can_renew_error == "too_much_oweing") {
|
||||
msg +=
|
||||
"<span class='renewals-disabled'>" +
|
||||
__(
|
||||
"Cannot renew, he patron has a debt of " + parseFloat(oObj.fine).format_price()
|
||||
"Cannot renew, he patron has a debt of " +
|
||||
parseFloat(oObj.fine).format_price()
|
||||
) +
|
||||
"</span>";
|
||||
|
||||
|
|
@ -1000,13 +999,13 @@ $(document).ready(function () {
|
|||
e.preventDefault();
|
||||
let refresh_table = true;
|
||||
|
||||
if(show_confirm && parseFloat(fines) > parseFloat(amountlimit) ) {
|
||||
if (show_confirm && parseFloat(fines) > parseFloat(amountlimit)) {
|
||||
var result = confirm(MSG_CONFIRM_RENEW);
|
||||
if(!result){
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
// Prevent displaying confirm box again
|
||||
show_confirm = false;
|
||||
show_confirm = false;
|
||||
}
|
||||
|
||||
function renew(item_id) {
|
||||
|
|
@ -1044,8 +1043,18 @@ $(document).ready(function () {
|
|||
params.date_due = dueDate;
|
||||
}
|
||||
|
||||
|
||||
$(this).parent().parent().replaceWith("<img id='renew_" + item_id+ "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
|
||||
$(this)
|
||||
.parent()
|
||||
.parent()
|
||||
.replaceWith(
|
||||
"<img id='renew_" +
|
||||
item_id +
|
||||
"' src='" +
|
||||
interface +
|
||||
"/" +
|
||||
theme +
|
||||
"/img/spinner-small.gif' />"
|
||||
);
|
||||
|
||||
const client = APIClient.circulation;
|
||||
return client.checkouts.renew(params).then(
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
|
|||
}
|
||||
|
||||
my $amountoutstanding = $patron->account->balance;
|
||||
my $no_renewal_amt = C4::Context->preference( 'FineNoRenewals' );
|
||||
$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('FineNoRenewals','10');
|
||||
C4::Context->set_preference('OPACFineNoRenewalsIncludeCredit','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,10 +1365,9 @@ 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, FineNoRenewals=10, patron has 5' );
|
||||
is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 5' );
|
||||
|
||||
$account->add_debit(
|
||||
{
|
||||
|
|
@ -1379,10 +1378,9 @@ 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, FineNoRenewals=10, patron has 10' );
|
||||
is( $error, 'auto_renew', 'Can auto renew, FineNoRenewals=10, patron has 10' );
|
||||
|
||||
$account->add_debit(
|
||||
{
|
||||
|
|
@ -1393,10 +1391,9 @@ 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, FineNoRenewals=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(
|
||||
{
|
||||
|
|
@ -1893,7 +1890,7 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
"Account line description must not contain 'Lost Items ', but be title, barcode, itemcallnumber"
|
||||
);
|
||||
|
||||
t::lib::Mocks::mock_preference('FineNoRenewals', 0);
|
||||
t::lib::Mocks::mock_preference( 'FineNoRenewals', 0 );
|
||||
|
||||
# Recalls
|
||||
t::lib::Mocks::mock_preference( 'UseRecalls', 1 );
|
||||
|
|
@ -1973,10 +1970,10 @@ subtest "CanBookBeRenewed tests" => sub {
|
|||
$recall->set_cancelled;
|
||||
|
||||
# Too much debt
|
||||
t::lib::Mocks::mock_preference('FineNoRenewals', 1);
|
||||
( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_1);
|
||||
is( $renewokay, 0, 'Cannot renew, too much debt and FineNoRenewals=1' );
|
||||
is( $error, 'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)');
|
||||
t::lib::Mocks::mock_preference( 'FineNoRenewals', 1 );
|
||||
( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrower_obj, $issue_1 );
|
||||
is( $renewokay, 0, 'Cannot renew, too much debt and FineNoRenewals=1' );
|
||||
is( $error, 'too_much_oweing', 'Cannot renew, debt not allowed (returned code is too_much_oweing)' );
|
||||
C4::Context->dbh->do("DELETE FROM accountlines");
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue