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

(-)a/C4/Serials.pm (+15 lines)
Lines 1892-1897 sub updateClaim { Link Here
1892
    unless ( ref $serialids ) {
1892
    unless ( ref $serialids ) {
1893
        $serialids = [ $serialids ];
1893
        $serialids = [ $serialids ];
1894
    }
1894
    }
1895
1896
    foreach my $serialid(@$serialids) {
1897
        my $serial = Koha::Serials->find($serialid);
1898
1899
        C4::Serials::ModSerialStatus(
1900
            $serialid,
1901
            $serial->serialseq,
1902
            $serial->planneddate,
1903
            $serial->publisheddate,
1904
            $serial->publisheddatetext,
1905
            C4::Serials->CLAIMED,
1906
            $serial->notes
1907
        );
1908
    }
1909
1895
    my $dbh = C4::Context->dbh;
1910
    my $dbh = C4::Context->dbh;
1896
    return $dbh->do(q|
1911
    return $dbh->do(q|
1897
        UPDATE serial
1912
        UPDATE serial
(-)a/t/db_dependent/Serials/updateClaim.t (-1 / +42 lines)
Line 0 Link Here
0
- 
1
use Modern::Perl;
2
use Test::More tests => 3;
3
4
use C4::Serials;
5
use Koha::Database;
6
use Koha::DateUtils qw( dt_from_string output_pref );
7
8
my $schema = Koha::Database->new->schema;
9
$schema->storage->txn_begin;
10
my $dbh = C4::Context->dbh;
11
12
$dbh->do(q|DELETE FROM issues|);
13
$dbh->do(q|DELETE FROM subscription|);
14
15
my $branchcode = 'CPL';
16
my $record = MARC::Record->new();
17
my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio($record, '');
18
19
# Create a new subscription
20
my $subscriptionid_claims = C4::Serials::NewSubscription(
21
undef,      $branchcode,     undef, undef, undef, $biblionumber,
22
'2013-01-01', undef, undef, undef,  undef,
23
undef,      undef,  undef, undef, undef, undef,
24
1,          "notes",undef, '9999-01-01', undef, undef,
25
undef,       undef,  0,    "intnotes",  0,
26
undef, undef, 0,          undef,         '2013-12-31', 0
27
);
28
29
# Verify and get the serial ID of the subscription
30
my ( $totalissues, @serials ) = C4::Serials::GetSerials($subscriptionid_claims, 1);
31
32
C4::Serials::updateClaim( $serials[0]->{serialid} ); # Updating the claim
33
# sort the result to separate the CLAIMED and EXPECTED status
34
@serials = sort { $a->{serialid} <=> $b->{serialid} } @serials;
35
36
# Verify if serial IDs are correctly generated
37
( $totalissues, @serials ) = C4::Serials::GetSerials($subscriptionid_claims);
38
39
is ( scalar(@serials), 2, "le test est terminé" );  # Gives the length of the @serials
40
41
is ( ($serials[0]->{status}), C4::Serials::CLAIMED, "test CLAIMED" );
42
is ( ($serials[1]->{status}), C4::Serials::EXPECTED, "test EXPECTED" );

Return to bug 23775