@@ -, +, @@ --- 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 | 6 ++-- 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 | 6 ++-- 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 | 18 +++++------ opac/opac-downloadshelf.pl | 18 +++++------ opac/opac-memberentry.pl | 8 ++--- 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, 153 insertions(+), 193 deletions(-) --- a/C4/Overdues.pm +++ a/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; } --- a/Koha/Acquisition/Currency.pm +++ a/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; }); --- a/Koha/AudioAlerts.pm +++ a/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(); } --- a/Koha/Holds.pm +++ a/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( { --- a/Koha/Library/Group.pm +++ a/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( { --- a/acqui/addorderiso2709.pl +++ a/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, ); --- a/acqui/basket.pl +++ a/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 }, --- a/acqui/basketheader.pl +++ a/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}, ); --- a/acqui/duplicate_orders.pl +++ a/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, ); } --- a/acqui/histsearch.pl +++ a/acqui/histsearch.pl @@ -99,10 +99,10 @@ 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 ); +my $additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } ); +$template->param( available_additional_fields => $additional_fields ); my @additional_field_filters; -foreach my $additional_field (@additional_fields) { +while ( my $additional_field = $additional_fields->next ) { my $value = $input->param('additional_field_' . $additional_field->id); if (defined $value and $value ne '') { push @additional_field_filters, { --- a/acqui/lateorders.pl +++ a/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; --- a/acqui/neworderempty.pl +++ a/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, --- a/acqui/supplier.pl +++ a/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, ); } --- a/acqui/transferorder.pl +++ a/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, ); } } --- a/admin/authorised_values.pl +++ a/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, ); } --- a/admin/branches.pl +++ a/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( --- a/admin/item_circulation_alerts.pl +++ a/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; } --- a/admin/itemtypes.pl +++ a/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, ); } --- a/admin/marc_subfields_structure.pl +++ a/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 ); --- a/admin/sms_providers.pl +++ a/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; --- a/catalogue/item-export.pl +++ a/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,14 +44,14 @@ if ($format eq 'barcodes') { attachment => 'barcodes.txt', }); - foreach my $item (@items) { + while ( my $item = $items->next ) { print $item->barcode . "\n"; } exit; } $template->param( - results => \@items, + results => $items, ); print $cgi->header({ --- a/catalogue/itemsearch.pl +++ a/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) { --- a/cataloguing/editor.pl +++ a/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 --- a/circ/circulation.pl +++ a/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; --- a/circ/transfers_to_send.pl +++ a/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 ); --- a/clubs/clubs.pl +++ a/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 ); --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -64,12 +64,12 @@ - [% IF csv_profiles.size %] + [% IF csv_profiles.count %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -7,7 +7,7 @@