From b7946b72e20d6a8b49e06f7dc012bb7712a1b700 Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 16 Jun 2005 19:10:09 +0000 Subject: [PATCH] Adding 2 status to serial issues : - delete : to delete the current issue - not issued : to distinguish missing from not issued serial number. --- C4/Bull.pm | 57 ++++++++++++++----- .../default/en/bull/statecollection.tmpl | 14 +++++ 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/C4/Bull.pm b/C4/Bull.pm index 752e03847a..0307a6e926 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -50,7 +50,7 @@ Give all XYZ functions &getserials &serialchangestatus &Find_Next_Date, &Get_Next_Seq &hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew - &getSupplierListWithLateIssues &GetLateIssues); + &getSupplierListWithLateIssues &GetLateIssues &serialdelete); sub getSupplierListWithLateIssues { my $dbh = C4::Context->dbh; @@ -274,7 +274,7 @@ sub getserials { my ($subscriptionid) = @_; my $dbh = C4::Context->dbh; # status = 2 is "arrived" - my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate from serial where subscriptionid = ? and status <>2 and status <>4"); + my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5"); $sth->execute($subscriptionid); my @serials; while(my $line = $sth->fetchrow_hashref) { @@ -288,28 +288,50 @@ sub getserials { return ($totalissues,@serials); } -sub serialchangestatus { - my ($serialid,$serialseq,$planneddate,$status)=@_; -# warn "($serialid,$serialseq,$planneddate,$status)"; - # 1st, get previous status : if we change from "waited" to something else, then we will have to create a new "waited" entry +sub serialdelete { + my ($serialid,$serialseq)=@_; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?"); $sth->execute($serialid); my ($subscriptionid,$oldstatus) = $sth->fetchrow; # change status & update subscriptionhistory - $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=? where serialid = ?"); - $sth->execute($serialseq,$planneddate,$status,$serialid); + my $sth = $dbh->prepare("delete * from serial where serialid = ?"); + $sth->execute($serialid); $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); $sth->execute($subscriptionid); my ($missinglist,$recievedlist) = $sth->fetchrow; - if ($status eq 2) { - $recievedlist .= ",$serialseq"; - } - if ($status eq 4) { - $missinglist .= ",$serialseq"; - } + $recievedlist =~ s/",$serialseq"//; + $missinglist =~ s/",$serialseq"//; $sth=$dbh->prepare("update subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?"); $sth->execute($recievedlist,$missinglist,$subscriptionid); +} + +sub serialchangestatus { + my ($serialid,$serialseq,$planneddate,$status)=@_; +# warn "($serialid,$serialseq,$planneddate,$status)"; + # 1st, get previous status : if we change from "waited" to something else, then we will have to create a new "waited" entry + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?"); + $sth->execute($serialid); + my ($subscriptionid,$oldstatus) = $sth->fetchrow; + # change status & update subscriptionhistory + if ($status eq 6){ + delissue($serialseq, $subscriptionid) + }else{ + $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=? where serialid = ?"); + $sth->execute($serialseq,$planneddate,$status,$serialid); + $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); + $sth->execute($subscriptionid); + my ($missinglist,$recievedlist) = $sth->fetchrow; + if ($status eq 2) { + $recievedlist .= ",$serialseq"; + } + $missinglist .= ",$serialseq" if ($status eq 4) ; + $missinglist .= ",not issued $serialseq" if ($status eq 5); + $sth=$dbh->prepare("update subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?"); + $sth->execute($recievedlist,$missinglist,$subscriptionid); + } + # create new waited entry if needed (ie : was a "waited" and has changed) if ($oldstatus eq 1 && $status ne 1) { $sth = $dbh->prepare("select * from subscription where subscriptionid = ? "); @@ -334,6 +356,13 @@ sub newissue { $sth->execute($serialseq,$subscriptionid,$biblionumber,$status, $planneddate); } +sub delissue { + my ($serialseq,$subscriptionid) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("delete from serial where serialseq= ? and subscriptionid= ? "); + $sth->execute($serialseq,$subscriptionid); +} + sub Get_Next_Date(@) { my ($planneddate,$subscription) = @_; my $resultdate; diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl index 5e118c5003..d4e41f51ac 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/statecollection.tmpl @@ -53,6 +53,16 @@ + + + + + + + + + + @@ -97,6 +107,10 @@

 

Missing issues

 

+ +

Not issued

+

 

+

Opac's note

 

-- 2.39.5