Removing hard-coded $ symbols from the template, addressing Bug 2547
[koha.git] / serials / serials-recieve.pl
index 8342122..89e86be 100755 (executable)
@@ -17,7 +17,6 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id$
 
 =head1 NAME
 
@@ -66,11 +65,11 @@ op can be :
 use strict;
 use CGI;
 use C4::Auth;
-use C4::Date;
+use C4::Dates qw/format_date format_date_in_iso/;
 use C4::Biblio;
+use C4::Items;
 use C4::Koha;
 use C4::Output;
-use C4::Interface::CGI::Output;
 use C4::Context;
 use C4::Serials;
 use C4::Branch; # GetBranches
@@ -197,11 +196,11 @@ my $sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId();
 $sth->execute($subscriptionid);
 my $solhistory = $sth->fetchrow_hashref;
 
-my $subs = &GetSubscription($subscriptionid);
-my ($totalissues,@serialslist) = GetSerials($subscriptionid);
+$subs = &GetSubscription($subscriptionid);
+($totalissues,@serialslist) = GetSerials($subscriptionid);
 
 if (C4::Context->preference("serialsadditems")){
-    my $fwk=MARCfind_frameworkcode($subscription->{biblionumber});
+    my $fwk=GetFrameworkCode($subscription->{biblionumber});
 
     my $branches = GetBranches;
     my @branchloop;
@@ -218,13 +217,13 @@ 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},
                 );
 #              warn "".$row{'itemval'}.", ". $row{"itemlib"};
-                $itemstatusloopcount++;
+               $itemstatusloopcount++;
         push @itemstatusloop, \%row;
     }
     my $itemlocationhash = GetItemLocation($fwk);
@@ -236,29 +235,26 @@ if (C4::Context->preference("serialsadditems")){
         push @itemlocationloop, \%row;
     }
 
-        my $choice = 0;
-        if($itemstatusloopcount == 1){ $choice = 1;}   
-        foreach my $data (@serialslist){
-            if (scalar(@itemstatusloop)){$data->{"itemstatusloop"}=\@itemstatusloop;}
-            else { $data->{"itemstatusloop"}=[];}
-            if (scalar(@itemlocationloop)){$data->{"itemlocationloop"}=\@itemlocationloop;}
-            else {$data->{"itemlocationloop"}=[];}
-            $data->{"branchloop"}=\@branchloop ;
-    }
+       my $choice = ($itemstatusloopcount == 1) ? 1 : 0;
+       foreach my $data (@serialslist){
+               $data->{"itemstatusloop"}   = (scalar(@itemstatusloop  )) ? \@itemstatusloop   : [];
+               $data->{"itemlocationloop"} = (scalar(@itemlocationloop)) ? \@itemlocationloop : [];
+               $data->{"branchloop"} = \@branchloop ;
+       }
 # warn "Choice: $choice";
     $template->param(choice => $choice);    
     $template->param(serialadditems =>C4::Context->preference("serialsadditems"),
                     branchloop => \@branchloop,
                     ) ;
-    $template->param(itemstatus=>1,itemstatusloop=>\@itemstatusloop) if (scalar(@itemstatusloop));
-    $template->param(itemlocation=>1,itemlocationloop=>\@itemlocationloop) if (scalar(@itemlocationloop));
-}else{
+       $template->param(  itemstatus=>1,  itemstatusloop=>\@itemstatusloop  ) if (scalar(@itemstatusloop  ));
+       $template->param(itemlocation=>1,itemlocationloop=>\@itemlocationloop) if (scalar(@itemlocationloop));
+} else {
     $template->param(branchloop=>[],itemstatusloop=>[],itemlocationloop=>[]) ;
 }
 
-my $sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId();
+$sth= C4::Serials::GetSubscriptionHistoryFromSubscriptionId();
 $sth->execute($subscriptionid);
-my $solhistory = $sth->fetchrow_hashref;
+$solhistory = $sth->fetchrow_hashref;
 
 $template->param(
             user => $auser,
@@ -276,9 +272,6 @@ $template->param(
             biblionumber => $subs->{biblionumber},
             hassubscriptionexpired =>$hassubscriptionexpired,
             abouttoexpire =>$abouttoexpire,    
-            intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-            intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-            IntranetNav => C4::Context->preference("IntranetNav"),
             routing => $routing,
             missingseq => $manualissue,
             frommissing => $manualstatus,