From a80366439e13fe3682d815c910d2efd7adafe840 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 18 May 2017 17:42:02 -0300 Subject: [PATCH] Bug 18632: Remove 'CGI::param called in list context' warnings Once again, after bug 16154 and bug 16259 we need to remove more occurrence of CGi->param called in list context. Refer to bug 15809 for more information. Test plan: Make sure you do not see the error on the modified scripts. Signed-off-by: Josef Moravec Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- admin/authorised_values.pl | 6 ++--- admin/classsources.pl | 21 +++++++-------- admin/edi_accounts.pl | 24 ++++++++--------- admin/import_export_framework.pl | 2 +- admin/patron-attr-types.pl | 2 +- clubs/clubs-add-modify.pl | 8 +++--- clubs/templates-add-modify.pl | 10 ++++---- installer/install.pl | 2 +- members/housebound.pl | 44 ++++++++++++++++---------------- opac/opac-overdrive-search.pl | 2 +- opac/opac-user.pl | 4 +-- 11 files changed, 63 insertions(+), 62 deletions(-) diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index bb94e23993..272ed0012b 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -119,8 +119,8 @@ if ($op eq 'add_form') { elsif ( $id ) { # Update my $av = Koha::AuthorisedValues->new->find( $id ); - $av->lib( $input->param('lib') || undef ); - $av->lib_opac( $input->param('lib_opac') || undef ); + $av->lib( scalar $input->param('lib') || undef ); + $av->lib_opac( scalar $input->param('lib_opac') || undef ); $av->category( $new_category ); $av->authorised_value( $new_authorised_value ); $av->imageurl( $imageurl ); @@ -192,7 +192,7 @@ if ($op eq 'add_form') { $op = 'list'; } elsif ($op eq 'delete') { - my $av = Koha::AuthorisedValues->new->find( $input->param('id') ); + my $av = Koha::AuthorisedValues->new->find( $id ); my $deleted = eval {$av->delete}; if ( $@ or not $deleted ) { push @messages, {type => 'error', code => 'error_on_delete' }; diff --git a/admin/classsources.pl b/admin/classsources.pl index 74e682a200..539095f457 100755 --- a/admin/classsources.pl +++ b/admin/classsources.pl @@ -34,7 +34,7 @@ my $input = new CGI; my $op = $input->param('op') || ''; my $source_code = $input->param('class_source'); my $rule_code = $input->param('sort_rule'); - +my $sort_routine = $input->param('sort_routine'); my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "admin/classsources.tt", query => $input, @@ -46,15 +46,16 @@ my ($template, $loggedinuser, $cookie) $template->param(script_name => $script_name); $template->param($op => 1) if $op; - +my $description = $input->param('description'); +my $used = $input->param('used'); my $display_lists = 0; if ($op eq "add_source") { add_class_source_form($template); } elsif ($op eq "add_source_confirmed") { add_class_source($template, $source_code, - $input->param('description'), - $input->param('used') eq "used" ? 1 : 0, + $description, + $used eq "used" ? 1 : 0, $rule_code); $display_lists = 1; } elsif ($op eq "delete_source") { @@ -67,8 +68,8 @@ if ($op eq "add_source") { } elsif ($op eq "edit_source_confirmed") { edit_class_source($template, $source_code, - $input->param('description'), - $input->param('used') eq "used" ? 1 : 0, + $description, + $used eq "used" ? 1 : 0, $rule_code); $display_lists = 1; } elsif ($op eq "add_sort_rule") { @@ -76,8 +77,8 @@ if ($op eq "add_source") { } elsif ($op eq "add_sort_rule_confirmed") { add_class_sort_rule($template, $rule_code, - $input->param('description'), - $input->param('sort_routine')); + $description, + $sort_routine); $display_lists = 1; } elsif ($op eq "delete_sort_rule") { delete_sort_rule_form($template, $rule_code); @@ -89,8 +90,8 @@ if ($op eq "add_source") { } elsif ($op eq "edit_sort_rule_confirmed") { edit_class_sort_rule($template, $rule_code, - $input->param('description'), - $input->param('sort_routine')); + $description, + $sort_routine); $display_lists = 1; } else { $display_lists = 1; diff --git a/admin/edi_accounts.pl b/admin/edi_accounts.pl index eeab341704..9225b7ced8 100755 --- a/admin/edi_accounts.pl +++ b/admin/edi_accounts.pl @@ -73,22 +73,22 @@ else { # validate & display my $id = $input->param('id'); my $fields = { - description => $input->param('description'), - host => $input->param('host'), - username => $input->param('username'), - password => $input->param('password'), - vendor_id => $input->param('vendor_id'), - upload_directory => $input->param('upload_directory'), - download_directory => $input->param('download_directory'), - san => $input->param('san'), - transport => $input->param('transport'), + description => scalar $input->param('description'), + host => scalar $input->param('host'), + username => scalar $input->param('username'), + password => scalar $input->param('password'), + vendor_id => scalar $input->param('vendor_id'), + upload_directory => scalar $input->param('upload_directory'), + download_directory => scalar $input->param('download_directory'), + san => scalar $input->param('san'), + transport => scalar $input->param('transport'), quotes_enabled => defined $input->param('quotes_enabled'), invoices_enabled => defined $input->param('invoices_enabled'), orders_enabled => defined $input->param('orders_enabled'), responses_enabled => defined $input->param('responses_enabled'), auto_orders => defined $input->param('auto_orders'), - id_code_qualifier => $input->param('id_code_qualifier'), - plugin => $input->param('plugin'), + id_code_qualifier => scalar $input->param('id_code_qualifier'), + plugin => scalar $input->param('plugin'), }; if ($id) { @@ -105,7 +105,7 @@ else { elsif ( $op eq 'delete_confirmed' ) { $schema->resultset('VendorEdiAccount') - ->search( { id => $input->param('id'), } )->delete_all; + ->search( { id => scalar $input->param('id'), } )->delete_all; } # we do a default dispaly after deletes and saves diff --git a/admin/import_export_framework.pl b/admin/import_export_framework.pl index b2d090dad6..de1f195894 100755 --- a/admin/import_export_framework.pl +++ b/admin/import_export_framework.pl @@ -84,7 +84,7 @@ if ($action eq 'export' && $input->request_method() eq 'GET') { my $extension = $1; my $uploadFd = $input->upload($fieldname); if ($uploadFd && !$input->cgi_error) { - my $tmpfilename = $input->tmpFileName($input->param($fieldname)); + my $tmpfilename = $input->tmpFileName(scalar $input->param($fieldname)); $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension $ok = ImportFramework($filename, $frameworkcode, 1) if (rename($tmpfilename, $filename)); } diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index 178bf373b6..ca4e19060f 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -135,7 +135,7 @@ sub error_add_attribute_type_form { $template->param( attribute_type_form => 1, confirm_op => 'add_attribute_type_confirmed', - authorised_value_category => $input->param('authorised_value_category'), + authorised_value_category => scalar $input->param('authorised_value_category'), ); } diff --git a/clubs/clubs-add-modify.pl b/clubs/clubs-add-modify.pl index 9d0ff08d6f..dabac245fa 100755 --- a/clubs/clubs-add-modify.pl +++ b/clubs/clubs-add-modify.pl @@ -64,10 +64,10 @@ $date_end = $date_end ? dt_from_string($date_end) : undef; if ( $cgi->param('name') ) { # Update or create club $club->set( { - club_template_id => $cgi->param('club_template_id') || undef, - name => $cgi->param('name') || undef, - description => $cgi->param('description') || undef, - branchcode => $cgi->param('branchcode') || undef, + club_template_id => scalar $cgi->param('club_template_id') || undef, + name => scalar $cgi->param('name') || undef, + description => scalar $cgi->param('description') || undef, + branchcode => scalar $cgi->param('branchcode') || undef, date_start => $date_start, date_end => $date_end, date_updated => dt_from_string(), diff --git a/clubs/templates-add-modify.pl b/clubs/templates-add-modify.pl index ae46178508..254a99e219 100755 --- a/clubs/templates-add-modify.pl +++ b/clubs/templates-add-modify.pl @@ -62,12 +62,12 @@ if ( $cgi->param('name') ) { # Update or create club $club_template->set( { id => $id || undef, - name => $cgi->param('name') || undef, - description => $cgi->param('description') || undef, - branchcode => $cgi->param('branchcode') || undef, + name => scalar $cgi->param('name') || undef, + description => scalar $cgi->param('description') || undef, + branchcode => scalar $cgi->param('branchcode') || undef, date_updated => dt_from_string(), - is_email_required => $cgi->param('is_email_required') ? 1 : 0, - is_enrollable_from_opac => $cgi->param('is_enrollable_from_opac') ? 1 : 0, + is_email_required => scalar $cgi->param('is_email_required') ? 1 : 0, + is_enrollable_from_opac => scalar $cgi->param('is_enrollable_from_opac') ? 1 : 0, } )->store(); diff --git a/installer/install.pl b/installer/install.pl index 3056ddcfc1..e4efda79a8 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -245,7 +245,7 @@ elsif ( $step && $step == 3 ) { my ( $fwk_language, $list ) = $installer->load_sql_in_order( $all_languages, - $query->param('framework') ); + scalar $query->param('framework') ); $template->param( "fwklanguage" => $fwk_language, "list" => $list diff --git a/members/housebound.pl b/members/housebound.pl index def6c57d15..0ffe685548 100755 --- a/members/housebound.pl +++ b/members/housebound.pl @@ -86,13 +86,13 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) { # We have received the input from the profile edit form. We must save the # changes, and return to simple display. $houseboundprofile->set({ - day => $input->param('day') // q{}, - frequency => $input->param('frequency') // q{}, - fav_itemtypes => $input->param('fav_itemtypes') // q{}, - fav_subjects => $input->param('fav_subjects') // q{}, - fav_authors => $input->param('fav_authors') // q{}, - referral => $input->param('referral') // q{}, - notes => $input->param('notes') // q{}, + day => scalar $input->param('day') // q{}, + frequency => scalar $input->param('frequency') // q{}, + fav_itemtypes => scalar $input->param('fav_itemtypes') // q{}, + fav_subjects => scalar $input->param('fav_subjects') // q{}, + fav_authors => scalar $input->param('fav_authors') // q{}, + referral => scalar $input->param('referral') // q{}, + notes => scalar $input->param('notes') // q{}, }); my $success = eval { return $houseboundprofile->store }; push @messages, { type => 'error', code => 'error_on_profile_store' } @@ -103,13 +103,13 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) { # save it, and return to simple display. $houseboundprofile = Koha::Patron::HouseboundProfile->new({ borrowernumber => $patron->borrowernumber, - day => $input->param('day') // q{}, - frequency => $input->param('frequency') // q{}, - fav_itemtypes => $input->param('fav_itemtypes') // q{}, - fav_subjects => $input->param('fav_subjects') // q{}, - fav_authors => $input->param('fav_authors') // q{}, - referral => $input->param('referral') // q{}, - notes => $input->param('notes') // q{}, + day => scalar $input->param('day') // q{}, + frequency => scalar $input->param('frequency') // q{}, + fav_itemtypes => scalar $input->param('fav_itemtypes') // q{}, + fav_subjects => scalar $input->param('fav_subjects') // q{}, + fav_authors => scalar $input->param('fav_authors') // q{}, + referral => scalar $input->param('referral') // q{}, + notes => scalar $input->param('notes') // q{}, }); my $success = eval { return $houseboundprofile->store }; push @messages, { type => 'error', code => 'error_on_profile_create' } @@ -130,11 +130,11 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) { # We have received input for editing a visit. We must store and return to # simple display. $visit->set({ - borrowernumber => $input->param('borrowernumber') // q{}, + borrowernumber => scalar $input->param('borrowernumber') // q{}, appointment_date => dt_from_string($input->param('date') // q{}), - day_segment => $input->param('segment') // q{}, - chooser_brwnumber => $input->param('chooser') // q{}, - deliverer_brwnumber => $input->param('deliverer') // q{}, + day_segment => scalar $input->param('segment') // q{}, + chooser_brwnumber => scalar $input->param('chooser') // q{}, + deliverer_brwnumber => scalar $input->param('deliverer') // q{}, }); my $success = eval { return $visit->store }; push @messages, { type => 'error', code => 'error_on_visit_store' } @@ -144,11 +144,11 @@ if ( $method eq 'updateconfirm' and $houseboundprofile ) { # We have received input for creating a visit. We must store and return # to simple display. my $visit = Koha::Patron::HouseboundVisit->new({ - borrowernumber => $input->param('borrowernumber') // q{}, + borrowernumber => scalar $input->param('borrowernumber') // q{}, appointment_date => dt_from_string($input->param('date') // q{}), - day_segment => $input->param('segment') // q{}, - chooser_brwnumber => $input->param('chooser') // q{}, - deliverer_brwnumber => $input->param('deliverer') // q{}, + day_segment => scalar $input->param('segment') // q{}, + chooser_brwnumber => scalar $input->param('chooser') // q{}, + deliverer_brwnumber => scalar $input->param('deliverer') // q{}, }); my $success = eval { return $visit->store }; push @messages, { type => 'error', code => 'error_on_visit_create' } diff --git a/opac/opac-overdrive-search.pl b/opac/opac-overdrive-search.pl index 1f8304b0fd..3c10fde4fa 100755 --- a/opac/opac-overdrive-search.pl +++ b/opac/opac-overdrive-search.pl @@ -41,6 +41,6 @@ $template->{'VARS'}->{'q'} = $cgi->param('q'); $template->{'VARS'}->{'limit'} = C4::Context->preference('OPACnumSearchResults') || 20; $template->{'VARS'}->{'OPACnumSearchResults'} = C4::Context->preference('OPACnumSearchResults') || 20; $template->{'VARS'}->{'OverDriveLibraryID'} = C4::Context->preference('OverDriveLibraryID'); -$template->param(overdrive_error => $cgi->param('overdrive_error')); +$template->param(overdrive_error => scalar $cgi->param('overdrive_error')); output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 3618a30866..00e5a97f62 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -318,8 +318,8 @@ if (C4::Context->preference("OPACAmazonCoverImages") or $template->param( OverDriveCirculation => C4::Context->preference('OverDriveCirculation') || 0, - overdrive_error => $query->param('overdrive_error') || undef, - overdrive_tab => $query->param('overdrive_tab') || 0, + overdrive_error => scalar $query->param('overdrive_error') || undef, + overdrive_tab => scalar $query->param('overdrive_tab') || 0, ); my $patron_messages = Koha::Patron::Messages->search( -- 2.39.5