Bugzilla – Attachment 19938 Details for
Bug 10640
ModBookseller needs more explicit return values in C4::Bookseller.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
ModBookseller needs more explicit return values in C4::Bookseller.pm
ModBookseller-needs-more-explicit-return-values-in.patch (text/plain), 2.80 KB, created by
kenza
on 2013-07-25 08:07:44 UTC
(
hide
)
Description:
ModBookseller needs more explicit return values in C4::Bookseller.pm
Filename:
MIME Type:
Creator:
kenza
Created:
2013-07-25 08:07:44 UTC
Size:
2.80 KB
patch
obsolete
>From c9bc2ff728af0842e7bb384d83009541520230c1 Mon Sep 17 00:00:00 2001 >From: root <root@kenza-VirtualBox> >Date: Thu, 25 Jul 2013 09:59:51 +0200 >Subject: [PATCH] ModBookseller needs more explicit return values in > C4::Bookseller.pm > >Before, ModBookseller always returns undef. This patch modifies it in order to be more explicit. >Now it returns : >1 -> If a modification has been done >0E0 -> If the given id doesn't exist >undef -> If no id given > >It also fix one of the tests which didn't pass before in t/db_dependent/Bookseller.t > >To Test: >prove db_dependent/Bookseller. >Bookseller.t .. 1/55 >[Some warnings about uninitialized values] >t/db_dependent/Bookseller.t .. ok >All tests successful. >Files=1, Tests=55, 1 wallclock secs ( 0.03 usr 0.00 sys + 0.46 cusr 0.04 csys = 0.53 CPU) >Result: PASS > >http://bugs.koha-community.org/show_bug.cgi?id=10640 >--- > C4/Bookseller.pm | 4 ++-- > t/db_dependent/Bookseller.t | 6 ++---- > 2 files changed, 4 insertions(+), 6 deletions(-) > >diff --git a/C4/Bookseller.pm b/C4/Bookseller.pm >index c53919f..18dc43a 100644 >--- a/C4/Bookseller.pm >+++ b/C4/Bookseller.pm >@@ -225,6 +225,7 @@ C<&ModBookseller> with the result. > > sub ModBookseller { > my ($data) = @_; >+ return unless $data->{'id'}; > my $dbh = C4::Context->dbh; > my $query = 'UPDATE aqbooksellers > SET name=?,address1=?,address2=?,address3=?,address4=?, >@@ -235,7 +236,7 @@ sub ModBookseller { > discount=?,notes=?,gstrate=?,deliverytime=? > WHERE id=?'; > my $sth = $dbh->prepare($query); >- $sth->execute( >+ return $sth->execute( > $data->{'name'}, $data->{'address1'}, > $data->{'address2'}, $data->{'address3'}, > $data->{'address4'}, $data->{'postal'}, >@@ -253,7 +254,6 @@ sub ModBookseller { > $data->{deliverytime}, > $data->{'id'} > ); >- return; > } > > =head2 DelBookseller >diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t >index fdac9c2..fca6913 100644 >--- a/t/db_dependent/Bookseller.t >+++ b/t/db_dependent/Bookseller.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 54; >+use Test::More tests => 55; > use C4::Context; > use Koha::DateUtils; > use DateTime::Duration; >@@ -247,13 +247,11 @@ $sample_supplier2 = { > deliverytime => 2, > }; > >-#FIXME : ModBookseller always returns undef, even if the id isn't given >-#or doesn't exist > my $modif1 = C4::Bookseller::ModBookseller(); > is( $modif1, undef, > "ModBookseller returns undef if no params given - Nothing happened" ); > $modif1 = C4::Bookseller::ModBookseller($sample_supplier2); >-#is( $modif1, 1, "ModBookseller modifies only the supplier2" ); >+is( $modif1, 1, "ModBookseller modifies only the supplier2" ); > is( scalar( C4::Bookseller::GetBookSeller('') ), > $count + 2, "Supplier2 has been modified - Nothing added" ); > >-- >1.7.9.5
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 10640
:
19938
|
19939
|
19990
|
20587