Bugzilla – Attachment 169179 Details for
Bug 29087
Holds to pull list can crash with a SQL::Abstract puke
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29087: Prevent filter_by_for_hold to crash if default holdallowed is not_allowed
Bug-29087-Prevent-filterbyforhold-to-crash-if-defa.patch (text/plain), 2.90 KB, created by
Marcel de Rooy
on 2024-07-19 08:10:40 UTC
(
hide
)
Description:
Bug 29087: Prevent filter_by_for_hold to crash if default holdallowed is not_allowed
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-07-19 08:10:40 UTC
Size:
2.90 KB
patch
obsolete
>From 44e1dd7cef9399d099042ace29e36a4e474bae61 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 19 Nov 2021 13:27:44 +0100 >Subject: [PATCH] Bug 29087: Prevent filter_by_for_hold to crash if default > holdallowed is not_allowed >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Items.pm | 30 ++++++++++++++++++++++++++---- > t/db_dependent/Koha/Holds.t | 7 +++++++ > 2 files changed, 33 insertions(+), 4 deletions(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 7c594e6798..ff6f80db75 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -61,15 +61,37 @@ placing a hold on one of those items. > sub filter_by_for_hold { > my ($self) = @_; > >- my @hold_not_allowed_itypes = Koha::CirculationRules->search( >+ my $default_rule = Koha::CirculationRules->get_effective_rule( > { > rule_name => 'holdallowed', >- branchcode => undef, >- categorycode => undef, > rule_value => 'not_allowed', > } >- )->get_column('itemtype'); >+ ); >+ my @hold_not_allowed_itypes; >+ if ( $default_rule ) { >+ @hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype'); >+ my @hold_allowed_itypes = Koha::CirculationRules->search( >+ { >+ rule_name => 'holdallowed', >+ rule_value => { '!=' => 'not_allowed' }, >+ branchcode => undef, >+ categorycode => undef, >+ } >+ )->get_column('itemtype'); >+ @hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes ) >+ } else { >+ @hold_not_allowed_itypes = Koha::CirculationRules->search( >+ { >+ rule_name => 'holdallowed', >+ branchcode => undef, >+ categorycode => undef, >+ rule_value => 'not_allowed', >+ } >+ )->get_column('itemtype'); >+ } >+ > push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype'); >+ @hold_not_allowed_itypes = uniq @hold_not_allowed_itypes; > > my $params = { > itemlost => 0, >diff --git a/t/db_dependent/Koha/Holds.t b/t/db_dependent/Koha/Holds.t >index bc02e3aa0d..b543ef96e2 100755 >--- a/t/db_dependent/Koha/Holds.t >+++ b/t/db_dependent/Koha/Holds.t >@@ -533,6 +533,13 @@ subtest 'Desks' => sub { > subtest 'get_items_that_can_fill' => sub { > plan tests => 6; > >+ Koha::CirculationRules->search( >+ { >+ rule_name => 'holdallowed', >+ rule_value => 'not_allowed', >+ } >+ )->delete; >+ > my $biblio = $builder->build_sample_biblio; > my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4 > my $itype_2 = $builder->build_object({ class => 'Koha::ItemTypes' }); >-- >2.30.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 29087
:
127859
|
164936
|
166354
|
166355
|
166359
|
166360
|
166527
|
166528
|
168241
|
168242
| 169179 |
169180
|
169181