[Koha-patches] [PATCH] Fix test data in issue.t and defaults for stats

Srdjan srdjan at catalyst.net.nz
Fri Jun 10 02:58:12 CEST 2016


'' and 'Null' are not really NULL values

https://bugs.koha-community.org/show_bug.cgi?id=14803
---
 C4/Stats.pm                        | 14 +++++++-------
 t/db_dependent/Circulation/issue.t | 28 ++++++++++++++++------------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/C4/Stats.pm b/C4/Stats.pm
index 54e3a39..bec439d 100644
--- a/C4/Stats.pm
+++ b/C4/Stats.pm
@@ -118,13 +118,13 @@ sub UpdateStats {
 # get the parameters
     my $branch            = $params->{branch};
     my $type              = $params->{type};
-    my $borrowernumber    = exists $params->{borrowernumber} ? $params->{borrowernumber} :'';
-    my $itemnumber        = exists $params->{itemnumber}     ? $params->{itemnumber} :'';
-    my $amount            = exists $params->{amount}         ? $params->{amount} :'';
-    my $other             = exists $params->{other}          ? $params->{other} :'';
-    my $itemtype          = exists $params->{itemtype}       ? $params->{itemtype} :'';
-    my $accountno         = exists $params->{accountno}      ? $params->{accountno} :'';
-    my $ccode             = exists $params->{ccode}          ? $params->{ccode} :'';
+    my $borrowernumber    = exists $params->{borrowernumber} ? $params->{borrowernumber} : undef;
+    my $itemnumber        = exists $params->{itemnumber}     ? $params->{itemnumber} : undef;
+    my $amount            = exists $params->{amount}         ? $params->{amount} : undef;
+    my $other             = exists $params->{other}          ? $params->{other} : undef;
+    my $itemtype          = exists $params->{itemtype}       ? $params->{itemtype} : undef;
+    my $accountno         = exists $params->{accountno}      ? $params->{accountno} : undef;
+    my $ccode             = exists $params->{ccode}          ? $params->{ccode} : undef;
 
     my $dbh = C4::Context->dbh;
     my $sth = $dbh->prepare(
diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t
index a28b1c5..bbb7909 100644
--- a/t/db_dependent/Circulation/issue.t
+++ b/t/db_dependent/Circulation/issue.t
@@ -118,17 +118,17 @@ Koha::Library->new($samplebranch2)->store;
 my $samplecat = {
     categorycode          => 'CAT1',
     description           => 'Description1',
-    enrolmentperiod       => 'Null',
-    enrolmentperioddate   => 'Null',
-    dateofbirthrequired   => 'Null',
-    finetype              => 'Null',
-    bulk                  => 'Null',
-    enrolmentfee          => 'Null',
-    overduenoticerequired => 'Null',
-    issuelimit            => 'Null',
-    reservefee            => 'Null',
+    enrolmentperiod       => undef,
+    enrolmentperioddate   => undef,
+    dateofbirthrequired   => undef,
+    finetype              => undef,
+    bulk                  => undef,
+    enrolmentfee          => undef,
+    overduenoticerequired => undef,
+    issuelimit            => undef,
+    reservefee            => undef,
     hidelostitems         => 0,
-    category_type         => 'Null'
+    category_type         => 'A',
 };
 my $query =
 "INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,dateofbirthrequired ,finetype,bulk,enrolmentfee,overduenoticerequired,issuelimit ,reservefee ,hidelostitems ,category_type) VALUES( ?,?,?,?,?,?,?,?,?,?,?,?,?)";
@@ -179,14 +179,18 @@ my $item_id2 = $sampleitem2[2];
 #Add borrower
 my $borrower_id1 = C4::Members::AddMember(
     firstname    => 'firstname1',
-    surname      => 'surname1 ',
+    surname      => 'surname1',
+    address      => 'address 1',
+    city         => 'city 1',
     categorycode => $samplecat->{categorycode},
     branchcode   => $samplebranch1->{branchcode},
 );
 my $borrower_1 = C4::Members::GetMember(borrowernumber => $borrower_id1);
 my $borrower_id2 = C4::Members::AddMember(
     firstname    => 'firstname2',
-    surname      => 'surname2 ',
+    surname      => 'surname2',
+    address      => 'address 2',
+    city         => 'city 2',
     categorycode => $samplecat->{categorycode},
     branchcode   => $samplebranch2->{branchcode},
 );
-- 
2.7.4


More information about the Koha-patches mailing list