Bugzilla – Attachment 68912 Details for
Bug 18882
Add location code to statistics table for checkouts and renewals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18882 [QA Followup] - Ensure stats with no or undef location are set to NULL in db
Bug-18882-QA-Followup---Ensure-stats-with-no-or-un.patch (text/plain), 4.29 KB, created by
Marcel de Rooy
on 2017-11-03 10:59:08 UTC
(
hide
)
Description:
Bug 18882 [QA Followup] - Ensure stats with no or undef location are set to NULL in db
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-11-03 10:59:08 UTC
Size:
4.29 KB
patch
obsolete
>From 85e3f76d455e0968b0ee794c7697ecc31bf31c69 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 30 Jun 2017 10:37:14 -0400 >Subject: [PATCH] Bug 18882 [QA Followup] - Ensure stats with no or undef > location are set to NULL in db >Content-Type: text/plain; charset=utf-8 > >Confirm that only NULL or a string are in the location field of the >statistics table. Test with two items, one with shelving location set, >and one without it set. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Stats.pm | 16 ++++++++-------- > t/db_dependent/Stats.t | 41 ++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 48 insertions(+), 9 deletions(-) > >diff --git a/C4/Stats.pm b/C4/Stats.pm >index 23e5807..2ad685c 100644 >--- a/C4/Stats.pm >+++ b/C4/Stats.pm >@@ -118,14 +118,14 @@ 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 $location = exists $params->{location} ? $params->{location} :''; >- my $accountno = exists $params->{accountno} ? $params->{accountno} :''; >- my $ccode = exists $params->{ccode} ? $params->{ccode} :''; >+ 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 $location = exists $params->{location} ? $params->{location} : undef; >+ my $accountno = exists $params->{accountno} ? $params->{accountno} : ''; >+ my $ccode = exists $params->{ccode} ? $params->{ccode} : ''; > > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( >diff --git a/t/db_dependent/Stats.t b/t/db_dependent/Stats.t >index 21a3226..7675a16 100644 >--- a/t/db_dependent/Stats.t >+++ b/t/db_dependent/Stats.t >@@ -3,7 +3,7 @@ > use Modern::Perl; > use C4::Stats; > >-use Test::More tests => 18; >+use Test::More tests => 20; > > BEGIN { > use_ok('C4::Stats'); >@@ -125,6 +125,45 @@ is ($params->{location}, $line->{location}, "UpdateStats save locati > is ($params->{accountno}, $line->{proccode}, "UpdateStats save accountno param in proccode field of statistics table"); > is ($params->{ccode}, $line->{ccode}, "UpdateStats save ccode param in ccode field of statistics table"); > >+$dbh->do(q|DELETE FROM statistics|); >+$params = { >+ branch => "BRA", >+ itemnumber => 31, >+ borrowernumber => 5, >+ amount => 5.1, >+ other => "bla", >+ itemtype => "BK", >+ accountno => 51, >+ ccode => "CODE", >+ type => "return" >+}; >+UpdateStats($params); >+$sth = $dbh->prepare("SELECT * FROM statistics"); >+$sth->execute(); >+$line = ${ $sth->fetchall_arrayref( {} ) }[0]; >+is( $line->{location}, undef, >+ "UpdateStats sets location to NULL if no location is passed in." ); >+ >+$dbh->do(q|DELETE FROM statistics|); >+$params = { >+ branch => "BRA", >+ itemnumber => 31, >+ borrowernumber => 5, >+ amount => 5.1, >+ other => "bla", >+ itemtype => "BK", >+ location => undef, >+ accountno => 51, >+ ccode => "CODE", >+ type => "return" >+}; >+UpdateStats($params); >+$sth = $dbh->prepare("SELECT * FROM statistics"); >+$sth->execute(); >+$line = ${ $sth->fetchall_arrayref( {} ) }[0]; >+is( $line->{location}, undef, >+ "UpdateStats sets location to NULL if undef is passed in." ); >+ > # > # Test TotalPaid > # >-- >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 18882
:
64727
|
64756
|
64758
|
64759
|
68911
| 68912