[Koha-patches] [PATCH] Fix some code issues in serials scripts

Colin Campbell colin.campbell at ptfs-europe.com
Mon Feb 1 20:48:29 CET 2010


Add use warnings where not present
Remove unused variables
Avoid redeclarations of variables
trailing spaces trimmed
---
 serials/acqui-search-result.pl     |    4 +-
 serials/checkexpiration.pl         |    2 +-
 serials/claims.pl                  |    1 -
 serials/lateissues-excel.pl        |    1 -
 serials/member-search.pl           |   20 +++---
 serials/routing-preview.pl         |    2 +-
 serials/serial-issues.pl           |    1 -
 serials/serials-collection.pl      |    8 +-
 serials/serials-recieve.pl         |   17 ++--
 serials/statecollection.pl         |    5 +-
 serials/subscription-add.pl        |  142 ++++++++++++++++++------------------
 serials/subscription-bib-search.pl |    8 +-
 serials/subscription-renew.pl      |    3 +-
 serials/viewalerts.pl              |    2 +-
 14 files changed, 107 insertions(+), 109 deletions(-)

diff --git a/serials/acqui-search-result.pl b/serials/acqui-search-result.pl
index df73738..8b8b896 100755
--- a/serials/acqui-search-result.pl
+++ b/serials/acqui-search-result.pl
@@ -27,7 +27,7 @@ acqui-search-result.pl
 
 =head1 DESCRIPTION
  TODO
- 
+
 =head1 PARAMETERS
 
 =over 4
@@ -67,7 +67,7 @@ my @suppliers = GetBookSeller($supplier);
 my $loop_suppliers = [];
 for my $s (@suppliers) {
     my $orders = GetPendingOrders($s->{'id'});
-    
+
     my $loop_basket = [];
     for my $ord ( @{$orders} ) {
         push @{$loop_basket}, {
diff --git a/serials/checkexpiration.pl b/serials/checkexpiration.pl
index 865e163..c055d5d 100755
--- a/serials/checkexpiration.pl
+++ b/serials/checkexpiration.pl
@@ -85,7 +85,7 @@ if ($date) {
             push @subscriptions_loop,$subscription;
         }
     }
-    
+
     $template->param (
         title           => $title,
         issn            => $issn,
diff --git a/serials/claims.pl b/serials/claims.pl
index d6a7ce7..0a28ebe 100755
--- a/serials/claims.pl
+++ b/serials/claims.pl
@@ -19,7 +19,6 @@ my $supplierid = $input->param('supplierid');
 my $suppliername = $input->param('suppliername');
 my $order = $input->param('order');
 my %supplierlist = GetSuppliersWithLateIssues();
-my @select_supplier;
 
 # open template first (security & userenv set here)
 my ($template, $loggedinuser, $cookie)
diff --git a/serials/lateissues-excel.pl b/serials/lateissues-excel.pl
index 6110bcd..ea0f503 100755
--- a/serials/lateissues-excel.pl
+++ b/serials/lateissues-excel.pl
@@ -33,7 +33,6 @@ my $op = $query->param('op') || q{};
 my $serialidcount = @serialid;
 
 my %supplierlist = GetSuppliersWithLateIssues;
-my @select_supplier;
 
 my @loop1;
 my ($count, @lateissues);
diff --git a/serials/member-search.pl b/serials/member-search.pl
index 6e26a07..6009db4 100755
--- a/serials/member-search.pl
+++ b/serials/member-search.pl
@@ -38,7 +38,7 @@ my $startfrom = $cgi->param('startfrom')||1;
 
 my $patron = $cgi->Vars;
 foreach (keys %$patron){
-	delete $$patron{$_} unless($$patron{$_}); 
+    delete $$patron{$_} unless($$patron{$_});
 }
 
 my @categories=C4::Category->all;
@@ -61,12 +61,12 @@ foreach my $category (@categories){
 			 };
 	$categories_dislay{$$category{categorycode}} = $hash;
 }
-$template->param( 
+$template->param(
         "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
             );
 if (C4::Context->preference("AddPatronLists")=~/code/){
     $categories[0]->{'first'}=1;
-}  
+}
 
 my $member=$cgi->param('member');
 my $orderby=$cgi->param('orderby');
@@ -95,7 +95,7 @@ if ($results){
 	$count =scalar(@$results);
 }
 my @resultsdata;
-my $to=($count>$to?$to:$count);
+$to=($count>$to?$to:$count);
 my $index=$from;
 foreach my $borrower(@$results[$from..$to-1]){
   #find out stats
@@ -121,10 +121,10 @@ if ($$patron{categorycode}){
 	}
 }
 my %parameters=
-        (  %$patron
-		, 'orderby'			=> $orderby 
-		, 'resultsperpage'	=> $resultsperpage 
-        , 'type'=> 'intranet'); 
+(  %{$patron},
+    'orderby' => $orderby,
+    'resultsperpage' => $resultsperpage,
+    'type'=> 'intranet');
 my $base_url =
     'member-search.pl?&'
   . join(
@@ -138,7 +138,7 @@ $template->param(
         $startfrom, 'startfrom'
     ),
     startfrom => $startfrom,
-    from      => ($startfrom-1)*$resultsperpage+1,  
+    from      => ($startfrom-1)*$resultsperpage+1,
     to        => $to,
     multipage => ($count != $to+1 || $startfrom!=1),
 );
@@ -148,7 +148,7 @@ $template->param(
 );
 
 
-$template->param( 
+$template->param(
         searching       => "1",
 		actionname		=> basename($0),
 		%$patron,
diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl
index ab9e6a6..7fb4719 100755
--- a/serials/routing-preview.pl
+++ b/serials/routing-preview.pl
@@ -43,7 +43,7 @@ if($edit){
 
 my ($routing, @routinglist) = getroutinglist($subscriptionid);
 my $subs = GetSubscription($subscriptionid);
-my ($count, at serials) = GetSerials($subscriptionid);
+my ($tmp , at serials) = GetSerials($subscriptionid);
 my ($template, $loggedinuser, $cookie);
 
 if($ok){
diff --git a/serials/serial-issues.pl b/serials/serial-issues.pl
index 842876a..67716a2 100755
--- a/serials/serial-issues.pl
+++ b/serials/serial-issues.pl
@@ -57,7 +57,6 @@ my $dbh = C4::Context->dbh;
 my $selectview = $query->param('selectview');
 $selectview = C4::Context->preference("SubscriptionHistory") unless $selectview;
 
-my $sth;
 my ($template, $loggedinuser, $cookie);
 my $biblionumber = $query->param('biblionumber');
 if ($selectview eq "full"){
diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl
index aee821f..c82a2fa 100755
--- a/serials/serials-collection.pl
+++ b/serials/serials-collection.pl
@@ -34,8 +34,6 @@ my $query = new CGI;
 my $op = $query->param('op') || q{};
 my $dbh = C4::Context->dbh;
 
-my $sth;
-# my $id;
 my ($template, $loggedinuser, $cookie);
 ($template, $loggedinuser, $cookie)
   = get_template_and_user({template_name => "serials/serials-collection.tmpl",
@@ -55,7 +53,7 @@ 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 = ?");
 	$sth->execute($subscriptionid);
 
@@ -71,12 +69,12 @@ if($op eq 'gennext' && @subscriptionid){
              $newinnerloop1, $newinnerloop2, $newinnerloop3
             ) = GetNextSeq($subscription);
 
-	     ## We generate the next publication date    
+	     ## We generate the next publication date
 	     my $nextpublisheddate = GetNextDate( $expected->{planneddate}->output('iso'), $subscription );
 	     ## Creating the new issue
 	     NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'},
 	             1, $nextpublisheddate, $nextpublisheddate );
-             
+
 	     ## Updating the subscription seq status
 	     my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
 	                 WHERE  subscriptionid = ?";
diff --git a/serials/serials-recieve.pl b/serials/serials-recieve.pl
index 6df5b94..d70def4 100755
--- a/serials/serials-recieve.pl
+++ b/serials/serials-recieve.pl
@@ -28,7 +28,7 @@ serials-recieve.pl
 
 =item op
 op can be :
-    * modsubscriptionhistory :to modify the subscription history 
+    * modsubscriptionhistory :to modify the subscription history
     * serialchangestatus     :to modify the status of this subscription
 
 =item subscriptionid
@@ -63,6 +63,7 @@ op can be :
 
 
 use strict;
+use warnings;
 use CGI;
 use C4::Auth;
 use C4::Dates qw/format_date format_date_in_iso/;
@@ -125,7 +126,7 @@ 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]),format_date_in_iso($publisheddates[$i]),$status[$i],$notes[$i]) unless ($hassubscriptionexpired && $oldstatus == 1);
@@ -140,11 +141,11 @@ if ($op eq 'serialchangestatus') {
                 my ($status2, @errors)= ItemizeSerials($serialids[$i],\%info);
                 my $sth2 = $dbh->prepare("UPDATE subscriptionhistory SET lastbranch = ? WHERE subscriptionid = ?");
                 $sth2->execute($homebranches[$i],$subscriptionid);
-                $sth2->finish;			    
+                $sth2->finish;
                 # remove from missing list if item being checked in is on it
                 if ($status2 ==1){
                 removeMissingIssue($serialseqs[$i],$subscriptionid);
-                }			    
+                }
             }
         } else {
             # add a special issue
@@ -185,7 +186,7 @@ my $subs = &GetSubscription($subscriptionid);
 my ($totalissues, at serialslist) = GetSerials($subscriptionid);
 my $count = @serialslist;
 for(my $i=0;$i<$count;$i++){
-    warn "la : $i";
+    #warn "la : $i";
     $serialslist[$i]->{'callnumber'} = $subscription->{'callnumber'};
     my $temp = rand(10000000);
     $serialslist[$i]->{'barcode'} = "TEMP" . sprintf("%.0f",$temp);
@@ -217,7 +218,7 @@ if (C4::Context->preference("serialsadditems")){
     }
     my $itemstatushash = GetItemStatus($fwk);
     my @itemstatusloop;
-	my $itemstatusloopcount=0;    
+	my $itemstatusloopcount=0;
     foreach my $thisitemstatus (keys %$itemstatushash) {
         my %row =(itemval => $thisitemstatus,
                     itemlib => $itemstatushash->{$thisitemstatus},
@@ -242,7 +243,7 @@ if (C4::Context->preference("serialsadditems")){
 		$data->{"branchloop"} = \@branchloop ;
 	}
 # warn "Choice: $choice";
-    $template->param(choice => $choice);    
+    $template->param(choice => $choice);
     $template->param(serialadditems =>C4::Context->preference("serialsadditems"),
                     branchloop => \@branchloop,
                     ) ;
@@ -271,7 +272,7 @@ $template->param(
             bibliotitle => $subs->{bibliotitle},
             biblionumber => $subs->{biblionumber},
             hassubscriptionexpired =>$hassubscriptionexpired,
-            abouttoexpire =>$abouttoexpire,    
+            abouttoexpire =>$abouttoexpire,
             routing => $routing,
             missingseq => $manualissue,
             frommissing => $manualstatus,
diff --git a/serials/statecollection.pl b/serials/statecollection.pl
index 7e40369..13960fb 100755
--- a/serials/statecollection.pl
+++ b/serials/statecollection.pl
@@ -17,6 +17,7 @@
 
 
 use strict;
+use warnings;
 use CGI;
 use C4::Auth;
 use C4::Dates qw/format_date format_date_in_iso/;
@@ -66,8 +67,8 @@ if ($op eq 'serialchangestatus') {
 		} 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 $sub=getsubscription($subscriptionid);
+				newissue($serialseqs[$i],$subscriptionid,$sub->{biblionumber},$status[$i], format_date_in_iso($planneddates[$i]));
 			}
 		}
 	}
diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl
index 6ee32f5..46fd88d 100755
--- a/serials/subscription-add.pl
+++ b/serials/subscription-add.pl
@@ -30,21 +30,15 @@ use C4::Context;
 use C4::Branch; # GetBranches
 use C4::Serials;
 use C4::Letters;
+use Carp;
 
 #use Smart::Comments;
 
-my $query = new CGI;
+my $query = CGI->new;
 my $op = $query->param('op') || '';
 my $dbh = C4::Context->dbh;
-my ($subscriptionid,$auser,$branchcode,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
-	$firstacquidate, $dow, $irregularity, $numberpattern, $numberlength, $weeklength, $monthlength, $sublength,
-	$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
-	$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
-	$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-	$numberingmethod, $status, $biblionumber,
-	$bibliotitle, $callnumber, $notes, $hemisphere, $letter, $manualhistory,$serialsadditems, $location);
+my $sub_length;
 
-	my @budgets;
 my ($template, $loggedinuser, $cookie)
 = get_template_and_user({template_name => "serials/subscription-add.tmpl",
 				query => $query,
@@ -68,11 +62,11 @@ my $nextexpected;
 
 if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
 
-    $subscriptionid = $query->param('subscriptionid');
-    $subs = &GetSubscription($subscriptionid);
+    my $subscriptionid = $query->param('subscriptionid');
+    $subs = GetSubscription($subscriptionid);
 ## FIXME : Check rights to edit if mod. Could/Should display an error message.
     if ($subs->{'cannotedit'} && $op eq 'mod'){
-      warn "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
+      carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
       print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
     }
     $firstissuedate = $subs->{firstacquidate};  # in iso format.
@@ -87,15 +81,13 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
 	  }
     $subs->{'letter'}='' unless($subs->{'letter'});
     letter_loop($subs->{'letter'}, $template);
-    $irregularity   = $subs->{'irregularity'};
-    $numberpattern  = $subs->{'numberpattern'};
     $nextexpected = GetNextExpected($subscriptionid);
     $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ;
     $subs->{nextacquidate} = $nextexpected->{planneddate}->output()  if($op eq 'mod');
     unless($op eq 'modsubscription') {
 		foreach my $length_unit qw(numberlength weeklength monthlength){
 			if ($subs->{$length_unit}){
-				$sublength=$subs->{$length_unit};
+				$sub_length=$subs->{$length_unit};
 				$sub_on=$length_unit;
 				last;
 			}
@@ -106,7 +98,7 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
         $template->param(
                     $op => 1,
                     "subtype_$sub_on" => 1,
-                    sublength =>$sublength,
+                    sublength =>$sub_length,
                     history => ($op eq 'mod'),
                     "periodicity".$subs->{'periodicity'} => 1,
                     "numberpattern".$subs->{'numberpattern'} => 1,
@@ -120,18 +112,18 @@ my $onlymine=C4::Context->preference('IndependantBranches') &&
              C4::Context->userenv->{flags} % 2 !=1 &&
              C4::Context->userenv->{branch};
 my $branches = GetBranches($onlymine);
-my @branchloop;
-for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
+my $branchloop;
+for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) {
     my $selected = 0;
     $selected = 1 if ($thisbranch eq C4::Context->userenv->{'branch'});
     $selected = 1 if (defined($subs) && $thisbranch eq $subs->{'branchcode'});
-    my %row =(value => $thisbranch,
-                selected => $selected,
-                branchname => $branches->{$thisbranch}->{'branchname'},
-            );
-    push @branchloop, \%row;
+    push @{$branchloop}, {
+        value => $thisbranch,
+        selected => $selected,
+        branchname => $branches->{$thisbranch}->{'branchname'},
+    };
 }
-$template->param(branchloop => \@branchloop,
+$template->param(branchloop => $branchloop,
     DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
 );
 my $count = 0;
@@ -140,13 +132,58 @@ $template->param(  'dateformat_' . C4::Context->preference('dateformat') => 1 ,
                 );
 
 if ($op eq 'addsubscription') {
+    redirect_add_subscription();
+} elsif ($op eq 'modsubscription') {
+    redirect_mod_subscription();
+} else {
+        while (@subscription_types) {
+           my $sub_type = shift @subscription_types;
+           my %row = ( 'name' => $sub_type );
+           if ( defined $sub_on and $sub_on eq $sub_type ) {
+	     $row{'selected'} = ' selected';
+           } else {
+	     $row{'selected'} = '';
+           }
+           push( @sub_type_data, \%row );
+        }
+    $template->param(subtype => \@sub_type_data,
+	);
+
+    letter_loop('', $template);
+
+    my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
+    if (defined $new_biblionumber) {
+        my $bib = GetBiblioData($new_biblionumber);
+        if (defined $bib) {
+            $template->param(bibnum      => $new_biblionumber);
+            $template->param(bibliotitle => $bib->{title});
+        }
+    }
+	output_html_with_http_headers $query, $cookie, $template->output;
+}
+
+sub letter_loop {
+    my ($selected_letter, $templte) = @_;
+    my $letters = GetLetters('serial');
+    my @letterloop;
+    foreach my $thisletter (keys %$letters) {
+        my $selected = $thisletter eq $selected_letter ? 1 : 0;
+        push @letterloop, {
+            value => $thisletter,
+            selected => $selected,
+            lettername => $letters->{$thisletter},
+        };
+    }
+    $templte->param(letterloop => \@letterloop) if @letterloop;
+    return;
+}
+
+sub redirect_add_subscription {
     my $auser           = $query->param('user');
     my $branchcode      = $query->param('branchcode');
     my $aqbooksellerid  = $query->param('aqbooksellerid');
     my $cost            = $query->param('cost');
     my $aqbudgetid      = $query->param('aqbudgetid');
-    my $startdate       = $query->param('startdate');
-    my $firstacquidate  = $query->param('firstacquidate');
     my $periodicity     = $query->param('periodicity');
     my $dow             = $query->param('dow');
     my @irregularity    = $query->param('irregularity_select');
@@ -198,7 +235,7 @@ if ($op eq 'addsubscription') {
     my $location = $query->param('location');
     my $startdate       = format_date_in_iso($query->param('startdate'));
     my $enddate       = format_date_in_iso($query->param('enddate'));
-    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));    
+    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
     my $histenddate = format_date_in_iso($query->param('histenddate'));
     my $histstartdate = format_date_in_iso($query->param('histstartdate'));
     my $recievedlist = $query->param('recievedlist');
@@ -217,7 +254,10 @@ if ($op eq 'addsubscription') {
     ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
 
     print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
-} elsif ($op eq 'modsubscription') {
+    return;
+}
+
+sub redirect_mod_subscription {
     my $subscriptionid = $query->param('subscriptionid');
 	  my @irregularity = $query->param('irregularity_select');
     my $auser = $query->param('user');
@@ -228,7 +268,6 @@ if ($op eq 'addsubscription') {
     my $biblionumber = $query->param('biblionumber');
     my $aqbudgetid = $query->param('aqbudgetid');
     my $startdate = format_date_in_iso($query->param('startdate'));
-    my $enddate = format_date_in_iso($query->param('enddate'));
     my $nextacquidate = $query->param('nextacquidate') ?
                             format_date_in_iso($query->param('nextacquidate')):
                             format_date_in_iso($query->param('startdate'));
@@ -238,6 +277,7 @@ if ($op eq 'addsubscription') {
     my $sublength = $query->param('sublength');
     my $subtype = $query->param('subtype');
 
+    my ($monthlength, $weeklength, $numberlength);
     if($subtype eq 'months'){
         $monthlength = $sublength;
     } elsif ($subtype eq 'weeks'){
@@ -291,10 +331,10 @@ if ($op eq 'addsubscription') {
         $firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
     }
 
-        &ModSubscription(
+        ModSubscription(
             $auser,           $branchcode,   $aqbooksellerid, $cost,
             $aqbudgetid,      $startdate,    $periodicity,    $firstissuedate,
-            $dow,             join(",", at irregularity), $numberpattern,  $numberlength,
+            $dow,             join(q{,}, at irregularity), $numberpattern,  $numberlength,
             $weeklength,      $monthlength,  $add1,           $every1,
             $whenmorethan1,   $setto1,       $lastvalue1,     $innerloop1,
             $add2,            $every2,       $whenmorethan2,  $setto2,
@@ -306,45 +346,5 @@ if ($op eq 'addsubscription') {
         );
         ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
     print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
-} else {
-        while (@subscription_types) {
-           my $sub_type = shift @subscription_types;
-           my %row = ( 'name' => $sub_type );
-           if ( defined $sub_on and $sub_on eq $sub_type ) {
-	     $row{'selected'} = ' selected';
-           } else {
-	     $row{'selected'} = '';
-           }
-           push( @sub_type_data, \%row );
-        }
-    $template->param(subtype => \@sub_type_data,
-	);
-
-    letter_loop('', $template);
-
-    my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
-    if (defined $new_biblionumber) {
-        my $bib = GetBiblioData($new_biblionumber);
-        if (defined $bib) {
-            $template->param(bibnum      => $new_biblionumber);
-            $template->param(bibliotitle => $bib->{title});
-        }
-    }
-	output_html_with_http_headers $query, $cookie, $template->output;
-}
-
-sub letter_loop {
-    my ($selected_letter, $template) = @_;
-    my $letters = GetLetters('serial');
-    my @letterloop;
-    foreach my $thisletter (keys %$letters) {
-        my $selected = $thisletter eq $selected_letter ? 1 : 0;
-        push @letterloop, {
-            value => $thisletter,
-            selected => $selected,
-            lettername => $letters->{$thisletter},
-        };
-    }
-    $template->param(letterloop => \@letterloop) if @letterloop;
     return;
 }
diff --git a/serials/subscription-bib-search.pl b/serials/subscription-bib-search.pl
index eba6318..f247f90 100755
--- a/serials/subscription-bib-search.pl
+++ b/serials/subscription-bib-search.pl
@@ -79,13 +79,13 @@ if ($op eq "do_search" && $query) {
     # add the itemtype limit if applicable
     my $itemtypelimit = $input->param('itemtypelimit');
     if ( $itemtypelimit ) {
-	if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {                                                                 
+	if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
 	    $query .= " AND $itype_or_itemtype=$itemtypelimit";
 	} else {
 	    $query .= " AND $advanced_search_types=$itemtypelimit";
 	}
     }
-    $debug && warn $query; 
+    $debug && warn $query;
     $resultsperpage= $input->param('resultsperpage');
     $resultsperpage = 20 if(!defined $resultsperpage);
 
@@ -180,7 +180,7 @@ if ($op eq "do_search" && $query) {
 } # end of if ($op eq "do_search" & $query)
  else {
     my @itemtypesloop;
-    if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {                                                                 
+    if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
 	# load the itemtypes
 	my $itemtypes = GetItemTypes;
 	my $selected=1;
@@ -223,7 +223,7 @@ if ($op eq "do_search" && $query) {
                 debug => 1,
                 });
 
- 
+
     if ($op eq "do_search") {
        $template->param("no_query" => 1);
     } else {
diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl
index 8846826..eede24b 100755
--- a/serials/subscription-renew.pl
+++ b/serials/subscription-renew.pl
@@ -47,6 +47,7 @@ use strict;
 use warnings;
 
 use CGI;
+use Carp;
 use C4::Koha;
 use C4::Auth;
 use C4::Dates qw/format_date/;
@@ -83,7 +84,7 @@ if ( $op eq "renew" ) {
 
 my $subscription = GetSubscription($subscriptionid);
 if ($subscription->{'cannotedit'}){
-  warn "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
+  carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
   print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
 }
 
diff --git a/serials/viewalerts.pl b/serials/viewalerts.pl
index cf2278d..77b1f69 100755
--- a/serials/viewalerts.pl
+++ b/serials/viewalerts.pl
@@ -19,6 +19,7 @@
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
 use CGI;
 use C4::Auth;
 use C4::Context;
@@ -31,7 +32,6 @@ my $dbh = C4::Context->dbh;
 
 my $input = new CGI;
 my $print = $input->param('print');
-my $template_name;
 
 my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => 'serials/viewalerts.tmpl',
-- 
1.6.6




More information about the Koha-patches mailing list