Bugzilla – Attachment 129346 Details for
Bug 29859
Favor iterators over as_list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29859: Use iterator instead of as_list
Bug-29859-Use-iterator-instead-of-aslist.patch (text/plain), 56.13 KB, created by
Jonathan Druart
on 2022-01-12 13:57:24 UTC
(
hide
)
Description:
Bug 29859: Use iterator instead of as_list
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-12 13:57:24 UTC
Size:
56.13 KB
patch
obsolete
>From c22acd258fe54c7ddab28abb66191d163c6859df Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 12 Jan 2022 14:56:16 +0100 >Subject: [PATCH] Bug 29859: Use iterator instead of as_list > >On bug 29844 we decided to remove wantarray from Koha::Objects->search. >Reviewing the difference occurrences I found some unnecessary uses of ->as_list, >where iterators should be used instead. > >This patch only removes the obvious places, not the tricky ones. >--- > C4/Overdues.pm | 2 +- > Koha/Acquisition/Currency.pm | 8 ++--- > Koha/AudioAlerts.pm | 4 +-- > Koha/Holds.pm | 30 +++++++++---------- > Koha/Library/Group.pm | 6 ++-- > acqui/addorderiso2709.pl | 10 +++---- > acqui/basket.pl | 4 +-- > acqui/basketheader.pl | 8 ++--- > acqui/duplicate_orders.pl | 3 +- > acqui/histsearch.pl | 3 +- > acqui/lateorders.pl | 2 +- > acqui/neworderempty.pl | 4 +-- > acqui/supplier.pl | 3 +- > acqui/transferorder.pl | 6 ++-- > admin/authorised_values.pl | 16 +++++----- > admin/branches.pl | 12 ++------ > admin/item_circulation_alerts.pl | 13 ++++---- > admin/itemtypes.pl | 2 +- > admin/marc_subfields_structure.pl | 3 +- > admin/sms_providers.pl | 4 +-- > catalogue/item-export.pl | 4 +-- > catalogue/itemsearch.pl | 8 +---- > cataloguing/editor.pl | 4 +-- > circ/circulation.pl | 2 +- > circ/transfers_to_send.pl | 6 ++-- > clubs/clubs.pl | 7 ++--- > .../prog/en/includes/checkouts-table.inc | 4 +-- > .../prog/en/modules/acqui/addorderiso2709.tt | 8 ++--- > .../prog/en/modules/acqui/basket.tt | 2 +- > .../prog/en/modules/acqui/basketheader.tt | 2 +- > .../prog/en/modules/acqui/lateorders.tt | 2 +- > .../prog/en/modules/acqui/neworderempty.tt | 4 +-- > .../prog/en/modules/acqui/transferorder.tt | 4 +-- > .../en/modules/admin/authorised_values.tt | 4 +-- > .../prog/en/modules/admin/branches.tt | 4 +-- > .../prog/en/modules/admin/sms_providers.tt | 2 +- > .../prog/en/modules/circ/transfers_to_send.tt | 2 +- > .../prog/en/modules/clubs/clubs.tt | 8 ++--- > .../prog/en/modules/members/apikeys.tt | 2 +- > .../prog/en/modules/serials/claims.tt | 2 +- > .../en/modules/serials/subscription-detail.tt | 2 +- > .../bootstrap/en/modules/opac-memberentry.tt | 2 +- > members/apikeys.pl | 4 +-- > members/boraccount.pl | 6 ++-- > members/maninvoice.pl | 6 ++-- > members/members-home.pl | 7 +++-- > members/moremember.pl | 2 +- > misc/cronjobs/reconcile_balances.pl | 4 +-- > opac/opac-basket.pl | 7 ++--- > opac/opac-downloadcart.pl | 17 +++++------ > opac/opac-downloadshelf.pl | 17 +++++------ > opac/opac-memberentry.pl | 6 ++-- > opac/opac-messaging.pl | 4 +-- > opac/opac-search.pl | 3 +- > opac/opac-shelves.pl | 12 ++++---- > reports/acquisitions_stats.pl | 4 +-- > reports/borrowers_stats.pl | 2 +- > serials/claims.pl | 2 +- > serials/subscription-detail.pl | 2 +- > suggestion/suggestion.pl | 4 +-- > 60 files changed, 147 insertions(+), 190 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 1f63ce3e0b5..c2bb2170867 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -652,7 +652,7 @@ sub GetBranchcodesWithOverdueRules { > |); > if ( $branchcodes->[0] eq '' ) { > # If a default rule exists, all branches should be returned >- return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; >+ return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode'); > } > return @$branchcodes; > } >diff --git a/Koha/Acquisition/Currency.pm b/Koha/Acquisition/Currency.pm >index ee91925d104..bf1daaf1651 100644 >--- a/Koha/Acquisition/Currency.pm >+++ b/Koha/Acquisition/Currency.pm >@@ -42,16 +42,12 @@ sub store { > $self->_result->result_source->schema->txn_do( sub { > if ( $self->active ) { > # Remove the active flag from all other active currencies >- my @currencies = Koha::Acquisition::Currencies->search( >+ Koha::Acquisition::Currencies->search( > { > currency => { '!=' => $self->currency }, > active => 1, > } >- )->as_list; >- for my $currency ( @currencies ) { >- $currency->active(0); >- $currency->store; >- } >+ )->update({ active => 0 }); > } > $result = $self->SUPER::store; > }); >diff --git a/Koha/AudioAlerts.pm b/Koha/AudioAlerts.pm >index 734d3a62819..8190ee01d1e 100644 >--- a/Koha/AudioAlerts.pm >+++ b/Koha/AudioAlerts.pm >@@ -91,14 +91,14 @@ sub move { > > if ( $where eq 'up' ) { > unless ( $alert->precedence() == 1 ) { >- my ($other) = $self->search( { precedence => $alert->precedence() - 1 } )->as_list; >+ my $other = $self->search( { precedence => $alert->precedence() - 1 } )->next; > $other->precedence( $alert->precedence() )->store(); > $alert->precedence( $alert->precedence() - 1 )->store(); > } > } > elsif ( $where eq 'down' ) { > unless ( $alert->precedence() == $self->get_last_precedence() ) { >- my ($other) = $self->search( { precedence => $alert->precedence() + 1 } )->as_list; >+ my $other = $self->search( { precedence => $alert->precedence() + 1 } )->next; > $other->precedence( $alert->precedence() )->store(); > $alert->precedence( $alert->precedence() + 1 )->store(); > } >diff --git a/Koha/Holds.pm b/Koha/Holds.pm >index 15118d49f46..046653b681b 100644 >--- a/Koha/Holds.pm >+++ b/Koha/Holds.pm >@@ -113,22 +113,20 @@ sub get_items_that_can_fill { > > my @biblionumbers = $self->get_column('biblionumber'); > >- my @branchtransfers = map { $_->itemnumber } >- Koha::Item::Transfers->search( >- { datearrived => undef }, >- { >- columns => ['itemnumber'], >- collapse => 1, >- } >- )->as_list; >- my @waiting_holds = map { $_->itemnumber } >- Koha::Holds->search( >- { 'found' => 'W' }, >- { >- columns => ['itemnumber'], >- collapse => 1, >- } >- )->as_list; >+ my @branchtransfers = Koha::Item::Transfers->search( >+ { datearrived => undef }, >+ { >+ columns => ['itemnumber'], >+ collapse => 1, >+ } >+ )->get_columns('itemnumber'); >+ my @waiting_holds = Koha::Holds->search( >+ { 'found' => 'W' }, >+ { >+ columns => ['itemnumber'], >+ collapse => 1, >+ } >+ )->get_column('itemnumber'); > > return Koha::Items->search( > { >diff --git a/Koha/Library/Group.pm b/Koha/Library/Group.pm >index 2eb8adf786e..262a2c249dd 100644 >--- a/Koha/Library/Group.pm >+++ b/Koha/Library/Group.pm >@@ -111,15 +111,13 @@ sub libraries { > > my $in_or_not = $invert ? '-not_in' : '-in'; > >- my @children = Koha::Library::Groups->search( >+ my @branchcodes = Koha::Library::Groups->search( > { > parent_id => $self->id, > branchcode => { '!=' => undef }, > }, > { order_by => 'branchcode' } >- )->as_list; >- >- my @branchcodes = map { $_->branchcode } @children; >+ )->get_column('branchcode'); > > return Koha::Libraries->search( > { >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 1ce63d158b3..658adb03da4 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -96,12 +96,11 @@ if ($op eq ""){ > # > } elsif ($op eq "batch_details"){ > #display lines inside the selected batch >- # get currencies (for change rates calcs if needed) >- my @currencies = Koha::Acquisition::Currencies->search->as_list; > > $template->param("batch_details" => 1, > "basketno" => $cgiparams->{'basketno'}, >- currencies => \@currencies, >+ # get currencies (for change rates calcs if needed) >+ currencies => Koha::Acquisition::Currencies->search, > bookseller => $bookseller, > "allmatch" => $allmatch, > ); >@@ -611,7 +610,6 @@ sub import_biblios_list { > my $overlay_action = GetImportBatchOverlayAction($import_batch_id); > my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id); > my $item_action = GetImportBatchItemAction($import_batch_id); >- my @itypes = Koha::ItemTypes->search->as_list; > $template->param(biblio_list => \@list, > num_results => $num_records, > import_batch_id => $import_batch_id, >@@ -622,9 +620,9 @@ sub import_biblios_list { > "item_action_${item_action}" => 1, > item_action => $item_action, > item_error => $item_error, >- libraries => scalar Koha::Libraries->search(), >+ libraries => Koha::Libraries->search, > locationloop => \@locations, >- itypeloop => \@itypes, >+ itemtypes => Koha::ItemTypes->search, > ccodeloop => \@ccodes, > notforloanloop => \@notforloans, > ); >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 7d9ee557c95..19ac863d47b 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -424,8 +424,8 @@ if ( $op eq 'list' ) { > unclosable => @orders || @cancelledorders ? $basket->{is_standing} : 1, > has_budgets => $has_budgets, > duplinbatch => $duplinbatch, >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' })->as_list ], >- available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ], >+ csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }), >+ available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } )], > additional_field_values => { map { > $_->field->name => $_->value > } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list }, >diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl >index f813c0e1e13..e79daa70a7e 100755 >--- a/acqui/basketheader.pl >+++ b/acqui/basketheader.pl >@@ -74,7 +74,7 @@ my $basket; > my $op = $input->param('op'); > my $is_an_edit = $input->param('is_an_edit'); > >-$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ] ); >+$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ); > > if ( $op eq 'add_form' ) { > my @contractloop; >@@ -116,9 +116,9 @@ if ( $op eq 'add_form' ) { > $template->param(contractloop => \@contractloop, > basketcontractnumber => $basket->{'contractnumber'}); > } >- my @booksellers = Koha::Acquisition::Booksellers->search( >+ my $booksellers = Koha::Acquisition::Booksellers->search( > undef, >- { order_by => { -asc => 'name' } } )->as_list; >+ { order_by => { -asc => 'name' } } ); > > $template->param( add_form => 1, > basketname => $basket->{'basketname'}, >@@ -127,7 +127,7 @@ if ( $op eq 'add_form' ) { > booksellername => $bookseller->name, > booksellerid => $booksellerid, > basketno => $basketno, >- booksellers => \@booksellers, >+ booksellers => $booksellers, > is_standing => $basket->{is_standing}, > create_items => $basket->{create_items}, > ); >diff --git a/acqui/duplicate_orders.pl b/acqui/duplicate_orders.pl >index d22babe64d7..21e382e72f2 100755 >--- a/acqui/duplicate_orders.pl >+++ b/acqui/duplicate_orders.pl >@@ -117,9 +117,8 @@ elsif ( $op eq 'batch_edit' ) { > @{$budget_loop} = > sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop}; > >- my @currencies = Koha::Acquisition::Currencies->search->as_list; > $template->param( >- currencies => \@currencies, >+ currencies => Koha::Acquisition::Currencies->search, > budget_loop => $budget_loop, > ); > } >diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl >index a905763283c..4f90d674f02 100755 >--- a/acqui/histsearch.pl >+++ b/acqui/histsearch.pl >@@ -99,8 +99,7 @@ unless ( $input->param('from') ) { > } > $filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ); > $filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } ); >-my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } )->as_list; >-$template->param( available_additional_fields => \@additional_fields ); >+$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } ) ); > my @additional_field_filters; > foreach my $additional_field (@additional_fields) { > my $value = $input->param('additional_field_' . $additional_field->id); >diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl >index 43ce39685a4..a47088c44ef 100755 >--- a/acqui/lateorders.pl >+++ b/acqui/lateorders.pl >@@ -157,6 +157,6 @@ $template->param( > estimateddeliverydatefrom => $estimateddeliverydatefrom, > estimateddeliverydateto => $estimateddeliverydateto, > intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' })->as_list ], >+ csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' }), > ); > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 204448a5365..7c443147b15 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -207,7 +207,6 @@ if ( not $ordernumber ) { # create order > } > > if ( not $biblionumber and Koha::BiblioFrameworks->find('ACQ') ) { >- #my $acq_mss = Koha::MarcSubfieldStructures->search({ frameworkcode => 'ACQ', tagfield => { '!=' => $itemnumber_tag } }); > foreach my $tag ( sort keys %{$tagslib} ) { > next if $tag eq ''; > next if $tag eq $itemnumber_tag; # skip items fields >@@ -326,7 +325,6 @@ $template->param( catalog_details => \@catalog_details, ); > my $suggestion; > $suggestion = GetSuggestionInfo($suggestionid) if $suggestionid; > >-my @currencies = Koha::Acquisition::Currencies->search->as_list; > my $active_currency = Koha::Acquisition::Currencies->get_active; > > # build bookfund list >@@ -452,7 +450,7 @@ $template->param( > invoiceincgst => $bookseller->invoiceincgst, > cur_active_sym => $active_currency->symbol, > cur_active => $active_currency->currency, >- currencies => \@currencies, >+ currencies => Koha::Acquisition::Currencies->search, > currency => $data->{currency}, > vendor_currency => $bookseller->listprice, > orderexists => ( $new eq 'yes' ) ? 0 : 1, >diff --git a/acqui/supplier.pl b/acqui/supplier.pl >index 82c08e4b08a..af8fce7135d 100755 >--- a/acqui/supplier.pl >+++ b/acqui/supplier.pl >@@ -96,7 +96,6 @@ if ( $op eq 'display' ) { > print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl'); > exit; > } else { >- my @currencies = Koha::Acquisition::Currencies->search->as_list; > > # get option values from TaxRates syspref > my @gst_values = map { >@@ -108,7 +107,7 @@ if ( $op eq 'display' ) { > active => $supplier ? $supplier->active : 1, > tax_rate => $supplier ? $supplier->tax_rate + 0.0 : 0, > gst_values => \@gst_values, >- currencies => \@currencies, >+ currencies => Koha::Acquisition::Currencies->search, > enter => 1, > ); > } >diff --git a/acqui/transferorder.pl b/acqui/transferorder.pl >index 06a41aa7637..1fa15be7b85 100755 >--- a/acqui/transferorder.pl >+++ b/acqui/transferorder.pl >@@ -117,13 +117,13 @@ if( $basketno && $ordernumber) { > # Search for booksellers to transfer from/to > $op = '' unless $op; > if( $op eq "do_search" ) { >- my @booksellers = Koha::Acquisition::Booksellers->search( >+ my $booksellers = Koha::Acquisition::Booksellers->search( > { name => { -like => "%$query%" } }, >- { order_by => { -asc => 'name' } } )->as_list; >+ { order_by => { -asc => 'name' } } ); > $template->param( > query => $query, > do_search => 1, >- booksellersloop => \@booksellers, >+ booksellers => $booksellers, > ); > } > } >diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl >index f99454e4047..b7ee5b4426d 100755 >--- a/admin/authorised_values.pl >+++ b/admin/authorised_values.pl >@@ -212,13 +212,15 @@ $template->param( > > if ( $op eq 'list' ) { > # build categories list >- my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } )->as_list; >- my @category_list; >- for my $category ( @categories ) { >- push( @category_list, $category->category_name ); >- } >+ my @category_names = Koha::AuthorisedValueCategories->search( >+ { >+ category_name => >+ { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } >+ }, >+ { order_by => ['category_name'] } >+ )->get_column('category_name'); > >- $searchfield ||= $category_list[0]; >+ $searchfield ||= $category_names[0]; > > my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list; > my @loop_data = (); >@@ -238,7 +240,7 @@ if ( $op eq 'list' ) { > $template->param( > loop => \@loop_data, > category => Koha::AuthorisedValueCategories->find($searchfield), # TODO Move this up and add a Koha::AVC->authorised_values method to replace call for avs_by_category >- categories => \@category_list, >+ category_names => \@category_names, > ); > > } >diff --git a/admin/branches.pl b/admin/branches.pl >index 40b2b346e2f..08a73f6571f 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -49,17 +49,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > if ( $op eq 'add_form' ) { >- my $library; >- if ($branchcode) { >- $library = Koha::Libraries->find($branchcode); >- $template->param( selected_smtp_server => $library->smtp_server ); >- } >- >- my @smtp_servers = Koha::SMTP::Servers->search->as_list; >- > $template->param( >- library => $library, >- smtp_servers => \@smtp_servers >+ library => Koha::Libraries->find($branchcode), >+ smtp_servers => Koha::SMTP::Servers->search, > ); > } elsif ( $op eq 'add_validate' ) { > my @fields = qw( >diff --git a/admin/item_circulation_alerts.pl b/admin/item_circulation_alerts.pl >index 58bb6b27454..57a3c7d1233 100755 >--- a/admin/item_circulation_alerts.pl >+++ b/admin/item_circulation_alerts.pl >@@ -47,16 +47,15 @@ sub show { > ); > > my $branch = $input->param('branch') || '*'; >- my @categories = Koha::Patron::Categories->search_with_library_limits->as_list; >- my @item_types = Koha::ItemTypes->search->as_list; > my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' }); > my $grid_checkin = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' }); > >- $template->param(branch => $branch); >- $template->param(categories => \@categories); >- $template->param(item_types => \@item_types); >- $template->param(grid_checkout => $grid_checkout); >- $template->param(grid_checkin => $grid_checkin); >+ $template->param( >+ branch => $branch, >+ item_types => Koha::ItemTypes->search, >+ grid_checkout => $grid_checkout, >+ grid_checkin => $grid_checkin, >+ ); > > output_html_with_http_headers $input, $cookie, $template->output; > } >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index 975064af9ab..44e9ad54459 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -198,7 +198,7 @@ if ( $op eq 'add_form' ) { > > if ( $op eq 'list' ) { > $template->param( >- itemtypes => scalar Koha::ItemTypes->search, >+ itemtypes => Koha::ItemTypes->search, > messages => \@messages, > ); > } >diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl >index f0f3e0cd3cd..cf8e16462f4 100755 >--- a/admin/marc_subfields_structure.pl >+++ b/admin/marc_subfields_structure.pl >@@ -97,8 +97,7 @@ if ( $op eq 'add_form' ) { > $sth2->finish; > $sth2 = $dbh->prepare("select distinct category from authorised_values"); > $sth2->execute; >- my @av_cat = Koha::AuthorisedValueCategories->search->as_list; >- my @authorised_values = map { $_->category_name } @av_cat; >+ my @authorised_values= Koha::AuthorisedValueCategories->search->get_column('category_name'); > > # build thesaurus categories list > my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list ); >diff --git a/admin/sms_providers.pl b/admin/sms_providers.pl >index a059ece5633..1677576d941 100755 >--- a/admin/sms_providers.pl >+++ b/admin/sms_providers.pl >@@ -62,8 +62,8 @@ elsif ( $op eq 'delete' ) { > $provider->delete() if $provider; > } > >-my @providers = Koha::SMS::Providers->search->as_list; >+my $providers = Koha::SMS::Providers->search; > >-$template->param( providers => \@providers ); >+$template->param( providers => $providers ); > > output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/catalogue/item-export.pl b/catalogue/item-export.pl >index 4aec67e0353..cbd89eaf49f 100755 >--- a/catalogue/item-export.pl >+++ b/catalogue/item-export.pl >@@ -36,7 +36,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({ > my @itemnumbers = $cgi->multi_param('itemnumber'); > my $format = $cgi->param('format') // 'csv'; > >-my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } })->as_list; >+my $items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } }); > > if ($format eq 'barcodes') { > print $cgi->header({ >@@ -44,7 +44,7 @@ if ($format eq 'barcodes') { > attachment => 'barcodes.txt', > }); > >- foreach my $item (@items) { >+ while ( my $item = $items->next ) { > print $item->barcode . "\n"; > } > exit; >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index b9cc03be0be..354ea86ccbb 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -260,13 +260,7 @@ if ( defined $format ) { > # Display the search form > > my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list; >-my @itemtypes; >-foreach my $itemtype ( Koha::ItemTypes->search_with_localization->as_list ) { >- push @itemtypes, { >- value => $itemtype->itemtype, >- label => $itemtype->translated_description, >- }; >-} >+my @itemtypes = map { value => $_->itemtype, label => $_->translated_description }, Koha::ItemTypes->search_with_localization->as_list; > > my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' }); > foreach my $ccode (@ccodes) { >diff --git a/cataloguing/editor.pl b/cataloguing/editor.pl >index 8ce41e8eb2f..53152c01dd1 100755 >--- a/cataloguing/editor.pl >+++ b/cataloguing/editor.pl >@@ -49,11 +49,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > > my $schema = Koha::Database->new->schema; > >-my @keyboard_shortcuts = Koha::KeyboardShortcuts->search->as_list; >- > # Keyboard shortcuts > $template->param( >- shortcuts => \@keyboard_shortcuts, >+ shortcuts => Koha::KeyboardShortcuts->search, > ); > > # Available import batches >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 4e31d124856..76355aefb51 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -603,7 +603,7 @@ $template->param( > > > if ( C4::Context->preference("ExportCircHistory") ) { >- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]); >+ $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc' })); > } > > my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count; >diff --git a/circ/transfers_to_send.pl b/circ/transfers_to_send.pl >index da5c0c3e5ce..865b9048dfc 100755 >--- a/circ/transfers_to_send.pl >+++ b/circ/transfers_to_send.pl >@@ -41,7 +41,7 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > my $branchcode = C4::Context->userenv->{'branch'}; > > # transfers requested but not yet sent >-my @transfers = Koha::Libraries->search( >+my $transfers = Koha::Libraries->search( > { > 'branchtransfers_tobranches.frombranch' => $branchcode, > 'branchtransfers_tobranches.daterequested' => { '!=' => undef }, >@@ -53,10 +53,10 @@ my @transfers = Koha::Libraries->search( > prefetch => 'branchtransfers_tobranches', > order_by => 'branchtransfers_tobranches.tobranch' > } >-)->as_list; >+); > > $template->param( >- libraries => \@transfers, >+ libraries => $transfers, > show_date => dt_from_string > ); > >diff --git a/clubs/clubs.pl b/clubs/clubs.pl >index 05d7fe985e9..ce2053e5af7 100755 >--- a/clubs/clubs.pl >+++ b/clubs/clubs.pl >@@ -45,15 +45,12 @@ my $club_id = $cgi->param('club_id'); > my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef; > my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef; > >-my @club_templates = Koha::Club::Templates->search->as_list; >-my @clubs = Koha::Clubs->search->as_list; >- > $template->param( > stored => $stored, > club_template => $club_template, > club => $club, >- club_templates => \@club_templates, >- clubs => \@clubs, >+ club_templates => Koha::Club::Templates->search, >+ clubs => Koha::Clubs->search, > ); > > output_html_with_http_headers( $cgi, $cookie, $template->output ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >index 002a1b4440d..0c13322abd1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >@@ -64,12 +64,12 @@ > <select name="issues-table-output-format" id="issues-table-output-format"> > <option value="iso2709_995">MARC with items</option> > <option value="iso2709">MARC without items</option> >- [% IF csv_profiles.size %] >+ [% IF csv_profiles.count %] > <option value="csv">CSV</option> > [% END %] > </select> > >- [% IF csv_profiles.size %] >+ [% IF csv_profiles.count %] > <select name="csv_profile_id"> > [% FOREACH csv_profile IN csv_profiles %] > <option value="[% csv_profile.export_format_id | html %]">[% csv_profile.profile | html %]</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >index 4e0df282bcd..d22111bb6a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >@@ -215,11 +215,11 @@ Batch list > </select> > </li> > <li><label for="itype_item_[% item.item_id | html %]">itype</label><select id="itype_item_[% item.item_id | html %]" name="itype_[% item.biblio_count | html %]"> >- [% FOREACH itypeloo IN itypeloop %] >- [% IF ( itypeloo.itemtype ) == ( item.itype ) %] >- <option value="[% itypeloo.itemtype | html %]" selected="selected">[% itypeloo.description | html %]</option> >+ [% FOREACH itemtype IN itemtypes %] >+ [% IF itemtype.itemtype == item.itype %] >+ <option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option> > [% ELSE %] >- <option value="[% itypeloo.itemtype | html %]">[% itypeloo.description | html %]</option> >+ <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option> > [% END %] > [% END %] > </select> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index 1914c5545bd..09648ab56aa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -7,7 +7,7 @@ > <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a> > <ul class="dropdown-menu" id="export-csv-menu"> > <li><a href="#">Default</a></li> >- [% IF csv_profiles %] >+ [% IF csv_profiles.count %] > [% FOR csv IN csv_profiles %] > <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >index b3bc583040d..4db81b16508 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >@@ -148,7 +148,7 @@ > </ol> > </fieldset> > >- [% IF available_additional_fields %] >+ [% IF available_additional_fields.count %] > [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >index 6cccff9bbfa..db4a47e7673 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >@@ -204,7 +204,7 @@ > <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a> > <ul class="dropdown-menu" id="export-csv-menu"> > <li><a href="#">Default</a></li> >- [% IF csv_profiles %] >+ [% IF csv_profiles.count %] > [% FOR csv IN csv_profiles %] > <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 288b2f5f43f..0b61a1e08c9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -145,7 +145,7 @@ > <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" /> > <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" /> > >- [% FOREACH c IN currencies %] >+ [% FOREACH c IN currencies.count %] > <input type="hidden" id="currency_rate_[% c.currency | html %]" name="[% c.currency | html %]" value="[% c.rate | html %]" /> > [% END %] > >@@ -395,7 +395,7 @@ > <li> > <label for="currency">Currency:</label> > <select name="currency" id="currency" onchange="updateCosts();"> >- [% FOREACH c IN currencies %] >+ [% FOREACH c IN currencies.count %] > [% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %] > <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option> > [% ELSIF not c.archived %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt >index c424341b93e..2aebea9ed92 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt >@@ -98,7 +98,7 @@ > [% ELSE %] > <h3>Choose a vendor to transfer from</h3> > [% END %] >- [% IF ( booksellersloop ) %] >+ [% IF booksellers.count %] > <table> > <thead> > <tr> >@@ -107,7 +107,7 @@ > </tr> > </thead> > <tbody> >- [% FOREACH bookseller IN booksellersloop %] >+ [% FOREACH bookseller IN booksellers %] > <tr> > <td>[% bookseller.name | html %]</td> > <td><a class="btn btn-default btn-xs" href="transferorder.pl?[% IF (bookselleridfrom) %]bookselleridto[% ELSE %]bookselleridfrom[% END %]=[% bookseller.id | html %][% IF (ordernumber) %]&ordernumber=[% ordernumber | html %][% END %]">Choose</a></td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >index f27cced6240..bd7339277b9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >@@ -239,7 +239,7 @@ Authorized values › Administration › Koha > <p> > <label for="category_search">Show category: </label> > <select name="searchfield" id="category_search"> >- [% FOR c IN categories %] >+ [% FOR c IN category_names %] > [% IF c == searchfield %] > <option value="[% c | html %]" selected="selected">[% c | html %]</option> > [% ELSE %] >@@ -322,7 +322,7 @@ Authorized values › Administration › Koha > </tr> > </thead> > <tbody> >- [% FOR c IN categories %] >+ [% FOR c IN category_names %] > <tr> > <td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td> > <td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >index d05c5aa1b7e..7f5db486e46 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >@@ -220,13 +220,13 @@ Libraries › Administration › Koha > </li> > <li><label for="smtp_server">SMTP server: </label> > <select name="smtp_server" id="smtp_server"> >- [% IF selected_smtp_server.is_system_default %] >+ [% IF library AND library.smtp_server.is_system_default %] > <option value="*" selected="selected">Default</option> > [% ELSE %] > <option value="*">Default</option> > [% END %] > [% FOREACH smtp_server IN smtp_servers %] >- [% IF smtp_server.id == selected_smtp_server.id %] >+ [% IF library AND smtp_server.id == library.smtp_server.id %] > <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option> > [% ELSE %] > <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt >index 614b704484b..120104a6262 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt >@@ -37,7 +37,7 @@ > > <h2>SMS cellular providers</h2> > >- [% IF providers.size %] >+ [% IF providers.count %] > > <table id="providerst"> > <thead> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt >index fcca1bf8bda..bd578be835f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt >@@ -43,7 +43,7 @@ > > <h1>Transfers requested of your library as of [% show_date | $KohaDates %]</h1> > >- [% IF ( libraries ) %] >+ [% IF libraries.count %] > <p>Your library is the origin for the following transfer(s)</p> > <div id="resultlist"> > [% FOREACH library IN libraries %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt >index dbecc11f085..ebf7339bd20 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt >@@ -65,7 +65,7 @@ > </div> > [% END %] > >- [% IF club_templates %] >+ [% IF club_templates.count %] > <table id="club-templates-table"> > <thead> > <tr> >@@ -120,7 +120,7 @@ > [% IF CAN_user_clubs_edit_clubs %] > <div class="btn-toolbar"> > <div class="btn-group"> >- [% IF club_templates %] >+ [% IF club_templates.count %] > <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button> > [% ELSE %] > <button disabled="disabled" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button> >@@ -134,10 +134,10 @@ > </div> > [% END %] > >- [% IF clubs %] >+ [% IF clubs.count %] > [% INCLUDE 'clubs-table.inc' %] > [% ELSE %] >- [% IF club_templates %] >+ [% IF club_templates.count %] > <div class="dialog message">No clubs defined.</div> > [% ELSE %] > <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt >index cc20d296019..ac0ff23741a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt >@@ -74,7 +74,7 @@ > </form> > > <div id="keys"> >- [% IF api_keys && api_keys.size > 0 %] >+ [% IF api_keys.count %] > <p> > <button class="btn btn-default toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new client id/key pair</button> > </p> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >index 7f3615b4585..9c9278a7f2b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >@@ -185,7 +185,7 @@ > [% END %]</tbody> > </table> > >- [% IF csv_profiles %] >+ [% IF csv_profiles.count %] > <fieldset class="action"> > <label for="csv_code">Select CSV profile:</label> > <select id="csv_profile_for_export"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >index 2ec7fefd529..4cccfff7dbd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >@@ -157,7 +157,7 @@ > </div> <!-- /.col-sm-6 --> > </div> <!-- /.row --> > >- [% IF available_additional_fields %] >+ [% IF available_additional_fields.count %] > <hr> > <div class="row"> > <div class="col-sm-6"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index 8d2b8a0f78b..76588c94edd 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -245,7 +245,7 @@ > > [% UNLESS hidden.defined('branchcode') %] > <li> >- [% IF ( libraries.size > 1 ) %] >+ [% IF libraries.count %] > <label for="borrower_branchcode" class="[% required.branchcode | html %]">Home library:</label> > > <select id="borrower_branchcode" name="borrower_branchcode" class="[% required.branchcode | html %]"> >diff --git a/members/apikeys.pl b/members/apikeys.pl >index d05f6043015..5f1cd271caf 100755 >--- a/members/apikeys.pl >+++ b/members/apikeys.pl >@@ -121,10 +121,8 @@ if ($op) { > } > } > >-my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id })->as_list; >- > $template->param( >- api_keys => \@api_keys, >+ api_keys => Koha::ApiKeys->search({ patron_id => $patron_id }), > csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $cgi->cookie('CGISESSID') }), > patron => $patron > ); >diff --git a/members/boraccount.pl b/members/boraccount.pl >index 097cec79743..23283beb0cb 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -174,10 +174,10 @@ if ( $action eq 'discount' ) { > #get account details > my $total = $patron->account->balance; > >-my @accountlines = Koha::Account::Lines->search( >+my $accountlines = Koha::Account::Lines->search( > { borrowernumber => $patron->borrowernumber }, > { order_by => { -desc => 'accountlines_id' } } >-)->as_list; >+); > > my $totalcredit; > if($total <= 0){ >@@ -209,7 +209,7 @@ $template->param( > finesview => 1, > total => sprintf("%.2f",$total), > totalcredit => $totalcredit, >- accounts => \@accountlines, >+ accounts => $accountlines, > payment_id => $payment_id, > change_given => $change_given, > renew_results => $renew_results_display, >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 7ab302bebff..d194bdd299a 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -205,12 +205,12 @@ if ($add) { > } > } > >-my @debit_types = Koha::Account::DebitTypes->search_with_library_limits( >+my $debit_types = Koha::Account::DebitTypes->search_with_library_limits( > { can_be_invoiced => 1, archived => 0 }, >- {}, $library_id )->as_list; >+ {}, $library_id ); > > $template->param( >- debit_types => \@debit_types, >+ debit_types => $debit_types, > csrf_token => Koha::Token->new->generate_csrf( > { session_id => scalar $input->cookie('CGISESSID') } > ), >diff --git a/members/members-home.pl b/members/members-home.pl >index 8111eeeb4e0..d5efc9d6b27 100755 >--- a/members/members-home.pl >+++ b/members/members-home.pl >@@ -43,13 +43,14 @@ if( Koha::Libraries->search->count < 1){ > $template->param(no_branches => 1); > } > >-my @categories = Koha::Patron::Categories->search_with_library_limits->as_list; >-if(scalar(@categories) < 1){ >+my $categories = Koha::Patron::Categories->search_with_library_limits; >+unless ( $categories->count ) { > $no_add = 1; > $template->param(no_categories => 1); > } > else { >- $template->param(categories=>\@categories); >+ # FIXME This does not seem to be used in the template >+ $template->param(categories => $categories); > } > > my $branch = >diff --git a/members/moremember.pl b/members/moremember.pl >index 2d5a1d1d6c6..9f74c53586e 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -162,7 +162,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > } > > if ( C4::Context->preference("ExportCircHistory") ) { >- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]); >+ $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc' })); > } > > my $patron_messages = Koha::Patron::Messages->search( >diff --git a/misc/cronjobs/reconcile_balances.pl b/misc/cronjobs/reconcile_balances.pl >index 2559ed8894c..b200df1921b 100755 >--- a/misc/cronjobs/reconcile_balances.pl >+++ b/misc/cronjobs/reconcile_balances.pl >@@ -72,7 +72,7 @@ GetOptions( > pod2usage(1) if $help; > cronlogaction(); > >-my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search( >+my @patron_ids = Koha::Account::Lines->search( > { > amountoutstanding => { '<' => 0 }, > borrowernumber => { '!=' => undef } >@@ -81,7 +81,7 @@ my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search( > columns => [ qw/borrowernumber/ ], > distinct => 1, > } >- )->as_list; >+ )->get_column('borrowernumber'); > > my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } }); > >diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl >index cf7d9595bf6..4304541013b 100755 >--- a/opac/opac-basket.pl >+++ b/opac/opac-basket.pl >@@ -176,11 +176,8 @@ my $resultsarray = \@results; > # my $itemsarray=\@items; > > $template->param( >- csv_profiles => [ >- Koha::CsvProfiles->search( >- { type => 'marc', used_for => 'export_records', staff_only => 0 } >- )->as_list >- ], >+ csv_profiles => Koha::CsvProfiles->search( >+ { type => 'marc', used_for => 'export_records', staff_only => 0 } ), > bib_list => $bib_list, > BIBLIO_RESULTS => $resultsarray, > ); >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index c911647f01f..4806347ec65 100755 >--- a/opac/opac-downloadcart.pl >+++ b/opac/opac-downloadcart.pl >@@ -130,16 +130,13 @@ if ($bib_list && $format) { > > } else { > $template->param( >- csv_profiles => [ >- Koha::CsvProfiles->search( >- { >- type => 'marc', >- used_for => 'export_records', >- staff_only => 0 >- } >- )->as_list >- ] >- ); >+ csv_profiles => Koha::CsvProfiles->search( >+ { >+ type => 'marc', >+ used_for => 'export_records', >+ staff_only => 0 >+ } >+ ), > $template->param(bib_list => $bib_list); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl >index 8eff0f62638..d67ca5c6522 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -146,16 +146,13 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > $template->param(fullpage => 1); > } > $template->param( >- csv_profiles => [ >- Koha::CsvProfiles->search( >- { >- type => 'marc', >- used_for => 'export_records', >- staff_only => 0 >- } >- )->as_list >- ] >- ); >+ csv_profiles => Koha::CsvProfiles->search( >+ { >+ type => 'marc', >+ used_for => 'export_records', >+ staff_only => 0 >+ } >+ ); > $template->param( shelf => $shelf ); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 3bac68ab5c9..28b324c2cac 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -86,7 +86,7 @@ if ( $action eq 'create' || $action eq 'new' ) { > $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } } > if @PatronSelfRegistrationLibraryList; > } >-my @libraries = Koha::Libraries->search($params)->as_list; >+my $libraries = Koha::Libraries->search($params); > > my ( $min, $max ) = C4::Members::get_cardnumber_length(); > if ( defined $min ) { >@@ -102,7 +102,7 @@ $template->param( > action => $action, > hidden => GetHiddenFields( $mandatory, $action ), > mandatory => $mandatory, >- libraries => \@libraries, >+ libraries => $libraries, > OPACPatronDetails => C4::Context->preference('OPACPatronDetails'), > defaultCategory => $defaultCategory, > ); >@@ -625,7 +625,7 @@ sub GeneratePatronAttributesForm { > my ( $borrowernumber, $entered_attributes ) = @_; > > # Get all attribute types and the values for this patron (if applicable) >- my @types = grep { $_->opac_editable() or $_->opac_display } >+ my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC > Koha::Patron::Attribute::Types->search()->as_list(); > if ( scalar(@types) == 0 ) { > return []; >diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl >index d8ab5ec95ea..84867da0ba3 100755 >--- a/opac/opac-messaging.pl >+++ b/opac/opac-messaging.pl >@@ -79,8 +79,8 @@ $template->param( > TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") ); > > if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) { >- my @providers = Koha::SMS::Providers->search->as_list; >- $template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id ); >+ my $providers = Koha::SMS::Providers->search; >+ $template->param( sms_providers => $providers, sms_provider_id => $patron->sms_provider_id ); > } > > my $new_session_id = $cookie->value; >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index b731c6ad138..b2d7be17c87 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -436,8 +436,7 @@ my %is_nolimit = map { $_ => 1 } @nolimits; > if (@searchCategories > 0) { > my @tabcat; > foreach my $typecategory (@searchCategories) { >- my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory })->as_list; >- push @tabcat, $_->itemtype for @itemtypes; >+ push @tabcat, Koha::ItemTypes->search({ searchcategory => $typecategory })->get_column('itemtype'); > } > > foreach my $itemtypeInCategory (@tabcat) { >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index f2d2ae6c62e..4c76116bca8 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -397,11 +397,13 @@ if ( $op eq 'view' ) { > itemsloop => \@items_info, > sortfield => $sortfield, > direction => $direction, >- csv_profiles => [ >- Koha::CsvProfiles->search( >- { type => 'marc', used_for => 'export_records', staff_only => 0 } >- )->as_list >- ], >+ csv_profiles => Koha::CsvProfiles->search( >+ { >+ type => 'marc', >+ used_for => 'export_records', >+ staff_only => 0 >+ } >+ ), > ); > if ( $page ) { > my $pager = $contents->pager; >diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl >index d6cc868e3be..c804f72abe8 100755 >--- a/reports/acquisitions_stats.pl >+++ b/reports/acquisitions_stats.pl >@@ -181,7 +181,7 @@ else { > > my $CGIsepChoice = GetDelimiterChoices; > >- my @branches = Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; >+ my $libraries = Koha::Libraries->search({}, { order_by => 'branchname' }); > > my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode'); > my $ccode_label; >@@ -201,7 +201,7 @@ else { > Sort1 => $Sort1, > Sort2 => $Sort2, > CGIsepChoice => $CGIsepChoice, >- branches => \@branches, >+ branches => $libraries, > ccode_label => $ccode_label, > ccode_avlist => $ccode_avlist, > ); >diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl >index 188034ccbf8..7263c3b0dc0 100755 >--- a/reports/borrowers_stats.pl >+++ b/reports/borrowers_stats.pl >@@ -219,7 +219,7 @@ sub calculate { > } > } > >- my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list; >+ my @branchcodes = Koha::Libraries->search->get_column('branchcode'); > ($status ) and push @loopfilter,{crit=>"Status", filter=>$status }; > ($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity}; > # year of activity >diff --git a/serials/claims.pl b/serials/claims.pl >index a4ef35f9952..a16d840efeb 100755 >--- a/serials/claims.pl >+++ b/serials/claims.pl >@@ -96,7 +96,7 @@ $template->param( > supplierid => $supplierid, > claimletter => $claimletter, > additional_fields_for_subscription => $additional_fields, >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' })->as_list ], >+ csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }), > letters => $letters, > (uc(C4::Context->preference("marcflavour"))) => 1 > ); >diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl >index bd599701d38..392ce34c1fb 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -126,7 +126,7 @@ my $default_bib_view = get_default_view(); > > my $subscription_object = Koha::Subscriptions->find( $subscriptionid ); > $template->param( >- available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } )->as_list ], >+ available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ), > additional_field_values => { > map { $_->field->name => $_->value } > $subscription_object->additional_field_values->as_list >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index feb8dc4802f..5372e00d5b0 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -456,9 +456,9 @@ if( $suggestion_ref->{STATUS} ) { > ); > } > >-my @currencies = Koha::Acquisition::Currencies->search->as_list; >+my $currencies = Koha::Acquisition::Currencies->search; > $template->param( >- currencies => \@currencies, >+ currencies => $currencies, > suggestion => $suggestion_ref, > price => sprintf("%.2f", $$suggestion_ref{'price'}||0), > total => sprintf("%.2f", $$suggestion_ref{'total'}||0), >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29859
:
129346
|
129350
|
130102
|
130148
|
130149
|
130480
|
130483
|
132972
|
132983