View | Details | Raw Unified | Return to bug 29844
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2291-2297 sub GetHistory { Link Here
2291
        push @query_params, @$ordernumbers;
2291
        push @query_params, @$ordernumbers;
2292
    }
2292
    }
2293
    if ( @$additional_fields ) {
2293
    if ( @$additional_fields ) {
2294
        my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields($additional_fields);
2294
        my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields($additional_fields)->as_list;
2295
2295
2296
        return [] unless @baskets;
2296
        return [] unless @baskets;
2297
2297
(-)a/C4/Auth.pm (-4 / +4 lines)
Lines 540-546 sub get_template_and_user { Link Here
540
            EnableBorrowerFiles                                                        => C4::Context->preference('EnableBorrowerFiles'),
540
            EnableBorrowerFiles                                                        => C4::Context->preference('EnableBorrowerFiles'),
541
            UseCourseReserves                                                          => C4::Context->preference("UseCourseReserves"),
541
            UseCourseReserves                                                          => C4::Context->preference("UseCourseReserves"),
542
            useDischarge                                                               => C4::Context->preference('useDischarge'),
542
            useDischarge                                                               => C4::Context->preference('useDischarge'),
543
            pending_checkout_notes                                                     => scalar Koha::Checkouts->search({ noteseen => 0 }),
543
            pending_checkout_notes                                                     => Koha::Checkouts->search({ noteseen => 0 }),
544
        );
544
        );
545
    }
545
    }
546
    else {
546
    else {
Lines 582-588 sub get_template_and_user { Link Here
582
            $opac_name = C4::Context->userenv->{'branch'};
582
            $opac_name = C4::Context->userenv->{'branch'};
583
        }
583
        }
584
584
585
        my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' });
585
        my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list;
586
        $template->param(
586
        $template->param(
587
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
587
            AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
588
            LibrarySearchGroups                   => \@search_groups,
588
            LibrarySearchGroups                   => \@search_groups,
Lines 1156-1162 sub checkauth { Link Here
1156
                        $register_id   = $register->id   if ($register);
1156
                        $register_id   = $register->id   if ($register);
1157
                        $register_name = $register->name if ($register);
1157
                        $register_name = $register->name if ($register);
1158
                    }
1158
                    }
1159
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1159
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
1160
                    if ( $type ne 'opac' and C4::Context->preference('AutoLocation') ) {
1160
                    if ( $type ne 'opac' and C4::Context->preference('AutoLocation') ) {
1161
1161
1162
                        # we have to check they are coming from the right ip range
1162
                        # we have to check they are coming from the right ip range
Lines 1578-1584 sub check_api_auth { Link Here
1578
                    my $library = Koha::Libraries->find($branchcode);
1578
                    my $library = Koha::Libraries->find($branchcode);
1579
                    $branchname = $library? $library->branchname: '';
1579
                    $branchname = $library? $library->branchname: '';
1580
                }
1580
                }
1581
                my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1581
                my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
1582
                foreach my $br ( keys %$branches ) {
1582
                foreach my $br ( keys %$branches ) {
1583
1583
1584
                    #     now we work with the treatment of ip
1584
                    #     now we work with the treatment of ip
(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 837-843 sub CanBookBeIssued { Link Here
837
    my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees");
837
    my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees");
838
    $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
838
    $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
839
    if ( defined $no_issues_charge_guarantees ) {
839
    if ( defined $no_issues_charge_guarantees ) {
840
        my @guarantees = map { $_->guarantee } $patron->guarantee_relationships();
840
        my @guarantees = map { $_->guarantee } $patron->guarantee_relationships->as_list;
841
        my $guarantees_non_issues_charges = 0;
841
        my $guarantees_non_issues_charges = 0;
842
        foreach my $g ( @guarantees ) {
842
        foreach my $g ( @guarantees ) {
843
            $guarantees_non_issues_charges += $g->account->non_issues_charges;
843
            $guarantees_non_issues_charges += $g->account->non_issues_charges;
(-)a/C4/HoldsQueue.pm (-1 / +1 lines)
Lines 429-435 sub MapItemsToHoldRequests { Link Here
429
429
430
    map { $_->{_object} = Koha::Items->find( $_->{itemnumber} ) } @$available_items;
430
    map { $_->{_object} = Koha::Items->find( $_->{itemnumber} ) } @$available_items;
431
    my $libraries = {};
431
    my $libraries = {};
432
    map { $libraries->{$_->id} = $_ } Koha::Libraries->search();
432
    map { $libraries->{$_->id} = $_ } Koha::Libraries->search->as_list;
433
433
434
    # group available items by itemnumber
434
    # group available items by itemnumber
435
    my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items;
435
    my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items;
(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 548-554 sub GetPatronInfo { Link Here
548
                    value_description => $_->description, # Awkward retro-compability...
548
                    value_description => $_->description, # Awkward retro-compability...
549
                  }
549
                  }
550
                  : ()
550
                  : ()
551
            } $patron->extended_attributes->search
551
            } $patron->extended_attributes->search->as_list
552
        ];
552
        ];
553
    }
553
    }
554
554
(-)a/C4/ItemCirculationAlertPreference.pm (-2 / +2 lines)
Lines 331-338 sub grid { Link Here
331
    my ($class, $where) = @_;
331
    my ($class, $where) = @_;
332
    my @branch_prefs = $class->find($where);
332
    my @branch_prefs = $class->find($where);
333
    my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
333
    my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
334
    my @cc = Koha::Patron::Categories->search_with_library_limits;
334
    my @cc = Koha::Patron::Categories->search_with_library_limits->as_list;
335
    my @it = Koha::ItemTypes->search;
335
    my @it = Koha::ItemTypes->search->as_list;
336
    my $notification = $where->{notification};
336
    my $notification = $where->{notification};
337
    my %disabled = map {
337
    my %disabled = map {
338
        my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
338
        my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
(-)a/C4/Members.pm (-1 / +1 lines)
Lines 167-173 sub patronflags { Link Here
167
    $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
167
    $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
168
    if ( defined $no_issues_charge_guarantees ) {
168
    if ( defined $no_issues_charge_guarantees ) {
169
        my $p = Koha::Patrons->find( $patroninformation->{borrowernumber} );
169
        my $p = Koha::Patrons->find( $patroninformation->{borrowernumber} );
170
        my @guarantees = map { $_->guarantee } $p->guarantee_relationships;
170
        my @guarantees = map { $_->guarantee } $p->guarantee_relationships->as_list;
171
        my $guarantees_non_issues_charges = 0;
171
        my $guarantees_non_issues_charges = 0;
172
        foreach my $g ( @guarantees ) {
172
        foreach my $g ( @guarantees ) {
173
            $guarantees_non_issues_charges += $g->account->non_issues_charges;
173
            $guarantees_non_issues_charges += $g->account->non_issues_charges;
(-)a/C4/Overdues.pm (-1 / +1 lines)
Lines 652-658 sub GetBranchcodesWithOverdueRules { Link Here
652
    |);
652
    |);
653
    if ( $branchcodes->[0] eq '' ) {
653
    if ( $branchcodes->[0] eq '' ) {
654
        # If a default rule exists, all branches should be returned
654
        # If a default rule exists, all branches should be returned
655
        return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' });
655
        return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
656
    }
656
    }
657
    return @$branchcodes;
657
    return @$branchcodes;
658
}
658
}
(-)a/C4/Reserves.pm (-4 / +4 lines)
Lines 989-995 Unsuspends all suspended reserves with a suspend_until date from before today. Link Here
989
sub AutoUnsuspendReserves {
989
sub AutoUnsuspendReserves {
990
    my $today = dt_from_string();
990
    my $today = dt_from_string();
991
991
992
    my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } );
992
    my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } )->as_list;
993
993
994
    map { $_->resume() } @holds;
994
    map { $_->resume() } @holds;
995
}
995
}
Lines 1414-1420 AllowHoldsOnDamagedItems or 'holdallowed' own/sibling library) Link Here
1414
sub ItemsAnyAvailableAndNotRestricted {
1414
sub ItemsAnyAvailableAndNotRestricted {
1415
    my $param = shift;
1415
    my $param = shift;
1416
1416
1417
    my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } );
1417
    my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list;
1418
1418
1419
    foreach my $i (@items) {
1419
    foreach my $i (@items) {
1420
        my $reserves_control_branch =
1420
        my $reserves_control_branch =
Lines 1553-1559 sub SuspendAll { Link Here
1553
    $params->{borrowernumber} = $borrowernumber if $borrowernumber;
1553
    $params->{borrowernumber} = $borrowernumber if $borrowernumber;
1554
    $params->{biblionumber}   = $biblionumber if $biblionumber;
1554
    $params->{biblionumber}   = $biblionumber if $biblionumber;
1555
1555
1556
    my @holds = Koha::Holds->search($params);
1556
    my @holds = Koha::Holds->search($params)->as_list;
1557
1557
1558
    if ($suspend) {
1558
    if ($suspend) {
1559
        map { $_->suspend_hold($suspend_until) } @holds;
1559
        map { $_->suspend_hold($suspend_until) } @holds;
Lines 2287-2293 sub GetMaxPatronHoldsForRecord { Link Here
2287
    my ( $borrowernumber, $biblionumber ) = @_;
2287
    my ( $borrowernumber, $biblionumber ) = @_;
2288
2288
2289
    my $patron = Koha::Patrons->find($borrowernumber);
2289
    my $patron = Koha::Patrons->find($borrowernumber);
2290
    my @items = Koha::Items->search( { biblionumber => $biblionumber } );
2290
    my @items = Koha::Items->search( { biblionumber => $biblionumber } )->as_list;
2291
2291
2292
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
2292
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
2293
2293
(-)a/C4/SIP/ILS/Patron.pm (-1 / +1 lines)
Lines 565-571 sub build_patron_attributes_string { Link Here
565
                    borrowernumber => $self->{borrowernumber},
565
                    borrowernumber => $self->{borrowernumber},
566
                    code           => $a->{code}
566
                    code           => $a->{code}
567
                }
567
                }
568
            );
568
            )->as_list;
569
569
570
            foreach my $attribute ( @attributes ) {
570
            foreach my $attribute ( @attributes ) {
571
                my $value = $attribute->attribute();
571
                my $value = $attribute->attribute();
(-)a/C4/Search.pm (-2 / +2 lines)
Lines 307-313 sub getRecords { Link Here
307
    my $results_hashref = ();
307
    my $results_hashref = ();
308
308
309
    # TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter
309
    # TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter
310
    $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search };
310
    $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search->as_list };
311
311
312
    # Initialize variables for the faceted results objects
312
    # Initialize variables for the faceted results objects
313
    my $facets_counter = {};
313
    my $facets_counter = {};
Lines 1638-1644 sub searchResults { Link Here
1638
    });
1638
    });
1639
1639
1640
    #Build branchnames hash
1640
    #Build branchnames hash
1641
    my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
1641
    my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
1642
1642
1643
# FIXME - We build an authorised values hash here, using the default framework
1643
# FIXME - We build an authorised values hash here, using the default framework
1644
# though it is possible to have different authvals for different fws.
1644
# though it is possible to have different authvals for different fws.
(-)a/C4/Serials.pm (-1 / +1 lines)
Lines 528-534 sub SearchSubscriptions { Link Here
528
    my $additional_fields = $args->{additional_fields} // [];
528
    my $additional_fields = $args->{additional_fields} // [];
529
    my $matching_record_ids_for_additional_fields = [];
529
    my $matching_record_ids_for_additional_fields = [];
530
    if ( @$additional_fields ) {
530
    if ( @$additional_fields ) {
531
        my @subscriptions = Koha::Subscriptions->filter_by_additional_fields($additional_fields);
531
        my @subscriptions = Koha::Subscriptions->filter_by_additional_fields($additional_fields)->as_list;
532
532
533
        return () unless @subscriptions;
533
        return () unless @subscriptions;
534
534
(-)a/C4/XSLT.pm (-1 / +1 lines)
Lines 342-348 sub buildKohaItemsNamespace { Link Here
342
    my $ccodes =
342
    my $ccodes =
343
      { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) };
343
      { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) };
344
344
345
    my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
345
    my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
346
346
347
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
347
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
348
    my $xml = '';
348
    my $xml = '';
(-)a/Koha/AudioAlerts.pm (-3 / +3 lines)
Lines 91-104 sub move { Link Here
91
91
92
    if ( $where eq 'up' ) {
92
    if ( $where eq 'up' ) {
93
        unless ( $alert->precedence() == 1 ) {
93
        unless ( $alert->precedence() == 1 ) {
94
            my ($other) = $self->search( { precedence => $alert->precedence() - 1 } );
94
            my ($other) = $self->search( { precedence => $alert->precedence() - 1 } )->as_list;
95
            $other->precedence( $alert->precedence() )->store();
95
            $other->precedence( $alert->precedence() )->store();
96
            $alert->precedence( $alert->precedence() - 1 )->store();
96
            $alert->precedence( $alert->precedence() - 1 )->store();
97
        }
97
        }
98
    }
98
    }
99
    elsif ( $where eq 'down' ) {
99
    elsif ( $where eq 'down' ) {
100
        unless ( $alert->precedence() == $self->get_last_precedence() ) {
100
        unless ( $alert->precedence() == $self->get_last_precedence() ) {
101
            my ($other) = $self->search( { precedence => $alert->precedence() + 1 } );
101
            my ($other) = $self->search( { precedence => $alert->precedence() + 1 } )->as_list;
102
            $other->precedence( $alert->precedence() )->store();
102
            $other->precedence( $alert->precedence() )->store();
103
            $alert->precedence( $alert->precedence() + 1 )->store();
103
            $alert->precedence( $alert->precedence() + 1 )->store();
104
        }
104
        }
Lines 125-131 and to have no gaps Link Here
125
sub fix_precedences {
125
sub fix_precedences {
126
    my ($self) = @_;
126
    my ($self) = @_;
127
127
128
    my @alerts = $self->search();
128
    my @alerts = $self->search->as_list;
129
129
130
    my $i = 1;
130
    my $i = 1;
131
    map { $_->precedence( $i++ )->store() } @alerts;
131
    map { $_->precedence( $i++ )->store() } @alerts;
(-)a/Koha/AuthorisedValues.pm (-1 / +1 lines)
Lines 126-132 sub get_descriptions_by_koha_field { Link Here
126
    my $cached       = $memory_cache->get_from_cache($cache_key);
126
    my $cached       = $memory_cache->get_from_cache($cache_key);
127
    return @$cached if $cached;
127
    return @$cached if $cached;
128
128
129
    my @avs          = $self->search_by_koha_field($params);
129
    my @avs          = $self->search_by_koha_field($params)->as_list;
130
    my @descriptions = map {
130
    my @descriptions = map {
131
        {
131
        {
132
            authorised_value => $_->authorised_value,
132
            authorised_value => $_->authorised_value,
(-)a/Koha/BackgroundJob/BatchUpdateBiblio.pm (-1 / +1 lines)
Lines 155-161 sub additional_report { Link Here
155
155
156
    my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
156
    my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
157
    return {
157
    return {
158
        lists => scalar Koha::Virtualshelves->search(
158
        lists => Koha::Virtualshelves->search(
159
            [
159
            [
160
                { public => 0, owner => $loggedinuser },
160
                { public => 0, owner => $loggedinuser },
161
                { public => 1 }
161
                { public => 1 }
(-)a/Koha/Club.pm (-1 / +1 lines)
Lines 71-77 sub club_enrollments { Link Here
71
71
72
    return unless $self->id();
72
    return unless $self->id();
73
73
74
    return scalar Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } );
74
    return Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } );
75
}
75
}
76
76
77
=head3 club_fields
77
=head3 club_fields
(-)a/Koha/Clubs.pm (-1 / +1 lines)
Lines 50-56 sub get_enrollable { Link Here
50
    my $borrower = $params->{borrower};
50
    my $borrower = $params->{borrower};
51
    if ($borrower) {
51
    if ($borrower) {
52
        delete( $params->{borrower} );
52
        delete( $params->{borrower} );
53
        my @enrollments = $borrower->get_club_enrollments();
53
        my @enrollments = $borrower->get_club_enrollments->as_list;
54
        if (@enrollments) {
54
        if (@enrollments) {
55
            $params->{'me.id'} = { -not_in => [ map { $_->club()->id() } @enrollments ] };
55
            $params->{'me.id'} = { -not_in => [ map { $_->club()->id() } @enrollments ] };
56
        }
56
        }
(-)a/Koha/Library/Group.pm (-3 / +3 lines)
Lines 96-102 sub library { Link Here
96
96
97
=head3 libraries
97
=head3 libraries
98
98
99
my @libraries = $group->libraries( { [invert => 1] } );
99
my $libraries = $group->libraries( { [invert => 1] } );
100
100
101
Returns the libraries set as direct children of this group.
101
Returns the libraries set as direct children of this group.
102
102
Lines 117-123 sub libraries { Link Here
117
            branchcode => { '!=' => undef },
117
            branchcode => { '!=' => undef },
118
        },
118
        },
119
        { order_by => 'branchcode' }
119
        { order_by => 'branchcode' }
120
    );
120
    )->as_list;
121
121
122
    my @branchcodes = map { $_->branchcode } @children;
122
    my @branchcodes = map { $_->branchcode } @children;
123
123
Lines 159-165 sub all_libraries { Link Here
159
159
160
=head3 libraries_not_direct_children
160
=head3 libraries_not_direct_children
161
161
162
my @libraries = $group->libraries_not_direct_children();
162
my $libraries = $group->libraries_not_direct_children();
163
163
164
Returns the libraries *not* set as direct children of this group
164
Returns the libraries *not* set as direct children of this group
165
165
(-)a/Koha/Library/Groups.pm (-1 / +1 lines)
Lines 48-54 sub get_root_groups { Link Here
48
48
49
=head3 get_search_groups
49
=head3 get_search_groups
50
50
51
my @search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']}))
51
my $search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']}))
52
52
53
Returns search groups for the specified interface.
53
Returns search groups for the specified interface.
54
Defaults to OPAC if no interface is specified.
54
Defaults to OPAC if no interface is specified.
(-)a/Koha/Objects/Mixin/AdditionalFields.pm (-1 / +1 lines)
Lines 28-34 Koha::Objects::Mixin::AdditionalFields Link Here
28
28
29
=head3 filter_by_additional_fields
29
=head3 filter_by_additional_fields
30
30
31
    my @objects = Koha::Foos->filter_by_additional_fields([
31
    my $objects = Koha::Foos->filter_by_additional_fields([
32
        {
32
        {
33
            id => 1,
33
            id => 1,
34
            value => 'foo',
34
            value => 'foo',
(-)a/Koha/Patron.pm (-4 / +4 lines)
Lines 395-405 sub delete { Link Here
395
            # This pref should then govern the results of other routines/methods such as
395
            # This pref should then govern the results of other routines/methods such as
396
            # Koha::Virtualshelf->new->delete too.
396
            # Koha::Virtualshelf->new->delete too.
397
            # FIXME Could be $patron->get_lists
397
            # FIXME Could be $patron->get_lists
398
            $_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } );
398
            $_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } )->as_list;
399
399
400
            # We cannot have a FK on borrower_modifications.borrowernumber, the table is also used
400
            # We cannot have a FK on borrower_modifications.borrowernumber, the table is also used
401
            # for patron selfreg
401
            # for patron selfreg
402
            $_->delete for Koha::Patron::Modifications->search( { borrowernumber => $self->borrowernumber } );
402
            $_->delete for Koha::Patron::Modifications->search( { borrowernumber => $self->borrowernumber } )->as_list;
403
403
404
            $self->SUPER::delete;
404
            $self->SUPER::delete;
405
405
Lines 1207-1213 sub get_overdues { Link Here
1207
1207
1208
=head3 get_routing_lists
1208
=head3 get_routing_lists
1209
1209
1210
my @routinglists = $patron->get_routing_lists
1210
my $routinglists = $patron->get_routing_lists
1211
1211
1212
Returns the routing lists a patron is subscribed to.
1212
Returns the routing lists a patron is subscribed to.
1213
1213
Lines 1779-1785 sub _anonymize_column { Link Here
1779
1779
1780
=head3 add_guarantor
1780
=head3 add_guarantor
1781
1781
1782
    my @relationships = $patron->add_guarantor(
1782
    my $relationship = $patron->add_guarantor(
1783
        {
1783
        {
1784
            borrowernumber => $borrowernumber,
1784
            borrowernumber => $borrowernumber,
1785
            relationships  => $relationship,
1785
            relationships  => $relationship,
(-)a/Koha/Patron/Modification.pm (-1 / +1 lines)
Lines 127-133 sub approve { Link Here
127
                        {   borrowernumber => $patron->borrowernumber,
127
                        {   borrowernumber => $patron->borrowernumber,
128
                            code           => $code
128
                            code           => $code
129
                        }
129
                        }
130
                    );
130
                    )->as_list;
131
                }
131
                }
132
                foreach my $attr ( @{$extended_attributes} ) {
132
                foreach my $attr ( @{$extended_attributes} ) {
133
                    $attr->{attribute} = exists $attr->{attribute} ? $attr->{attribute} : $attr->{value};
133
                    $attr->{attribute} = exists $attr->{attribute} ? $attr->{attribute} : $attr->{value};
(-)a/Koha/REST/V1/Biblios.pm (-2 / +2 lines)
Lines 292-299 sub get_checkouts { Link Here
292
292
293
        my $checkouts =
293
        my $checkouts =
294
          ($checked_in)
294
          ($checked_in)
295
          ? $c->objects->search( scalar $biblio->old_checkouts )
295
          ? $c->objects->search( $biblio->old_checkouts )
296
          : $c->objects->search( scalar $biblio->current_checkouts );
296
          : $c->objects->search( $biblio->current_checkouts );
297
297
298
        return $c->render(
298
        return $c->render(
299
            status  => 200,
299
            status  => 200,
(-)a/Koha/REST/V1/Patrons.pm (-1 / +1 lines)
Lines 75-81 sub get { Link Here
75
75
76
    return try {
76
    return try {
77
        my $patron_id = $c->validation->param('patron_id');
77
        my $patron_id = $c->validation->param('patron_id');
78
        my $patron    = $c->objects->find( scalar Koha::Patrons->search_limited, $patron_id );
78
        my $patron    = $c->objects->find( Koha::Patrons->search_limited, $patron_id );
79
79
80
        unless ($patron) {
80
        unless ($patron) {
81
            return $c->render(
81
            return $c->render(
(-)a/Koha/SearchEngine/Elasticsearch.pm (-2 / +2 lines)
Lines 1354-1363 sub get_facetable_fields { Link Here
1354
    my @search_field_names = qw( author itype location su-geo title-series subject ccode holdingbranch homebranch ln );
1354
    my @search_field_names = qw( author itype location su-geo title-series subject ccode holdingbranch homebranch ln );
1355
    my @faceted_fields = Koha::SearchFields->search(
1355
    my @faceted_fields = Koha::SearchFields->search(
1356
        { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
1356
        { name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
1357
    );
1357
    )->as_list;
1358
    my @not_faceted_fields = Koha::SearchFields->search(
1358
    my @not_faceted_fields = Koha::SearchFields->search(
1359
        { name => { -in => \@search_field_names }, facet_order => undef }, { order_by => ['facet_order'] }
1359
        { name => { -in => \@search_field_names }, facet_order => undef }, { order_by => ['facet_order'] }
1360
    );
1360
    )->as_list;
1361
    # This could certainly be improved
1361
    # This could certainly be improved
1362
    return ( @faceted_fields, @not_faceted_fields );
1362
    return ( @faceted_fields, @not_faceted_fields );
1363
}
1363
}
(-)a/Koha/Template/Plugin/Branches.pm (-1 / +1 lines)
Lines 132-138 sub pickup_locations { Link Here
132
              if defined $biblio;
132
              if defined $biblio;
133
        }
133
        }
134
    } else {
134
    } else {
135
        @libraries = Koha::Libraries->search( { pickup_location => 1 }, { order_by => ['branchname'] } )
135
        @libraries = Koha::Libraries->search( { pickup_location => 1 }, { order_by => ['branchname'] } )->as_list
136
          unless @libraries;
136
          unless @libraries;
137
    }
137
    }
138
138
(-)a/Koha/Template/Plugin/Desks.pm (-1 / +1 lines)
Lines 80-86 sub ListForLibrary { Link Here
80
    my ($self) = @_;
80
    my ($self) = @_;
81
    my $branch_limit =
81
    my $branch_limit =
82
      C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
82
      C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
83
    return scalar Koha::Desks->search(
83
    return Koha::Desks->search(
84
        { branchcode => $branch_limit },
84
        { branchcode => $branch_limit },
85
        { order_by   => { '-asc' => 'desk_name' } }
85
        { order_by   => { '-asc' => 'desk_name' } }
86
    );
86
    );
(-)a/Koha/Uploader.pm (-2 / +2 lines)
Lines 36-43 Koha::Uploader - Facilitate file uploads (temporary and permanent) Link Here
36
    # Do something with $upload->count, $upload->result or $upload->err
36
    # Do something with $upload->count, $upload->result or $upload->err
37
37
38
    # get some upload records (in staff) via Koha::UploadedFiles
38
    # get some upload records (in staff) via Koha::UploadedFiles
39
    my @uploads1 = Koha::UploadedFiles->search({ filename => $name });
39
    my $uploads1 = Koha::UploadedFiles->search({ filename => $name });
40
    my @uploads2 = Koha::UploadedFiles->search_term({ term => $term });
40
    my $uploads2 = Koha::UploadedFiles->search_term({ term => $term });
41
41
42
    # staff download (via Koha::UploadedFile[s])
42
    # staff download (via Koha::UploadedFile[s])
43
    my $rec = Koha::UploadedFiles->find( $id );
43
    my $rec = Koha::UploadedFiles->find( $id );
(-)a/acqui/addorderiso2709.pl (-2 / +2 lines)
Lines 97-103 if ($op eq ""){ Link Here
97
} elsif ($op eq "batch_details"){
97
} elsif ($op eq "batch_details"){
98
#display lines inside the selected batch
98
#display lines inside the selected batch
99
    # get currencies (for change rates calcs if needed)
99
    # get currencies (for change rates calcs if needed)
100
    my @currencies = Koha::Acquisition::Currencies->search;
100
    my @currencies = Koha::Acquisition::Currencies->search->as_list;
101
101
102
    $template->param("batch_details" => 1,
102
    $template->param("batch_details" => 1,
103
                     "basketno"      => $cgiparams->{'basketno'},
103
                     "basketno"      => $cgiparams->{'basketno'},
Lines 611-617 sub import_biblios_list { Link Here
611
    my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
611
    my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
612
    my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
612
    my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
613
    my $item_action = GetImportBatchItemAction($import_batch_id);
613
    my $item_action = GetImportBatchItemAction($import_batch_id);
614
    my @itypes = Koha::ItemTypes->search;
614
    my @itypes = Koha::ItemTypes->search->as_list;
615
    $template->param(biblio_list => \@list,
615
    $template->param(biblio_list => \@list,
616
                        num_results => $num_records,
616
                        num_results => $num_records,
617
                        import_batch_id => $import_batch_id,
617
                        import_batch_id => $import_batch_id,
(-)a/acqui/basket.pl (-2 / +2 lines)
Lines 424-431 if ( $op eq 'list' ) { Link Here
424
        unclosable           => @orders || @cancelledorders ? $basket->{is_standing} : 1,
424
        unclosable           => @orders || @cancelledorders ? $basket->{is_standing} : 1,
425
        has_budgets          => $has_budgets,
425
        has_budgets          => $has_budgets,
426
        duplinbatch          => $duplinbatch,
426
        duplinbatch          => $duplinbatch,
427
        csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }) ],
427
        csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' })->as_list ],
428
        available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ],
428
        available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ],
429
        additional_field_values => { map {
429
        additional_field_values => { map {
430
            $_->field->name => $_->value
430
            $_->field->name => $_->value
431
        } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
431
        } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
(-)a/acqui/basketheader.pl (-2 / +2 lines)
Lines 74-80 my $basket; Link Here
74
my $op = $input->param('op');
74
my $op = $input->param('op');
75
my $is_an_edit = $input->param('is_an_edit');
75
my $is_an_edit = $input->param('is_an_edit');
76
76
77
$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ] );
77
$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ] );
78
78
79
if ( $op eq 'add_form' ) {
79
if ( $op eq 'add_form' ) {
80
    my @contractloop;
80
    my @contractloop;
Lines 118-124 if ( $op eq 'add_form' ) { Link Here
118
    }
118
    }
119
    my @booksellers = Koha::Acquisition::Booksellers->search(
119
    my @booksellers = Koha::Acquisition::Booksellers->search(
120
                        undef,
120
                        undef,
121
                        { order_by => { -asc => 'name' } } );
121
                        { order_by => { -asc => 'name' } } )->as_list;
122
122
123
    $template->param( add_form => 1,
123
    $template->param( add_form => 1,
124
                    basketname => $basket->{'basketname'},
124
                    basketname => $basket->{'basketname'},
(-)a/acqui/booksellers.pl (-1 / +1 lines)
Lines 83-89 if ($booksellerid) { Link Here
83
} else {
83
} else {
84
    @suppliers = Koha::Acquisition::Booksellers->search(
84
    @suppliers = Koha::Acquisition::Booksellers->search(
85
                        { name => { -like => "%$supplier%" } },
85
                        { name => { -like => "%$supplier%" } },
86
                        { order_by => { -asc => 'name' } } );
86
                        { order_by => { -asc => 'name' } } )->as_list;
87
}
87
}
88
88
89
my $supplier_count = @suppliers;
89
my $supplier_count = @suppliers;
(-)a/acqui/duplicate_orders.pl (-1 / +1 lines)
Lines 117-123 elsif ( $op eq 'batch_edit' ) { Link Here
117
    @{$budget_loop} =
117
    @{$budget_loop} =
118
      sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
118
      sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
119
119
120
    my @currencies = Koha::Acquisition::Currencies->search;
120
    my @currencies = Koha::Acquisition::Currencies->search->as_list;
121
    $template->param(
121
    $template->param(
122
        currencies  => \@currencies,
122
        currencies  => \@currencies,
123
        budget_loop => $budget_loop,
123
        budget_loop => $budget_loop,
(-)a/acqui/histsearch.pl (-1 / +1 lines)
Lines 99-105 unless ( $input->param('from') ) { Link Here
99
}
99
}
100
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
100
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
101
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
101
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
102
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
102
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } )->as_list;
103
$template->param( available_additional_fields => \@additional_fields );
103
$template->param( available_additional_fields => \@additional_fields );
104
my @additional_field_filters;
104
my @additional_field_filters;
105
foreach my $additional_field (@additional_fields) {
105
foreach my $additional_field (@additional_fields) {
(-)a/acqui/invoices.pl (-1 / +1 lines)
Lines 87-93 if ( $op and $op eq 'do_search' ) { Link Here
87
}
87
}
88
88
89
# Build suppliers list
89
# Build suppliers list
90
my @suppliers      = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } );
90
my @suppliers      = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } )->as_list;
91
my $suppliers_loop = [];
91
my $suppliers_loop = [];
92
my $suppliername;
92
my $suppliername;
93
foreach (@suppliers) {
93
foreach (@suppliers) {
(-)a/acqui/lateorders.pl (-1 / +1 lines)
Lines 157-162 $template->param( Link Here
157
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
157
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
158
    estimateddeliverydateto   => $estimateddeliverydateto,
158
    estimateddeliverydateto   => $estimateddeliverydateto,
159
	intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
159
	intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
160
    csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' }) ],
160
    csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' })->as_list ],
161
);
161
);
162
output_html_with_http_headers $input, $cookie, $template->output;
162
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/neworderempty.pl (-2 / +2 lines)
Lines 326-332 $template->param( catalog_details => \@catalog_details, ); Link Here
326
my $suggestion;
326
my $suggestion;
327
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
327
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
328
328
329
my @currencies = Koha::Acquisition::Currencies->search;
329
my @currencies = Koha::Acquisition::Currencies->search->as_list;
330
my $active_currency = Koha::Acquisition::Currencies->get_active;
330
my $active_currency = Koha::Acquisition::Currencies->get_active;
331
331
332
# build bookfund list
332
# build bookfund list
Lines 367-373 if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) { Link Here
367
367
368
# 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
368
# 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
369
my @itemtypes;
369
my @itemtypes;
370
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
370
@itemtypes = Koha::ItemTypes->search->as_list unless C4::Context->preference('item-level_itypes');
371
371
372
if ( defined $from_subscriptionid ) {
372
if ( defined $from_subscriptionid ) {
373
    # Get the last received order for this subscription
373
    # Get the last received order for this subscription
(-)a/acqui/orderreceive.pl (-1 / +1 lines)
Lines 152-158 $template->param( Link Here
152
    freight               => $freight,
152
    freight               => $freight,
153
    name                  => $bookseller->name,
153
    name                  => $bookseller->name,
154
    active_currency       => $active_currency,
154
    active_currency       => $active_currency,
155
    currencies            => scalar $currencies->search({ rate => { '!=' => 1 } }),
155
    currencies            => $currencies->search({ rate => { '!=' => 1 } }),
156
    invoiceincgst         => $bookseller->invoiceincgst,
156
    invoiceincgst         => $bookseller->invoiceincgst,
157
    bookfund              => $budget->{budget_name},
157
    bookfund              => $budget->{budget_name},
158
    creator               => $creator,
158
    creator               => $creator,
(-)a/acqui/supplier.pl (-1 / +1 lines)
Lines 96-102 if ( $op eq 'display' ) { Link Here
96
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
96
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
97
    exit;
97
    exit;
98
} else {
98
} else {
99
    my @currencies = Koha::Acquisition::Currencies->search;
99
    my @currencies = Koha::Acquisition::Currencies->search->as_list;
100
100
101
    # get option values from TaxRates syspref
101
    # get option values from TaxRates syspref
102
    my @gst_values = map {
102
    my @gst_values = map {
(-)a/acqui/transferorder.pl (-1 / +1 lines)
Lines 119-125 if( $basketno && $ordernumber) { Link Here
119
    if( $op eq "do_search" ) {
119
    if( $op eq "do_search" ) {
120
        my @booksellers = Koha::Acquisition::Booksellers->search(
120
        my @booksellers = Koha::Acquisition::Booksellers->search(
121
                            { name     => { -like => "%$query%" } },
121
                            { name     => { -like => "%$query%" } },
122
                            { order_by => { -asc => 'name' } } );
122
                            { order_by => { -asc => 'name' } } )->as_list;
123
        $template->param(
123
        $template->param(
124
            query => $query,
124
            query => $query,
125
            do_search => 1,
125
            do_search => 1,
(-)a/admin/audio_alerts.pl (-1 / +1 lines)
Lines 61-66 if (@delete) { Link Here
61
    Koha::AudioAlerts->fix_precedences();
61
    Koha::AudioAlerts->fix_precedences();
62
}
62
}
63
63
64
$template->param( AudioAlertsPage => 1, audio_alerts => scalar Koha::AudioAlerts->search() );
64
$template->param( AudioAlertsPage => 1, audio_alerts => Koha::AudioAlerts->search() );
65
65
66
output_html_with_http_headers $cgi, $cookie, $template->output;
66
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/admin/auth_subfields_structure.pl (-1 / +1 lines)
Lines 78-84 if ($op eq 'add_form') { Link Here
78
        push @authorised_value_categories, 'itemtypes';
78
        push @authorised_value_categories, 'itemtypes';
79
79
80
        # build thesaurus categories list
80
        # build thesaurus categories list
81
        my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
81
        my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );
82
82
83
	# build value_builder list
83
	# build value_builder list
84
	my @value_builder=('');
84
	my @value_builder=('');
(-)a/admin/authorised_values.pl (-2 / +2 lines)
Lines 212-218 $template->param( Link Here
212
212
213
if ( $op eq 'list' ) {
213
if ( $op eq 'list' ) {
214
    # build categories list
214
    # build categories list
215
    my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } );
215
    my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } )->as_list;
216
    my @category_list;
216
    my @category_list;
217
    for my $category ( @categories ) {
217
    for my $category ( @categories ) {
218
        push( @category_list, $category->category_name );
218
        push( @category_list, $category->category_name );
Lines 220-226 if ( $op eq 'list' ) { Link Here
220
220
221
    $searchfield ||= $category_list[0];
221
    $searchfield ||= $category_list[0];
222
222
223
    my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } );
223
    my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list;
224
    my @loop_data = ();
224
    my @loop_data = ();
225
    # builds value list
225
    # builds value list
226
    for my $av ( @avs_by_category ) {
226
    for my $av ( @avs_by_category ) {
(-)a/admin/branches.pl (-1 / +1 lines)
Lines 55-61 if ( $op eq 'add_form' ) { Link Here
55
        $template->param( selected_smtp_server => $library->smtp_server );
55
        $template->param( selected_smtp_server => $library->smtp_server );
56
    }
56
    }
57
57
58
    my @smtp_servers = Koha::SMTP::Servers->search;
58
    my @smtp_servers = Koha::SMTP::Servers->search->as_list;
59
59
60
    $template->param(
60
    $template->param(
61
        library      => $library,
61
        library      => $library,
(-)a/admin/classsources.pl (-2 / +2 lines)
Lines 60-67 if ( $op eq "add_source" ) { Link Here
60
      $cn_source ? Koha::ClassSources->find($cn_source) : undef;
60
      $cn_source ? Koha::ClassSources->find($cn_source) : undef;
61
    $template->param(
61
    $template->param(
62
        class_source => $class_source,
62
        class_source => $class_source,
63
        sort_rules   => scalar Koha::ClassSortRules->search,
63
        sort_rules   => Koha::ClassSortRules->search,
64
        split_rules  => scalar Koha::ClassSplitRules->search,
64
        split_rules  => Koha::ClassSplitRules->search,
65
    );
65
    );
66
}
66
}
67
elsif ( $op eq "add_source_validate" ) {
67
elsif ( $op eq "add_source_validate" ) {
(-)a/admin/item_circulation_alerts.pl (-2 / +2 lines)
Lines 47-54 sub show { Link Here
47
    );
47
    );
48
48
49
    my $branch   = $input->param('branch') || '*';
49
    my $branch   = $input->param('branch') || '*';
50
    my @categories = Koha::Patron::Categories->search_with_library_limits;
50
    my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
51
    my @item_types = Koha::ItemTypes->search;
51
    my @item_types = Koha::ItemTypes->search->as_list;
52
    my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
52
    my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
53
    my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
53
    my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
54
54
(-)a/admin/koha2marclinks.pl (-1 / +1 lines)
Lines 91-97 my @loop_data; Link Here
91
foreach my $col ( @cols ) {
91
foreach my $col ( @cols ) {
92
    my $found;
92
    my $found;
93
    my $readonly = $col =~ /\.(biblio|biblioitem|item)number$/;
93
    my $readonly = $col =~ /\.(biblio|biblioitem|item)number$/;
94
    foreach my $row ( $kohafields->search({ kohafield => $col }) ) {
94
    foreach my $row ( $kohafields->search({ kohafield => $col })->as_list ) {
95
        $found = 1;
95
        $found = 1;
96
        push @loop_data, {
96
        push @loop_data, {
97
            kohafield    => $col,
97
            kohafield    => $col,
(-)a/admin/marc_subfields_structure.pl (-2 / +2 lines)
Lines 97-107 if ( $op eq 'add_form' ) { Link Here
97
    $sth2->finish;
97
    $sth2->finish;
98
    $sth2 = $dbh->prepare("select distinct category from authorised_values");
98
    $sth2 = $dbh->prepare("select distinct category from authorised_values");
99
    $sth2->execute;
99
    $sth2->execute;
100
    my @av_cat = Koha::AuthorisedValueCategories->search;
100
    my @av_cat = Koha::AuthorisedValueCategories->search->as_list;
101
    my @authorised_values = map { $_->category_name } @av_cat;
101
    my @authorised_values = map { $_->category_name } @av_cat;
102
102
103
    # build thesaurus categories list
103
    # build thesaurus categories list
104
    my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
104
    my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );
105
105
106
    # build value_builder list
106
    # build value_builder list
107
    my @value_builder = ('');
107
    my @value_builder = ('');
(-)a/admin/overdrive.pl (-1 / +1 lines)
Lines 55-61 if ( $op && $op eq 'update' ) { Link Here
55
    }
55
    }
56
}
56
}
57
57
58
my @branches = Koha::Libraries->search();
58
my @branches = Koha::Libraries->search->as_list;
59
my @branch_od_info;
59
my @branch_od_info;
60
foreach my $branch ( @branches ){
60
foreach my $branch ( @branches ){
61
    my $od_info =  Koha::Library::OverDriveInfos->find($branch->branchcode);
61
    my $od_info =  Koha::Library::OverDriveInfos->find($branch->branchcode);
(-)a/admin/preferences.pl (-1 / +1 lines)
Lines 99-105 sub _get_chunk { Link Here
99
            } elsif ( $options{'choices'} eq 'staff-templates' ) {
99
            } elsif ( $options{'choices'} eq 'staff-templates' ) {
100
                $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) }
100
                $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) }
101
            } elsif ( $options{choices} eq 'patron-categories' ) {
101
            } elsif ( $options{choices} eq 'patron-categories' ) {
102
                $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search };
102
                $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search->as_list };
103
                $add_blank = 1;
103
                $add_blank = 1;
104
            } else {
104
            } else {
105
                die 'Unrecognized source of preference values: ' . $options{'choices'};
105
                die 'Unrecognized source of preference values: ' . $options{'choices'};
(-)a/admin/sms_providers.pl (-1 / +1 lines)
Lines 62-68 elsif ( $op eq 'delete' ) { Link Here
62
    $provider->delete() if $provider;
62
    $provider->delete() if $provider;
63
}
63
}
64
64
65
my @providers = Koha::SMS::Providers->search();
65
my @providers = Koha::SMS::Providers->search->as_list;
66
66
67
$template->param( providers => \@providers );
67
$template->param( providers => \@providers );
68
68
(-)a/admin/transport-cost-matrix.pl (-1 / +1 lines)
Lines 45-51 unless ($update) { Link Here
45
    $have_matrix = keys %$cost_matrix if $cost_matrix;
45
    $have_matrix = keys %$cost_matrix if $cost_matrix;
46
}
46
}
47
47
48
my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' });
48
my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
49
my (@branchfromloop, @errors);
49
my (@branchfromloop, @errors);
50
foreach my $branchfrom ( @branchloop ) {
50
foreach my $branchfrom ( @branchloop ) {
51
    my $fromcode = $branchfrom->{code};
51
    my $fromcode = $branchfrom->{code};
(-)a/basket/basket.pl (-1 / +1 lines)
Lines 126-132 my $resultsarray = \@results; Link Here
126
126
127
$template->param(
127
$template->param(
128
    BIBLIO_RESULTS => $resultsarray,
128
    BIBLIO_RESULTS => $resultsarray,
129
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
129
    csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }),
130
    bib_list => $bib_list,
130
    bib_list => $bib_list,
131
);
131
);
132
132
(-)a/basket/downloadcart.pl (-1 / +1 lines)
Lines 92-98 if ($bib_list && $format) { Link Here
92
    print $output;
92
    print $output;
93
93
94
} else { 
94
} else { 
95
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
95
    $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }));
96
    $template->param(bib_list => $bib_list); 
96
    $template->param(bib_list => $bib_list); 
97
    output_html_with_http_headers $query, $cookie, $template->output;
97
    output_html_with_http_headers $query, $cookie, $template->output;
98
}
98
}
(-)a/catalogue/issuehistory.pl (-2 / +2 lines)
Lines 47-60 my @checkouts = Koha::Checkouts->search( Link Here
47
        join       => 'item',
47
        join       => 'item',
48
        order_by   => 'timestamp',
48
        order_by   => 'timestamp',
49
    }
49
    }
50
);
50
)->as_list;
51
my @old_checkouts = Koha::Old::Checkouts->search(
51
my @old_checkouts = Koha::Old::Checkouts->search(
52
    { biblionumber => $biblionumber },
52
    { biblionumber => $biblionumber },
53
    {
53
    {
54
        join       => 'item',
54
        join       => 'item',
55
        order_by   => 'timestamp',
55
        order_by   => 'timestamp',
56
    }
56
    }
57
);
57
)->as_list;
58
58
59
my $biblio = Koha::Biblios->find( $biblionumber );
59
my $biblio = Koha::Biblios->find( $biblionumber );
60
60
(-)a/catalogue/item-export.pl (-1 / +1 lines)
Lines 36-42 my ($template, $borrowernumber, $cookie) = get_template_and_user({ Link Here
36
my @itemnumbers = $cgi->multi_param('itemnumber');
36
my @itemnumbers = $cgi->multi_param('itemnumber');
37
my $format = $cgi->param('format') // 'csv';
37
my $format = $cgi->param('format') // 'csv';
38
38
39
my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } });
39
my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } })->as_list;
40
40
41
if ($format eq 'barcodes') {
41
if ($format eq 'barcodes') {
42
    print $cgi->header({
42
    print $cgi->header({
(-)a/catalogue/itemsearch.pl (-2 / +2 lines)
Lines 259-267 if ( defined $format ) { Link Here
259
259
260
# Display the search form
260
# Display the search form
261
261
262
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } );
262
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
263
my @itemtypes;
263
my @itemtypes;
264
foreach my $itemtype ( Koha::ItemTypes->search_with_localization ) {
264
foreach my $itemtype ( Koha::ItemTypes->search_with_localization->as_list ) {
265
    push @itemtypes, {
265
    push @itemtypes, {
266
        value => $itemtype->itemtype,
266
        value => $itemtype->itemtype,
267
        label => $itemtype->translated_description,
267
        label => $itemtype->translated_description,
(-)a/catalogue/search.pl (-1 / +1 lines)
Lines 231-237 if($cgi->cookie("intranet_bib_list")){ Link Here
231
}
231
}
232
232
233
my @search_groups =
233
my @search_groups =
234
  Koha::Library::Groups->get_search_groups( { interface => 'staff' } );
234
  Koha::Library::Groups->get_search_groups( { interface => 'staff' } )->as_list;
235
@search_groups = sort { $a->title cmp $b->title } @search_groups;
235
@search_groups = sort { $a->title cmp $b->title } @search_groups;
236
236
237
$template->param(
237
$template->param(
(-)a/cataloguing/editor.pl (-1 / +1 lines)
Lines 49-55 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
49
49
50
my $schema = Koha::Database->new->schema;
50
my $schema = Koha::Database->new->schema;
51
51
52
my @keyboard_shortcuts = Koha::KeyboardShortcuts->search();
52
my @keyboard_shortcuts = Koha::KeyboardShortcuts->search->as_list;
53
53
54
# Keyboard shortcuts
54
# Keyboard shortcuts
55
$template->param(
55
$template->param(
(-)a/cataloguing/value_builder/cn_browser.pl (-1 / +1 lines)
Lines 83-89 my $launcher = sub { Link Here
83
    }
83
    }
84
84
85
    my $cn_source = $cgi->param('cn_source') || C4::Context->preference("DefaultClassificationSource");
85
    my $cn_source = $cgi->param('cn_source') || C4::Context->preference("DefaultClassificationSource");
86
    my @class_sources = Koha::ClassSources->search({ used => 1});
86
    my @class_sources = Koha::ClassSources->search({ used => 1})->as_list;
87
87
88
    #Don't show half the results of show lt or gt
88
    #Don't show half the results of show lt or gt
89
    $real_limit = $results_per_page if $search ne $q;
89
    $real_limit = $results_per_page if $search ne $q;
(-)a/cataloguing/value_builder/marc21_linking_section.pl (-1 / +1 lines)
Lines 297-303 my $launcher = sub { Link Here
297
            }
297
            }
298
        );
298
        );
299
299
300
        my @itemtypes = Koha::ItemTypes->search;
300
        my @itemtypes = Koha::ItemTypes->search->as_list;
301
301
302
        $template->param(
302
        $template->param(
303
            itypeloop => \@itemtypes,
303
            itypeloop => \@itemtypes,
(-)a/cataloguing/value_builder/unimarc_field_4XX.pl (-1 / +1 lines)
Lines 484-490 sub plugin { Link Here
484
            }
484
            }
485
        );
485
        );
486
486
487
        my @itemtypes = Koha::ItemTypes->search;
487
        my @itemtypes = Koha::ItemTypes->search->as_list;
488
488
489
        $template->param(    #classlist => $classlist,
489
        $template->param(    #classlist => $classlist,
490
            itypeloop    => \@itemtypes,
490
            itypeloop    => \@itemtypes,
(-)a/circ/article-requests.pl (-3 / +3 lines)
Lines 39-47 my $branchcode = defined( $query->param('branchcode') ) ? $query->param('branchc Link Here
39
39
40
$template->param(
40
$template->param(
41
    branchcode                  => $branchcode,
41
    branchcode                  => $branchcode,
42
    article_requests_requested  => scalar Koha::ArticleRequests->requested($branchcode),
42
    article_requests_requested  => Koha::ArticleRequests->requested($branchcode),
43
    article_requests_pending    => scalar Koha::ArticleRequests->pending($branchcode),
43
    article_requests_pending    => Koha::ArticleRequests->pending($branchcode),
44
    article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode),
44
    article_requests_processing => Koha::ArticleRequests->processing($branchcode),
45
);
45
);
46
46
47
output_html_with_http_headers $query, $cookie, $template->output;
47
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/circ/circulation.pl (-4 / +4 lines)
Lines 545-555 my $view = $batch Link Here
545
545
546
my @relatives;
546
my @relatives;
547
if ( $patron ) {
547
if ( $patron ) {
548
    if ( my @guarantors = $patron->guarantor_relationships()->guarantors() ) {
548
    if ( my @guarantors = $patron->guarantor_relationships()->guarantors->as_list ) {
549
        push( @relatives, $_->id ) for @guarantors;
549
        push( @relatives, $_->id ) for @guarantors;
550
        push( @relatives, $_->id ) for $patron->siblings();
550
        push( @relatives, $_->id ) for $patron->siblings->as_list;
551
    } else {
551
    } else {
552
        push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees();
552
        push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees->as_list;
553
    }
553
    }
554
}
554
}
555
my $relatives_issues_count =
555
my $relatives_issues_count =
Lines 603-609 $template->param( Link Here
603
603
604
604
605
if ( C4::Context->preference("ExportCircHistory") ) {
605
if ( C4::Context->preference("ExportCircHistory") ) {
606
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
606
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
607
}
607
}
608
608
609
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
609
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
(-)a/circ/transfers_to_send.pl (-1 / +1 lines)
Lines 53-59 my @transfers = Koha::Libraries->search( Link Here
53
        prefetch => 'branchtransfers_tobranches',
53
        prefetch => 'branchtransfers_tobranches',
54
        order_by => 'branchtransfers_tobranches.tobranch'
54
        order_by => 'branchtransfers_tobranches.tobranch'
55
    }
55
    }
56
);
56
)->as_list;
57
57
58
$template->param(
58
$template->param(
59
    libraries => \@transfers,
59
    libraries => \@transfers,
(-)a/clubs/clubs.pl (-2 / +2 lines)
Lines 45-52 my $club_id = $cgi->param('club_id'); Link Here
45
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
45
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
46
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
46
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
47
47
48
my @club_templates = Koha::Club::Templates->search();
48
my @club_templates = Koha::Club::Templates->search->as_list;
49
my @clubs          = Koha::Clubs->search();
49
my @clubs          = Koha::Clubs->search->as_list;
50
50
51
$template->param(
51
$template->param(
52
    stored         => $stored,
52
    stored         => $stored,
(-)a/clubs/patron-clubs-tab.pl (-2 / +2 lines)
Lines 42-49 my $patronnumber = $cgi->param('borrowernumber'); Link Here
42
42
43
my $patron = Koha::Patrons->find($patronnumber);
43
my $patron = Koha::Patrons->find($patronnumber);
44
44
45
my @enrollments = $patron->get_club_enrollments();
45
my @enrollments = $patron->get_club_enrollments->as_list;
46
my @clubs       = $patron->get_enrollable_clubs();
46
my @clubs       = $patron->get_enrollable_clubs->as_list;
47
47
48
$template->param(
48
$template->param(
49
    enrollments    => \@enrollments,
49
    enrollments    => \@enrollments,
(-)a/ill/ill-requests.pl (-1 / +1 lines)
Lines 429-435 $template->param( Link Here
429
    backends   => $backends,
429
    backends   => $backends,
430
    types      => [ "Book", "Article", "Journal" ],
430
    types      => [ "Book", "Article", "Journal" ],
431
    query_type => $op,
431
    query_type => $op,
432
    branches   => scalar Koha::Libraries->search,
432
    branches   => Koha::Libraries->search,
433
);
433
);
434
434
435
output_html_with_http_headers( $cgi, $cookie, $template->output );
435
output_html_with_http_headers( $cgi, $cookie, $template->output );
(-)a/members/apikeys.pl (-2 / +2 lines)
Lines 84-90 if ($op) { Link Here
84
84
85
        $template->param(
85
        $template->param(
86
            fresh_api_key => $api_key,
86
            fresh_api_key => $api_key,
87
            api_keys      => scalar Koha::ApiKeys->search({ patron_id => $patron_id }),
87
            api_keys      => Koha::ApiKeys->search({ patron_id => $patron_id }),
88
        );
88
        );
89
    }
89
    }
90
90
Lines 121-127 if ($op) { Link Here
121
    }
121
    }
122
}
122
}
123
123
124
my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id });
124
my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id })->as_list;
125
125
126
$template->param(
126
$template->param(
127
    api_keys   => \@api_keys,
127
    api_keys   => \@api_keys,
(-)a/members/boraccount.pl (-1 / +1 lines)
Lines 177-183 my $total = $patron->account->balance; Link Here
177
my @accountlines = Koha::Account::Lines->search(
177
my @accountlines = Koha::Account::Lines->search(
178
    { borrowernumber => $patron->borrowernumber },
178
    { borrowernumber => $patron->borrowernumber },
179
    { order_by       => { -desc => 'accountlines_id' } }
179
    { order_by       => { -desc => 'accountlines_id' } }
180
);
180
)->as_list;
181
181
182
my $totalcredit;
182
my $totalcredit;
183
if($total <= 0){
183
if($total <= 0){
(-)a/members/mancredit.pl (-1 / +1 lines)
Lines 115-121 else { Link Here
115
115
116
    my @credit_types = Koha::Account::CreditTypes->search_with_library_limits(
116
    my @credit_types = Koha::Account::CreditTypes->search_with_library_limits(
117
        { can_be_added_manually => 1, archived => 0 },
117
        { can_be_added_manually => 1, archived => 0 },
118
        {}, $library_id );
118
        {}, $library_id )->as_list;
119
119
120
    $template->param(
120
    $template->param(
121
        patron       => $patron,
121
        patron       => $patron,
(-)a/members/maninvoice.pl (-1 / +1 lines)
Lines 207-213 if ($add) { Link Here
207
207
208
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
208
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
209
  { can_be_invoiced => 1, archived => 0 },
209
  { can_be_invoiced => 1, archived => 0 },
210
  {}, $library_id );
210
  {}, $library_id )->as_list;
211
211
212
$template->param(
212
$template->param(
213
  debit_types => \@debit_types,
213
  debit_types => \@debit_types,
(-)a/members/memberentry.pl (-2 / +2 lines)
Lines 68-74 if ( $borrowernumber and not $patron ) { Link Here
68
}
68
}
69
69
70
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
70
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
71
    my @providers = Koha::SMS::Providers->search();
71
    my @providers = Koha::SMS::Providers->search->as_list;
72
    $template->param( sms_providers => \@providers );
72
    $template->param( sms_providers => \@providers );
73
}
73
}
74
74
Lines 96-102 my $userenv = C4::Context->userenv; Link Here
96
my @messages;
96
my @messages;
97
97
98
## Deal with guarantor stuff
98
## Deal with guarantor stuff
99
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
99
$template->param( relationships => $patron->guarantor_relationships ) if $patron;
100
100
101
my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1;
101
my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1;
102
@relations = ('') unless @relations;
102
@relations = ('') unless @relations;
(-)a/members/members-home.pl (-1 / +1 lines)
Lines 43-49 if( Koha::Libraries->search->count < 1){ Link Here
43
    $template->param(no_branches => 1);
43
    $template->param(no_branches => 1);
44
}
44
}
45
45
46
my @categories = Koha::Patron::Categories->search_with_library_limits;
46
my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
47
if(scalar(@categories) < 1){
47
if(scalar(@categories) < 1){
48
    $no_add = 1;
48
    $no_add = 1;
49
    $template->param(no_categories => 1);
49
    $template->param(no_categories => 1);
(-)a/members/members-update.pl (-1 / +1 lines)
Lines 59-65 foreach my $pm (@$pending_modifications) { Link Here
59
    foreach my $type (@modified_atypes) {
59
    foreach my $type (@modified_atypes) {
60
        my $type_obj = Koha::Patron::Attribute::Types->find($type);
60
        my $type_obj = Koha::Patron::Attribute::Types->find($type);
61
        my @before   = Koha::Patron::Attributes->search(
61
        my @before   = Koha::Patron::Attributes->search(
62
            { borrowernumber => $pm->{borrowernumber}, code => $type } );
62
            { borrowernumber => $pm->{borrowernumber}, code => $type } )->as_list;
63
        my @after = grep { $_->code eq $type } @{ $pm->{extended_attributes} };
63
        my @after = grep { $_->code eq $type } @{ $pm->{extended_attributes} };
64
        push @{$modified_attributes}, { type => $type_obj, before => \@before, after => \@after };
64
        push @{$modified_attributes}, { type => $type_obj, before => \@before, after => \@after };
65
    }
65
    }
(-)a/members/moremember.pl (-4 / +4 lines)
Lines 95-105 $template->param( flagged => 1 ) if $patron->account_locked; Link Here
95
95
96
my @relatives;
96
my @relatives;
97
my $guarantor_relationships = $patron->guarantor_relationships;
97
my $guarantor_relationships = $patron->guarantor_relationships;
98
my @guarantees              = $patron->guarantee_relationships->guarantees;
98
my @guarantees              = $patron->guarantee_relationships->guarantees->as_list;
99
my @guarantors              = $guarantor_relationships->guarantors;
99
my @guarantors              = $guarantor_relationships->guarantors->as_list;
100
if (@guarantors) {
100
if (@guarantors) {
101
    push( @relatives, $_->id ) for @guarantors;
101
    push( @relatives, $_->id ) for @guarantors;
102
    push( @relatives, $_->id ) for $patron->siblings();
102
    push( @relatives, $_->id ) for $patron->siblings->as_list;
103
}
103
}
104
else {
104
else {
105
    push( @relatives, $_->id ) for @guarantees;
105
    push( @relatives, $_->id ) for @guarantees;
Lines 162-168 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
162
}
162
}
163
163
164
if ( C4::Context->preference("ExportCircHistory") ) {
164
if ( C4::Context->preference("ExportCircHistory") ) {
165
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
165
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
166
}
166
}
167
167
168
my $patron_messages = Koha::Patron::Messages->search(
168
my $patron_messages = Koha::Patron::Messages->search(
(-)a/members/paycollect.pl (-1 / +1 lines)
Lines 125-131 if ( $selected_accts ) { Link Here
125
    @selected_accountlines = Koha::Account::Lines->search(
125
    @selected_accountlines = Koha::Account::Lines->search(
126
        $search_params,
126
        $search_params,
127
        { order_by => 'date' }
127
        { order_by => 'date' }
128
    );
128
    )->as_list;
129
129
130
    my $sum = Koha::Account::Lines->search(
130
    my $sum = Koha::Account::Lines->search(
131
        $search_params,
131
        $search_params,
(-)a/members/print_overdues.pl (-1 / +1 lines)
Lines 49-55 my $patron = Koha::Patrons->find( $borrowernumber ); Link Here
49
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
49
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
50
50
51
my $overdues = [
51
my $overdues = [
52
    map { $_->unblessed_all_relateds } $patron->get_overdues
52
    map { $_->unblessed_all_relateds } $patron->get_overdues->as_list
53
];
53
];
54
54
55
my $letter = parse_overdues_letter(
55
my $letter = parse_overdues_letter(
(-)a/members/update-child.pl (-1 / +1 lines)
Lines 80-86 elsif ( $op eq 'update' ) { Link Here
80
    # But we should not hit that with a normal use of the interface
80
    # But we should not hit that with a normal use of the interface
81
    die "You are doing something wrong updating this child" unless $adult_category;
81
    die "You are doing something wrong updating this child" unless $adult_category;
82
82
83
    $_->delete() for $patron->guarantor_relationships();
83
    $_->delete() for $patron->guarantor_relationships->as_list;
84
84
85
    $patron->categorycode($adult_category->categorycode);
85
    $patron->categorycode($adult_category->categorycode);
86
    $patron->store;
86
    $patron->store;
(-)a/misc/cronjobs/delete_records_via_leader.pl (-1 / +1 lines)
Lines 86-92 foreach my $m (@metadatas) { Link Here
86
    if ($delete_items) {
86
    if ($delete_items) {
87
        my $deleted_count = 0;
87
        my $deleted_count = 0;
88
        my $biblio = Koha::Biblios->find( $biblionumber );
88
        my $biblio = Koha::Biblios->find( $biblionumber );
89
        my @items = Koha::Items->search( { biblionumber => $biblionumber } );
89
        my @items = Koha::Items->search( { biblionumber => $biblionumber } )->as_list;
90
        foreach my $item ( @items ) {
90
        foreach my $item ( @items ) {
91
            my $itemnumber = $item->itemnumber;
91
            my $itemnumber = $item->itemnumber;
92
92
(-)a/misc/cronjobs/reconcile_balances.pl (-1 / +1 lines)
Lines 81-87 my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search( Link Here
81
            columns  => [ qw/borrowernumber/ ],
81
            columns  => [ qw/borrowernumber/ ],
82
            distinct => 1,
82
            distinct => 1,
83
        }
83
        }
84
    );
84
    )->as_list;
85
85
86
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });
86
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });
87
87
(-)a/opac/clubs/clubs-tab.pl (-2 / +2 lines)
Lines 39-46 my $borrowernumber = $cgi->param('borrowernumber'); Link Here
39
39
40
my $borrower = Koha::Patrons->find($borrowernumber);
40
my $borrower = Koha::Patrons->find($borrowernumber);
41
41
42
my @enrollments = $borrower->get_club_enrollments();
42
my @enrollments = $borrower->get_club_enrollments->as_list;
43
my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 );
43
my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 )->as_list;
44
44
45
$template->param(
45
$template->param(
46
    enrollments => \@enrollments,
46
    enrollments => \@enrollments,
(-)a/opac/opac-account.pl (-1 / +1 lines)
Lines 50-56 if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor') Link Here
50
    my @relatives;
50
    my @relatives;
51
51
52
    # Filter out guarantees that don't want guarantor to see checkouts
52
    # Filter out guarantees that don't want guarantor to see checkouts
53
    foreach my $gr ( $patron->guarantee_relationships() ) {
53
    foreach my $gr ( $patron->guarantee_relationships->as_list ) {
54
        my $g = $gr->guarantee;
54
        my $g = $gr->guarantee;
55
        if ( $g->privacy_guarantor_fines ) {
55
        if ( $g->privacy_guarantor_fines ) {
56
56
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 179-185 $template->param( Link Here
179
    csv_profiles => [
179
    csv_profiles => [
180
        Koha::CsvProfiles->search(
180
        Koha::CsvProfiles->search(
181
            { type => 'marc', used_for => 'export_records', staff_only => 0 }
181
            { type => 'marc', used_for => 'export_records', staff_only => 0 }
182
        )
182
        )->as_list
183
    ],
183
    ],
184
    bib_list => $bib_list,
184
    bib_list => $bib_list,
185
    BIBLIO_RESULTS => $resultsarray,
185
    BIBLIO_RESULTS => $resultsarray,
(-)a/opac/opac-downloadcart.pl (-1 / +1 lines)
Lines 137-143 if ($bib_list && $format) { Link Here
137
                    used_for   => 'export_records',
137
                    used_for   => 'export_records',
138
                    staff_only => 0
138
                    staff_only => 0
139
                }
139
                }
140
            )
140
            )->as_list
141
        ]
141
        ]
142
    );
142
    );
143
    $template->param(bib_list => $bib_list); 
143
    $template->param(bib_list => $bib_list); 
(-)a/opac/opac-downloadshelf.pl (-1 / +1 lines)
Lines 153-159 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
153
                        used_for   => 'export_records',
153
                        used_for   => 'export_records',
154
                        staff_only => 0
154
                        staff_only => 0
155
                    }
155
                    }
156
                )
156
                )->as_list
157
            ]
157
            ]
158
        );
158
        );
159
        $template->param( shelf => $shelf );
159
        $template->param( shelf => $shelf );
(-)a/opac/opac-memberentry.pl (-2 / +2 lines)
Lines 86-92 if ( $action eq 'create' || $action eq 'new' ) { Link Here
86
    $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
86
    $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
87
      if @PatronSelfRegistrationLibraryList;
87
      if @PatronSelfRegistrationLibraryList;
88
}
88
}
89
my @libraries = Koha::Libraries->search($params);
89
my @libraries = Koha::Libraries->search($params)->as_list;
90
90
91
my ( $min, $max ) = C4::Members::get_cardnumber_length();
91
my ( $min, $max ) = C4::Members::get_cardnumber_length();
92
if ( defined $min ) {
92
if ( defined $min ) {
Lines 698-704 sub ParsePatronAttributes { Link Here
698
    my @values = $cgi->multi_param('patron_attribute_value');
698
    my @values = $cgi->multi_param('patron_attribute_value');
699
699
700
    my @editable_attribute_types
700
    my @editable_attribute_types
701
        = map { $_->code } Koha::Patron::Attribute::Types->search({ opac_editable => 1 });
701
        = map { $_->code } Koha::Patron::Attribute::Types->search({ opac_editable => 1 })->as_list;
702
702
703
    my $ea = each_array( @codes, @values );
703
    my $ea = each_array( @codes, @values );
704
    my @attributes;
704
    my @attributes;
(-)a/opac/opac-messaging.pl (-1 / +1 lines)
Lines 79-85 $template->param( Link Here
79
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
79
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
80
80
81
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
81
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
82
    my @providers = Koha::SMS::Providers->search();
82
    my @providers = Koha::SMS::Providers->search->as_list;
83
    $template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
83
    $template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
84
}
84
}
85
85
(-)a/opac/opac-search.pl (-1 / +1 lines)
Lines 436-442 my %is_nolimit = map { $_ => 1 } @nolimits; Link Here
436
if (@searchCategories > 0) {
436
if (@searchCategories > 0) {
437
    my @tabcat;
437
    my @tabcat;
438
    foreach my $typecategory (@searchCategories) {
438
    foreach my $typecategory (@searchCategories) {
439
        my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory });
439
        my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory })->as_list;
440
        push @tabcat, $_->itemtype for @itemtypes;
440
        push @tabcat, $_->itemtype for @itemtypes;
441
    }
441
    }
442
442
(-)a/opac/opac-shelves.pl (-1 / +1 lines)
Lines 400-406 if ( $op eq 'view' ) { Link Here
400
                csv_profiles => [
400
                csv_profiles => [
401
                    Koha::CsvProfiles->search(
401
                    Koha::CsvProfiles->search(
402
                        { type => 'marc', used_for => 'export_records', staff_only => 0 }
402
                        { type => 'marc', used_for => 'export_records', staff_only => 0 }
403
                    )
403
                    )->as_list
404
                ],
404
                ],
405
            );
405
            );
406
            if ( $page ) {
406
            if ( $page ) {
(-)a/opac/opac-user.pl (-2 / +2 lines)
Lines 370-376 if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' Link Here
370
{
370
{
371
    my @relatives;
371
    my @relatives;
372
    # Filter out guarantees that don't want guarantor to see checkouts
372
    # Filter out guarantees that don't want guarantor to see checkouts
373
    foreach my $gr ( $patron->guarantee_relationships() ) {
373
    foreach my $gr ( $patron->guarantee_relationships->as_list ) {
374
        my $g = $gr->guarantee;
374
        my $g = $gr->guarantee;
375
        push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
375
        push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
376
    }
376
    }
Lines 382-388 if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor') Link Here
382
{
382
{
383
    my @relatives_with_fines;
383
    my @relatives_with_fines;
384
    # Filter out guarantees that don't want guarantor to see checkouts
384
    # Filter out guarantees that don't want guarantor to see checkouts
385
    foreach my $gr ( $patron->guarantee_relationships() ) {
385
    foreach my $gr ( $patron->guarantee_relationships->as_list ) {
386
        my $g = $gr->guarantee;
386
        my $g = $gr->guarantee;
387
        push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
387
        push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
388
    }
388
    }
(-)a/reports/acquisitions_stats.pl (-1 / +1 lines)
Lines 181-187 else { Link Here
181
181
182
    my $CGIsepChoice = GetDelimiterChoices;
182
    my $CGIsepChoice = GetDelimiterChoices;
183
183
184
    my @branches = Koha::Libraries->search({}, { order_by => 'branchname' });
184
    my @branches = Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
185
185
186
    my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
186
    my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
187
    my $ccode_label;
187
    my $ccode_label;
(-)a/reports/borrowers_stats.pl (-1 / +1 lines)
Lines 219-225 sub calculate { Link Here
219
        }
219
        }
220
    }
220
    }
221
221
222
    my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
222
    my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
223
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
223
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
224
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
224
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
225
# year of activity
225
# year of activity
(-)a/reports/issues_stats.pl (-1 / +1 lines)
Lines 82-88 $template->param(do_it => $do_it, Link Here
82
82
83
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
83
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
84
84
85
our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
85
our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
86
86
87
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
87
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
88
our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
88
our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
(-)a/reports/reserves_stats.pl (-2 / +2 lines)
Lines 70-76 $sep = "\t" if ($sep eq 'tabulation'); Link Here
70
$template->param(do_it => $do_it,
70
$template->param(do_it => $do_it,
71
);
71
);
72
72
73
my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
73
my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
74
74
75
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
75
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
76
my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
76
my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
Lines 325-331 sub display_value { Link Here
325
        }
325
        }
326
    }
326
    }
327
    elsif ( $crit =~ /category/ ) {
327
    elsif ( $crit =~ /category/ ) {
328
        my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
328
        my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
329
        foreach my $patron_category ( @patron_categories ) {
329
        foreach my $patron_category ( @patron_categories ) {
330
            ( $value eq $patron_category->categorycode ) or next;
330
            ( $value eq $patron_category->categorycode ) or next;
331
            $display_value = $patron_category->description and last;
331
            $display_value = $patron_category->description and last;
(-)a/reserve/request.pl (-1 / +1 lines)
Lines 682-688 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
682
        $template->param( always_show_holds => $always_show_holds );
682
        $template->param( always_show_holds => $always_show_holds );
683
        my $show_holds_now = $input->param('show_holds_now');
683
        my $show_holds_now = $input->param('show_holds_now');
684
        unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){
684
        unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){
685
            my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } );
685
            my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } )->as_list;
686
            foreach my $res (
686
            foreach my $res (
687
                sort {
687
                sort {
688
                    my $a_found = $a->found() || '';
688
                    my $a_found = $a->found() || '';
(-)a/serials/acqui-search-result.pl (-1 / +1 lines)
Lines 60-66 my ($template, $loggedinuser, $cookie) Link Here
60
my $supplier=$query->param('supplier');
60
my $supplier=$query->param('supplier');
61
my @suppliers = Koha::Acquisition::Booksellers->search(
61
my @suppliers = Koha::Acquisition::Booksellers->search(
62
                    { name     => { -like => "%$supplier%" } },
62
                    { name     => { -like => "%$supplier%" } },
63
                    { order_by => { -asc => 'name' } } );
63
                    { order_by => { -asc => 'name' } } )->as_list;
64
64
65
#build result page
65
#build result page
66
my $loop_suppliers = [];
66
my $loop_suppliers = [];
(-)a/serials/claims.pl (-1 / +1 lines)
Lines 96-102 $template->param( Link Here
96
        supplierid => $supplierid,
96
        supplierid => $supplierid,
97
        claimletter => $claimletter,
97
        claimletter => $claimletter,
98
        additional_fields_for_subscription => $additional_fields,
98
        additional_fields_for_subscription => $additional_fields,
99
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }) ],
99
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' })->as_list ],
100
        letters => $letters,
100
        letters => $letters,
101
        (uc(C4::Context->preference("marcflavour"))) => 1
101
        (uc(C4::Context->preference("marcflavour"))) => 1
102
        );
102
        );
(-)a/serials/serials-search.pl (-2 / +2 lines)
Lines 76-82 if ( $op and $op eq "close" ) { Link Here
76
}
76
}
77
77
78
78
79
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'subscription', searchable => 1 } );
79
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'subscription', searchable => 1 } )->as_list;
80
my @additional_field_filters;
80
my @additional_field_filters;
81
for my $field ( @additional_fields ) {
81
for my $field ( @additional_fields ) {
82
    my $value = $query->param( 'additional_field_' . $field->id );
82
    my $value = $query->param( 'additional_field_' . $field->id );
Lines 163-169 else Link Here
163
        }
163
        }
164
    }
164
    }
165
165
166
    my @branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] } );
166
    my @branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] } )->as_list;
167
    my @branches_loop;
167
    my @branches_loop;
168
    foreach my $b ( @branches ) {
168
    foreach my $b ( @branches ) {
169
        my $selected = 0;
169
        my $selected = 0;
(-)a/serials/subscription-add.pl (-1 / +1 lines)
Lines 130-136 $template->param( Link Here
130
    locations_loop=>$locations_loop,
130
    locations_loop=>$locations_loop,
131
);
131
);
132
132
133
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
133
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' })->as_list;
134
my %additional_field_values;
134
my %additional_field_values;
135
if ($subscriptionid) {
135
if ($subscriptionid) {
136
    my $subscription = Koha::Subscriptions->find($subscriptionid);
136
    my $subscription = Koha::Subscriptions->find($subscriptionid);
(-)a/serials/subscription-batchedit.pl (-2 / +2 lines)
Lines 47-53 foreach my $subscriptionid (@subscriptionids) { Link Here
47
    push @subscriptions, $subscription if $subscription;
47
    push @subscriptions, $subscription if $subscription;
48
}
48
}
49
49
50
my @additional_fields = Koha::AdditionalFields->search({tablename => 'subscription'});
50
my @additional_fields = Koha::AdditionalFields->search({tablename => 'subscription'})->as_list;
51
51
52
my $batchedit = $cgi->param('batchedit');
52
my $batchedit = $cgi->param('batchedit');
53
if ($batchedit) {
53
if ($batchedit) {
Lines 98-104 if ($batchedit) { Link Here
98
98
99
$template->param(
99
$template->param(
100
    subscriptions => \@subscriptions,
100
    subscriptions => \@subscriptions,
101
    booksellers => [ Koha::Acquisition::Booksellers->search() ],
101
    booksellers => [ Koha::Acquisition::Booksellers->search->as_list ],
102
    additional_fields => \@additional_fields,
102
    additional_fields => \@additional_fields,
103
    referrer => scalar $cgi->param('referrer'),
103
    referrer => scalar $cgi->param('referrer'),
104
);
104
);
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 126-132 my $default_bib_view = get_default_view(); Link Here
126
126
127
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
127
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
128
$template->param(
128
$template->param(
129
    available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } ) ],
129
    available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } )->as_list ],
130
    additional_field_values => {
130
    additional_field_values => {
131
        map { $_->field->name => $_->value }
131
        map { $_->field->name => $_->value }
132
          $subscription_object->additional_field_values->as_list
132
          $subscription_object->additional_field_values->as_list
(-)a/suggestion/suggestion.pl (-1 / +1 lines)
Lines 456-462 if( $suggestion_ref->{STATUS} ) { Link Here
456
    );
456
    );
457
}
457
}
458
458
459
my @currencies = Koha::Acquisition::Currencies->search;
459
my @currencies = Koha::Acquisition::Currencies->search->as_list;
460
$template->param(
460
$template->param(
461
    currencies   => \@currencies,
461
    currencies   => \@currencies,
462
    suggestion   => $suggestion_ref,
462
    suggestion   => $suggestion_ref,
(-)a/t/db_dependent/AudioAlerts.t (-2 / +2 lines)
Lines 27-33 BEGIN { Link Here
27
my $schema = Koha::Database->new()->schema();
27
my $schema = Koha::Database->new()->schema();
28
$schema->storage->txn_begin();
28
$schema->storage->txn_begin();
29
29
30
map { $_->delete() } Koha::AudioAlerts->search();
30
map { $_->delete() } Koha::AudioAlerts->search->as_list;
31
31
32
## Check the basics
32
## Check the basics
33
# Creating 3 audio alerts named a, b and c
33
# Creating 3 audio alerts named a, b and c
Lines 97-103 is( $c->precedence, 3, "Alert C has a precedence of 3" ); Link Here
97
$a->move('bottom');
97
$a->move('bottom');
98
# Changed precedence order from database insert order
98
# Changed precedence order from database insert order
99
# Insert order was a, b, c. Precedence order is now b, c, a.
99
# Insert order was a, b, c. Precedence order is now b, c, a.
100
( $b, $c, $a ) = Koha::AudioAlerts->search();
100
( $b, $c, $a ) = Koha::AudioAlerts->search->as_list;
101
101
102
is( $b->selector,   'B', 'First sound is indeed B' );
102
is( $b->selector,   'B', 'First sound is indeed B' );
103
is( $b->precedence, 1,   "Alert B has a precedence of 1" );
103
is( $b->precedence, 1,   "Alert B has a precedence of 1" );
(-)a/t/db_dependent/AuthorisedValues.t (-4 / +4 lines)
Lines 111-117 $av3->lib_opac(''); Link Here
111
is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' );
111
is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' );
112
112
113
my @authorised_values =
113
my @authorised_values =
114
  Koha::AuthorisedValues->new()->search( { category => 'av_for_testing' } );
114
  Koha::AuthorisedValues->new()->search( { category => 'av_for_testing' } )->as_list;
115
is( @authorised_values, 3, "Get correct number of values" );
115
is( @authorised_values, 3, "Get correct number of values" );
116
116
117
my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode};
117
my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode};
Lines 119-132 my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode}; Link Here
119
119
120
$av1->add_library_limit( $branchcode1 );
120
$av1->add_library_limit( $branchcode1 );
121
121
122
@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode1 );
122
@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode1 )->as_list;
123
is( @authorised_values, 3, "Search including value with a branch limit ( branch can use the limited value ) gives correct number of results" );
123
is( @authorised_values, 3, "Search including value with a branch limit ( branch can use the limited value ) gives correct number of results" );
124
124
125
@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 );
125
@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 )->as_list;
126
is( @authorised_values, 2, "Search including value with a branch limit ( branch *cannot* use the limited value ) gives correct number of results" );
126
is( @authorised_values, 2, "Search including value with a branch limit ( branch *cannot* use the limited value ) gives correct number of results" );
127
127
128
$av1->del_library_limit( $branchcode1 );
128
$av1->del_library_limit( $branchcode1 );
129
@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 );
129
@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 )->as_list;
130
is( @authorised_values, 3, "Branch limitation deleted successfully" );
130
is( @authorised_values, 3, "Branch limitation deleted successfully" );
131
131
132
$av1->add_library_limit( $branchcode1 );
132
$av1->add_library_limit( $branchcode1 );
(-)a/t/db_dependent/Budgets.t (-1 / +1 lines)
Lines 516-522 is ( GetBudgetOrdered( $fund ), '20', "total ordered price is 20"); Link Here
516
516
517
# CloneBudgetPeriod
517
# CloneBudgetPeriod
518
# Let's make sure our timestamp is old
518
# Let's make sure our timestamp is old
519
my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id });
519
my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id })->as_list;
520
foreach my $fund (@orig_funds){
520
foreach my $fund (@orig_funds){
521
    $fund->timestamp('1999-12-31 23:59:59')->store;
521
    $fund->timestamp('1999-12-31 23:59:59')->store;
522
}
522
}
(-)a/t/db_dependent/Koha.t (-2 / +2 lines)
Lines 202-211 subtest 'GetItemTypesCategorized test' => sub{ Link Here
202
    $insertSth->execute('BKghjklo3', 'Yet another type of book', 'Qwertyware', 0);
202
    $insertSth->execute('BKghjklo3', 'Yet another type of book', 'Qwertyware', 0);
203
203
204
    # Azertyware should not exist.
204
    # Azertyware should not exist.
205
    my @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Azertyware' });
205
    my @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Azertyware' })->as_list;
206
    is( @itemtypes, 0, 'Search item types by searchcategory: Invalid category returns nothing');
206
    is( @itemtypes, 0, 'Search item types by searchcategory: Invalid category returns nothing');
207
207
208
    @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Qwertyware' });
208
    @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Qwertyware' })->as_list;
209
    my @got = map { $_->itemtype } @itemtypes;
209
    my @got = map { $_->itemtype } @itemtypes;
210
    my @expected = ( 'BKghjklo2', 'BKghjklo3' );
210
    my @expected = ( 'BKghjklo2', 'BKghjklo3' );
211
    is_deeply(\@got,\@expected,'Search item types by searchcategory: valid category returns itemtypes');
211
    is_deeply(\@got,\@expected,'Search item types by searchcategory: valid category returns itemtypes');
(-)a/t/db_dependent/Koha/Objects/Mixin/AdditionalFields.t (-6 / +6 lines)
Lines 88-94 my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields([ Link Here
88
        id => $foo->id,
88
        id => $foo->id,
89
        value => 'foo value for basket1',
89
        value => 'foo value for basket1',
90
    },
90
    },
91
]);
91
])->as_list;
92
92
93
is(scalar @baskets, 1, 'search returns only one result');
93
is(scalar @baskets, 1, 'search returns only one result');
94
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
94
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
Lines 98-104 is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); Link Here
98
        id => $foo->id,
98
        id => $foo->id,
99
        value => 'foo value for basket2',
99
        value => 'foo value for basket2',
100
    },
100
    },
101
]);
101
])->as_list;
102
102
103
is(scalar @baskets, 1, 'search returns only one result');
103
is(scalar @baskets, 1, 'search returns only one result');
104
is($baskets[0]->basketno, $basket2->basketno, 'result is basket2');
104
is($baskets[0]->basketno, $basket2->basketno, 'result is basket2');
Lines 112-118 is($baskets[0]->basketno, $basket2->basketno, 'result is basket2'); Link Here
112
        id => $bar->id,
112
        id => $bar->id,
113
        value => 'bar value for basket1',
113
        value => 'bar value for basket1',
114
    },
114
    },
115
]);
115
])->as_list;
116
116
117
is(scalar @baskets, 1, 'search returns only one result');
117
is(scalar @baskets, 1, 'search returns only one result');
118
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
118
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
Lines 126-132 is($baskets[0]->basketno, $basket1->basketno, 'result is basket1'); Link Here
126
        id => $bar->id,
126
        id => $bar->id,
127
        value => 'bar value for basket2',
127
        value => 'bar value for basket2',
128
    },
128
    },
129
]);
129
])->as_list;
130
130
131
is(scalar @baskets, 0, 'search returns no result');
131
is(scalar @baskets, 0, 'search returns no result');
132
132
Lines 135-141 is(scalar @baskets, 0, 'search returns no result'); Link Here
135
        id => $foo->id,
135
        id => $foo->id,
136
        value => 'foo',
136
        value => 'foo',
137
    },
137
    },
138
]);
138
])->as_list;
139
139
140
is(scalar @baskets, 2, 'search returns two results');
140
is(scalar @baskets, 2, 'search returns two results');
141
141
Lines 148-154 is(scalar @baskets, 2, 'search returns two results'); Link Here
148
        id => $foo->id,
148
        id => $foo->id,
149
        value => 'basket1',
149
        value => 'basket1',
150
    },
150
    },
151
]);
151
])->as_list;
152
152
153
is(scalar @baskets, 1, 'search returns only one result');
153
is(scalar @baskets, 1, 'search returns only one result');
154
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
154
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
(-)a/t/db_dependent/LibraryGroups.t (-4 / +4 lines)
Lines 36-42 my $library7 = $builder->build( { source => 'Branch' } ); Link Here
36
my $root_group =
36
my $root_group =
37
  Koha::Library::Group->new( { title => "Test root group" } )->store();
37
  Koha::Library::Group->new( { title => "Test root group" } )->store();
38
38
39
my @root_groups = Koha::Library::Groups->get_root_groups();
39
my @root_groups = Koha::Library::Groups->get_root_groups->as_list;
40
my $in_list = any { $_->id eq $root_group->id } @root_groups;
40
my $in_list = any { $_->id eq $root_group->id } @root_groups;
41
ok( $in_list, 'New root group is in the list returned by the get_root_groups method');
41
ok( $in_list, 'New root group is in the list returned by the get_root_groups method');
42
42
Lines 66-72 my $library = $groupA_library1->library(); Link Here
66
is( ref( $library ), 'Koha::Library', 'Method library returns a Koha::Library object' );
66
is( ref( $library ), 'Koha::Library', 'Method library returns a Koha::Library object' );
67
is( $library->id, $groupA_library1->branchcode, 'Branchcode for fetched library matches' );
67
is( $library->id, $groupA_library1->branchcode, 'Branchcode for fetched library matches' );
68
68
69
my @libraries_not_direct_children = $groupA->libraries_not_direct_children();
69
my @libraries_not_direct_children = $groupA->libraries_not_direct_children->as_list;
70
$in_list = any { $_->id eq $groupA_library1->branchcode } @libraries_not_direct_children;
70
$in_list = any { $_->id eq $groupA_library1->branchcode } @libraries_not_direct_children;
71
ok( !$in_list, 'Method libraries_not_direct_children returns all libraries not direct descendants of group, library 1 is not in the list');
71
ok( !$in_list, 'Method libraries_not_direct_children returns all libraries not direct descendants of group, library 1 is not in the list');
72
$in_list = any { $_->id eq $groupA1_library2->branchcode } @libraries_not_direct_children;
72
$in_list = any { $_->id eq $groupA1_library2->branchcode } @libraries_not_direct_children;
Lines 119-127 subtest 'Koha::Library::Group->get_search_groups' => sub { Link Here
119
    $groupA = Koha::Library::Groups->find( $groupA->id );
119
    $groupA = Koha::Library::Groups->find( $groupA->id );
120
    $groupB = Koha::Library::Groups->find( $groupB->id );
120
    $groupB = Koha::Library::Groups->find( $groupB->id );
121
121
122
    my @groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' });
122
    my @groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list;
123
    is_deeply( $groups[0]->unblessed, $groupA->unblessed, 'Get search groups opac should return enabled group' );
123
    is_deeply( $groups[0]->unblessed, $groupA->unblessed, 'Get search groups opac should return enabled group' );
124
    @groups = Koha::Library::Groups->get_search_groups({ interface => 'staff' });
124
    @groups = Koha::Library::Groups->get_search_groups({ interface => 'staff' })->as_list;
125
    is_deeply( $groups[0]->unblessed, $groupB->unblessed, 'Get search groups staff should return enabled group' );
125
    is_deeply( $groups[0]->unblessed, $groupB->unblessed, 'Get search groups staff should return enabled group' );
126
};
126
};
127
127
(-)a/t/db_dependent/Overdues.t (-1 / +1 lines)
Lines 91-97 $dbh->do(q| Link Here
91
        ( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 )
91
        ( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 )
92
|);
92
|);
93
93
94
my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
94
my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
95
95
96
my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
96
my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
97
is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' );
97
is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' );
(-)a/t/db_dependent/Patrons.t (-1 / +1 lines)
Lines 81-87 $b3_new->set({ firstname => 'Some first name for Test 3' })->store(); Link Here
81
$b3_new = Koha::Patrons->find( $b3->borrowernumber() );
81
$b3_new = Koha::Patrons->find( $b3->borrowernumber() );
82
is( t::lib::Dates::compare( $b3_new->updated_on, $now), 0, "borrowers.updated_on should have been set to now on updating" );
82
is( t::lib::Dates::compare( $b3_new->updated_on, $now), 0, "borrowers.updated_on should have been set to now on updating" );
83
83
84
my @patrons = Koha::Patrons->search( { branchcode => $branchcode } );
84
my @patrons = Koha::Patrons->search( { branchcode => $branchcode } )->as_list;
85
is( @patrons, 3, "Found 3 patrons with Search" );
85
is( @patrons, 3, "Found 3 patrons with Search" );
86
86
87
my $unexistent = Koha::Patrons->find( '1234567890' );
87
my $unexistent = Koha::Patrons->find( '1234567890' );
(-)a/t/db_dependent/Reserves.t (-1 / +1 lines)
Lines 272-278 is($holds->next->priority, 0, 'Item is correctly waiting'); Link Here
272
is($holds->next->priority, 1, 'Item is correctly priority 1');
272
is($holds->next->priority, 1, 'Item is correctly priority 1');
273
is($holds->next->priority, 2, 'Item is correctly priority 2');
273
is($holds->next->priority, 2, 'Item is correctly priority 2');
274
274
275
my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting();
275
my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting->as_list;
276
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
276
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
277
is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the reserve for the correct borrower' );
277
is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the reserve for the correct borrower' );
278
278
(-)a/t/db_dependent/Upload.t (-3 / +3 lines)
Lines 217-223 subtest 'Test delete_missing' => sub { Link Here
217
subtest 'Call search_term with[out] private flag' => sub {
217
subtest 'Call search_term with[out] private flag' => sub {
218
    plan tests => 3;
218
    plan tests => 3;
219
219
220
    my @recs = Koha::UploadedFiles->search_term({ term => 'file' });
220
    my @recs = Koha::UploadedFiles->search_term({ term => 'file' })->as_list;
221
    is( @recs, 1, 'Returns only one public result' );
221
    is( @recs, 1, 'Returns only one public result' );
222
    is( $recs[0]->filename, 'file3', 'Should be file3' );
222
    is( $recs[0]->filename, 'file3', 'Should be file3' );
223
223
Lines 289-298 subtest 'Testing delete_temporary' => sub { Link Here
289
    my $today = dt_from_string;
289
    my $today = dt_from_string;
290
    $today->subtract( minutes => 2 ); # should be enough :)
290
    $today->subtract( minutes => 2 ); # should be enough :)
291
    my $dt = $today->clone->subtract( days => 1 );
291
    my $dt = $today->clone->subtract( days => 1 );
292
    foreach my $rec ( Koha::UploadedFiles->search({ permanent => 1 }) ) {
292
    foreach my $rec ( Koha::UploadedFiles->search({ permanent => 1 })->as_list ) {
293
        $rec->dtcreated($dt)->store;
293
        $rec->dtcreated($dt)->store;
294
    }
294
    }
295
    my @recs = Koha::UploadedFiles->search({ permanent => 0 });
295
    my @recs = Koha::UploadedFiles->search({ permanent => 0 })->as_list;
296
    $dt = $today->clone->subtract( days => 3 );
296
    $dt = $today->clone->subtract( days => 3 );
297
    $recs[0]->dtcreated($dt)->store;
297
    $recs[0]->dtcreated($dt)->store;
298
    $dt = $today->clone->subtract( days => 5 );
298
    $dt = $today->clone->subtract( days => 5 );
(-)a/tools/additional-contents.pl (-1 / +1 lines)
Lines 69-75 if ( $op eq 'add_form' ) { Link Here
69
                    location   => $additional_content->location,
69
                    location   => $additional_content->location,
70
                    branchcode => $additional_content->branchcode,
70
                    branchcode => $additional_content->branchcode,
71
                }
71
                }
72
            )
72
            )->as_list
73
        };
73
        };
74
        $category = $additional_content->category;
74
        $category = $additional_content->category;
75
    }
75
    }
(-)a/tools/batch_delete_records.pl (-1 / +1 lines)
Lines 54-60 if ( $op eq 'form' ) { Link Here
54
    # Display the form
54
    # Display the form
55
    $template->param(
55
    $template->param(
56
        op => 'form',
56
        op => 'form',
57
        lists => scalar Koha::Virtualshelves->search(
57
        lists => Koha::Virtualshelves->search(
58
            [
58
            [
59
                { public => 0, owner => $loggedinuser },
59
                { public => 0, owner => $loggedinuser },
60
                { public => 1 }
60
                { public => 1 }
(-)a/tools/batch_record_modification.pl (-1 / +1 lines)
Lines 82-88 if ( $op eq 'form' ) { Link Here
82
    # Display the form
82
    # Display the form
83
    $template->param(
83
    $template->param(
84
        view => 'form',
84
        view => 'form',
85
        lists => scalar Koha::Virtualshelves->search(
85
        lists => Koha::Virtualshelves->search(
86
            [
86
            [
87
                { public => 0, owner => $loggedinuser },
87
                { public => 0, owner => $loggedinuser },
88
                { public => 1 }
88
                { public => 1 }
(-)a/tools/export.pl (-1 / +1 lines)
Lines 301-307 else { Link Here
301
        itemtypes                => $itemtypes,
301
        itemtypes                => $itemtypes,
302
        authority_types          => $authority_types,
302
        authority_types          => $authority_types,
303
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
303
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
304
        csv_profiles             => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
304
        csv_profiles             => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ],
305
        messages                 => \@messages,
305
        messages                 => \@messages,
306
    );
306
    );
307
307
(-)a/tools/import_borrowers.pl (-1 / +1 lines)
Lines 76-82 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
76
);
76
);
77
77
78
# get the patron categories and pass them to the template
78
# get the patron categories and pass them to the template
79
my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
79
my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
80
$template->param( categories => \@patron_categories );
80
$template->param( categories => \@patron_categories );
81
my $columns = C4::Templates::GetColumnDefs( $input )->{borrowers};
81
my $columns = C4::Templates::GetColumnDefs( $input )->{borrowers};
82
$columns = [ grep { $_->{field} ne 'borrowernumber' ? $_ : () } @$columns ];
82
$columns = [ grep { $_->{field} ne 'borrowernumber' ? $_ : () } @$columns ];
(-)a/tools/inventory.pl (-2 / +2 lines)
Lines 122-131 for my $authvfield (@$statuses) { Link Here
122
# the full set.
122
# the full set.
123
@notforloans = @{$staton->{'items.notforloan'}} if defined $staton->{'items.notforloan'} and scalar @{$staton->{'items.notforloan'}} > 0;
123
@notforloans = @{$staton->{'items.notforloan'}} if defined $staton->{'items.notforloan'} and scalar @{$staton->{'items.notforloan'}} > 0;
124
124
125
my @class_sources = Koha::ClassSources->search({ used => 1 });
125
my @class_sources = Koha::ClassSources->search({ used => 1 })->as_list;
126
my $pref_class = C4::Context->preference("DefaultClassificationSource");
126
my $pref_class = C4::Context->preference("DefaultClassificationSource");
127
127
128
my @itemtypes = Koha::ItemTypes->search;
128
my @itemtypes = Koha::ItemTypes->search->as_list;
129
my @selected_itemtypes;
129
my @selected_itemtypes;
130
foreach my $itemtype ( @itemtypes ) {
130
foreach my $itemtype ( @itemtypes ) {
131
    if ( defined $input->param('itemtype-' . $itemtype->itemtype) ) {
131
    if ( defined $input->param('itemtype-' . $itemtype->itemtype) ) {
(-)a/tools/modborrowers.pl (-1 / +1 lines)
Lines 130-136 if ( $op eq 'show' ) { Link Here
130
    my @patron_attributes_codes;
130
    my @patron_attributes_codes;
131
    my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
131
    my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
132
    my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
132
    my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
133
    my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
133
    my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
134
    while ( my $attr_type = $patron_attribute_types->next ) {
134
    while ( my $attr_type = $patron_attribute_types->next ) {
135
        # TODO Repeatable attributes are not correctly managed and can cause data lost.
135
        # TODO Repeatable attributes are not correctly managed and can cause data lost.
136
        # This should be implemented.
136
        # This should be implemented.
(-)a/tools/overduerules.pl (-1 / +1 lines)
Lines 32-38 use Koha::Patron::Categories; Link Here
32
our $input = CGI->new;
32
our $input = CGI->new;
33
my $dbh = C4::Context->dbh;
33
my $dbh = C4::Context->dbh;
34
34
35
my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } );
35
my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } )->as_list;
36
my @category_codes  = map { $_->categorycode } @patron_categories;
36
my @category_codes  = map { $_->categorycode } @patron_categories;
37
our @rule_params     = qw(delay letter debarred);
37
our @rule_params     = qw(delay letter debarred);
38
38
(-)a/tools/viewlog.pl (-1 / +1 lines)
Lines 139-145 if ($do_it) { Link Here
139
        $search_params{object} = $object if $object;
139
        $search_params{object} = $object if $object;
140
    }
140
    }
141
141
142
    my @logs = Koha::ActionLogs->search(\%search_params);
142
    my @logs = Koha::ActionLogs->search(\%search_params)->as_list;
143
143
144
    my @data;
144
    my @data;
145
    foreach my $log (@logs) {
145
    foreach my $log (@logs) {
(-)a/virtualshelves/downloadshelf.pl (-1 / +1 lines)
Lines 100-106 if ($shelfid && $format) { Link Here
100
    }
100
    }
101
}
101
}
102
else {
102
else {
103
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
103
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ]);
104
    $template->param(shelfid => $shelfid); 
104
    $template->param(shelfid => $shelfid); 
105
}
105
}
106
$template->param( messages => \@messages );
106
$template->param( messages => \@messages );
(-)a/virtualshelves/shelves.pl (-2 / +1 lines)
Lines 358-364 $template->param( Link Here
358
    messages => \@messages,
358
    messages => \@messages,
359
    public   => $public,
359
    public   => $public,
360
    print    => scalar $query->param('print') || 0,
360
    print    => scalar $query->param('print') || 0,
361
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
361
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ],
362
);
362
);
363
363
364
output_html_with_http_headers $query, $cookie, $template->output;
364
output_html_with_http_headers $query, $cookie, $template->output;
365
- 

Return to bug 29844