Bugzilla – Attachment 57656 Details for
Bug 17642
Authorised values code is broken because of the refactoring
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17642: Do not explode if no authorised value exist
Bug-17642-Do-not-explode-if-no-authorised-value-ex.patch (text/plain), 2.33 KB, created by
Martin Renvoize (ashimema)
on 2016-11-18 15:51:31 UTC
(
hide
)
Description:
Bug 17642: Do not explode if no authorised value exist
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2016-11-18 15:51:31 UTC
Size:
2.33 KB
patch
obsolete
>From bf6286fb4c0cb680dd204ade6414b599367223e8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 17 Nov 2016 11:23:57 +0000 >Subject: [PATCH] Bug 17642: Do not explode if no authorised value exist > >Can't call method "lib" on an undefined value at >/home/vagrant/kohaclone/Koha/AuthorisedValues.pm line 137. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/AuthorisedValues.pm | 1 + > t/db_dependent/AuthorisedValues.t | 7 ++++++- > 2 files changed, 7 insertions(+), 1 deletion(-) > >diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm >index d9e6d68..5c73052 100644 >--- a/Koha/AuthorisedValues.pm >+++ b/Koha/AuthorisedValues.pm >@@ -134,6 +134,7 @@ sub get_description_by_koha_field { > return $cached if $cached; > > my $av = $self->find_by_koha_field($params); >+ return {} unless defined $av; > my $descriptions = { lib => $av->lib, opac_description => $av->opac_description }; > $memory_cache->set_in_cache( $cache_key, $descriptions ); > return $descriptions; >diff --git a/t/db_dependent/AuthorisedValues.t b/t/db_dependent/AuthorisedValues.t >index 5f344d3..6d44a72 100644 >--- a/t/db_dependent/AuthorisedValues.t >+++ b/t/db_dependent/AuthorisedValues.t >@@ -174,7 +174,7 @@ subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { > is( $av, undef, ); > }; > subtest 'get_description_by_koha_field' => sub { >- plan tests => 3; >+ plan tests => 4; > my $descriptions; > > # Test authorised_value = 0 >@@ -199,6 +199,11 @@ subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { > $descriptions = Koha::AuthorisedValues->get_description_by_koha_field( > { kohafield => 'items.restricted', authorised_value => undef } ); > is_deeply( $descriptions, {}, ) ; # This could be arguable, we could return undef instead >+ >+ # No authorised_value >+ $descriptions = Koha::AuthorisedValues->get_description_by_koha_field( >+ { kohafield => 'items.restricted', authorised_value => "does not exist" } ); >+ is_deeply( $descriptions, {}, ) ; # This could be arguable, we could return undef instead > }; > subtest 'get_descriptions_by_koha_field' => sub { > plan tests => 1; >-- >2.1.4
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 17642
:
57533
|
57569
|
57570
|
57571
|
57572
|
57573
|
57574
|
57595
|
57616
|
57628
|
57629
|
57630
|
57631
|
57632
|
57633
|
57634
|
57635
|
57650
|
57651
|
57652
|
57653
|
57654
|
57655
| 57656 |
57657