From 524b4cb0fffc16bd1b9447bf4b30d87e78928251 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Thu, 26 Nov 2015 08:26:34 +0100 Subject: [PATCH] Bug 15258: Fix Perl scripts declaring unused variables Signed-off-by: Hector Castro Signed-off-by: Jonathan Druart All affected files tested with `perl -c`. Signed-off-by: Jesse Weaver (cherry picked from commit ff1579de6d2e95158cf4f9e9261068bdeef31f53) Signed-off-by: Julian Maurice --- C4/SIP/Sip/MsgType.pm | 4 ++-- Koha/MetaSearcher.pm | 1 - Koha/QueryParser/Driver/PQF/Util.pm | 1 - Koha/QueryParser/Driver/PQF/query_plan/modifier.pm | 1 - Koha/Template/Plugin/Price.pm | 1 - acqui/basketheader.pl | 1 - acqui/invoice.pl | 1 - acqui/spent.pl | 1 - admin/aqplan.pl | 5 ----- admin/auth_subfields_structure.pl | 1 - admin/koha2marclinks.pl | 1 - admin/transport-cost-matrix.pl | 2 +- basket/basket.pl | 1 - catalogue/MARCdetail.pl | 1 - cataloguing/addbiblio.pl | 3 --- cataloguing/merge.pl | 1 - cataloguing/value_builder/macles.pl | 4 +--- cataloguing/value_builder/marc21_linking_section.pl | 1 - cataloguing/value_builder/unimarc_field_4XX.pl | 1 - circ/branchtransfers.pl | 1 - circ/pendingreserves.pl | 13 ------------- circ/waitingreserves.pl | 2 -- labels/label-item-search.pl | 4 ++-- members/moremember.pl | 2 -- reserve/placerequest.pl | 1 - reserve/request.pl | 3 --- serials/checkexpiration.pl | 1 - serials/subscription-add.pl | 2 -- sms/sms_listen.pl | 2 -- 29 files changed, 6 insertions(+), 57 deletions(-) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 1e06a19b96..dd799a845c 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -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)}; diff --git a/Koha/MetaSearcher.pm b/Koha/MetaSearcher.pm index 7c4c87a63d..e38b15df22 100644 --- a/Koha/MetaSearcher.pm +++ b/Koha/MetaSearcher.pm @@ -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; diff --git a/Koha/QueryParser/Driver/PQF/Util.pm b/Koha/QueryParser/Driver/PQF/Util.pm index af3c81b29e..99e36f0a60 100644 --- a/Koha/QueryParser/Driver/PQF/Util.pm +++ b/Koha/QueryParser/Driver/PQF/Util.pm @@ -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 } . ' '; diff --git a/Koha/QueryParser/Driver/PQF/query_plan/modifier.pm b/Koha/QueryParser/Driver/PQF/query_plan/modifier.pm index 7577bc4a62..bf34e72cb4 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/modifier.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/modifier.pm @@ -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'}; diff --git a/Koha/Template/Plugin/Price.pm b/Koha/Template/Plugin/Price.pm index 807f30189e..44f7cd8170 100644 --- a/Koha/Template/Plugin/Price.pm +++ b/Koha/Template/Plugin/Price.pm @@ -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; diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index 18090c449f..a4ef0b9fea 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -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 ); diff --git a/acqui/invoice.pl b/acqui/invoice.pl index f56afcc5ec..d2f649d38c 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -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; diff --git a/acqui/spent.pl b/acqui/spent.pl index 4d60029115..d32f0c9038 100755 --- a/acqui/spent.pl +++ b/acqui/spent.pl @@ -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'}; diff --git a/admin/aqplan.pl b/admin/aqplan.pl index f1bf4965b6..7374428983 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -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) { diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl index 6a960f2cb1..321a33731e 100755 --- a/admin/auth_subfields_structure.pl +++ b/admin/auth_subfields_structure.pl @@ -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'); diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index 8ba6b1c36f..9ccca3722b 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -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=''" diff --git a/admin/transport-cost-matrix.pl b/admin/transport-cost-matrix.pl index 383318cf94..55fd912353 100755 --- a/admin/transport-cost-matrix.pl +++ b/admin/transport-cost-matrix.pl @@ -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}; diff --git a/basket/basket.pl b/basket/basket.pl index d7662dd7e6..1dfbdb805d 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -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'; diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 3462b7dd70..0aff1842f8 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -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++ ) { diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index b4784edc2f..b6805c94fe 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -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 ); diff --git a/cataloguing/merge.pl b/cataloguing/merge.pl index a1e56be541..490eaa109c 100755 --- a/cataloguing/merge.pl +++ b/cataloguing/merge.pl @@ -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); diff --git a/cataloguing/value_builder/macles.pl b/cataloguing/value_builder/macles.pl index bab687b81f..c37b6a06a0 100755 --- a/cataloguing/value_builder/macles.pl +++ b/cataloguing/value_builder/macles.pl @@ -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/){ diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl index 13f3a649b0..bcb9624c24 100755 --- a/cataloguing/value_builder/marc21_linking_section.pl +++ b/cataloguing/value_builder/marc21_linking_section.pl @@ -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'); diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl index a3786186f9..3fba406974 100755 --- a/cataloguing/value_builder/unimarc_field_4XX.pl +++ b/cataloguing/value_builder/unimarc_field_4XX.pl @@ -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'); diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 4caca05bd6..9d761cde50 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -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 diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 4d6ec051bd..9e811dad9d 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -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+$//; diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 67afdccdd8..268213a523 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -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", diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl index 9bbfa60c8f..8b72cb4ea2 100755 --- a/labels/label-item-search.pl +++ b/labels/label-item-search.pl @@ -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, diff --git a/members/moremember.pl b/members/moremember.pl index 688215b8c6..6198d87c46 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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; diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 6cbaa7b8d5..80dcfdc0e5 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -92,7 +92,6 @@ if ($type eq 'str8' && $borrower){ $i2++; } } - my $const; if (defined $checkitem && $checkitem ne ''){ my $item = GetItem($checkitem); diff --git a/reserve/request.pl b/reserve/request.pl index 80cf0d6118..14715f59d4 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -47,7 +47,6 @@ use Koha::DateUtils; use Koha::Borrower::Debarments qw(IsDebarred); my $dbh = C4::Context->dbh; -my $sth; my $input = new CGI; my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( { @@ -140,7 +139,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" ... @@ -283,7 +281,6 @@ foreach my $biblionumber (@biblionumbers) { # adding a fixed value for priority options my $fixedRank = $count+1; - my @branchcodes; my %itemnumbers_of_biblioitem; my @itemnumbers; diff --git a/serials/checkexpiration.pl b/serials/checkexpiration.pl index 3222e22c9f..9f1ff14a47 100755 --- a/serials/checkexpiration.pl +++ b/serials/checkexpiration.pl @@ -113,7 +113,6 @@ if ($date) { ); } -my $branchname; my $branches_loop; if ( !C4::Context->preference("IndependentBranches") or C4::Context->IsSuperLibrarian() diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 1790866856..7525b59056 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -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; diff --git a/sms/sms_listen.pl b/sms/sms_listen.pl index a7420d91be..0ee3f532f5 100755 --- a/sms/sms_listen.pl +++ b/sms/sms_listen.pl @@ -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; -- 2.39.5