Lines 34-39
use List::MoreUtils qw/uniq/;
Link Here
|
34 |
|
34 |
|
35 |
my $query = new CGI; |
35 |
my $query = new CGI; |
36 |
my $op = $query->param('op') || q{}; |
36 |
my $op = $query->param('op') || q{}; |
|
|
37 |
my $nbissues=$query->param('nbissues'); |
37 |
my $dbh = C4::Context->dbh; |
38 |
my $dbh = C4::Context->dbh; |
38 |
|
39 |
|
39 |
my ($template, $loggedinuser, $cookie); |
40 |
my ($template, $loggedinuser, $cookie); |
Lines 55-73
my $subscriptions;
Link Here
|
55 |
|
56 |
|
56 |
if($op eq 'gennext' && @subscriptionid){ |
57 |
if($op eq 'gennext' && @subscriptionid){ |
57 |
my $subscriptionid = $subscriptionid[0]; |
58 |
my $subscriptionid = $subscriptionid[0]; |
58 |
my $subscription = GetSubscription($subscriptionid); |
59 |
my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate |
59 |
|
|
|
60 |
my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate |
61 |
FROM serial WHERE status = 1 AND subscriptionid = ?"); |
60 |
FROM serial WHERE status = 1 AND subscriptionid = ?"); |
|
|
61 |
my $status = defined( $nbissues ) ? 2 : 3; |
62 |
$nbissues ||= 1; |
63 |
for ( my $i = 0; $i < $nbissues; $i++ ){ |
62 |
$sth->execute($subscriptionid); |
64 |
$sth->execute($subscriptionid); |
63 |
|
|
|
64 |
# modify actual expected issue, to generate the next |
65 |
# modify actual expected issue, to generate the next |
65 |
if ( my $issue = $sth->fetchrow_hashref ) { |
66 |
if ( my $issue = $sth->fetchrow_hashref ) { |
66 |
ModSerialStatus( $issue->{serialid}, $issue->{serialseq}, |
67 |
ModSerialStatus( $issue->{serialid}, $issue->{serialseq}, |
67 |
$issue->{planneddate}, $issue->{publisheddate}, |
68 |
$issue->{planneddate}, $issue->{publisheddate}, |
68 |
3, "" ); |
69 |
$status, "" ); |
69 |
}else{ |
70 |
}else{ |
70 |
my $expected = GetNextExpected($subscriptionid); |
71 |
my $subscription = GetSubscription($subscriptionid); |
|
|
72 |
my $expected = GetNextExpected($subscriptionid); |
71 |
my ( |
73 |
my ( |
72 |
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
74 |
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
73 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 |
75 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 |
Lines 82-95
if($op eq 'gennext' && @subscriptionid){
Link Here
|
82 |
## Updating the subscription seq status |
84 |
## Updating the subscription seq status |
83 |
my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
85 |
my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
84 |
WHERE subscriptionid = ?"; |
86 |
WHERE subscriptionid = ?"; |
85 |
$sth = $dbh->prepare($squery); |
87 |
my $seqsth = $dbh->prepare($squery); |
86 |
$sth->execute( |
88 |
$seqsth->execute( |
87 |
$newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, |
89 |
$newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, |
88 |
$newinnerloop2, $newinnerloop3, $subscriptionid |
90 |
$newinnerloop2, $newinnerloop3, $subscriptionid |
89 |
); |
91 |
); |
90 |
|
92 |
|
91 |
} |
93 |
} |
92 |
|
94 |
last if $nbissues == 1; |
|
|
95 |
last if HasSubscriptionExpired($subscriptionid) > 0; |
96 |
} |
93 |
print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid); |
97 |
print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid); |
94 |
} |
98 |
} |
95 |
|
99 |
|
96 |
- |
|
|