Bug 15258: Fix Perl scripts declaring unused variables
authorFrédéric Demians <f.demians@tamil.fr>
Thu, 26 Nov 2015 07:26:34 +0000 (08:26 +0100)
committerJesse Weaver <jweaver@bywatersolutions.com>
Thu, 31 Dec 2015 00:24:45 +0000 (17:24 -0700)
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

All affected files tested with `perl -c`.
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>

29 files changed:
C4/SIP/Sip/MsgType.pm
Koha/MetaSearcher.pm
Koha/QueryParser/Driver/PQF/Util.pm
Koha/QueryParser/Driver/PQF/query_plan/modifier.pm
Koha/Template/Plugin/Price.pm
acqui/basketheader.pl
acqui/invoice.pl
acqui/spent.pl
admin/aqplan.pl
admin/auth_subfields_structure.pl
admin/koha2marclinks.pl
admin/transport-cost-matrix.pl
basket/basket.pl
catalogue/MARCdetail.pl
cataloguing/addbiblio.pl
cataloguing/merge.pl
cataloguing/value_builder/macles.pl
cataloguing/value_builder/marc21_linking_section.pl
cataloguing/value_builder/unimarc_field_4XX.pl
circ/branchtransfers.pl
circ/pendingreserves.pl
circ/waitingreserves.pl
labels/label-item-search.pl
members/moremember.pl
reserve/placerequest.pl
reserve/request.pl
serials/checkexpiration.pl
serials/subscription-add.pl
sms/sms_listen.pl

index 1e06a19..dd799a8 100644 (file)
@@ -310,7 +310,7 @@ sub new {
 
 sub _initialize {
        my ($self, $msg, $control_block) = @_;
-       my ($fs, $fn, $fe);
+       my $fn;
        my $proto = $control_block->{protocol}->{$protocol_version};
 
        $self->{name}    = $control_block->{name};
@@ -931,7 +931,7 @@ sub handle_patron_info {
     my ($lang, $trans_date, $summary) = @{$self->{fixed_fields}};
     my $fields = $self->{fields};
     my ($inst_id, $patron_id, $terminal_pwd, $patron_pwd, $start, $end);
-    my ($resp, $patron, $count);
+    my ($resp, $patron);
 
     $inst_id      = $fields->{(FID_INST_ID)};
     $patron_id    = $fields->{(FID_PATRON_ID)};
index 7c4c87a..e38b15d 100644 (file)
@@ -106,7 +106,6 @@ sub search {
     };
     my $start = clock_gettime( CLOCK_MONOTONIC );
     my $select = IO::Select->new;
-    my @worker_fhs;
 
     my @cached_sets;
     my @servers;
index af3c81b..99e36f0 100644 (file)
@@ -41,7 +41,6 @@ Convert a hashref with a Bib-1 mapping into its PQF string representation.
 sub attributes_to_attr_string {
     my ($attributes) = @_;
     my $attr_string = '';
-    my $value;
     foreach my $key ( sort keys %{$attributes} ) {
         next unless looks_like_number($key);
         $attr_string .= ' @attr ' . $key . '=' . $attributes->{ $key } . ' ';
index 7577bc4..bf34e72 100644 (file)
@@ -41,7 +41,6 @@ not have a reference to their parent query_plan.
 sub target_syntax {
     my ($self, $server, $query_plan) = @_;
     my $pqf = '';
-    my @fields;
 
     my $attributes = $query_plan->QueryParser->bib1_mapping_by_name('modifier', $self->name, $server);
     $pqf = ($attributes->{'op'} ? $attributes->{'op'} . ' ' : '') . ($self->negate ? '@not @attr 1=_ALLRECORDS @attr 2=103 "" ' : '') . $attributes->{'attr_string'};
index 807f301..44f7cd8 100644 (file)
@@ -29,7 +29,6 @@ sub filter {
     my ( $self, $value, $args, $config ) = @_;
     $value ||= 0;
     $config->{on_editing} //= 0;
-    my $formatted_price;
     return $config->{on_editing}
         ? Koha::Number::Price->new( $value )->format_for_editing
         : Koha::Number::Price->new( $value )->format;
index 18090c4..a4ef0b9 100755 (executable)
@@ -129,7 +129,6 @@ if ( $op eq 'add_form' ) {
     my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"};
 
     # Build the combobox to select the billing place
-    my @billingplaceloop;
 
     my $branches = C4::Branch::GetBranchesLoop( $billingplace );
     $template->param( billingplaceloop => $branches );
index f56afcc..d2f649d 100755 (executable)
@@ -112,7 +112,6 @@ my $details = GetInvoiceDetails($invoiceid);
 my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $details->{booksellerid} });
 my @orders_loop = ();
 my $orders = $details->{'orders'};
-my $qty_total;
 my @foot_loop;
 my %foot;
 my $total_quantity = 0;
index 4d60029..d32f0c9 100755 (executable)
@@ -89,7 +89,6 @@ if ( $sth->err ) {
     die "An error occurred fetching records: " . $sth->errstr;
 }
 my $subtotal = 0;
-my $toggle;
 my @spent;
 while ( my $data = $sth->fetchrow_hashref ) {
     my $recv = $data->{'quantityreceived'};
index f1bf496..7374428 100755 (executable)
@@ -85,7 +85,6 @@ $template->param(
 my $borrower_id         = $template->{VARS}->{'USER_INFO'}->{'borrowernumber'};
 my $borrower_branchcode = $template->{VARS}->{'USER_INFO'}->{'branchcode'};
 
-my $periods;
 my $authcat      = $input->param('authcat');
 my $show_active  = $input->param('show_active');
 my $show_actual  = $input->param('show_actual');
@@ -107,8 +106,6 @@ $authcat = 'Asort1' if  not defined $authcat; # defaults to Asort if no authcat
 my $budget_id = $input->param('budget_id');
 my $op        = $input->param("op");
 
-my $budget_branchcode;
-
 my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{VARS}->{'USER_INFO'}->{'branchcode'}:'', $show_mine?$template->{VARS}->{'USER_INFO'}->{'borrowernumber'}:'' );
 
 # build categories list
@@ -140,7 +137,6 @@ $template->param( authcat_dropbox => {
     });
 
 my @budgets = @$budgets_ref;
-my $CGISort;
 my @authvals;
 my %labels;
 
@@ -160,7 +156,6 @@ if ( $op eq 'save' ) {
     my %seen;
     @buds        = grep { !$seen{$_}++ } @buds;
     @auth_values = grep { !$seen{$_}++ } @auth_values;
-    my @budget_ids;
     my @budget_lines;
 
     foreach my $budget (@buds) {
index 6a960f2..321a337 100755 (executable)
@@ -273,7 +273,6 @@ if ($op eq 'add_form') {
        my @kohafield           = ''.$input->param('kohafield');
        my @tab                         = $input->param('tab');
        my @seealso             = $input->param('seealso');
-       my @hidden;
        my @ohidden             = $input->param('ohidden');
        #my @ihidden            = $input->param('ihidden');
        #my @ehidden            = $input->param('ehidden');
index 8ba6b1c..9ccca37 100755 (executable)
@@ -64,7 +64,6 @@ my $cache = Koha::Cache->get_instance();
 ################## ADD_FORM ##################################
 # called by default. Used to create form to add or  modify a record
 if ( $op eq 'add_form' ) {
-    my $data;
     my $sth =
       $dbh->prepare(
 "select tagfield,tagsubfield,liblibrarian as lib,tab from marc_subfield_structure where kohafield=? AND frameworkcode=''"
index 383318c..55fd912 100755 (executable)
@@ -55,7 +55,7 @@ my @branchloop = map { code => $_,
                        name => $branches->{$_}->{'branchname'} },
                  sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
                  keys %$branches;
-my (@branchfromloop, @cost, @errors);
+my (@branchfromloop, @errors);
 foreach my $branchfrom ( @branchloop ) {
     my $fromcode = $branchfrom->{code};
 
index d7662dd..1dfbdb8 100755 (executable)
@@ -84,7 +84,6 @@ foreach my $biblionumber ( @bibs ) {
                }
        }
        # COinS format FIXME: for books Only
-        my $coins_format;
         my $fmt = substr $record->leader(), 6,2;
         my $fmts;
         $fmts->{'am'} = 'book';
index 3462b7d..0aff184 100755 (executable)
@@ -130,7 +130,6 @@ foreach my $thisframeworkcode ( keys %$frameworks ) {
 $template->param( frameworkcodeloop => \@frameworkcodeloop, );
 # fill arrays
 my @loop_data = ();
-my $tag;
 
 # loop through each tab 0 through 9
 for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) {
index b4784ed..b6805c9 100755 (executable)
@@ -178,7 +178,6 @@ sub build_authorized_values_list {
           && !C4::Context->IsSuperLibrarian()
           && C4::Context->userenv->{branch};
         my $branches = GetBranches($onlymine);
-        my @branchloop;
         foreach my $thisbranch ( sort keys %$branches ) {
             push @authorised_values, $thisbranch;
             $authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
@@ -777,7 +776,6 @@ my (
        $biblionumbertagsubfield,
        $biblioitemnumtagfield,
        $biblioitemnumtagsubfield,
-       $bibitem,
        $biblioitemnumber
 );
 
@@ -845,7 +843,6 @@ if ( $op eq "addbiblio" ) {
     my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
     # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
     if ( !$duplicatebiblionumber or $confirm_not_duplicate ) {
-        my $oldbibnum;
         my $oldbibitemnum;
         if (C4::Context->preference("BiblioAddsAuthorities")){
             BiblioAutoLink( $record, $frameworkcode );
index a1e56be..490eaa1 100755 (executable)
@@ -121,7 +121,6 @@ if ($merge) {
             my @marcfields = $marcrecord->field($field->{tag});
             foreach my $marcfield (@marcfields) {
                 my $tag = $marcfield->tag();
-                my %subfields;
                 if (scalar @{$field->{subfields}}) {
                     foreach my $subfield (@{$field->{subfields}}) {
                         my @values = $marcfield->subfield($subfield);
index bab687b..c37b6a0 100755 (executable)
@@ -51,7 +51,6 @@ return ($function_name,$res);
 
 sub plugin {
 my ($input) = @_;
-       my %env;
 
 #      my $input = new CGI;
        my $index= $input->param('index');
@@ -62,8 +61,7 @@ my ($input) = @_;
     #tabs
     $rq->execute;
     my @BIGLOOP;
-    my @innerloop;
-    my (%numbers,%cells,@colhdr,@rowhdr,@multiplelines,@lists,$table);
+    my (%numbers,@lists,$table);
     while (my $tab = $rq->fetchrow_hashref){
       my $number=substr($tab->{authorised_value},0,1);
       if ($tab->{authorised_value}=~/[0-9]XX/){
index 13f3a64..bcb9624 100755 (executable)
@@ -64,7 +64,6 @@ my $launcher = sub {
     $startfrom = 0 if ( !defined $startfrom );
     my ( $template, $loggedinuser, $cookie );
     my $resultsperpage;
-    my $searchdesc;
 
     if ( $op eq "fillinput" ) {
         my $biblionumber = $query->param('biblionumber');
index a378618..3fba406 100755 (executable)
@@ -68,7 +68,6 @@ sub plugin {
     $startfrom = 0 if ( !defined $startfrom );
     my ( $template, $loggedinuser, $cookie );
     my $resultsperpage;
-    my $searchdesc;
 
     if ( $op eq "fillinput" ) {
         my $biblionumber = $query->param('biblionumber');
index 22c9a07..454fbef 100755 (executable)
@@ -106,7 +106,6 @@ elsif ( $request eq 'KillReserved' ) {
 
 # collect the stack of books already transfered so they can printed...
 my @trsfitemloop;
-my %transfereditems;
 my $transfered;
 my $barcode = $query->param('barcode');
 # strip whitespace
index 4d6ec05..9e811da 100755 (executable)
@@ -53,19 +53,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
-my $duedate;
-my $borrowernumber;
-my $itemnum;
-my $data1;
-my $data2;
-my $data3;
-my $name;
-my $phone;
-my $email;
-my $biblionumber;
-my $title;
-my $author;
-
 my $today = dt_from_string;
 $startdate =~ s/^\s+//;
 $startdate =~ s/\s+$//;
index 67afdcc..268213a 100755 (executable)
@@ -48,8 +48,6 @@ my $all_branches   = $input->param('allbranches') || '';
 my $cancelall      = $input->param('cancelall');
 my $tab            = $input->param('tab');
 
-my $cancel;
-
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
         template_name   => "circ/waitingreserves.tt",
index 9bbfa60..8b72cb4 100755 (executable)
@@ -53,7 +53,7 @@ my $ccl_query = $query->param('ccl_query');
 my $startfrom = $query->param('startfrom') || 1;
 my ($template, $loggedinuser, $cookie) = (undef, undef, undef);
 my (
-    $total_hits,  $orderby, $results,  $total,  $error,
+    $total_hits,  $total,  $error,
     $marcresults, $idx,     $datefrom, $dateto, $ccl_textbox
 );
 my $resultsperpage = C4::Context->preference('numSearchResults') || '20';
@@ -174,7 +174,7 @@ if ($show_results) {
     );
 
     # build page nav stuff.
-    my ( @field_data, @numbers );
+    my @numbers;
     $total = $total_hits;
 
     my ( $from, $to, $startfromnext, $startfromprev, $displaynext,
index 688215b..6198d87 100755 (executable)
@@ -154,7 +154,6 @@ if ( IsDebarred($borrowernumber) ) {
 
 $data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex};
 
-my $catcode;
 if ( $category_type eq 'C') {
    my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
    my $cnt = scalar(@$catcodes);
@@ -252,7 +251,6 @@ my $relatives_issues_count =
 my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} );
 my $today       = DateTime->now( time_zone => C4::Context->tz);
 $today->truncate(to => 'day');
-my @borrowers_with_issues;
 my $overdues_exist = 0;
 my $totalprice = 0;
 
index 6cbaa7b..80dcfdc 100755 (executable)
@@ -92,7 +92,6 @@ if ($type eq 'str8' && $borrower){
                 $i2++;
             }
         }
-        my $const;
 
     if (defined $checkitem && $checkitem ne ''){
                my $item = GetItem($checkitem);
index 4860dcd..9b37f48 100755 (executable)
@@ -48,7 +48,6 @@ use Koha::Borrower::Debarments qw(IsDebarred);
 use Koha::Holds;
 
 my $dbh = C4::Context->dbh;
-my $sth;
 my $input = new CGI;
 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
     {
@@ -141,7 +140,6 @@ if ($multihold) {
 if ($borrowernumber_hold && !$action) {
     my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold );
     my $diffbranch;
-    my @getreservloop;
 
     # we check the reserves of the borrower, and if he can reserv a document
     # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
@@ -284,7 +282,6 @@ foreach my $biblionumber (@biblionumbers) {
     # adding a fixed value for priority options
     my $fixedRank = $count+1;
 
-    my @branchcodes;
     my %itemnumbers_of_biblioitem;
     my @itemnumbers;
 
index 3222e22..9f1ff14 100755 (executable)
@@ -113,7 +113,6 @@ if ($date) {
     );
 }
 
-my $branchname;
 my $branches_loop;
 if (  !C4::Context->preference("IndependentBranches")
     or C4::Context->IsSuperLibrarian()
index 1790866..7525b59 100755 (executable)
@@ -42,7 +42,6 @@ my $op = $query->param('op') || '';
 my $dbh = C4::Context->dbh;
 my $sub_length;
 
-my @budgets;
 
 # Permission needed if it is a modification : edit_subscription
 # Permission needed otherwise (nothing or dup) : create_subscription
@@ -437,7 +436,6 @@ sub redirect_mod_subscription {
 
 sub insert_additional_fields {
     my ( $additional_fields, $biblionumber, $subscriptionid ) = @_;
-    my @additional_field_values;
     my $record = GetMarcBiblio( $biblionumber, 1 );
     for my $field ( @$additional_fields ) {
         my $af = Koha::AdditionalField->new({ id => $field->{id} })->fetch;
index a7420d9..0ee3f53 100755 (executable)
@@ -10,9 +10,7 @@ use C4::Members;
 use C4::Circulation;
 
 my ($res,$ua);
-my %commands;
 my $message;
-my $phone;
 my $result;
 my $errorcode;
 my $smsid;