Bug 28762: Rename not_for_loan as effective_not_for_loan_status
This patch updates the method name to follow current conventions. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
4e6d9d13bf
commit
fdefef1444
3 changed files with 17 additions and 18 deletions
13
Koha/Item.pm
13
Koha/Item.pm
|
@ -1737,9 +1737,7 @@ sub to_api {
|
||||||
|
|
||||||
$overrides->{effective_item_type_id} = $self->effective_itemtype;
|
$overrides->{effective_item_type_id} = $self->effective_itemtype;
|
||||||
|
|
||||||
my $itype_notforloan = $self->itemtype->notforloan;
|
$overrides->{effective_not_for_loan_status} = $self->effective_not_for_loan_status;
|
||||||
$overrides->{effective_not_for_loan_status} =
|
|
||||||
( defined $itype_notforloan && !$self->notforloan ) ? $itype_notforloan : $self->notforloan;
|
|
||||||
|
|
||||||
return { %$response, %$overrides };
|
return { %$response, %$overrides };
|
||||||
}
|
}
|
||||||
|
@ -1835,17 +1833,18 @@ sub item_type {
|
||||||
return shift->itemtype;
|
return shift->itemtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
=head3 not_for_loan
|
=head3 effective_not_for_loan_status
|
||||||
|
|
||||||
my $nfl = $item->not_for_loan;
|
my $nfl = $item->effective_not_for_loan_status;
|
||||||
|
|
||||||
Returns the effective not for loan status of the item
|
Returns the effective not for loan status of the item
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub not_for_loan {
|
sub effective_not_for_loan_status {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
return $self->notforloan ? $self->notforloan : $self->itemtype->notforloan;
|
my $itype_notforloan = $self->itemtype->notforloan;
|
||||||
|
return ( defined($itype_notforloan) && !$self->notforloan ) ? $itype_notforloan : $self->notforloan;
|
||||||
}
|
}
|
||||||
|
|
||||||
=head3 orders
|
=head3 orders
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
[% IF ( item.not_for_loan ) %]
|
[% IF ( item.effective_not_for_loan_status ) %]
|
||||||
[% SET itemavailable = 0 %]
|
[% SET itemavailable = 0 %]
|
||||||
[% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.not_for_loan ) %]
|
[% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.effective_not_for_loan_status ) %]
|
||||||
[% IF notforloan_description %]
|
[% IF notforloan_description %]
|
||||||
<span class="item-status notforloan">[% notforloan_description | html %]</span>
|
<span class="item-status notforloan">[% notforloan_description | html %]</span>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
|
|
|
@ -2747,7 +2747,7 @@ subtest 'check_booking tests' => sub {
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
};
|
};
|
||||||
|
|
||||||
subtest 'not_for_loan() tests' => sub {
|
subtest 'effective_not_for_loan_status() tests' => sub {
|
||||||
|
|
||||||
plan tests => 5;
|
plan tests => 5;
|
||||||
|
|
||||||
|
@ -2769,14 +2769,14 @@ subtest 'not_for_loan() tests' => sub {
|
||||||
note("item-level_itypes: 0");
|
note("item-level_itypes: 0");
|
||||||
|
|
||||||
is(
|
is(
|
||||||
$item->not_for_loan, $item->notforloan,
|
$item->effective_not_for_loan_status, $item->notforloan,
|
||||||
'->not_for_loan returns item specific notforloan value when defined and non-zero'
|
'->effective_not_for_loan_status returns item specific notforloan value when defined and non-zero'
|
||||||
);
|
);
|
||||||
|
|
||||||
$item->notforloan(0)->store();
|
$item->notforloan(0)->store();
|
||||||
is(
|
is(
|
||||||
$item->not_for_loan, $biblio_itype->notforloan,
|
$item->effective_not_for_loan_status, $biblio_itype->notforloan,
|
||||||
'->not_for_loan returns biblio level itype notforloan value when item notforloan is 0'
|
'->effective_not_for_loan_status returns biblio level itype notforloan value when item notforloan is 0'
|
||||||
);
|
);
|
||||||
|
|
||||||
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 );
|
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 );
|
||||||
|
@ -2784,14 +2784,14 @@ subtest 'not_for_loan() tests' => sub {
|
||||||
|
|
||||||
$item->notforloan(1)->store();
|
$item->notforloan(1)->store();
|
||||||
is(
|
is(
|
||||||
$item->not_for_loan, $item->notforloan,
|
$item->effective_not_for_loan_status, $item->notforloan,
|
||||||
'->not_for_loan returns item specific notforloan value when defined and non-zero'
|
'->effective_not_for_loan_status returns item specific notforloan value when defined and non-zero'
|
||||||
);
|
);
|
||||||
|
|
||||||
$item->notforloan(0)->store();
|
$item->notforloan(0)->store();
|
||||||
is(
|
is(
|
||||||
$item->not_for_loan, $item_itype->notforloan,
|
$item->effective_not_for_loan_status, $item_itype->notforloan,
|
||||||
'->not_for_loan returns biblio level itype notforloan value when item notforloan is 0'
|
'->effective_not_for_loan_status returns biblio level itype notforloan value when item notforloan is 0'
|
||||||
);
|
);
|
||||||
|
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
|
|
Loading…
Reference in a new issue