View | Details | Raw Unified | Return to bug 12748
Collapse All | Expand All

(-)a/C4/Serials.pm (-2 / +22 lines)
Lines 1125-1132 sub ModSerialStatus { Link Here
1125
        }
1125
        }
1126
    }
1126
    }
1127
1127
1128
    # create new waited entry if needed (ie : was a "waited" and has changed)
1128
    # create new expected entry if needed (ie : was "expected" and has changed)
1129
    if ( $oldstatus == EXPECTED && $status != EXPECTED ) {
1129
    # BUG 12748: Check if there are no other expected issues.
1130
    my $otherIssueExpected = scalar findSerialByStatus(1, $subscriptionid);
1131
    if ( !$otherIssueExpected && $oldstatus == EXPECTED && $status != EXPECTED ) {
1130
        my $subscription = GetSubscription($subscriptionid);
1132
        my $subscription = GetSubscription($subscriptionid);
1131
        my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern});
1133
        my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern});
1132
1134
Lines 2731-2736 sub _can_do_on_subscription { Link Here
2731
    return 0;
2733
    return 0;
2732
}
2734
}
2733
2735
2736
=head2 findSerialByStatus
2737
2738
    @serials = findSerialByStatus($status, $subscriptionid);
2739
2740
    Returns an array of serials matching a given status and subscription id.
2741
2742
=cut
2743
sub findSerialByStatus{
2744
    my($status, $subscriptionid) = @_;
2745
    my $dbh = C4::Context->dbh;
2746
    my $query = qq| SELECT * from serial
2747
                    WHERE status = ?
2748
                    AND subscriptionid = ?
2749
                |;
2750
    my $sth = $dbh->prepare($query);
2751
    $sth->execute($status, $subscriptionid);
2752
    return @{$sth->fetchall_arrayref({})};
2753
}
2734
1;
2754
1;
2735
__END__
2755
__END__
2736
2756
(-)a/t/db_dependent/Serials.t (-2 / +3 lines)
Lines 15-21 use C4::Bookseller; Link Here
15
use C4::Biblio;
15
use C4::Biblio;
16
use C4::Budgets;
16
use C4::Budgets;
17
use Koha::DateUtils;
17
use Koha::DateUtils;
18
use Test::More tests => 46;
18
use Test::More tests => 48;
19
19
20
BEGIN {
20
BEGIN {
21
    use_ok('C4::Serials');
21
    use_ok('C4::Serials');
Lines 190-195 is(C4::Serials::check_routing(), undef, 'test checking route'); Link Here
190
190
191
is(C4::Serials::addroutingmember(),undef, 'test adding route member');
191
is(C4::Serials::addroutingmember(),undef, 'test adding route member');
192
192
193
is( C4::Serials::findSerialByStatus() ,0, "test finding a serial by its status");
193
194
194
# Unit tests for statuses management (Bug 11689)
195
# Unit tests for statuses management (Bug 11689)
195
$subscriptionid = NewSubscription(
196
$subscriptionid = NewSubscription(
Lines 246-249 for my $am ( @arrived_missing ) { Link Here
246
}
247
}
247
is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" );
248
is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" );
248
249
250
is( C4::Serials::findSerialByStatus(2,$subscriptionid) ,2, "findSerialByStatus returns array of serials if status and subscriptionid is given");
249
$dbh->rollback;
251
$dbh->rollback;
250
- 

Return to bug 12748