POD added.
authortoins <toins>
Wed, 12 Jul 2006 16:41:35 +0000 (16:41 +0000)
committertoins <toins>
Wed, 12 Jul 2006 16:41:35 +0000 (16:41 +0000)
serials/lateissues.pl
serials/serials-home.pl
serials/serials-recieve.pl
serials/subscription-bib-search.pl
serials/subscription-detail.pl

index 5433b64..179265b 100755 (executable)
 
 # $Id$
 
+=head1 NAME
+
+lateissues
+
+=head1 DESCRIPTION
+
+this script display late issue by types.
+
+=head1 PARAMETERS
+
+=over 4
+
+=item supplierid
+the id of the supplier this script has to search late issues.
+
+=back
+
+=cut
+
 use strict;
 use CGI;
 use C4::Auth;
@@ -35,18 +54,19 @@ my $query = new CGI;
 # my @subscriptions = GetSubscriptions($title,$ISSN);
 
 my $supplierid = $query->param('supplierid');
-my %supplierlist = GetSupplierListWithLateIssues;
+my %supplierlist = GetSuppliersWithLateIssues;
 my @select_supplier;
 push @select_supplier,"";
 foreach my $supplierid (keys %supplierlist){
-       push @select_supplier, $supplierid
+    push @select_supplier, $supplierid
 }
-my $CGIsupplier=CGI::scrolling_list( -name     => 'supplierid',
-                       -values   => \@select_supplier,
-                       -default  => $supplierid,
-                       -labels   => \%supplierlist,
-                       -size     => 1,
-                       -multiple => 0 );
+my $CGIsupplier=CGI::scrolling_list(
+            -name     => 'supplierid',
+            -values   => \@select_supplier,
+            -default  => $supplierid,
+            -labels   => \%supplierlist,
+            -size     => 1,
+            -multiple => 0 );
 
 my @lateissues;
 @lateissues = GetLateIssues($supplierid) if $supplierid;
@@ -56,18 +76,18 @@ my $nothing;
 
 my ($template, $loggedinuser, $cookie)
 = get_template_and_user({template_name => "serials/lateissues.tmpl",
-                               query => $query,
-                               type => "intranet",
-                               authnotrequired => 0,
-                               flagsrequired => {catalogue => 1},
-                               debug => 1,
-                               });
+                query => $query,
+                type => "intranet",
+                authnotrequired => 0,
+                flagsrequired => {catalogue => 1},
+                debug => 1,
+                });
 
 $template->param(
-       CGIsupplier => $CGIsupplier,
-       lateissues => \@lateissues,
-       phone => $supplierinfo[0]->{phone},
-       booksellerfax => $supplierinfo[0]->{booksellerfax},
-       bookselleremail => $supplierinfo[0]->{bookselleremail},
-       );
+    CGIsupplier => $CGIsupplier,
+    lateissues => \@lateissues,
+    phone => $supplierinfo[0]->{phone},
+    booksellerfax => $supplierinfo[0]->{booksellerfax},
+    bookselleremail => $supplierinfo[0]->{bookselleremail},
+    );
 output_html_with_http_headers $query, $cookie, $template->output;
index b440faf..1cb8507 100755 (executable)
 
 # $Id$
 
+=head1 NAME
+
+serials-home.pl
+
+=head1 DESCRIPTION
+
+this script is the main page for serials/
+
+=head1 PARAMETERS
+
+=over 4
+
+=item title
+
+=item ISSN
+
+=item biblionumber
+
+=back
+
+=cut
+
+
 use strict;
 use CGI;
 use C4::Auth;
index f0a9a6d..6827dbd 100755 (executable)
 
 # $Id$
 
+=head1 NAME
+
+serials-recieve.pl
+
+=head1 Parameters
+
+=over 4
+
+=item op
+ op can be :
+    * modsubscriptionhistory :to modify the subscription history 
+    * serialchangestatus     :to modify the status of this subscription
+
+=item subscriptionid
+
+=item user
+
+=item histstartdate
+
+=item enddate
+
+=item recievedlist
+
+=item missinglist
+
+=item opacnote
+
+=item librariannote
+
+=item serialid
+
+=item serialseq
+
+=item planneddate
+
+=item notes
+
+=item status
+
+=back
+
+=cut
+
+
 use strict;
 use CGI;
 use C4::Auth;
@@ -45,11 +89,13 @@ my $librariannote = $query->param('librariannote');
 my @serialids = $query->param('serialid');
 my @serialseqs = $query->param('serialseq');
 my @planneddates = $query->param('planneddate');
-my @publisheddates = $query->param('publisheddate');
+my @notes = $query->param('notes');
 my @status = $query->param('status');
+# my @publisheddates = $query->param('publisheddates');
+
 
 my ($template, $loggedinuser, $cookie)
-= get_template_and_user({template_name => "serials/statecollection.tmpl",
+= get_template_and_user({template_name => "serials/serials-recieve.tmpl",
                 query => $query,
                 type => "intranet",
                 authnotrequired => 0,
@@ -65,47 +111,26 @@ if ($op eq 'modsubscriptionhistory') {
     ModSubscriptionHistory($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
 }
 # change status except, if subscription has expired, for the "waited" issue.
-if ($op eq 'modserialstatus') {
-    my $sth = GetSerialStatusFromSerialId();
-    for (my $i=0;$i<=$#serialids;$i++) {
-        $sth->execute($serialids[$i]);
-
-        my ($oldstatus) = $sth->fetchrow;
-        if ($serialids[$i]) {
-            ModSerialStatus($serialids[$i],$serialseqs[$i],format_date_in_iso($publisheddates[$i]),($planneddates[$i]?format_date_in_iso($planneddates[$i]):format_date_in_iso(localtime(time()))),$status[$i],$notes[$i]) unless ($hassubscriptionexpired && $oldstatus == 1);
-            if (($status[$i]==2) && C4::Context->preference("serialsadditems")){
-                my %info;
-                $info{branch}=$homebranches[$i];
-#               $info{barcode}=$barcodes[$i];
-                $info{itemcallnumber}=$itemcallnumbers[$i];
-                $info{location}=$locations[$i];
-                $info{status}=$itemstatus[$i];
-                $info{notes}=$serialseqs[$i];
-                my ($status, @errors)= ItemizeSerials($serialids[$i],\%info);
-            }
-        } else {
-            # add a special issue
-            if ($serialseqs[$i]) {
-                my $subscription=GetSubscription($subscriptionid);
-                NewIssue($serialseqs[$i],$subscriptionid,$subscription->{biblionumber},$status[$i], format_date_in_iso($planneddates[$i]));
-            }
-            if (($status[$i]==2) && C4::Context->preference("serialsadditems") && !HasSubscriptionExpired($subscriptionid)){
-                my %info;
-                $info{branch}=$homebranches[$i];
-#                 $info{barcode}=$barcodes[$i];
-                $info{itemcallnumber}=$itemcallnumbers[$i];
-                $info{location}=$locations[$i];
-                $info{status}=$itemstatus[$i];
-                $info{notes}=$serialseqs[$i];
-                my ($status, @errors)= ItemizeSerials($serialids[$i],\%info);
-            }
-        }
-    }
+if ($op eq 'serialchangestatus') {
+       my $sth = $dbh->prepare("select status from serial where serialid=?");
+       for (my $i=0;$i<=$#serialids;$i++) {
+               $sth->execute($serialids[$i]);
+               my ($oldstatus) = $sth->fetchrow;
+               if ($serialids[$i]) {
+                       ModSerialStatus($serialids[$i],$serialseqs[$i],format_date_in_iso($planneddates[$i]),$status[$i],$notes[$i]) unless ($hassubscriptionexpired && $oldstatus == 1);
+               } else {
+                       # add a special issue
+                       if ($serialseqs[$i]) {
+                               my $subscription=getsubscription($subscriptionid);
+                               newissue($serialseqs[$i],$subscriptionid,$subscription->{biblionumber},$status[$i], format_date_in_iso($planneddates[$i]));
+                       }
+               }
+       }
 }
 my $subs = &GetSubscription($subscriptionid);
 my ($totalissues,@serialslist) = GetSerials($subscriptionid,10);
 
-my $sth= GetSubscriptionHistoryFromSubscriptionId();
+my $sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId();
 
 $sth->execute($subscriptionid);
 my $solhistory = $sth->fetchrow_hashref;
@@ -159,7 +184,7 @@ if (C4::Context->preference("serialsadditems")){
     $template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ;
 }
 
-my $sth= GetSubscriptionHistoryFromSubscriptionId();
+my $sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId();
 $sth->execute($subscriptionid);
 my $solhistory = $sth->fetchrow_hashref;
 
index 51b235d..1620ed8 100755 (executable)
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
+
+=head1 NAME
+
+subscription-bib-search.pl
+
+=head1 DESCRIPTION
+
+this script search among all existing subscriptions.
+
+=head1 PARAMETERS
+
+=over 4
+
+=item op
+op use to know the operation to do on this template.
+ * do_search : to search the subscription.
+
+Note that if op = do_search there are some others params specific to the search :
+    marclist,and_or,excluding,operator,value
+
+=item startfrom
+to multipage gestion.
+
+
+=back
+
+=cut
+
+
 use strict;
 require Exporter;
 use CGI;
@@ -30,147 +59,140 @@ use C4::Interface::CGI::Output;
 use C4::SearchMarc;
 
 my $query=new CGI;
-my $type=$query->param('type');
+my $type=$query->param('type');
 my $op = $query->param('op');
 my $dbh = C4::Context->dbh;
 
 my $startfrom=$query->param('startfrom');
-$startfrom=0 if(!defined $startfrom);
+$startfrom=0 unless $startfrom;
 my ($template, $loggedinuser, $cookie);
 my $resultsperpage;
 
 if ($op eq "do_search") {
-       my @marclist = $query->param('marclist');
-       my @and_or = $query->param('and_or');
-       my @excluding = $query->param('excluding');
-       my @operator = $query->param('operator');
-       my @value = $query->param('value');
-
-       $resultsperpage= $query->param('resultsperpage');
-       $resultsperpage = 19 if(!defined $resultsperpage);
-       my $orderby = $query->param('orderby');
-
-       # builds tag and subfield arrays
-       my @tags;
-
-       foreach my $marc (@marclist) {
-               if ($marc) {
-                       my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc);
-                       if ($tag) {
-                               push @tags,$dbh->quote("$tag$subfield");
-                       } else {
-                               push @tags, $dbh->quote(substr($marc,0,4));
-                       }
-               } else {
-                       push @tags, "";
-               }
-       }
-       my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or,
-                                                                               \@excluding, \@operator, \@value,
-                                                                               $startfrom*$resultsperpage, $resultsperpage,$orderby);
-
-       ($template, $loggedinuser, $cookie)
-               = get_template_and_user({template_name => "serials/result.tmpl",
-                               query => $query,
-                               type => "intranet",
-                               authnotrequired => 0,
-                               flagsrequired => {borrowers => 1},
-                               flagsrequired => {catalogue => 1},
-                               debug => 1,
-                               });
-
-       # multi page display gestion
-       my $displaynext=0;
-       my $displayprev=$startfrom;
-       if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
-               $displaynext = 1;
-       }
-
-       my @field_data = ();
-
-
-       for(my $i = 0 ; $i <= $#marclist ; $i++)
-       {
-               push @field_data, { term => "marclist", val=>$marclist[$i] };
-               push @field_data, { term => "and_or", val=>$and_or[$i] };
-               push @field_data, { term => "excluding", val=>$excluding[$i] };
-               push @field_data, { term => "operator", val=>$operator[$i] };
-               push @field_data, { term => "value", val=>$value[$i] };
-       }
-
-       my @numbers = ();
-
-       if ($total>$resultsperpage)
-       {
-               for (my $i=1; $i<$total/$resultsperpage+1; $i++)
-               {
-                       if ($i<16)
-                       {
-                       my $highlight=0;
-                       ($startfrom==($i-1)) && ($highlight=1);
-                       push @numbers, { number => $i,
-                                       highlight => $highlight ,
-                                       searchdata=> \@field_data,
-                                       startfrom => ($i-1)};
-                       }
-       }
-       }
-
-       my $from = $startfrom*$resultsperpage+1;
-       my $to;
-
-       if($total < (($startfrom+1)*$resultsperpage))
-       {
-               $to = $total;
-       } else {
-               $to = (($startfrom+1)*$resultsperpage);
-       }
-       $template->param(result => $results,
-                                                       startfrom=> $startfrom,
-                                                       displaynext=> $displaynext,
-                                                       displayprev=> $displayprev,
-                                                       resultsperpage => $resultsperpage,
-                                                       startfromnext => $startfrom+1,
-                                                       startfromprev => $startfrom-1,
-                                                       searchdata=>\@field_data,
-                                                       total=>$total,
-                                                       from=>$from,
-                                                       to=>$to,
-                                                       numbers=>\@numbers,
-                                                       );
+    my @marclist = $query->param('marclist');
+    my @and_or = $query->param('and_or');
+    my @excluding = $query->param('excluding');
+    my @operator = $query->param('operator');
+    my @value = $query->param('value');
+
+    $resultsperpage= $query->param('resultsperpage');
+    $resultsperpage = 19 if(!defined $resultsperpage);
+    my $orderby = $query->param('orderby');
+
+    # builds tag and subfield arrays
+    my @tags;
+
+    foreach my $marc (@marclist) {
+        if ($marc) {
+            my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc);
+            if ($tag) {
+                push @tags,$dbh->quote("$tag$subfield");
+            } else {
+                push @tags, $dbh->quote(substr($marc,0,4));
+            }
+        } else {
+            push @tags, "";
+        }
+    }
+    my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or,
+                               \@excluding, \@operator, \@value,
+                               $startfrom*$resultsperpage, $resultsperpage,$orderby);
+
+    ($template, $loggedinuser, $cookie)
+        = get_template_and_user({template_name => "serials/result.tmpl",
+                query => $query,
+                type => "intranet",
+                authnotrequired => 0,
+                flagsrequired => {borrowers => 1},
+                flagsrequired => {catalogue => 1},
+                debug => 1,
+                });
+
+    # multi page display gestion
+    my $displaynext=0;
+    my $displayprev=$startfrom;
+    if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
+        $displaynext = 1;
+    }
+
+    my @field_data = ();
+
+
+    for(my $i = 0 ; $i <= $#marclist ; $i++)
+    {
+        push @field_data, { term => "marclist", val=>$marclist[$i] };
+        push @field_data, { term => "and_or", val=>$and_or[$i] };
+        push @field_data, { term => "excluding", val=>$excluding[$i] };
+        push @field_data, { term => "operator", val=>$operator[$i] };
+        push @field_data, { term => "value", val=>$value[$i] };
+    }
+
+    my @numbers = ();
+
+    if ($total>$resultsperpage)
+    {
+        for (my $i=1; $i<$total/$resultsperpage+1; $i++)
+        {
+            if ($i<16)
+            {
+                my $highlight=0;
+                ($startfrom==($i-1)) && ($highlight=1);
+                push @numbers, { number => $i,
+                    highlight => $highlight ,
+                    searchdata=> \@field_data,
+                    startfrom => ($i-1)};
+            }
+        }
+    }
+
+    my $from = $startfrom*$resultsperpage+1;
+    my $to;
+
+    if($total < (($startfrom+1)*$resultsperpage))
+    {
+        $to = $total;
+    } else {
+        $to = (($startfrom+1)*$resultsperpage);
+    }
+    $template->param(result => $results,
+                            startfrom=> $startfrom,
+                            displaynext=> $displaynext,
+                            displayprev=> $displayprev,
+                            resultsperpage => $resultsperpage,
+                            startfromnext => $startfrom+1,
+                            startfromprev => $startfrom-1,
+                            searchdata=>\@field_data,
+                            total=>$total,
+                            from=>$from,
+                            to=>$to,
+                            numbers=>\@numbers,
+                            );
 } else {
-       ($template, $loggedinuser, $cookie)
-               = get_template_and_user({template_name => "serials/subscription-bib-search.tmpl",
-                               query => $query,
-                               type => "intranet",
-                               authnotrequired => 0,
-                               flagsrequired => {catalogue => 1},
-                               debug => 1,
-                               });
-       my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
-       $sth->execute;
-       my  @itemtype;
-       my %itemtypes;
-       push @itemtype, "";
-       $itemtypes{''} = "";
-       while (my ($value,$lib) = $sth->fetchrow_array) {
-               push @itemtype, $value;
-               $itemtypes{$value}=$lib;
-       }
-
-       my $CGIitemtype=CGI::scrolling_list( -name     => 'value',
-                               -values   => \@itemtype,
-                               -labels   => \%itemtypes,
-                               -size     => 1,
-                               -multiple => 0 );
-       $sth->finish;
-
-       $template->param(
-                       CGIitemtype => $CGIitemtype,
-                       );
+    ($template, $loggedinuser, $cookie)
+        = get_template_and_user({template_name => "serials/subscription-bib-search.tmpl",
+                query => $query,
+                type => "intranet",
+                authnotrequired => 0,
+                flagsrequired => {catalogue => 1},
+                debug => 1,
+                });
+
+    my  %itemtypes = GetItemTypes();
+    my @values = values %itemtypes;
+    my @labels = keys %itemtypes;
+    my $CGIitemtype=CGI::scrolling_list(
+            -name     => 'value',
+            -values   => \@values,
+            -labels   => \@labels,
+            -size     => 1,
+            -multiple => 0
+    );
+
+    $template->param(
+            CGIitemtype => $CGIitemtype,
+    );
 }
 
-
 # Print the page
 output_html_with_http_headers $query, $cookie, $template->output;
 
index 1d4a909..52d34fa 100755 (executable)
 
 # $Id$
 
+=head1 NAME
+
+subscription-details.pl
+
+=head1 DESCRIPTION
+
+this script display the detail of a subscription given on input arg.
+
+=head1 Parameters
+
+=over 4
+
+=item op
+op use to know the operation to do on this template.
+ * modsubscription : to modify the subscription.
+ * del : to delete this subscription.
+
+Note that if op = modsubscription there are a lot of other parameters.
+
+=item subscriptionid
+The subscription this script has to dislay
+
+=back
+
+=cut
+
+
 use strict;
 use CGI;
 use C4::Auth;
@@ -37,63 +64,62 @@ my $sth;
 # my $id;
 my ($template, $loggedinuser, $cookie, $subs, $user, $sessionID, $flags);
 my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
-       $dow, $numberlength, $weeklength, $monthlength,
-       $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-       $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-       $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-       $numberingmethod, $status, $biblionumber, $bibliotitle, $notes,$letter);
+    $dow, $numberlength, $weeklength, $monthlength,
+    $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
+    $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
+    $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
+    $numberingmethod, $status, $biblionumber, $bibliotitle, $notes,$letter);
 
 $subscriptionid = $query->param('subscriptionid');
 
 if ($op eq 'modsubscription') {
-       $auser = $query->param('user');
-       $librarian = $query->param('librarian');
-       $cost = $query->param('cost');
-       $aqbooksellerid = $query->param('aqbooksellerid');
-       $biblionumber = $query->param('biblionumber');
-       $aqbudgetid = $query->param('aqbudgetid');
-       $startdate = format_date_in_iso($query->param('startdate'));
-       $periodicity = $query->param('periodicity');
-       $dow = $query->param('dow');
-       $numberlength = $query->param('numberlength');
-       $weeklength = $query->param('weeklength');
-       $monthlength = $query->param('monthlength');
-       $add1 = $query->param('add1');
-       $every1 = $query->param('every1');
-       $whenmorethan1 = $query->param('whenmorethan1');
-       $setto1 = $query->param('setto1');
-       $lastvalue1 = $query->param('lastvalue1');
-       $innerloop1 = $query->param('innerloop1');
-       $add2 = $query->param('add2');
-       $every2 = $query->param('every2');
-       $whenmorethan2 = $query->param('whenmorethan2');
-       $setto2 = $query->param('setto2');
-       $lastvalue2 = $query->param('lastvalue2');
-       $innerloop2 = $query->param('innerloop2');
-       $add3 = $query->param('add3');
-       $every3 = $query->param('every3');
-       $whenmorethan3 = $query->param('whenmorethan3');
-       $setto3 = $query->param('setto3');
-       $lastvalue3 = $query->param('lastvalue3');
-       $innerloop3 = $query->param('innerloop3');
-       $numberingmethod = $query->param('numberingmethod');
-       $status = 1;
-       $notes = $query->param('notes');
-       $letter = $query->param('letter');
-    
-       &ModSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
-                                       $periodicity,$dow,$numberlength,$weeklength,$monthlength,
-                                       $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-                                       $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-                                       $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-                                       $numberingmethod, $status, $biblionumber, $notes, $letter, $subscriptionid);
+    $auser = $query->param('user');
+    $librarian = $query->param('librarian');
+    $cost = $query->param('cost');
+    $aqbooksellerid = $query->param('aqbooksellerid');
+    $biblionumber = $query->param('biblionumber');
+    $aqbudgetid = $query->param('aqbudgetid');
+    $startdate = format_date_in_iso($query->param('startdate'));
+    $periodicity = $query->param('periodicity');
+    $dow = $query->param('dow');
+    $numberlength = $query->param('numberlength');
+    $weeklength = $query->param('weeklength');
+    $monthlength = $query->param('monthlength');
+    $add1 = $query->param('add1');
+    $every1 = $query->param('every1');
+    $whenmorethan1 = $query->param('whenmorethan1');
+    $setto1 = $query->param('setto1');
+    $lastvalue1 = $query->param('lastvalue1');
+    $innerloop1 = $query->param('innerloop1');
+    $add2 = $query->param('add2');
+    $every2 = $query->param('every2');
+    $whenmorethan2 = $query->param('whenmorethan2');
+    $setto2 = $query->param('setto2');
+    $lastvalue2 = $query->param('lastvalue2');
+    $innerloop2 = $query->param('innerloop2');
+    $add3 = $query->param('add3');
+    $every3 = $query->param('every3');
+    $whenmorethan3 = $query->param('whenmorethan3');
+    $setto3 = $query->param('setto3');
+    $lastvalue3 = $query->param('lastvalue3');
+    $innerloop3 = $query->param('innerloop3');
+    $numberingmethod = $query->param('numberingmethod');
+    $status = 1;
+    $notes = $query->param('notes');
+    $letter = $query->param('letter');
+
+    &ModSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
+                    $periodicity,$dow,$numberlength,$weeklength,$monthlength,
+                    $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
+                    $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
+                    $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
+                    $numberingmethod, $status, $biblionumber, $notes, $letter, $subscriptionid);
 }
 
 if ($op eq 'del') {
-       &DelSubscription($subscriptionid);
-       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=../bull-home.pl\"></html>";
-       exit;
-
+    &DelSubscription($subscriptionid);
+    print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=../serials-home.pl\"></html>";
+    exit;
 }
 $subs = &GetSubscription($subscriptionid);
 # html'ize distributedto
@@ -103,61 +129,60 @@ $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscript
 
 ($template, $loggedinuser, $cookie)
 = get_template_and_user({template_name => "serials/subscription-detail.tmpl",
-                               query => $query,
-                               type => "intranet",
-                               authnotrequired => 0,
-                               flagsrequired => {catalogue => 1},
-                               debug => 1,
-                               });
+                query => $query,
+                type => "intranet",
+                authnotrequired => 0,
+                flagsrequired => {catalogue => 1},
+                debug => 1,
+                });
 
 ($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, "intranet");
 
 $template->param(
-       user => $subs->{auser},
-       librarian => $subs->{librarian},
-       aqbooksellerid => $subs->{aqbooksellerid},
-       aqbooksellername => $subs->{aqbooksellername},
-       cost => $subs->{cost},
-       aqbudgetid => $subs->{aqbudgetid},
-       bookfundid => $subs->{bookfundid},
-       startdate => format_date($subs->{startdate}),
-       periodicity => $subs->{periodicity},
-       dow => $subs->{dow},
-       numberlength => $subs->{numberlength},
-       weeklength => $subs->{weeklength},
-       monthlength => $subs->{monthlength},
-       add1 => $subs->{add1},
-       every1 => $subs->{every1},
-       whenmorethan1 => $subs->{whenmorethan1},
-       innerloop1 => $subs->{innerloop1},
-       setto1 => $subs->{setto1},
-       lastvalue1 => $subs->{lastvalue1},
-       add2 => $subs->{add2},
-       every2 => $subs->{every2},
-       whenmorethan2 => $subs->{whenmorethan2},
-       setto2 => $subs->{setto2},
-       lastvalue2 => $subs->{lastvalue2},
-       innerloop2 => $subs->{innerloop2},
-       add3 => $subs->{add3},
-       every3 => $subs->{every3},
-       whenmorethan3 => $subs->{whenmorethan3},
-       setto3 => $subs->{setto3},
-       lastvalue3 => $subs->{lastvalue3},
-       innerloop3 => $subs->{innerloop3},
-       numberingmethod => $subs->{numberingmethod},
-       status => $subs->{status},
-       biblionumber => $subs->{biblionumber},
-       bibliotitle => $subs->{bibliotitle},
-       notes => $subs->{notes},
-       letter => $subs->{letter},
-       distributedto => $subs->{distributedto},
-       subscriptionid => $subs->{subscriptionid},
-       serialslist => \@serialslist,
-       totalissues => $totalissues,
-       );
-$template->param(
-                       "periodicity$subs->{periodicity}" => 1,
-                       "arrival$subs->{dow}" => 1,
-                       );
+    user => $subs->{auser},
+    librarian => $subs->{librarian},
+    aqbooksellerid => $subs->{aqbooksellerid},
+    aqbooksellername => $subs->{aqbooksellername},
+    cost => $subs->{cost},
+    aqbudgetid => $subs->{aqbudgetid},
+    bookfundid => $subs->{bookfundid},
+    startdate => format_date($subs->{startdate}),
+    periodicity => $subs->{periodicity},
+    dow => $subs->{dow},
+    numberlength => $subs->{numberlength},
+    weeklength => $subs->{weeklength},
+    monthlength => $subs->{monthlength},
+    add1 => $subs->{add1},
+    every1 => $subs->{every1},
+    whenmorethan1 => $subs->{whenmorethan1},
+    innerloop1 => $subs->{innerloop1},
+    setto1 => $subs->{setto1},
+    lastvalue1 => $subs->{lastvalue1},
+    add2 => $subs->{add2},
+    every2 => $subs->{every2},
+    whenmorethan2 => $subs->{whenmorethan2},
+    setto2 => $subs->{setto2},
+    lastvalue2 => $subs->{lastvalue2},
+    innerloop2 => $subs->{innerloop2},
+    add3 => $subs->{add3},
+    every3 => $subs->{every3},
+    whenmorethan3 => $subs->{whenmorethan3},
+    setto3 => $subs->{setto3},
+    lastvalue3 => $subs->{lastvalue3},
+    innerloop3 => $subs->{innerloop3},
+    numberingmethod => $subs->{numberingmethod},
+    status => $subs->{status},
+    biblionumber => $subs->{biblionumber},
+    bibliotitle => $subs->{bibliotitle},
+    notes => $subs->{notes},
+    letter => $subs->{letter},
+    distributedto => $subs->{distributedto},
+    subscriptionid => $subs->{subscriptionid},
+    serialslist => \@serialslist,
+    totalissues => $totalissues,
+    "periodicity$subs->{periodicity}" => 1,
+    "arrival$subs->{dow}" => 1
+);
+
 
 output_html_with_http_headers $query, $cookie, $template->output;