Bugzilla – Attachment 52359 Details for
Bug 12748
Serials - two issues with status of "Expected"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12748: Code tidy
Bug-12748-Code-tidy.patch (text/plain), 4.27 KB, created by
Jonathan Druart
on 2016-06-14 09:53:52 UTC
(
hide
)
Description:
Bug 12748: Code tidy
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-06-14 09:53:52 UTC
Size:
4.27 KB
patch
obsolete
>From 49e9d89eb24306d72b8ff859092c87ff2ed6bc15 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 Jun 2016 10:43:14 +0100 >Subject: [PATCH] Bug 12748: Code tidy > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Serials.pm | 7 ++++--- > t/db_dependent/Serials.t | 40 ++++++++++++++++++++++++---------------- > 2 files changed, 28 insertions(+), 19 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index b844a7e..5cbd7df 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2706,9 +2706,9 @@ sub _can_do_on_subscription { > > =cut > >-sub findSerialsByStatus{ >- my($status, $subscriptionid) = @_; >- my $dbh = C4::Context->dbh; >+sub findSerialsByStatus { >+ my ( $status, $subscriptionid ) = @_; >+ my $dbh = C4::Context->dbh; > my $query = q| SELECT * from serial > WHERE status = ? > AND subscriptionid = ? >@@ -2716,6 +2716,7 @@ sub findSerialsByStatus{ > my $serials = $dbh->selectall_arrayref( $query, { Slice => {} }, $status, $subscriptionid ); > return @$serials; > } >+ > 1; > __END__ > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index b7258be..e848280 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -15,7 +15,7 @@ use C4::Bookseller; > use C4::Biblio; > use C4::Budgets; > use Koha::DateUtils; >-use Test::More tests => 49; >+use Test::More tests => 48; > > BEGIN { > use_ok('C4::Serials'); >@@ -248,20 +248,28 @@ for my $am ( @arrived_missing ) { > } > is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); > >-my ( $expected_serial ) = GetSerials2( $subscriptionid, [1] ); >-#Find serialid for serial with status Expected >-my $serialexpected = (C4::Serials::findSerialsByStatus(1,$subscriptionid))[0]; >-#delete serial with status Expected >-C4::Serials::ModSerialStatus( $serialexpected->{serialid},$serialexpected->{serialseq},$publisheddate,$publisheddate, $publisheddate,'1','an useless note'); >-@serialsByStatus = C4::Serials::findSerialsByStatus(1,$subscriptionid); >-is (@serialsByStatus,1,"ModSerialStatus delete corectly serial expected and create another if not exist"); >-# add 1 serial with status=Expected 1 >-C4::Serials::ModSerialStatus( $expected_serial->{serialid}, 'NO.20', $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); >-#Now we have two serials it have status expected >-#put status delete for last serial >-C4::Serials::ModSerialStatus( $serialexpected->{serialid},$serialexpected->{serialseq},$publisheddate,$publisheddate, $publisheddate,'1','an useless note'); >-#try if create or note another serial with status is expected >-@serialsByStatus = C4::Serials::findSerialsByStatus(1,$subscriptionid); >-is(@serialsByStatus,1,"ModSerialStatus delete corectly serial expected and not create another if exist"); >+subtest "Do not generate an expected if one already exists" => sub { >+ plan tests => 2; >+ my ($expected_serial) = GetSerials2( $subscriptionid, [1] ); >+ >+ #Find serialid for serial with status Expected >+ my $serialexpected = ( C4::Serials::findSerialsByStatus( 1, $subscriptionid ) )[0]; >+ >+ #delete serial with status Expected >+ C4::Serials::ModSerialStatus( $serialexpected->{serialid}, $serialexpected->{serialseq}, $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); >+ @serialsByStatus = C4::Serials::findSerialsByStatus( 1, $subscriptionid ); >+ is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and create another if not exist" ); >+ >+ # add 1 serial with status=Expected 1 >+ C4::Serials::ModSerialStatus( $expected_serial->{serialid}, 'NO.20', $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); >+ >+ #Now we have two serials it have status expected >+ #put status delete for last serial >+ C4::Serials::ModSerialStatus( $serialexpected->{serialid}, $serialexpected->{serialseq}, $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' ); >+ >+ #try if create or not another serial with status is expected >+ @serialsByStatus = C4::Serials::findSerialsByStatus( 1, $subscriptionid ); >+ is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); >+}; > > $dbh->rollback; >-- >2.8.1
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 12748
:
41228
|
41230
|
41371
|
41451
|
44533
|
46091
|
47770
|
47771
|
47773
|
47774
|
47775
|
47776
|
52356
|
52357
|
52358
| 52359 |
52360