Receiving serials in a loop
generate the number of issues entered from a message box and apply 'arrived' status. http://bugs.koha-community.org/show_bug.cgi?id=7913 Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
This commit is contained in:
parent
0fb3dda69f
commit
cd2fae07ae
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function generateReceive(subscriptionid) {
|
||||
if(nbissues=prompt(_("How many issues do you want to receive ?"))){
|
||||
document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues;
|
||||
}
|
||||
}
|
||||
function print_slip(subscriptionid,issue){
|
||||
var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
|
||||
window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
|
||||
|
|
@ -190,6 +195,7 @@ $(document).ready(function() {
|
|||
<p>
|
||||
<input type="submit" value="Edit serials" />
|
||||
<input type="button" value="Generate Next" onclick="javascript:generateNext([% subscriptionidlist %])" />
|
||||
[% IF ( subscriptions.size == 1 ) %] <input type="button" value="Multi receiving" onclick="javascript:generateReceive([% subscriptionidlist %])" />[% END %]
|
||||
</p>
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use List::MoreUtils qw/uniq/;
|
|||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param('op') || q{};
|
||||
my $nbissues=$query->param('nbissues');
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my ($template, $loggedinuser, $cookie);
|
||||
|
|
@ -55,19 +56,20 @@ my $subscriptions;
|
|||
|
||||
if($op eq 'gennext' && @subscriptionid){
|
||||
my $subscriptionid = $subscriptionid[0];
|
||||
my $subscription = GetSubscription($subscriptionid);
|
||||
|
||||
my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate
|
||||
my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate
|
||||
FROM serial WHERE status = 1 AND subscriptionid = ?");
|
||||
my $status = defined( $nbissues ) ? 2 : 3;
|
||||
$nbissues ||= 1;
|
||||
for ( my $i = 0; $i < $nbissues; $i++ ){
|
||||
$sth->execute($subscriptionid);
|
||||
|
||||
# modify actual expected issue, to generate the next
|
||||
if ( my $issue = $sth->fetchrow_hashref ) {
|
||||
ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
|
||||
$issue->{planneddate}, $issue->{publisheddate},
|
||||
3, "" );
|
||||
$status, "" );
|
||||
}else{
|
||||
my $expected = GetNextExpected($subscriptionid);
|
||||
my $subscription = GetSubscription($subscriptionid);
|
||||
my $expected = GetNextExpected($subscriptionid);
|
||||
my (
|
||||
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
|
||||
$newinnerloop1, $newinnerloop2, $newinnerloop3
|
||||
|
|
@ -82,14 +84,16 @@ if($op eq 'gennext' && @subscriptionid){
|
|||
## Updating the subscription seq status
|
||||
my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
|
||||
WHERE subscriptionid = ?";
|
||||
$sth = $dbh->prepare($squery);
|
||||
$sth->execute(
|
||||
my $seqsth = $dbh->prepare($squery);
|
||||
$seqsth->execute(
|
||||
$newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1,
|
||||
$newinnerloop2, $newinnerloop3, $subscriptionid
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
last if $nbissues == 1;
|
||||
last if HasSubscriptionExpired($subscriptionid) > 0;
|
||||
}
|
||||
print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue