Bugzilla – Attachment 46091 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 - Add test for step 7 and 8 and rename findSerialByStatus
Bug-12748---Add-test-for-step-7-and-8-and-rename-f.patch (text/plain), 4.44 KB, created by
Bouzid Fergani
on 2015-12-30 15:49:45 UTC
(
hide
)
Description:
Bug 12748 - Add test for step 7 and 8 and rename findSerialByStatus
Filename:
MIME Type:
Creator:
Bouzid Fergani
Created:
2015-12-30 15:49:45 UTC
Size:
4.44 KB
patch
obsolete
>From df0b9549600191b0f8f82248987e825be3fc6172 Mon Sep 17 00:00:00 2001 >From: Bouzid Fergani <bouzid.fergani@inlibro.com> >Date: Wed, 30 Dec 2015 10:41:13 -0500 >Subject: [PATCH] Bug 12748 - Add test for step 7 and 8 and rename > findSerialByStatus > >--- > C4/Serials.pm | 9 ++++----- > t/db_dependent/Serials.t | 21 ++++++++++++++++++--- > 2 files changed, 22 insertions(+), 8 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 816213c..c2776c2 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1173,8 +1173,7 @@ sub ModSerialStatus { > } > > # create new expected entry if needed (ie : was "expected" and has changed) >- # BUG 12748: Check if there are no other expected issues. >- my $otherIssueExpected = scalar findSerialByStatus(EXPECTED, $subscriptionid); >+ my $otherIssueExpected = scalar findSerialsByStatus(EXPECTED, $subscriptionid); > if ( !$otherIssueExpected && $oldstatus == EXPECTED && $status != EXPECTED ) { > my $subscription = GetSubscription($subscriptionid); > my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); >@@ -2672,15 +2671,15 @@ sub _can_do_on_subscription { > return 0; > } > >-=head2 findSerialByStatus >+=head2 findSerialsByStatus > >- @serials = findSerialByStatus($status, $subscriptionid); >+ @serials = findSerialsByStatus($status, $subscriptionid); > > Returns an array of serials matching a given status and subscription id. > > =cut > >-sub findSerialByStatus{ >+sub findSerialsByStatus{ > my($status, $subscriptionid) = @_; > my $dbh = C4::Context->dbh; > my $query = q| SELECT * from serial >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index 72165af..1cc0482 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 => 45; >+use Test::More tests => 49; > > BEGIN { > use_ok('C4::Serials'); >@@ -173,7 +173,7 @@ is(C4::Serials::ModSubscriptionHistory(), undef, 'test modding subscription hist > > is(C4::Serials::ModSerialStatus(),undef, 'test modding serials'); > >-is(C4::Serials::findSerialByStatus(), 0, 'test finding serial by status with no parameters'); >+is(C4::Serials::findSerialsByStatus(), 0, 'test finding serial by status with no parameters'); > is(C4::Serials::NewIssue(), undef, 'test getting 0 when nothing is entered'); > > is(C4::Serials::HasSubscriptionStrictlyExpired(), undef, 'test if the subscriptions has expired'); >@@ -219,7 +219,7 @@ for my $status ( @statuses ) { > $counter++; > } > # Here we have 15 serials with statuses : 2*2 + 5*3 + 2*4 + 1*41 + 1*42 + 1*43 + 1*44 + 1*5 + 1*1 >-my @serialsByStatus = C4::Serials::findSerialByStatus(2,$subscriptionid); >+my @serialsByStatus = C4::Serials::findSerialsByStatus(2,$subscriptionid); > is(@serialsByStatus,2,"findSerialByStatus returns all serials with chosen status"); > ( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); > is( $total_issues, @statuses + 1, "GetSerials returns total_issues" ); >@@ -246,5 +246,20 @@ 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'); >+my @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"); > > $dbh->rollback; >-- >1.9.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