View | Details | Raw Unified | Return to bug 13934
Collapse All | Expand All

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

Return to bug 13934