From 165c0f198530190eb34dcea219c7f1b484ec199a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Jan 2022 10:09:09 +0100 Subject: [PATCH] Bug 29844: Fix ->search occurrences and some more... There are lot of inconsistencies in our ->search calls. We could simplify some of them, but not in this patch. Here we want to prevent regressions as much as possible and so don't add unecessary changes. --- C4/Acquisition.pm | 2 +- C4/Auth.pm | 8 ++++---- C4/Circulation.pm | 2 +- C4/HoldsQueue.pm | 2 +- C4/ILSDI/Services.pm | 2 +- C4/ItemCirculationAlertPreference.pm | 4 ++-- C4/Members.pm | 2 +- C4/Overdues.pm | 2 +- C4/Reserves.pm | 8 ++++---- C4/SIP/ILS/Patron.pm | 2 +- C4/Search.pm | 4 ++-- C4/Serials.pm | 2 +- C4/XSLT.pm | 2 +- Koha/AudioAlerts.pm | 6 +++--- Koha/AuthorisedValues.pm | 2 +- Koha/BackgroundJob/BatchUpdateBiblio.pm | 2 +- Koha/Club.pm | 2 +- Koha/Clubs.pm | 2 +- Koha/Library/Group.pm | 6 +++--- Koha/Library/Groups.pm | 2 +- Koha/Objects/Mixin/AdditionalFields.pm | 2 +- Koha/Patron.pm | 8 ++++---- Koha/Patron/Modification.pm | 2 +- Koha/REST/V1/Biblios.pm | 4 ++-- Koha/REST/V1/Patrons.pm | 2 +- Koha/SearchEngine/Elasticsearch.pm | 4 ++-- Koha/Template/Plugin/Branches.pm | 2 +- Koha/Template/Plugin/Desks.pm | 2 +- Koha/Uploader.pm | 4 ++-- acqui/addorderiso2709.pl | 4 ++-- acqui/basket.pl | 4 ++-- acqui/basketheader.pl | 4 ++-- acqui/booksellers.pl | 2 +- acqui/duplicate_orders.pl | 2 +- acqui/histsearch.pl | 2 +- acqui/invoices.pl | 2 +- acqui/lateorders.pl | 2 +- acqui/neworderempty.pl | 4 ++-- acqui/orderreceive.pl | 2 +- acqui/supplier.pl | 2 +- acqui/transferorder.pl | 2 +- admin/audio_alerts.pl | 2 +- admin/auth_subfields_structure.pl | 2 +- admin/authorised_values.pl | 4 ++-- admin/branches.pl | 2 +- admin/classsources.pl | 4 ++-- admin/item_circulation_alerts.pl | 4 ++-- admin/koha2marclinks.pl | 2 +- admin/marc_subfields_structure.pl | 4 ++-- admin/overdrive.pl | 2 +- admin/preferences.pl | 2 +- admin/sms_providers.pl | 2 +- admin/transport-cost-matrix.pl | 2 +- basket/basket.pl | 2 +- basket/downloadcart.pl | 2 +- catalogue/issuehistory.pl | 4 ++-- catalogue/item-export.pl | 2 +- catalogue/itemsearch.pl | 4 ++-- catalogue/search.pl | 2 +- cataloguing/editor.pl | 2 +- cataloguing/value_builder/cn_browser.pl | 2 +- cataloguing/value_builder/marc21_linking_section.pl | 2 +- cataloguing/value_builder/unimarc_field_4XX.pl | 2 +- circ/article-requests.pl | 6 +++--- circ/circulation.pl | 8 ++++---- circ/transfers_to_send.pl | 2 +- clubs/clubs.pl | 4 ++-- clubs/patron-clubs-tab.pl | 4 ++-- ill/ill-requests.pl | 2 +- members/apikeys.pl | 4 ++-- members/boraccount.pl | 2 +- members/mancredit.pl | 2 +- members/maninvoice.pl | 2 +- members/memberentry.pl | 4 ++-- members/members-home.pl | 2 +- members/members-update.pl | 2 +- members/moremember.pl | 8 ++++---- members/paycollect.pl | 2 +- members/print_overdues.pl | 2 +- members/update-child.pl | 2 +- misc/cronjobs/delete_records_via_leader.pl | 2 +- misc/cronjobs/reconcile_balances.pl | 2 +- opac/clubs/clubs-tab.pl | 4 ++-- opac/opac-account.pl | 2 +- opac/opac-basket.pl | 2 +- opac/opac-downloadcart.pl | 2 +- opac/opac-downloadshelf.pl | 2 +- opac/opac-memberentry.pl | 4 ++-- opac/opac-messaging.pl | 2 +- opac/opac-search.pl | 2 +- opac/opac-shelves.pl | 2 +- opac/opac-user.pl | 4 ++-- reports/acquisitions_stats.pl | 2 +- reports/borrowers_stats.pl | 2 +- reports/issues_stats.pl | 2 +- reports/reserves_stats.pl | 4 ++-- reserve/request.pl | 4 ++-- serials/acqui-search-result.pl | 2 +- serials/claims.pl | 2 +- serials/serials-search.pl | 4 ++-- serials/subscription-add.pl | 2 +- serials/subscription-batchedit.pl | 4 ++-- serials/subscription-detail.pl | 2 +- suggestion/suggestion.pl | 2 +- t/db_dependent/AudioAlerts.t | 4 ++-- t/db_dependent/AuthorisedValues.t | 8 ++++---- t/db_dependent/Budgets.t | 2 +- t/db_dependent/Koha.t | 4 ++-- t/db_dependent/Koha/Objects/Mixin/AdditionalFields.t | 12 ++++++------ t/db_dependent/LibraryGroups.t | 8 ++++---- t/db_dependent/Overdues.t | 2 +- t/db_dependent/Patrons.t | 2 +- t/db_dependent/Reserves.t | 2 +- t/db_dependent/Upload.t | 6 +++--- tools/additional-contents.pl | 2 +- tools/batch_delete_records.pl | 2 +- tools/batch_record_modification.pl | 2 +- tools/export.pl | 2 +- tools/import_borrowers.pl | 2 +- tools/inventory.pl | 4 ++-- tools/modborrowers.pl | 2 +- tools/overduerules.pl | 2 +- tools/viewlog.pl | 2 +- virtualshelves/downloadshelf.pl | 2 +- virtualshelves/shelves.pl | 2 +- 125 files changed, 188 insertions(+), 188 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 1874289bb36..76b6e647c69 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2291,7 +2291,7 @@ sub GetHistory { push @query_params, @$ordernumbers; } if ( @$additional_fields ) { - my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields($additional_fields); + my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields($additional_fields)->as_list; return [] unless @baskets; diff --git a/C4/Auth.pm b/C4/Auth.pm index 1cfeed48cc4..38829cf176f 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -528,7 +528,7 @@ sub get_template_and_user { EnableBorrowerFiles => C4::Context->preference('EnableBorrowerFiles'), UseCourseReserves => C4::Context->preference("UseCourseReserves"), useDischarge => C4::Context->preference('useDischarge'), - pending_checkout_notes => scalar Koha::Checkouts->search({ noteseen => 0 }), + pending_checkout_notes => Koha::Checkouts->search({ noteseen => 0 }), ); } else { @@ -570,7 +570,7 @@ sub get_template_and_user { $opac_name = C4::Context->userenv->{'branch'}; } - my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' }); + my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list; $template->param( AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), LibrarySearchGroups => \@search_groups, @@ -1144,7 +1144,7 @@ sub checkauth { $register_id = $register->id if ($register); $register_name = $register->name if ($register); } - my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; + my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list }; if ( $type ne 'opac' and C4::Context->preference('AutoLocation') ) { # we have to check they are coming from the right ip range @@ -1559,7 +1559,7 @@ sub check_api_auth { my $library = Koha::Libraries->find($branchcode); $branchname = $library? $library->branchname: ''; } - my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; + my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list }; foreach my $br ( keys %$branches ) { # now we work with the treatment of ip diff --git a/C4/Circulation.pm b/C4/Circulation.pm index c2edf81f949..01e3770fb62 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -837,7 +837,7 @@ sub CanBookBeIssued { my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); if ( defined $no_issues_charge_guarantees ) { - my @guarantees = map { $_->guarantee } $patron->guarantee_relationships(); + my @guarantees = map { $_->guarantee } $patron->guarantee_relationships->as_list; my $guarantees_non_issues_charges = 0; foreach my $g ( @guarantees ) { $guarantees_non_issues_charges += $g->account->non_issues_charges; diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index b8abe214968..b7cf0c70279 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -429,7 +429,7 @@ sub MapItemsToHoldRequests { map { $_->{_object} = Koha::Items->find( $_->{itemnumber} ) } @$available_items; my $libraries = {}; - map { $libraries->{$_->id} = $_ } Koha::Libraries->search(); + map { $libraries->{$_->id} = $_ } Koha::Libraries->search->as_list; # group available items by itemnumber my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items; diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 34465a7caf6..a020522c3a4 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -546,7 +546,7 @@ sub GetPatronInfo { value_description => $_->description, # Awkward retro-compability... } : () - } $patron->extended_attributes->search + } $patron->extended_attributes->search->as_list ]; } diff --git a/C4/ItemCirculationAlertPreference.pm b/C4/ItemCirculationAlertPreference.pm index 45d30d95b7b..2526e5c61af 100644 --- a/C4/ItemCirculationAlertPreference.pm +++ b/C4/ItemCirculationAlertPreference.pm @@ -331,8 +331,8 @@ sub grid { my ($class, $where) = @_; my @branch_prefs = $class->find($where); my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} }); - my @cc = Koha::Patron::Categories->search_with_library_limits; - my @it = Koha::ItemTypes->search; + my @cc = Koha::Patron::Categories->search_with_library_limits->as_list; + my @it = Koha::ItemTypes->search->as_list; my $notification = $where->{notification}; my %disabled = map { my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification; diff --git a/C4/Members.pm b/C4/Members.pm index 210a9ea0de3..a08def6135f 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -167,7 +167,7 @@ sub patronflags { $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); if ( defined $no_issues_charge_guarantees ) { my $p = Koha::Patrons->find( $patroninformation->{borrowernumber} ); - my @guarantees = map { $_->guarantee } $p->guarantee_relationships; + my @guarantees = map { $_->guarantee } $p->guarantee_relationships->as_list; my $guarantees_non_issues_charges = 0; foreach my $g ( @guarantees ) { $guarantees_non_issues_charges += $g->account->non_issues_charges; diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 54a42649f72..1f63ce3e0b5 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' }); + return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; } return @$branchcodes; } diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 1490d5aa88a..86b709a44b2 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -977,7 +977,7 @@ Unsuspends all suspended reserves with a suspend_until date from before today. sub AutoUnsuspendReserves { my $today = dt_from_string(); - my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } ); + my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } )->as_list; map { $_->resume() } @holds; } @@ -1402,7 +1402,7 @@ AllowHoldsOnDamagedItems or 'holdallowed' own/sibling library) sub ItemsAnyAvailableAndNotRestricted { my $param = shift; - my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } ); + my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; foreach my $i (@items) { my $reserves_control_branch = @@ -1541,7 +1541,7 @@ sub SuspendAll { $params->{borrowernumber} = $borrowernumber if $borrowernumber; $params->{biblionumber} = $biblionumber if $biblionumber; - my @holds = Koha::Holds->search($params); + my @holds = Koha::Holds->search($params)->as_list; if ($suspend) { map { $_->suspend_hold($suspend_until) } @holds; @@ -2274,7 +2274,7 @@ sub GetMaxPatronHoldsForRecord { my ( $borrowernumber, $biblionumber ) = @_; my $patron = Koha::Patrons->find($borrowernumber); - my @items = Koha::Items->search( { biblionumber => $biblionumber } ); + my @items = Koha::Items->search( { biblionumber => $biblionumber } )->as_list; my $controlbranch = C4::Context->preference('ReservesControlBranch'); diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index e40dbdbf39c..033904f74e2 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -565,7 +565,7 @@ sub build_patron_attributes_string { borrowernumber => $self->{borrowernumber}, code => $a->{code} } - ); + )->as_list; foreach my $attribute ( @attributes ) { my $value = $attribute->attribute(); diff --git a/C4/Search.pm b/C4/Search.pm index 0bf8c6d2091..18a2977a974 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -307,7 +307,7 @@ sub getRecords { my $results_hashref = (); # TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter - $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search }; + $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search->as_list }; # Initialize variables for the faceted results objects my $facets_counter = {}; @@ -1638,7 +1638,7 @@ sub searchResults { }); #Build branchnames hash - my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); + my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; # FIXME - We build an authorised values hash here, using the default framework # though it is possible to have different authvals for different fws. diff --git a/C4/Serials.pm b/C4/Serials.pm index d840bf24b72..32c5a58c938 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -527,7 +527,7 @@ sub SearchSubscriptions { my $additional_fields = $args->{additional_fields} // []; my $matching_record_ids_for_additional_fields = []; if ( @$additional_fields ) { - my @subscriptions = Koha::Subscriptions->filter_by_additional_fields($additional_fields); + my @subscriptions = Koha::Subscriptions->filter_by_additional_fields($additional_fields)->as_list; return () unless @subscriptions; diff --git a/C4/XSLT.pm b/C4/XSLT.pm index f69f9e72a35..744389638ca 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -342,7 +342,7 @@ sub buildKohaItemsNamespace { my $ccodes = { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) }; - my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); + my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; my $xml = ''; diff --git a/Koha/AudioAlerts.pm b/Koha/AudioAlerts.pm index 11aede083c8..734d3a62819 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 } ); + my ($other) = $self->search( { precedence => $alert->precedence() - 1 } )->as_list; $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 } ); + my ($other) = $self->search( { precedence => $alert->precedence() + 1 } )->as_list; $other->precedence( $alert->precedence() )->store(); $alert->precedence( $alert->precedence() + 1 )->store(); } @@ -125,7 +125,7 @@ and to have no gaps sub fix_precedences { my ($self) = @_; - my @alerts = $self->search(); + my @alerts = $self->search->as_list; my $i = 1; map { $_->precedence( $i++ )->store() } @alerts; diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm index 628ddc331db..b52c6c79e62 100644 --- a/Koha/AuthorisedValues.pm +++ b/Koha/AuthorisedValues.pm @@ -126,7 +126,7 @@ sub get_descriptions_by_koha_field { my $cached = $memory_cache->get_from_cache($cache_key); return @$cached if $cached; - my @avs = $self->search_by_koha_field($params); + my @avs = $self->search_by_koha_field($params)->as_list; my @descriptions = map { { authorised_value => $_->authorised_value, diff --git a/Koha/BackgroundJob/BatchUpdateBiblio.pm b/Koha/BackgroundJob/BatchUpdateBiblio.pm index 386512bdbe6..480928c41d1 100644 --- a/Koha/BackgroundJob/BatchUpdateBiblio.pm +++ b/Koha/BackgroundJob/BatchUpdateBiblio.pm @@ -155,7 +155,7 @@ sub additional_report { my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef; return { - lists => scalar Koha::Virtualshelves->search( + lists => Koha::Virtualshelves->search( [ { public => 0, owner => $loggedinuser }, { public => 1 } diff --git a/Koha/Club.pm b/Koha/Club.pm index d4e00dae5be..b752301d79b 100644 --- a/Koha/Club.pm +++ b/Koha/Club.pm @@ -71,7 +71,7 @@ sub club_enrollments { return unless $self->id(); - return scalar Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } ); + return Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } ); } =head3 club_fields diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm index d206b9023af..36c26096a89 100644 --- a/Koha/Clubs.pm +++ b/Koha/Clubs.pm @@ -50,7 +50,7 @@ sub get_enrollable { my $borrower = $params->{borrower}; if ($borrower) { delete( $params->{borrower} ); - my @enrollments = $borrower->get_club_enrollments(); + my @enrollments = $borrower->get_club_enrollments->as_list; if (@enrollments) { $params->{'me.id'} = { -not_in => [ map { $_->club()->id() } @enrollments ] }; } diff --git a/Koha/Library/Group.pm b/Koha/Library/Group.pm index aaf68530d5a..2eb8adf786e 100644 --- a/Koha/Library/Group.pm +++ b/Koha/Library/Group.pm @@ -96,7 +96,7 @@ sub library { =head3 libraries -my @libraries = $group->libraries( { [invert => 1] } ); +my $libraries = $group->libraries( { [invert => 1] } ); Returns the libraries set as direct children of this group. @@ -117,7 +117,7 @@ sub libraries { branchcode => { '!=' => undef }, }, { order_by => 'branchcode' } - ); + )->as_list; my @branchcodes = map { $_->branchcode } @children; @@ -163,7 +163,7 @@ sub all_libraries { =head3 libraries_not_direct_children -my @libraries = $group->libraries_not_direct_children(); +my $libraries = $group->libraries_not_direct_children(); Returns the libraries *not* set as direct children of this group diff --git a/Koha/Library/Groups.pm b/Koha/Library/Groups.pm index f72e544262f..6b251fdbfaf 100644 --- a/Koha/Library/Groups.pm +++ b/Koha/Library/Groups.pm @@ -48,7 +48,7 @@ sub get_root_groups { =head3 get_search_groups -my @search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']})) +my $search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']})) Returns search groups for the specified interface. Defaults to OPAC if no interface is specified. diff --git a/Koha/Objects/Mixin/AdditionalFields.pm b/Koha/Objects/Mixin/AdditionalFields.pm index 3ef6931acef..a412d3215a8 100644 --- a/Koha/Objects/Mixin/AdditionalFields.pm +++ b/Koha/Objects/Mixin/AdditionalFields.pm @@ -28,7 +28,7 @@ Koha::Objects::Mixin::AdditionalFields =head3 filter_by_additional_fields - my @objects = Koha::Foos->filter_by_additional_fields([ + my $objects = Koha::Foos->filter_by_additional_fields([ { id => 1, value => 'foo', diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 4717ece3c48..bfbfa439331 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -395,11 +395,11 @@ sub delete { # This pref should then govern the results of other routines/methods such as # Koha::Virtualshelf->new->delete too. # FIXME Could be $patron->get_lists - $_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } ); + $_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } )->as_list; # We cannot have a FK on borrower_modifications.borrowernumber, the table is also used # for patron selfreg - $_->delete for Koha::Patron::Modifications->search( { borrowernumber => $self->borrowernumber } ); + $_->delete for Koha::Patron::Modifications->search( { borrowernumber => $self->borrowernumber } )->as_list; $self->SUPER::delete; @@ -1123,7 +1123,7 @@ sub get_overdues { =head3 get_routing_lists -my @routinglists = $patron->get_routing_lists +my $routinglists = $patron->get_routing_lists Returns the routing lists a patron is subscribed to. @@ -1695,7 +1695,7 @@ sub _anonymize_column { =head3 add_guarantor - my @relationships = $patron->add_guarantor( + my $relationship = $patron->add_guarantor( { borrowernumber => $borrowernumber, relationships => $relationship, diff --git a/Koha/Patron/Modification.pm b/Koha/Patron/Modification.pm index 3c92a6286a9..1b42223f048 100644 --- a/Koha/Patron/Modification.pm +++ b/Koha/Patron/Modification.pm @@ -127,7 +127,7 @@ sub approve { { borrowernumber => $patron->borrowernumber, code => $code } - ); + )->as_list; } foreach my $attr ( @{$extended_attributes} ) { $attr->{attribute} = exists $attr->{attribute} ? $attr->{attribute} : $attr->{value}; diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 839d117f566..268969af853 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -292,8 +292,8 @@ sub get_checkouts { my $checkouts = ($checked_in) - ? $c->objects->search( scalar $biblio->old_checkouts ) - : $c->objects->search( scalar $biblio->current_checkouts ); + ? $c->objects->search( $biblio->old_checkouts ) + : $c->objects->search( $biblio->current_checkouts ); return $c->render( status => 200, diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index 3da08744833..a33ac06d90e 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -75,7 +75,7 @@ sub get { return try { my $patron_id = $c->validation->param('patron_id'); - my $patron = $c->objects->find( scalar Koha::Patrons->search_limited, $patron_id ); + my $patron = $c->objects->find( Koha::Patrons->search_limited, $patron_id ); unless ($patron) { return $c->render( diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 5a373d0425e..96d88d31c05 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -1355,10 +1355,10 @@ sub get_facetable_fields { my @search_field_names = qw( author itype location su-geo title-series subject ccode holdingbranch homebranch ln ); my @faceted_fields = Koha::SearchFields->search( { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] } - ); + )->as_list; my @not_faceted_fields = Koha::SearchFields->search( { name => { -in => \@search_field_names }, facet_order => undef }, { order_by => ['facet_order'] } - ); + )->as_list; # This could certainly be improved return ( @faceted_fields, @not_faceted_fields ); } diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 8f82e0217a9..2cdb1be81d2 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -132,7 +132,7 @@ sub pickup_locations { if defined $biblio; } } else { - @libraries = Koha::Libraries->search( { pickup_location => 1 }, { order_by => ['branchname'] } ) + @libraries = Koha::Libraries->search( { pickup_location => 1 }, { order_by => ['branchname'] } )->as_list unless @libraries; } diff --git a/Koha/Template/Plugin/Desks.pm b/Koha/Template/Plugin/Desks.pm index 58e100163d7..0bc374c7f13 100644 --- a/Koha/Template/Plugin/Desks.pm +++ b/Koha/Template/Plugin/Desks.pm @@ -80,7 +80,7 @@ sub ListForLibrary { my ($self) = @_; my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; - return scalar Koha::Desks->search( + return Koha::Desks->search( { branchcode => $branch_limit }, { order_by => { '-asc' => 'desk_name' } } ); diff --git a/Koha/Uploader.pm b/Koha/Uploader.pm index 081bc3f0788..8fbb06a14c9 100644 --- a/Koha/Uploader.pm +++ b/Koha/Uploader.pm @@ -36,8 +36,8 @@ Koha::Uploader - Facilitate file uploads (temporary and permanent) # Do something with $upload->count, $upload->result or $upload->err # get some upload records (in staff) via Koha::UploadedFiles - my @uploads1 = Koha::UploadedFiles->search({ filename => $name }); - my @uploads2 = Koha::UploadedFiles->search_term({ term => $term }); + my $uploads1 = Koha::UploadedFiles->search({ filename => $name }); + my $uploads2 = Koha::UploadedFiles->search_term({ term => $term }); # staff download (via Koha::UploadedFile[s]) my $rec = Koha::UploadedFiles->find( $id ); diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 63cfb2afeeb..1ce63d158b3 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -97,7 +97,7 @@ 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; + my @currencies = Koha::Acquisition::Currencies->search->as_list; $template->param("batch_details" => 1, "basketno" => $cgiparams->{'basketno'}, @@ -611,7 +611,7 @@ 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; + my @itypes = Koha::ItemTypes->search->as_list; $template->param(biblio_list => \@list, num_results => $num_records, import_batch_id => $import_batch_id, diff --git a/acqui/basket.pl b/acqui/basket.pl index 1a2b2758a09..7d9ee557c95 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' }) ], - available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ], + csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' })->as_list ], + available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ], 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 a7cd098b64e..f813c0e1e13 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' } ) ] ); +$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ] ); if ( $op eq 'add_form' ) { my @contractloop; @@ -118,7 +118,7 @@ if ( $op eq 'add_form' ) { } my @booksellers = Koha::Acquisition::Booksellers->search( undef, - { order_by => { -asc => 'name' } } ); + { order_by => { -asc => 'name' } } )->as_list; $template->param( add_form => 1, basketname => $basket->{'basketname'}, diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index d3d09dd56d7..51de25d82bf 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -83,7 +83,7 @@ if ($booksellerid) { } else { @suppliers = Koha::Acquisition::Booksellers->search( { name => { -like => "%$supplier%" } }, - { order_by => { -asc => 'name' } } ); + { order_by => { -asc => 'name' } } )->as_list; } my $supplier_count = @suppliers; diff --git a/acqui/duplicate_orders.pl b/acqui/duplicate_orders.pl index 1964b41418c..d22babe64d7 100755 --- a/acqui/duplicate_orders.pl +++ b/acqui/duplicate_orders.pl @@ -117,7 +117,7 @@ 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; + my @currencies = Koha::Acquisition::Currencies->search->as_list; $template->param( currencies => \@currencies, budget_loop => $budget_loop, diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 6423bd18815..a905763283c 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -99,7 +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 } ); +my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } )->as_list; $template->param( available_additional_fields => \@additional_fields ); my @additional_field_filters; foreach my $additional_field (@additional_fields) { diff --git a/acqui/invoices.pl b/acqui/invoices.pl index b0e1db2befd..9720ead33ee 100755 --- a/acqui/invoices.pl +++ b/acqui/invoices.pl @@ -87,7 +87,7 @@ if ( $op and $op eq 'do_search' ) { } # Build suppliers list -my @suppliers = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } ); +my @suppliers = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } )->as_list; my $suppliers_loop = []; my $suppliername; foreach (@suppliers) { diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index 5999ab0a265..43ce39685a4 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' }) ], + csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' })->as_list ], ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 22c7c3c04f4..204448a5365 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -326,7 +326,7 @@ $template->param( catalog_details => \@catalog_details, ); my $suggestion; $suggestion = GetSuggestionInfo($suggestionid) if $suggestionid; -my @currencies = Koha::Acquisition::Currencies->search; +my @currencies = Koha::Acquisition::Currencies->search->as_list; my $active_currency = Koha::Acquisition::Currencies->get_active; # build bookfund list @@ -367,7 +367,7 @@ if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) { # Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio my @itemtypes; -@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes'); +@itemtypes = Koha::ItemTypes->search->as_list unless C4::Context->preference('item-level_itypes'); if ( defined $from_subscriptionid ) { # Get the last received order for this subscription diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 588b465d38d..e1b76d32732 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -152,7 +152,7 @@ $template->param( freight => $freight, name => $bookseller->name, active_currency => $active_currency, - currencies => scalar $currencies->search({ rate => { '!=' => 1 } }), + currencies => $currencies->search({ rate => { '!=' => 1 } }), invoiceincgst => $bookseller->invoiceincgst, bookfund => $budget->{budget_name}, creator => $creator, diff --git a/acqui/supplier.pl b/acqui/supplier.pl index 6766a1adef6..82c08e4b08a 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -96,7 +96,7 @@ if ( $op eq 'display' ) { print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl'); exit; } else { - my @currencies = Koha::Acquisition::Currencies->search; + my @currencies = Koha::Acquisition::Currencies->search->as_list; # get option values from TaxRates syspref my @gst_values = map { diff --git a/acqui/transferorder.pl b/acqui/transferorder.pl index 72f9087f82b..06a41aa7637 100755 --- a/acqui/transferorder.pl +++ b/acqui/transferorder.pl @@ -119,7 +119,7 @@ if( $basketno && $ordernumber) { if( $op eq "do_search" ) { my @booksellers = Koha::Acquisition::Booksellers->search( { name => { -like => "%$query%" } }, - { order_by => { -asc => 'name' } } ); + { order_by => { -asc => 'name' } } )->as_list; $template->param( query => $query, do_search => 1, diff --git a/admin/audio_alerts.pl b/admin/audio_alerts.pl index ed3a9a5e09b..e28151b8d7d 100755 --- a/admin/audio_alerts.pl +++ b/admin/audio_alerts.pl @@ -61,6 +61,6 @@ if (@delete) { Koha::AudioAlerts->fix_precedences(); } -$template->param( AudioAlertsPage => 1, audio_alerts => scalar Koha::AudioAlerts->search() ); +$template->param( AudioAlertsPage => 1, audio_alerts => Koha::AudioAlerts->search() ); output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl index 2fbe31e22b5..aec16d3f223 100755 --- a/admin/auth_subfields_structure.pl +++ b/admin/auth_subfields_structure.pl @@ -78,7 +78,7 @@ if ($op eq 'add_form') { push @authorised_value_categories, 'itemtypes'; # build thesaurus categories list - my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search ); + my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list ); # build value_builder list my @value_builder=(''); diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index f772a84be74..f99454e4047 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -212,7 +212,7 @@ $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'] } ); + 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 ); @@ -220,7 +220,7 @@ if ( $op eq 'list' ) { $searchfield ||= $category_list[0]; - my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } ); + my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list; my @loop_data = (); # builds value list for my $av ( @avs_by_category ) { diff --git a/admin/branches.pl b/admin/branches.pl index 88ff021c8cd..40b2b346e2f 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -55,7 +55,7 @@ if ( $op eq 'add_form' ) { $template->param( selected_smtp_server => $library->smtp_server ); } - my @smtp_servers = Koha::SMTP::Servers->search; + my @smtp_servers = Koha::SMTP::Servers->search->as_list; $template->param( library => $library, diff --git a/admin/classsources.pl b/admin/classsources.pl index d8b9733f261..89b2200c647 100755 --- a/admin/classsources.pl +++ b/admin/classsources.pl @@ -60,8 +60,8 @@ if ( $op eq "add_source" ) { $cn_source ? Koha::ClassSources->find($cn_source) : undef; $template->param( class_source => $class_source, - sort_rules => scalar Koha::ClassSortRules->search, - split_rules => scalar Koha::ClassSplitRules->search, + sort_rules => Koha::ClassSortRules->search, + split_rules => Koha::ClassSplitRules->search, ); } elsif ( $op eq "add_source_validate" ) { diff --git a/admin/item_circulation_alerts.pl b/admin/item_circulation_alerts.pl index 67b71a32e2f..58bb6b27454 100755 --- a/admin/item_circulation_alerts.pl +++ b/admin/item_circulation_alerts.pl @@ -47,8 +47,8 @@ sub show { ); my $branch = $input->param('branch') || '*'; - my @categories = Koha::Patron::Categories->search_with_library_limits; - my @item_types = Koha::ItemTypes->search; + 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' }); diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index e731cbebe2a..b60e4fdf4f8 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -91,7 +91,7 @@ my @loop_data; foreach my $col ( @cols ) { my $found; my $readonly = $col =~ /\.(biblio|biblioitem|item)number$/; - foreach my $row ( $kohafields->search({ kohafield => $col }) ) { + foreach my $row ( $kohafields->search({ kohafield => $col })->as_list ) { $found = 1; push @loop_data, { kohafield => $col, diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 636c3add4e2..f0f3e0cd3cd 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -97,11 +97,11 @@ if ( $op eq 'add_form' ) { $sth2->finish; $sth2 = $dbh->prepare("select distinct category from authorised_values"); $sth2->execute; - my @av_cat = Koha::AuthorisedValueCategories->search; + my @av_cat = Koha::AuthorisedValueCategories->search->as_list; my @authorised_values = map { $_->category_name } @av_cat; # build thesaurus categories list - my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search ); + my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list ); # build value_builder list my @value_builder = (''); diff --git a/admin/overdrive.pl b/admin/overdrive.pl index 3bff6dae746..a961b893373 100755 --- a/admin/overdrive.pl +++ b/admin/overdrive.pl @@ -55,7 +55,7 @@ if ( $op && $op eq 'update' ) { } } -my @branches = Koha::Libraries->search(); +my @branches = Koha::Libraries->search->as_list; my @branch_od_info; foreach my $branch ( @branches ){ my $od_info = Koha::Library::OverDriveInfos->find($branch->branchcode); diff --git a/admin/preferences.pl b/admin/preferences.pl index f405419999a..b6d753b8908 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -99,7 +99,7 @@ sub _get_chunk { } elsif ( $options{'choices'} eq 'staff-templates' ) { $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) } } elsif ( $options{choices} eq 'patron-categories' ) { - $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search }; + $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search->as_list }; $add_blank = 1; } else { die 'Unrecognized source of preference values: ' . $options{'choices'}; diff --git a/admin/sms_providers.pl b/admin/sms_providers.pl index a259b8627cd..a059ece5633 100755 --- a/admin/sms_providers.pl +++ b/admin/sms_providers.pl @@ -62,7 +62,7 @@ elsif ( $op eq 'delete' ) { $provider->delete() if $provider; } -my @providers = Koha::SMS::Providers->search(); +my @providers = Koha::SMS::Providers->search->as_list; $template->param( providers => \@providers ); diff --git a/admin/transport-cost-matrix.pl b/admin/transport-cost-matrix.pl index c138093c744..4af34aa9c5f 100755 --- a/admin/transport-cost-matrix.pl +++ b/admin/transport-cost-matrix.pl @@ -45,7 +45,7 @@ unless ($update) { $have_matrix = keys %$cost_matrix if $cost_matrix; } -my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' }); +my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; my (@branchfromloop, @errors); foreach my $branchfrom ( @branchloop ) { my $fromcode = $branchfrom->{code}; diff --git a/basket/basket.pl b/basket/basket.pl index 80a30ecee51..f6943d9fb93 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -126,7 +126,7 @@ my $resultsarray = \@results; $template->param( BIBLIO_RESULTS => $resultsarray, - csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], + csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }), bib_list => $bib_list, ); diff --git a/basket/downloadcart.pl b/basket/downloadcart.pl index c1e80bf40d6..f612099c6af 100755 --- a/basket/downloadcart.pl +++ b/basket/downloadcart.pl @@ -92,7 +92,7 @@ if ($bib_list && $format) { print $output; } else { - $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); + $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })); $template->param(bib_list => $bib_list); output_html_with_http_headers $query, $cookie, $template->output; } diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl index 8d17dc933af..4f361367bfe 100755 --- a/catalogue/issuehistory.pl +++ b/catalogue/issuehistory.pl @@ -47,14 +47,14 @@ my @checkouts = Koha::Checkouts->search( join => 'item', order_by => 'timestamp', } -); +)->as_list; my @old_checkouts = Koha::Old::Checkouts->search( { biblionumber => $biblionumber }, { join => 'item', order_by => 'timestamp', } -); +)->as_list; my $biblio = Koha::Biblios->find( $biblionumber ); diff --git a/catalogue/item-export.pl b/catalogue/item-export.pl index 0867376d302..4aec67e0353 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 } }); +my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } })->as_list; if ($format eq 'barcodes') { print $cgi->header({ diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 78900429f2f..b9cc03be0be 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -259,9 +259,9 @@ if ( defined $format ) { # Display the search form -my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } ); +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 ) { +foreach my $itemtype ( Koha::ItemTypes->search_with_localization->as_list ) { push @itemtypes, { value => $itemtype->itemtype, label => $itemtype->translated_description, diff --git a/catalogue/search.pl b/catalogue/search.pl index 5da9c063f3b..98924296310 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -231,7 +231,7 @@ if($cgi->cookie("intranet_bib_list")){ } my @search_groups = - Koha::Library::Groups->get_search_groups( { interface => 'staff' } ); + Koha::Library::Groups->get_search_groups( { interface => 'staff' } )->as_list; @search_groups = sort { $a->title cmp $b->title } @search_groups; $template->param( diff --git a/cataloguing/editor.pl b/cataloguing/editor.pl index c2864a31fdc..8ce41e8eb2f 100755 --- a/cataloguing/editor.pl +++ b/cataloguing/editor.pl @@ -49,7 +49,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $schema = Koha::Database->new->schema; -my @keyboard_shortcuts = Koha::KeyboardShortcuts->search(); +my @keyboard_shortcuts = Koha::KeyboardShortcuts->search->as_list; # Keyboard shortcuts $template->param( diff --git a/cataloguing/value_builder/cn_browser.pl b/cataloguing/value_builder/cn_browser.pl index b4e54edd0e8..8abdca75df9 100755 --- a/cataloguing/value_builder/cn_browser.pl +++ b/cataloguing/value_builder/cn_browser.pl @@ -83,7 +83,7 @@ my $launcher = sub { } my $cn_source = $cgi->param('cn_source') || C4::Context->preference("DefaultClassificationSource"); - my @class_sources = Koha::ClassSources->search({ used => 1}); + my @class_sources = Koha::ClassSources->search({ used => 1})->as_list; #Don't show half the results of show lt or gt $real_limit = $results_per_page if $search ne $q; diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl index 5bff56495d5..448dd4ee4b7 100755 --- a/cataloguing/value_builder/marc21_linking_section.pl +++ b/cataloguing/value_builder/marc21_linking_section.pl @@ -297,7 +297,7 @@ my $launcher = sub { } ); - my @itemtypes = Koha::ItemTypes->search; + my @itemtypes = Koha::ItemTypes->search->as_list; $template->param( itypeloop => \@itemtypes, diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl index 83dcaf3c8cc..565290cd897 100755 --- a/cataloguing/value_builder/unimarc_field_4XX.pl +++ b/cataloguing/value_builder/unimarc_field_4XX.pl @@ -484,7 +484,7 @@ sub plugin { } ); - my @itemtypes = Koha::ItemTypes->search; + my @itemtypes = Koha::ItemTypes->search->as_list; $template->param( #classlist => $classlist, itypeloop => \@itemtypes, diff --git a/circ/article-requests.pl b/circ/article-requests.pl index 026483bdc7f..2887a064be9 100755 --- a/circ/article-requests.pl +++ b/circ/article-requests.pl @@ -39,9 +39,9 @@ my $branchcode = defined( $query->param('branchcode') ) ? $query->param('branchc $template->param( branchcode => $branchcode, - article_requests_requested => scalar Koha::ArticleRequests->requested($branchcode), - article_requests_pending => scalar Koha::ArticleRequests->pending($branchcode), - article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode), + article_requests_requested => Koha::ArticleRequests->requested($branchcode), + article_requests_pending => Koha::ArticleRequests->pending($branchcode), + article_requests_processing => Koha::ArticleRequests->processing($branchcode), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/circ/circulation.pl b/circ/circulation.pl index 705ac45ac5b..4e31d124856 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -545,11 +545,11 @@ my $view = $batch my @relatives; if ( $patron ) { - if ( my @guarantors = $patron->guarantor_relationships()->guarantors() ) { + if ( my @guarantors = $patron->guarantor_relationships()->guarantors->as_list ) { push( @relatives, $_->id ) for @guarantors; - push( @relatives, $_->id ) for $patron->siblings(); + push( @relatives, $_->id ) for $patron->siblings->as_list; } else { - push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees(); + push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees->as_list; } } my $relatives_issues_count = @@ -603,7 +603,7 @@ $template->param( if ( C4::Context->preference("ExportCircHistory") ) { - $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]); } 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 fad59fd3bcb..da5c0c3e5ce 100755 --- a/circ/transfers_to_send.pl +++ b/circ/transfers_to_send.pl @@ -53,7 +53,7 @@ my @transfers = Koha::Libraries->search( prefetch => 'branchtransfers_tobranches', order_by => 'branchtransfers_tobranches.tobranch' } -); +)->as_list; $template->param( libraries => \@transfers, diff --git a/clubs/clubs.pl b/clubs/clubs.pl index bb4dee6dccd..05d7fe985e9 100755 --- a/clubs/clubs.pl +++ b/clubs/clubs.pl @@ -45,8 +45,8 @@ 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(); -my @clubs = Koha::Clubs->search(); +my @club_templates = Koha::Club::Templates->search->as_list; +my @clubs = Koha::Clubs->search->as_list; $template->param( stored => $stored, diff --git a/clubs/patron-clubs-tab.pl b/clubs/patron-clubs-tab.pl index 1a12083e655..bc0a405c5dc 100755 --- a/clubs/patron-clubs-tab.pl +++ b/clubs/patron-clubs-tab.pl @@ -42,8 +42,8 @@ my $patronnumber = $cgi->param('borrowernumber'); my $patron = Koha::Patrons->find($patronnumber); -my @enrollments = $patron->get_club_enrollments(); -my @clubs = $patron->get_enrollable_clubs(); +my @enrollments = $patron->get_club_enrollments->as_list; +my @clubs = $patron->get_enrollable_clubs->as_list; $template->param( enrollments => \@enrollments, diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 6898e5b8862..ea2305b3a4c 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -429,7 +429,7 @@ $template->param( backends => $backends, types => [ "Book", "Article", "Journal" ], query_type => $op, - branches => scalar Koha::Libraries->search, + branches => Koha::Libraries->search, ); output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/members/apikeys.pl b/members/apikeys.pl index a235697578d..d05f6043015 100755 --- a/members/apikeys.pl +++ b/members/apikeys.pl @@ -84,7 +84,7 @@ if ($op) { $template->param( fresh_api_key => $api_key, - api_keys => scalar Koha::ApiKeys->search({ patron_id => $patron_id }), + api_keys => Koha::ApiKeys->search({ patron_id => $patron_id }), ); } @@ -121,7 +121,7 @@ if ($op) { } } -my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id }); +my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id })->as_list; $template->param( api_keys => \@api_keys, diff --git a/members/boraccount.pl b/members/boraccount.pl index b28e6659047..097cec79743 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -177,7 +177,7 @@ my $total = $patron->account->balance; my @accountlines = Koha::Account::Lines->search( { borrowernumber => $patron->borrowernumber }, { order_by => { -desc => 'accountlines_id' } } -); +)->as_list; my $totalcredit; if($total <= 0){ diff --git a/members/mancredit.pl b/members/mancredit.pl index 943230b15aa..7ec9b957b21 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -115,7 +115,7 @@ else { my @credit_types = Koha::Account::CreditTypes->search_with_library_limits( { can_be_added_manually => 1, archived => 0 }, - {}, $library_id ); + {}, $library_id )->as_list; $template->param( patron => $patron, diff --git a/members/maninvoice.pl b/members/maninvoice.pl index ce1826ad411..7ab302bebff 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -207,7 +207,7 @@ if ($add) { my @debit_types = Koha::Account::DebitTypes->search_with_library_limits( { can_be_invoiced => 1, archived => 0 }, - {}, $library_id ); + {}, $library_id )->as_list; $template->param( debit_types => \@debit_types, diff --git a/members/memberentry.pl b/members/memberentry.pl index 38f2a2b1491..98c62f21399 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -68,7 +68,7 @@ if ( $borrowernumber and not $patron ) { } if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) { - my @providers = Koha::SMS::Providers->search(); + my @providers = Koha::SMS::Providers->search->as_list; $template->param( sms_providers => \@providers ); } @@ -96,7 +96,7 @@ my $userenv = C4::Context->userenv; my @messages; ## Deal with guarantor stuff -$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; +$template->param( relationships => $patron->guarantor_relationships ) if $patron; my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1; @relations = ('') unless @relations; diff --git a/members/members-home.pl b/members/members-home.pl index 55b3f3e590f..8111eeeb4e0 100755 --- a/members/members-home.pl +++ b/members/members-home.pl @@ -43,7 +43,7 @@ if( Koha::Libraries->search->count < 1){ $template->param(no_branches => 1); } -my @categories = Koha::Patron::Categories->search_with_library_limits; +my @categories = Koha::Patron::Categories->search_with_library_limits->as_list; if(scalar(@categories) < 1){ $no_add = 1; $template->param(no_categories => 1); diff --git a/members/members-update.pl b/members/members-update.pl index e6dffec97a2..b34a8b3ca31 100755 --- a/members/members-update.pl +++ b/members/members-update.pl @@ -59,7 +59,7 @@ foreach my $pm (@$pending_modifications) { foreach my $type (@modified_atypes) { my $type_obj = Koha::Patron::Attribute::Types->find($type); my @before = Koha::Patron::Attributes->search( - { borrowernumber => $pm->{borrowernumber}, code => $type } ); + { borrowernumber => $pm->{borrowernumber}, code => $type } )->as_list; my @after = grep { $_->code eq $type } @{ $pm->{extended_attributes} }; push @{$modified_attributes}, { type => $type_obj, before => \@before, after => \@after }; } diff --git a/members/moremember.pl b/members/moremember.pl index af3d3241115..2d5a1d1d6c6 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -95,11 +95,11 @@ $template->param( flagged => 1 ) if $patron->account_locked; my @relatives; my $guarantor_relationships = $patron->guarantor_relationships; -my @guarantees = $patron->guarantee_relationships->guarantees; -my @guarantors = $guarantor_relationships->guarantors; +my @guarantees = $patron->guarantee_relationships->guarantees->as_list; +my @guarantors = $guarantor_relationships->guarantors->as_list; if (@guarantors) { push( @relatives, $_->id ) for @guarantors; - push( @relatives, $_->id ) for $patron->siblings(); + push( @relatives, $_->id ) for $patron->siblings->as_list; } else { push( @relatives, $_->id ) for @guarantees; @@ -162,7 +162,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { } if ( C4::Context->preference("ExportCircHistory") ) { - $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]); } my $patron_messages = Koha::Patron::Messages->search( diff --git a/members/paycollect.pl b/members/paycollect.pl index d5cbd60bfce..d69b406e566 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -125,7 +125,7 @@ if ( $selected_accts ) { @selected_accountlines = Koha::Account::Lines->search( $search_params, { order_by => 'date' } - ); + )->as_list; my $sum = Koha::Account::Lines->search( $search_params, diff --git a/members/print_overdues.pl b/members/print_overdues.pl index ead651b630f..1fd226d9961 100755 --- a/members/print_overdues.pl +++ b/members/print_overdues.pl @@ -49,7 +49,7 @@ my $patron = Koha::Patrons->find( $borrowernumber ); output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); my $overdues = [ - map { $_->unblessed_all_relateds } $patron->get_overdues + map { $_->unblessed_all_relateds } $patron->get_overdues->as_list ]; my $letter = parse_overdues_letter( diff --git a/members/update-child.pl b/members/update-child.pl index 0742411f1f2..765687f128c 100755 --- a/members/update-child.pl +++ b/members/update-child.pl @@ -80,7 +80,7 @@ elsif ( $op eq 'update' ) { # But we should not hit that with a normal use of the interface die "You are doing something wrong updating this child" unless $adult_category; - $_->delete() for $patron->guarantor_relationships(); + $_->delete() for $patron->guarantor_relationships->as_list; $patron->categorycode($adult_category->categorycode); $patron->store; diff --git a/misc/cronjobs/delete_records_via_leader.pl b/misc/cronjobs/delete_records_via_leader.pl index 2794efb8d74..6c2d5ced9e1 100755 --- a/misc/cronjobs/delete_records_via_leader.pl +++ b/misc/cronjobs/delete_records_via_leader.pl @@ -86,7 +86,7 @@ foreach my $m (@metadatas) { if ($delete_items) { my $deleted_count = 0; my $biblio = Koha::Biblios->find( $biblionumber ); - my @items = Koha::Items->search( { biblionumber => $biblionumber } ); + my @items = Koha::Items->search( { biblionumber => $biblionumber } )->as_list; foreach my $item ( @items ) { my $itemnumber = $item->itemnumber; diff --git a/misc/cronjobs/reconcile_balances.pl b/misc/cronjobs/reconcile_balances.pl index ce95202b7ed..2559ed8894c 100755 --- a/misc/cronjobs/reconcile_balances.pl +++ b/misc/cronjobs/reconcile_balances.pl @@ -81,7 +81,7 @@ my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search( columns => [ qw/borrowernumber/ ], distinct => 1, } - ); + )->as_list; my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } }); diff --git a/opac/clubs/clubs-tab.pl b/opac/clubs/clubs-tab.pl index a3243d4d52a..8c3f7583753 100755 --- a/opac/clubs/clubs-tab.pl +++ b/opac/clubs/clubs-tab.pl @@ -39,8 +39,8 @@ my $borrowernumber = $cgi->param('borrowernumber'); my $borrower = Koha::Patrons->find($borrowernumber); -my @enrollments = $borrower->get_club_enrollments(); -my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 ); +my @enrollments = $borrower->get_club_enrollments->as_list; +my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 )->as_list; $template->param( enrollments => \@enrollments, diff --git a/opac/opac-account.pl b/opac/opac-account.pl index 1de5617fd61..c47bd58644b 100755 --- a/opac/opac-account.pl +++ b/opac/opac-account.pl @@ -50,7 +50,7 @@ if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor') my @relatives; # Filter out guarantees that don't want guarantor to see checkouts - foreach my $gr ( $patron->guarantee_relationships() ) { + foreach my $gr ( $patron->guarantee_relationships->as_list ) { my $g = $gr->guarantee; if ( $g->privacy_guarantor_fines ) { diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index ef137b95b0f..cf7d9595bf6 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -179,7 +179,7 @@ $template->param( csv_profiles => [ Koha::CsvProfiles->search( { type => 'marc', used_for => 'export_records', staff_only => 0 } - ) + )->as_list ], bib_list => $bib_list, BIBLIO_RESULTS => $resultsarray, diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl index ade1a53770a..c911647f01f 100755 --- a/opac/opac-downloadcart.pl +++ b/opac/opac-downloadcart.pl @@ -137,7 +137,7 @@ if ($bib_list && $format) { used_for => 'export_records', staff_only => 0 } - ) + )->as_list ] ); $template->param(bib_list => $bib_list); diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl index 31da711328d..8eff0f62638 100755 --- a/opac/opac-downloadshelf.pl +++ b/opac/opac-downloadshelf.pl @@ -153,7 +153,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { used_for => 'export_records', staff_only => 0 } - ) + )->as_list ] ); $template->param( shelf => $shelf ); diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 03c25fd2904..3bac68ab5c9 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); +my @libraries = Koha::Libraries->search($params)->as_list; my ( $min, $max ) = C4::Members::get_cardnumber_length(); if ( defined $min ) { @@ -698,7 +698,7 @@ sub ParsePatronAttributes { my @values = $cgi->multi_param('patron_attribute_value'); my @editable_attribute_types - = map { $_->code } Koha::Patron::Attribute::Types->search({ opac_editable => 1 }); + = map { $_->code } Koha::Patron::Attribute::Types->search({ opac_editable => 1 })->as_list; my $ea = each_array( @codes, @values ); my @attributes; diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index 40643830c65..d8ab5ec95ea 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -79,7 +79,7 @@ $template->param( TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") ); if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) { - my @providers = Koha::SMS::Providers->search(); + my @providers = Koha::SMS::Providers->search->as_list; $template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id ); } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 8d5fe07bc00..b731c6ad138 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -436,7 +436,7 @@ my %is_nolimit = map { $_ => 1 } @nolimits; if (@searchCategories > 0) { my @tabcat; foreach my $typecategory (@searchCategories) { - my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory }); + my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory })->as_list; push @tabcat, $_->itemtype for @itemtypes; } diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 78ce49da0e8..f2d2ae6c62e 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -400,7 +400,7 @@ if ( $op eq 'view' ) { csv_profiles => [ Koha::CsvProfiles->search( { type => 'marc', used_for => 'export_records', staff_only => 0 } - ) + )->as_list ], ); if ( $page ) { diff --git a/opac/opac-user.pl b/opac/opac-user.pl index e610cabc2ab..83ef251cdc2 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -370,7 +370,7 @@ if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' { my @relatives; # Filter out guarantees that don't want guarantor to see checkouts - foreach my $gr ( $patron->guarantee_relationships() ) { + foreach my $gr ( $patron->guarantee_relationships->as_list ) { my $g = $gr->guarantee; push( @relatives, $g ) if $g->privacy_guarantor_checkouts; } @@ -382,7 +382,7 @@ if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor') { my @relatives_with_fines; # Filter out guarantees that don't want guarantor to see checkouts - foreach my $gr ( $patron->guarantee_relationships() ) { + foreach my $gr ( $patron->guarantee_relationships->as_list ) { my $g = $gr->guarantee; push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines; } diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl index 1d27870c525..d6cc868e3be 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' }); + my @branches = Koha::Libraries->search({}, { order_by => 'branchname' })->as_list; my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode'); my $ccode_label; diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl index f636f6b5664..188034ccbf8 100755 --- a/reports/borrowers_stats.pl +++ b/reports/borrowers_stats.pl @@ -219,7 +219,7 @@ sub calculate { } } - my @branchcodes = map { $_->branchcode } Koha::Libraries->search; + my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list; ($status ) and push @loopfilter,{crit=>"Status", filter=>$status }; ($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity}; # year of activity diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl index f5209b2ff8a..ca0b8ec1004 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -82,7 +82,7 @@ $template->param(do_it => $do_it, our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed; -our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']}); +our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list; our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) }; our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) }; diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl index cb63a6ef87d..94bd5dad8b7 100755 --- a/reports/reserves_stats.pl +++ b/reports/reserves_stats.pl @@ -70,7 +70,7 @@ $sep = "\t" if ($sep eq 'tabulation'); $template->param(do_it => $do_it, ); -my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']}); +my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list; my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) }; my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) }; @@ -325,7 +325,7 @@ sub display_value { } } elsif ( $crit =~ /category/ ) { - my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']}); + my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list; foreach my $patron_category ( @patron_categories ) { ( $value eq $patron_category->categorycode ) or next; $display_value = $patron_category->description and last; diff --git a/reserve/request.pl b/reserve/request.pl index 714a6279880..1a50767f407 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -168,7 +168,7 @@ if($findclub) { my @clubs = Koha::Clubs->search( [ { name => { like => '%'.$findclub.'%' } }, { description => { like => '%'.$findclub.'%' } } - ] ); + ] )->as_list; if( scalar @clubs == 1 ) { $club_hold = $clubs[0]->id; } elsif ( @clubs ) { @@ -661,7 +661,7 @@ foreach my $biblionumber (@biblionumbers) { # existingreserves building my @reserveloop; - my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); + my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } )->as_list; foreach my $res ( sort { my $a_found = $a->found() || ''; diff --git a/serials/acqui-search-result.pl b/serials/acqui-search-result.pl index 1a820756d85..a2d1ae5b942 100755 --- a/serials/acqui-search-result.pl +++ b/serials/acqui-search-result.pl @@ -60,7 +60,7 @@ my ($template, $loggedinuser, $cookie) my $supplier=$query->param('supplier'); my @suppliers = Koha::Acquisition::Booksellers->search( { name => { -like => "%$supplier%" } }, - { order_by => { -asc => 'name' } } ); + { order_by => { -asc => 'name' } } )->as_list; #build result page my $loop_suppliers = []; diff --git a/serials/claims.pl b/serials/claims.pl index f988a6cc4ff..a4ef35f9952 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' }) ], + csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' })->as_list ], letters => $letters, (uc(C4::Context->preference("marcflavour"))) => 1 ); diff --git a/serials/serials-search.pl b/serials/serials-search.pl index 56a16e6543e..52d9cdfabf7 100755 --- a/serials/serials-search.pl +++ b/serials/serials-search.pl @@ -76,7 +76,7 @@ if ( $op and $op eq "close" ) { } -my @additional_fields = Koha::AdditionalFields->search( { tablename => 'subscription', searchable => 1 } ); +my @additional_fields = Koha::AdditionalFields->search( { tablename => 'subscription', searchable => 1 } )->as_list; my @additional_field_filters; for my $field ( @additional_fields ) { my $value = $query->param( 'additional_field_' . $field->id ); @@ -163,7 +163,7 @@ else } } - my @branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] } ); + my @branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] } )->as_list; my @branches_loop; foreach my $b ( @branches ) { my $selected = 0; diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 39426a62531..d10c20c69db 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -130,7 +130,7 @@ $template->param( locations_loop=>$locations_loop, ); -my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); +my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' })->as_list; my %additional_field_values; if ($subscriptionid) { my $subscription = Koha::Subscriptions->find($subscriptionid); diff --git a/serials/subscription-batchedit.pl b/serials/subscription-batchedit.pl index 4e069b9ab66..556f81e8b35 100755 --- a/serials/subscription-batchedit.pl +++ b/serials/subscription-batchedit.pl @@ -47,7 +47,7 @@ foreach my $subscriptionid (@subscriptionids) { push @subscriptions, $subscription if $subscription; } -my @additional_fields = Koha::AdditionalFields->search({tablename => 'subscription'}); +my @additional_fields = Koha::AdditionalFields->search({tablename => 'subscription'})->as_list; my $batchedit = $cgi->param('batchedit'); if ($batchedit) { @@ -98,7 +98,7 @@ if ($batchedit) { $template->param( subscriptions => \@subscriptions, - booksellers => [ Koha::Acquisition::Booksellers->search() ], + booksellers => [ Koha::Acquisition::Booksellers->search->as_list ], additional_fields => \@additional_fields, referrer => scalar $cgi->param('referrer'), ); diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl index 6e8204810fb..bd599701d38 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' } ) ], + available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } )->as_list ], 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 5f69087ca06..feb8dc4802f 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -456,7 +456,7 @@ if( $suggestion_ref->{STATUS} ) { ); } -my @currencies = Koha::Acquisition::Currencies->search; +my @currencies = Koha::Acquisition::Currencies->search->as_list; $template->param( currencies => \@currencies, suggestion => $suggestion_ref, diff --git a/t/db_dependent/AudioAlerts.t b/t/db_dependent/AudioAlerts.t index 4f43b3c59a9..5b616e50087 100755 --- a/t/db_dependent/AudioAlerts.t +++ b/t/db_dependent/AudioAlerts.t @@ -27,7 +27,7 @@ BEGIN { my $schema = Koha::Database->new()->schema(); $schema->storage->txn_begin(); -map { $_->delete() } Koha::AudioAlerts->search(); +map { $_->delete() } Koha::AudioAlerts->search->as_list; ## Check the basics # Creating 3 audio alerts named a, b and c @@ -97,7 +97,7 @@ is( $c->precedence, 3, "Alert C has a precedence of 3" ); $a->move('bottom'); # Changed precedence order from database insert order # Insert order was a, b, c. Precedence order is now b, c, a. -( $b, $c, $a ) = Koha::AudioAlerts->search(); +( $b, $c, $a ) = Koha::AudioAlerts->search->as_list; is( $b->selector, 'B', 'First sound is indeed B' ); is( $b->precedence, 1, "Alert B has a precedence of 1" ); diff --git a/t/db_dependent/AuthorisedValues.t b/t/db_dependent/AuthorisedValues.t index d39d13170c7..e9f64ed5db1 100755 --- a/t/db_dependent/AuthorisedValues.t +++ b/t/db_dependent/AuthorisedValues.t @@ -111,7 +111,7 @@ $av3->lib_opac(''); is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' ); my @authorised_values = - Koha::AuthorisedValues->new()->search( { category => 'av_for_testing' } ); + Koha::AuthorisedValues->new()->search( { category => 'av_for_testing' } )->as_list; is( @authorised_values, 3, "Get correct number of values" ); my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode}; @@ -119,14 +119,14 @@ my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode}; $av1->add_library_limit( $branchcode1 ); -@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode1 ); +@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode1 )->as_list; is( @authorised_values, 3, "Search including value with a branch limit ( branch can use the limited value ) gives correct number of results" ); -@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 ); +@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 )->as_list; is( @authorised_values, 2, "Search including value with a branch limit ( branch *cannot* use the limited value ) gives correct number of results" ); $av1->del_library_limit( $branchcode1 ); -@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 ); +@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 )->as_list; is( @authorised_values, 3, "Branch limitation deleted successfully" ); $av1->add_library_limit( $branchcode1 ); diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index e31753fb32b..0db09284a3e 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -516,7 +516,7 @@ is ( GetBudgetOrdered( $fund ), '20', "total ordered price is 20"); # CloneBudgetPeriod # Let's make sure our timestamp is old -my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id }); +my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id })->as_list; foreach my $fund (@orig_funds){ $fund->timestamp('1999-12-31 23:59:59')->store; } diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t index ca807234a39..f2d5ad614b7 100755 --- a/t/db_dependent/Koha.t +++ b/t/db_dependent/Koha.t @@ -202,10 +202,10 @@ subtest 'GetItemTypesCategorized test' => sub{ $insertSth->execute('BKghjklo3', 'Yet another type of book', 'Qwertyware', 0); # Azertyware should not exist. - my @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Azertyware' }); + my @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Azertyware' })->as_list; is( @itemtypes, 0, 'Search item types by searchcategory: Invalid category returns nothing'); - @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Qwertyware' }); + @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Qwertyware' })->as_list; my @got = map { $_->itemtype } @itemtypes; my @expected = ( 'BKghjklo2', 'BKghjklo3' ); is_deeply(\@got,\@expected,'Search item types by searchcategory: valid category returns itemtypes'); diff --git a/t/db_dependent/Koha/Objects/Mixin/AdditionalFields.t b/t/db_dependent/Koha/Objects/Mixin/AdditionalFields.t index e7e97c14f19..301a40ff418 100755 --- a/t/db_dependent/Koha/Objects/Mixin/AdditionalFields.t +++ b/t/db_dependent/Koha/Objects/Mixin/AdditionalFields.t @@ -88,7 +88,7 @@ my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields([ id => $foo->id, value => 'foo value for basket1', }, -]); +])->as_list; is(scalar @baskets, 1, 'search returns only one result'); is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); @@ -98,7 +98,7 @@ is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); id => $foo->id, value => 'foo value for basket2', }, -]); +])->as_list; is(scalar @baskets, 1, 'search returns only one result'); is($baskets[0]->basketno, $basket2->basketno, 'result is basket2'); @@ -112,7 +112,7 @@ is($baskets[0]->basketno, $basket2->basketno, 'result is basket2'); id => $bar->id, value => 'bar value for basket1', }, -]); +])->as_list; is(scalar @baskets, 1, 'search returns only one result'); is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); @@ -126,7 +126,7 @@ is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); id => $bar->id, value => 'bar value for basket2', }, -]); +])->as_list; is(scalar @baskets, 0, 'search returns no result'); @@ -135,7 +135,7 @@ is(scalar @baskets, 0, 'search returns no result'); id => $foo->id, value => 'foo', }, -]); +])->as_list; is(scalar @baskets, 2, 'search returns two results'); @@ -148,7 +148,7 @@ is(scalar @baskets, 2, 'search returns two results'); id => $foo->id, value => 'basket1', }, -]); +])->as_list; is(scalar @baskets, 1, 'search returns only one result'); is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); diff --git a/t/db_dependent/LibraryGroups.t b/t/db_dependent/LibraryGroups.t index f9ecabf6a27..00e699bd957 100755 --- a/t/db_dependent/LibraryGroups.t +++ b/t/db_dependent/LibraryGroups.t @@ -36,7 +36,7 @@ my $library7 = $builder->build( { source => 'Branch' } ); my $root_group = Koha::Library::Group->new( { title => "Test root group" } )->store(); -my @root_groups = Koha::Library::Groups->get_root_groups(); +my @root_groups = Koha::Library::Groups->get_root_groups->as_list; my $in_list = any { $_->id eq $root_group->id } @root_groups; ok( $in_list, 'New root group is in the list returned by the get_root_groups method'); @@ -66,7 +66,7 @@ my $library = $groupA_library1->library(); is( ref( $library ), 'Koha::Library', 'Method library returns a Koha::Library object' ); is( $library->id, $groupA_library1->branchcode, 'Branchcode for fetched library matches' ); -my @libraries_not_direct_children = $groupA->libraries_not_direct_children(); +my @libraries_not_direct_children = $groupA->libraries_not_direct_children->as_list; $in_list = any { $_->id eq $groupA_library1->branchcode } @libraries_not_direct_children; ok( !$in_list, 'Method libraries_not_direct_children returns all libraries not direct descendants of group, library 1 is not in the list'); $in_list = any { $_->id eq $groupA1_library2->branchcode } @libraries_not_direct_children; @@ -119,9 +119,9 @@ subtest 'Koha::Library::Group->get_search_groups' => sub { $groupA = Koha::Library::Groups->find( $groupA->id ); $groupB = Koha::Library::Groups->find( $groupB->id ); - my @groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' }); + my @groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list; is_deeply( $groups[0]->unblessed, $groupA->unblessed, 'Get search groups opac should return enabled group' ); - @groups = Koha::Library::Groups->get_search_groups({ interface => 'staff' }); + @groups = Koha::Library::Groups->get_search_groups({ interface => 'staff' })->as_list; is_deeply( $groups[0]->unblessed, $groupB->unblessed, 'Get search groups staff should return enabled group' ); }; diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t index 55a5db60b1b..13da09b3415 100755 --- a/t/db_dependent/Overdues.t +++ b/t/db_dependent/Overdues.t @@ -91,7 +91,7 @@ $dbh->do(q| ( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) |); -my @branchcodes = map { $_->branchcode } Koha::Libraries->search; +my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list; my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' ); diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t index 5fde05614d4..8c90f7e8a19 100755 --- a/t/db_dependent/Patrons.t +++ b/t/db_dependent/Patrons.t @@ -81,7 +81,7 @@ $b3_new->set({ firstname => 'Some first name for Test 3' })->store(); $b3_new = Koha::Patrons->find( $b3->borrowernumber() ); is( t::lib::Dates::compare( $b3_new->updated_on, $now), 0, "borrowers.updated_on should have been set to now on updating" ); -my @patrons = Koha::Patrons->search( { branchcode => $branchcode } ); +my @patrons = Koha::Patrons->search( { branchcode => $branchcode } )->as_list; is( @patrons, 3, "Found 3 patrons with Search" ); my $unexistent = Koha::Patrons->find( '1234567890' ); diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index a0e9df00164..f047f902e3c 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -272,7 +272,7 @@ is($holds->next->priority, 0, 'Item is correctly waiting'); is($holds->next->priority, 1, 'Item is correctly priority 1'); is($holds->next->priority, 2, 'Item is correctly priority 2'); -my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting(); +my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting->as_list; is( @reserves, 1, 'GetWaiting got only the waiting reserve' ); is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the reserve for the correct borrower' ); diff --git a/t/db_dependent/Upload.t b/t/db_dependent/Upload.t index 8c672ea1997..69506c0a5d7 100755 --- a/t/db_dependent/Upload.t +++ b/t/db_dependent/Upload.t @@ -217,7 +217,7 @@ subtest 'Test delete_missing' => sub { subtest 'Call search_term with[out] private flag' => sub { plan tests => 3; - my @recs = Koha::UploadedFiles->search_term({ term => 'file' }); + my @recs = Koha::UploadedFiles->search_term({ term => 'file' })->as_list; is( @recs, 1, 'Returns only one public result' ); is( $recs[0]->filename, 'file3', 'Should be file3' ); @@ -289,10 +289,10 @@ subtest 'Testing delete_temporary' => sub { my $today = dt_from_string; $today->subtract( minutes => 2 ); # should be enough :) my $dt = $today->clone->subtract( days => 1 ); - foreach my $rec ( Koha::UploadedFiles->search({ permanent => 1 }) ) { + foreach my $rec ( Koha::UploadedFiles->search({ permanent => 1 })->as_list ) { $rec->dtcreated($dt)->store; } - my @recs = Koha::UploadedFiles->search({ permanent => 0 }); + my @recs = Koha::UploadedFiles->search({ permanent => 0 })->as_list; $dt = $today->clone->subtract( days => 3 ); $recs[0]->dtcreated($dt)->store; $dt = $today->clone->subtract( days => 5 ); diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl index d5d02f00c92..00bbb87d8ea 100755 --- a/tools/additional-contents.pl +++ b/tools/additional-contents.pl @@ -69,7 +69,7 @@ if ( $op eq 'add_form' ) { location => $additional_content->location, branchcode => $additional_content->branchcode, } - ) + )->as_list }; $category = $additional_content->category; } diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index 11c412d4657..b09f7818186 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -54,7 +54,7 @@ if ( $op eq 'form' ) { # Display the form $template->param( op => 'form', - lists => scalar Koha::Virtualshelves->search( + lists => Koha::Virtualshelves->search( [ { public => 0, owner => $loggedinuser }, { public => 1 } diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index 1aa7df32b41..dab8910453d 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -82,7 +82,7 @@ if ( $op eq 'form' ) { # Display the form $template->param( view => 'form', - lists => scalar Koha::Virtualshelves->search( + lists => Koha::Virtualshelves->search( [ { public => 0, owner => $loggedinuser }, { public => 1 } diff --git a/tools/export.pl b/tools/export.pl index 7b9686197e0..4fe6ce5cc5a 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -301,7 +301,7 @@ else { itemtypes => $itemtypes, authority_types => $authority_types, export_remove_fields => C4::Context->preference("ExportRemoveFields"), - csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], + csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ], messages => \@messages, ); diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index 949f40261d0..d02d671d417 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -76,7 +76,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); # get the patron categories and pass them to the template -my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']}); +my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list; $template->param( categories => \@patron_categories ); my $columns = C4::Templates::GetColumnDefs( $input )->{borrowers}; $columns = [ grep { $_->{field} ne 'borrowernumber' ? $_ : () } @$columns ]; diff --git a/tools/inventory.pl b/tools/inventory.pl index 52b05997032..48de7e9c5c0 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -122,10 +122,10 @@ for my $authvfield (@$statuses) { # the full set. @notforloans = @{$staton->{'items.notforloan'}} if defined $staton->{'items.notforloan'} and scalar @{$staton->{'items.notforloan'}} > 0; -my @class_sources = Koha::ClassSources->search({ used => 1 }); +my @class_sources = Koha::ClassSources->search({ used => 1 })->as_list; my $pref_class = C4::Context->preference("DefaultClassificationSource"); -my @itemtypes = Koha::ItemTypes->search; +my @itemtypes = Koha::ItemTypes->search->as_list; my @selected_itemtypes; foreach my $itemtype ( @itemtypes ) { if ( defined $input->param('itemtype-' . $itemtype->itemtype) ) { diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index 4ff7dfe6dbb..769c9a4738c 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -130,7 +130,7 @@ if ( $op eq 'show' ) { my @patron_attributes_codes; my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); - my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']}); + my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list; while ( my $attr_type = $patron_attribute_types->next ) { # TODO Repeatable attributes are not correctly managed and can cause data lost. # This should be implemented. diff --git a/tools/overduerules.pl b/tools/overduerules.pl index 5cab5a802dd..1e5d920a076 100755 --- a/tools/overduerules.pl +++ b/tools/overduerules.pl @@ -32,7 +32,7 @@ use Koha::Patron::Categories; our $input = CGI->new; my $dbh = C4::Context->dbh; -my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } ); +my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } )->as_list; my @category_codes = map { $_->categorycode } @patron_categories; our @rule_params = qw(delay letter debarred); diff --git a/tools/viewlog.pl b/tools/viewlog.pl index 5909cb39edb..2d9b56ec780 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -139,7 +139,7 @@ if ($do_it) { $search_params{object} = $object if $object; } - my @logs = Koha::ActionLogs->search(\%search_params); + my @logs = Koha::ActionLogs->search(\%search_params)->as_list; my @data; foreach my $log (@logs) { diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl index 07b2682945f..e922e9b4e26 100755 --- a/virtualshelves/downloadshelf.pl +++ b/virtualshelves/downloadshelf.pl @@ -100,7 +100,7 @@ if ($shelfid && $format) { } } else { - $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ]); $template->param(shelfid => $shelfid); } $template->param( messages => \@messages ); diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index 2cc09766cb0..0ff8d9d332d 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -358,7 +358,7 @@ $template->param( messages => \@messages, public => $public, print => scalar $query->param('print') || 0, - csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], + csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ], ); output_html_with_http_headers $query, $cookie, $template->output; -- 2.25.1