--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -, +, @@ if no parameter given Bug 11944: Fix encoding issue in C4::ItemType @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; bless $opts => $class; -- Should receive nasty error. -- Should be told 'No item with barcode: {what you typed}' -- All tests should run successfully. demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. --- C4/ItemType.pm | 3 +++ t/ItemType.t | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) --- a/C4/ItemType.pm +++ a/C4/ItemType.pm @@ -99,6 +99,9 @@ an object. sub get { my ($class, $itemtype) = @_; + + return unless defined $itemtype; + my $dbh = C4::Context->dbh; my $data = $dbh->selectrow_hashref( --- a/t/ItemType.t +++ a/t/ItemType.t @@ -1,9 +1,8 @@ #!/usr/bin/perl -use strict; -use warnings; +use Modern::Perl; use DBI; -use Test::More tests => 26; +use Test::More tests => 27; use Test::MockModule; BEGIN { @@ -105,3 +104,6 @@ is( $itemtype->notforloan, '0', 'not for loan is 0' ); is( $itemtype->imageurl, '', ' not for loan is undef' ); is( $itemtype->checkinmsg, 'foo', 'checkinmsg is foo' ); + +$itemtype = C4::ItemType->get; +is( $itemtype, undef, 'C4::ItemType->get should return unless if no parameter is given' ); --