Bugzilla – Attachment 169314 Details for
Bug 28762
Item status shows incorrectly on course-details.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28762: Rename not_for_loan as effective_not_for_loan_status
Bug-28762-Rename-notforloan-as-effectivenotforloan.patch (text/plain), 4.89 KB, created by
Martin Renvoize
on 2024-07-22 15:45:24 UTC
(
hide
)
Description:
Bug 28762: Rename not_for_loan as effective_not_for_loan_status
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-07-22 15:45:24 UTC
Size:
4.89 KB
patch
obsolete
>From 19f291c17bdf4242a3160e353cd777d97df11085 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 22 Jul 2024 16:32:34 +0100 >Subject: [PATCH] Bug 28762: Rename not_for_loan as > effective_not_for_loan_status > >This patch updates the method name to follow current conventions. >--- > Koha/Item.pm | 13 ++++++------ > .../prog/en/includes/item-status.inc | 4 ++-- > t/db_dependent/Koha/Item.t | 20 +++++++++---------- > 3 files changed, 18 insertions(+), 19 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index ed573d1b6a9..64c18e47f47 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1737,9 +1737,7 @@ sub to_api { > > $overrides->{effective_item_type_id} = $self->effective_itemtype; > >- my $itype_notforloan = $self->itemtype->notforloan; >- $overrides->{effective_not_for_loan_status} = >- ( defined $itype_notforloan && !$self->notforloan ) ? $itype_notforloan : $self->notforloan; >+ $overrides->{effective_not_for_loan_status} = $self->effective_not_for_loan_status; > > return { %$response, %$overrides }; > } >@@ -1835,17 +1833,18 @@ sub item_type { > 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 > > =cut > >-sub not_for_loan { >+sub effective_not_for_loan_status { > 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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc >index 75ce267927d..a5dca17ec9e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc >@@ -43,9 +43,9 @@ > [% END %] > [% END %] > >-[% IF ( item.not_for_loan ) %] >+[% IF ( item.effective_not_for_loan_status ) %] > [% 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 %] > <span class="item-status notforloan">[% notforloan_description | html %]</span> > [% ELSE %] >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index f92a4095d6e..d1d85dac725 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 36; >+use Test::More tests => 35; > use Test::Exception; > use Test::MockModule; > >@@ -2747,7 +2747,7 @@ subtest 'check_booking tests' => sub { > $schema->storage->txn_rollback; > }; > >-subtest 'not_for_loan() tests' => sub { >+subtest 'effective_not_for_loan_status() tests' => sub { > > plan tests => 5; > >@@ -2769,14 +2769,14 @@ subtest 'not_for_loan() tests' => sub { > note("item-level_itypes: 0"); > > is( >- $item->not_for_loan, $item->notforloan, >- '->not_for_loan returns item specific notforloan value when defined and non-zero' >+ $item->effective_not_for_loan_status, $item->notforloan, >+ '->effective_not_for_loan_status returns item specific notforloan value when defined and non-zero' > ); > > $item->notforloan(0)->store(); > is( >- $item->not_for_loan, $biblio_itype->notforloan, >- '->not_for_loan returns biblio level itype notforloan value when item notforloan is 0' >+ $item->effective_not_for_loan_status, $biblio_itype->notforloan, >+ '->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 ); >@@ -2784,14 +2784,14 @@ subtest 'not_for_loan() tests' => sub { > > $item->notforloan(1)->store(); > is( >- $item->not_for_loan, $item->notforloan, >- '->not_for_loan returns item specific notforloan value when defined and non-zero' >+ $item->effective_not_for_loan_status, $item->notforloan, >+ '->effective_not_for_loan_status returns item specific notforloan value when defined and non-zero' > ); > > $item->notforloan(0)->store(); > is( >- $item->not_for_loan, $item_itype->notforloan, >- '->not_for_loan returns biblio level itype notforloan value when item notforloan is 0' >+ $item->effective_not_for_loan_status, $item_itype->notforloan, >+ '->effective_not_for_loan_status returns biblio level itype notforloan value when item notforloan is 0' > ); > > $schema->storage->txn_rollback; >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28762
:
123233
|
123234
|
123236
|
123237
|
124661
|
124666
|
124667
|
124668
|
124744
|
125220
|
125228
|
125229
|
125233
|
161563
|
161564
|
161565
|
161566
|
161567
|
161568
|
161569
|
161570
|
161571
|
161572
|
161573
|
161574
|
161584
|
161585
|
161586
|
161587
|
161588
|
161589
|
161590
|
161591
|
163310
|
163311
|
163312
|
163313
|
163314
|
163315
|
163316
|
163317
|
165843
|
165844
|
165845
|
165846
|
165847
|
165848
|
165849
|
165850
|
169172
|
169273
|
169274
|
169275
|
169276
|
169277
|
169278
|
169279
|
169280
|
169281
|
169311
|
169312
|
169313
|
169314
|
169354
|
169355
|
169356
|
169357
|
169358
|
169359
|
169360
|
169361
|
169362
|
169363
|
169364
|
169365
|
169366
|
169367
|
169393