Bugzilla – Attachment 172958 Details for
Bug 35906
Add bookable option on itemtypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35906: (QA follow-up) Refactor (slightly) to reduce complexity in Koha/Item(s).pm, catalogue/updateitem
Bug-35906-QA-follow-up-Refactor-slightly-to-reduce.patch (text/plain), 3.21 KB, created by
Paul Derscheid
on 2024-10-18 10:59:35 UTC
(
hide
)
Description:
Bug 35906: (QA follow-up) Refactor (slightly) to reduce complexity in Koha/Item(s).pm, catalogue/updateitem
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-10-18 10:59:35 UTC
Size:
3.21 KB
patch
obsolete
>From 2adfffe310b64d88ec853551e9181441e79fe75a Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Fri, 18 Oct 2024 09:58:19 +0000 >Subject: [PATCH] Bug 35906: (QA follow-up) Refactor (slightly) to reduce > complexity in Koha/Item(s).pm, catalogue/updateitem > >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> >--- > Koha/Item.pm | 2 +- > Koha/Items.pm | 30 +++++++++++++++++++++--------- > catalogue/updateitem.pl | 2 +- > 3 files changed, 23 insertions(+), 11 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 84a1088a9b..2c8c5436a9 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1885,7 +1885,7 @@ Returns the effective bookability of the current item, be that item or itemtype > sub effective_bookable { > my ($self) = @_; > >- return defined( $self->bookable ) ? $self->bookable : $self->itemtype->bookable; >+ return $self->bookable // $self->itemtype->bookable; > } > > =head3 orders >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 82df7df341..5a8f14c8a6 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -191,17 +191,29 @@ Returns a new resultset, containing only those items that are allowed to be book > sub filter_by_bookable { > my ($self) = @_; > >- my @bookable_itemtypes = Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype'); >- >- my ( $where, $attr ); >- if ( C4::Context->preference("item-level_itypes") ) { >- $where = [ { bookable => 1 }, { bookable => undef, itype => { -in => \@bookable_itemtypes } } ]; >- } else { >- $where = [ { bookable => 1 }, { bookable => undef, 'biblioitem.itemtype' => { -in => \@bookable_itemtypes } } ]; >- $attr = { join => 'biblioitem' }; >+ if ( !C4::Context->preference('item-level_itypes') ) { >+ return $self->search( >+ [ >+ { bookable => 1 }, >+ { >+ bookable => undef, >+ 'biblioitem.itemtype' => >+ { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] } >+ }, >+ ], >+ { join => 'biblioitem' } >+ ); > } > >- return $self->search( $where, $attr ); >+ return $self->search( >+ [ >+ { bookable => 1 }, >+ { >+ bookable => undef, >+ itype => { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] } >+ }, >+ ] >+ ); > } > > =head3 move_to_biblio >diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl >index 087dd98f8a..cb92efbb16 100755 >--- a/catalogue/updateitem.pl >+++ b/catalogue/updateitem.pl >@@ -77,7 +77,7 @@ elsif ( $op eq "cud-set_public_note" ) { # i.e., itemnotes parameter passed from > $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority); > $messages = "updated_exclude_from_local_holds_priority=$exclude_from_local_holds_priority&"; > } elsif ( $op eq "cud-set_bookable" && $bookable ne $item_data_hashref->{'bookable'} ) { >- undef($bookable) if $bookable eq ""; >+ undef $bookable if $bookable eq q{}; > $item->bookable($bookable); > } elsif ( $op eq "cud-set_damaged" && $damaged ne $item_data_hashref->{'damaged'}) { > $item->damaged($damaged); >-- >2.47.0
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 35906
:
161397
|
161638
|
161744
|
161961
|
162242
|
162365
|
162465
|
162466
|
162467
|
162468
|
162469
|
162470
|
162472
|
163291
|
163292
|
163293
|
163294
|
163295
|
163547
|
163548
|
163549
|
163550
|
163551
|
164579
|
164580
|
164581
|
164582
|
164583
|
164584
|
164585
|
165437
|
166866
|
166867
|
166868
|
166869
|
166870
|
166871
|
168120
|
168121
|
168122
|
168160
|
168161
|
168162
|
168163
|
168164
|
170187
|
170188
|
170189
|
170190
|
170191
|
170582
|
170583
|
170584
|
170585
|
170586
|
172127
|
172128
|
172129
|
172130
|
172131
|
172132
|
172941
|
172945
|
172950
|
172951
|
172952
|
172953
|
172954
|
172955
|
172956
|
172957
|
172958
|
172959
|
172960
|
172961
|
173324
|
173325
|
173326
|
173327
|
173328
|
173329
|
173330
|
173331
|
173332
|
173333
|
173334
|
173335
|
173893