and some more...
There are lot of inconsistencies in our ->search calls. We could
simplify some of them, but not in this patch. Here we want to prevent
regressions as much as possible and so don't add unecessary changes.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
125 files changed:
push @query_params, @$ordernumbers;
}
if ( @$additional_fields ) {
push @query_params, @$ordernumbers;
}
if ( @$additional_fields ) {
- my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields($additional_fields);
+ my @baskets = Koha::Acquisition::Baskets->filter_by_additional_fields($additional_fields)->as_list;
return [] unless @baskets;
return [] unless @baskets;
EnableBorrowerFiles => C4::Context->preference('EnableBorrowerFiles'),
UseCourseReserves => C4::Context->preference("UseCourseReserves"),
useDischarge => C4::Context->preference('useDischarge'),
EnableBorrowerFiles => C4::Context->preference('EnableBorrowerFiles'),
UseCourseReserves => C4::Context->preference("UseCourseReserves"),
useDischarge => C4::Context->preference('useDischarge'),
- pending_checkout_notes => scalar Koha::Checkouts->search({ noteseen => 0 }),
+ pending_checkout_notes => Koha::Checkouts->search({ noteseen => 0 }),
$opac_name = C4::Context->userenv->{'branch'};
}
$opac_name = C4::Context->userenv->{'branch'};
}
- my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' });
+ my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list;
$template->param(
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
LibrarySearchGroups => \@search_groups,
$template->param(
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
LibrarySearchGroups => \@search_groups,
$register_id = $register->id if ($register);
$register_name = $register->name if ($register);
}
$register_id = $register->id if ($register);
$register_name = $register->name if ($register);
}
- my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
+ my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
if ( $type ne 'opac' and C4::Context->preference('AutoLocation') ) {
# we have to check they are coming from the right ip range
if ( $type ne 'opac' and C4::Context->preference('AutoLocation') ) {
# we have to check they are coming from the right ip range
my $library = Koha::Libraries->find($branchcode);
$branchname = $library? $library->branchname: '';
}
my $library = Koha::Libraries->find($branchcode);
$branchname = $library? $library->branchname: '';
}
- my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
+ my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
foreach my $br ( keys %$branches ) {
# now we work with the treatment of ip
foreach my $br ( keys %$branches ) {
# now we work with the treatment of ip
my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees");
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
if ( defined $no_issues_charge_guarantees ) {
my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees");
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
if ( defined $no_issues_charge_guarantees ) {
- my @guarantees = map { $_->guarantee } $patron->guarantee_relationships();
+ my @guarantees = map { $_->guarantee } $patron->guarantee_relationships->as_list;
my $guarantees_non_issues_charges = 0;
foreach my $g ( @guarantees ) {
$guarantees_non_issues_charges += $g->account->non_issues_charges;
my $guarantees_non_issues_charges = 0;
foreach my $g ( @guarantees ) {
$guarantees_non_issues_charges += $g->account->non_issues_charges;
map { $_->{_object} = Koha::Items->find( $_->{itemnumber} ) } @$available_items;
my $libraries = {};
map { $_->{_object} = Koha::Items->find( $_->{itemnumber} ) } @$available_items;
my $libraries = {};
- map { $libraries->{$_->id} = $_ } Koha::Libraries->search();
+ map { $libraries->{$_->id} = $_ } Koha::Libraries->search->as_list;
# group available items by itemnumber
my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items;
# group available items by itemnumber
my %items_by_itemnumber = map { $_->{itemnumber} => $_ } @$available_items;
value_description => $_->description, # Awkward retro-compability...
}
: ()
value_description => $_->description, # Awkward retro-compability...
}
: ()
- } $patron->extended_attributes->search
+ } $patron->extended_attributes->search->as_list
my ($class, $where) = @_;
my @branch_prefs = $class->find($where);
my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
my ($class, $where) = @_;
my @branch_prefs = $class->find($where);
my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
- my @cc = Koha::Patron::Categories->search_with_library_limits;
- my @it = Koha::ItemTypes->search;
+ my @cc = Koha::Patron::Categories->search_with_library_limits->as_list;
+ my @it = Koha::ItemTypes->search->as_list;
my $notification = $where->{notification};
my %disabled = map {
my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
my $notification = $where->{notification};
my %disabled = map {
my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
if ( defined $no_issues_charge_guarantees ) {
my $p = Koha::Patrons->find( $patroninformation->{borrowernumber} );
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
if ( defined $no_issues_charge_guarantees ) {
my $p = Koha::Patrons->find( $patroninformation->{borrowernumber} );
- my @guarantees = map { $_->guarantee } $p->guarantee_relationships;
+ my @guarantees = map { $_->guarantee } $p->guarantee_relationships->as_list;
my $guarantees_non_issues_charges = 0;
foreach my $g ( @guarantees ) {
$guarantees_non_issues_charges += $g->account->non_issues_charges;
my $guarantees_non_issues_charges = 0;
foreach my $g ( @guarantees ) {
$guarantees_non_issues_charges += $g->account->non_issues_charges;
|);
if ( $branchcodes->[0] eq '' ) {
# If a default rule exists, all branches should be returned
|);
if ( $branchcodes->[0] eq '' ) {
# If a default rule exists, all branches should be returned
- return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' });
+ return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
}
return @$branchcodes;
}
}
return @$branchcodes;
}
sub AutoUnsuspendReserves {
my $today = dt_from_string();
sub AutoUnsuspendReserves {
my $today = dt_from_string();
- my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } );
+ my @holds = Koha::Holds->search( { suspend_until => { '<=' => $today->ymd() } } )->as_list;
map { $_->resume() } @holds;
}
map { $_->resume() } @holds;
}
sub ItemsAnyAvailableAndNotRestricted {
my $param = shift;
sub ItemsAnyAvailableAndNotRestricted {
my $param = shift;
- my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } );
+ my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list;
foreach my $i (@items) {
my $reserves_control_branch =
foreach my $i (@items) {
my $reserves_control_branch =
$params->{borrowernumber} = $borrowernumber if $borrowernumber;
$params->{biblionumber} = $biblionumber if $biblionumber;
$params->{borrowernumber} = $borrowernumber if $borrowernumber;
$params->{biblionumber} = $biblionumber if $biblionumber;
- my @holds = Koha::Holds->search($params);
+ my @holds = Koha::Holds->search($params)->as_list;
if ($suspend) {
map { $_->suspend_hold($suspend_until) } @holds;
if ($suspend) {
map { $_->suspend_hold($suspend_until) } @holds;
my ( $borrowernumber, $biblionumber ) = @_;
my $patron = Koha::Patrons->find($borrowernumber);
my ( $borrowernumber, $biblionumber ) = @_;
my $patron = Koha::Patrons->find($borrowernumber);
- my @items = Koha::Items->search( { biblionumber => $biblionumber } );
+ my @items = Koha::Items->search( { biblionumber => $biblionumber } )->as_list;
my $controlbranch = C4::Context->preference('ReservesControlBranch');
my $controlbranch = C4::Context->preference('ReservesControlBranch');
borrowernumber => $self->{borrowernumber},
code => $a->{code}
}
borrowernumber => $self->{borrowernumber},
code => $a->{code}
}
foreach my $attribute ( @attributes ) {
my $value = $attribute->attribute();
foreach my $attribute ( @attributes ) {
my $value = $attribute->attribute();
my $results_hashref = ();
# TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter
my $results_hashref = ();
# TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter
- $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search };
+ $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search->as_list };
# Initialize variables for the faceted results objects
my $facets_counter = {};
# Initialize variables for the faceted results objects
my $facets_counter = {};
});
#Build branchnames hash
});
#Build branchnames hash
- my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
+ my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
# FIXME - We build an authorised values hash here, using the default framework
# though it is possible to have different authvals for different fws.
# FIXME - We build an authorised values hash here, using the default framework
# though it is possible to have different authvals for different fws.
my $additional_fields = $args->{additional_fields} // [];
my $matching_record_ids_for_additional_fields = [];
if ( @$additional_fields ) {
my $additional_fields = $args->{additional_fields} // [];
my $matching_record_ids_for_additional_fields = [];
if ( @$additional_fields ) {
- my @subscriptions = Koha::Subscriptions->filter_by_additional_fields($additional_fields);
+ my @subscriptions = Koha::Subscriptions->filter_by_additional_fields($additional_fields)->as_list;
return () unless @subscriptions;
return () unless @subscriptions;
my $ccodes =
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) };
my $ccodes =
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) };
- my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
+ my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
my $xml = '';
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
my $xml = '';
if ( $where eq 'up' ) {
unless ( $alert->precedence() == 1 ) {
if ( $where eq 'up' ) {
unless ( $alert->precedence() == 1 ) {
- my ($other) = $self->search( { precedence => $alert->precedence() - 1 } );
+ my ($other) = $self->search( { precedence => $alert->precedence() - 1 } )->as_list;
$other->precedence( $alert->precedence() )->store();
$alert->precedence( $alert->precedence() - 1 )->store();
}
}
elsif ( $where eq 'down' ) {
unless ( $alert->precedence() == $self->get_last_precedence() ) {
$other->precedence( $alert->precedence() )->store();
$alert->precedence( $alert->precedence() - 1 )->store();
}
}
elsif ( $where eq 'down' ) {
unless ( $alert->precedence() == $self->get_last_precedence() ) {
- my ($other) = $self->search( { precedence => $alert->precedence() + 1 } );
+ my ($other) = $self->search( { precedence => $alert->precedence() + 1 } )->as_list;
$other->precedence( $alert->precedence() )->store();
$alert->precedence( $alert->precedence() + 1 )->store();
}
$other->precedence( $alert->precedence() )->store();
$alert->precedence( $alert->precedence() + 1 )->store();
}
sub fix_precedences {
my ($self) = @_;
sub fix_precedences {
my ($self) = @_;
- my @alerts = $self->search();
+ my @alerts = $self->search->as_list;
my $i = 1;
map { $_->precedence( $i++ )->store() } @alerts;
my $i = 1;
map { $_->precedence( $i++ )->store() } @alerts;
my $cached = $memory_cache->get_from_cache($cache_key);
return @$cached if $cached;
my $cached = $memory_cache->get_from_cache($cache_key);
return @$cached if $cached;
- my @avs = $self->search_by_koha_field($params);
+ my @avs = $self->search_by_koha_field($params)->as_list;
my @descriptions = map {
{
authorised_value => $_->authorised_value,
my @descriptions = map {
{
authorised_value => $_->authorised_value,
my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
return {
my $loggedinuser = C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
return {
- lists => scalar Koha::Virtualshelves->search(
+ lists => Koha::Virtualshelves->search(
[
{ public => 0, owner => $loggedinuser },
{ public => 1 }
[
{ public => 0, owner => $loggedinuser },
{ public => 1 }
return unless $self->id();
return unless $self->id();
- return scalar Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } );
+ return Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } );
my $borrower = $params->{borrower};
if ($borrower) {
delete( $params->{borrower} );
my $borrower = $params->{borrower};
if ($borrower) {
delete( $params->{borrower} );
- my @enrollments = $borrower->get_club_enrollments();
+ my @enrollments = $borrower->get_club_enrollments->as_list;
if (@enrollments) {
$params->{'me.id'} = { -not_in => [ map { $_->club()->id() } @enrollments ] };
}
if (@enrollments) {
$params->{'me.id'} = { -not_in => [ map { $_->club()->id() } @enrollments ] };
}
-my @libraries = $group->libraries( { [invert => 1] } );
+my $libraries = $group->libraries( { [invert => 1] } );
Returns the libraries set as direct children of this group.
Returns the libraries set as direct children of this group.
branchcode => { '!=' => undef },
},
{ order_by => 'branchcode' }
branchcode => { '!=' => undef },
},
{ order_by => 'branchcode' }
my @branchcodes = map { $_->branchcode } @children;
my @branchcodes = map { $_->branchcode } @children;
=head3 libraries_not_direct_children
=head3 libraries_not_direct_children
-my @libraries = $group->libraries_not_direct_children();
+my $libraries = $group->libraries_not_direct_children();
Returns the libraries *not* set as direct children of this group
Returns the libraries *not* set as direct children of this group
-my @search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']}))
+my $search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']}))
Returns search groups for the specified interface.
Defaults to OPAC if no interface is specified.
Returns search groups for the specified interface.
Defaults to OPAC if no interface is specified.
=head3 filter_by_additional_fields
=head3 filter_by_additional_fields
- my @objects = Koha::Foos->filter_by_additional_fields([
+ my $objects = Koha::Foos->filter_by_additional_fields([
{
id => 1,
value => 'foo',
{
id => 1,
value => 'foo',
# This pref should then govern the results of other routines/methods such as
# Koha::Virtualshelf->new->delete too.
# FIXME Could be $patron->get_lists
# This pref should then govern the results of other routines/methods such as
# Koha::Virtualshelf->new->delete too.
# FIXME Could be $patron->get_lists
- $_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } );
+ $_->delete for Koha::Virtualshelves->search( { owner => $self->borrowernumber } )->as_list;
# We cannot have a FK on borrower_modifications.borrowernumber, the table is also used
# for patron selfreg
# We cannot have a FK on borrower_modifications.borrowernumber, the table is also used
# for patron selfreg
- $_->delete for Koha::Patron::Modifications->search( { borrowernumber => $self->borrowernumber } );
+ $_->delete for Koha::Patron::Modifications->search( { borrowernumber => $self->borrowernumber } )->as_list;
-my @routinglists = $patron->get_routing_lists
+my $routinglists = $patron->get_routing_lists
Returns the routing lists a patron is subscribed to.
Returns the routing lists a patron is subscribed to.
- my @relationships = $patron->add_guarantor(
+ my $relationship = $patron->add_guarantor(
{
borrowernumber => $borrowernumber,
relationships => $relationship,
{
borrowernumber => $borrowernumber,
relationships => $relationship,
{ borrowernumber => $patron->borrowernumber,
code => $code
}
{ borrowernumber => $patron->borrowernumber,
code => $code
}
}
foreach my $attr ( @{$extended_attributes} ) {
$attr->{attribute} = exists $attr->{attribute} ? $attr->{attribute} : $attr->{value};
}
foreach my $attr ( @{$extended_attributes} ) {
$attr->{attribute} = exists $attr->{attribute} ? $attr->{attribute} : $attr->{value};
my $checkouts =
($checked_in)
my $checkouts =
($checked_in)
- ? $c->objects->search( scalar $biblio->old_checkouts )
- : $c->objects->search( scalar $biblio->current_checkouts );
+ ? $c->objects->search( $biblio->old_checkouts )
+ : $c->objects->search( $biblio->current_checkouts );
return $c->render(
status => 200,
return $c->render(
status => 200,
return try {
my $patron_id = $c->validation->param('patron_id');
return try {
my $patron_id = $c->validation->param('patron_id');
- my $patron = $c->objects->find( scalar Koha::Patrons->search_limited, $patron_id );
+ my $patron = $c->objects->find( Koha::Patrons->search_limited, $patron_id );
unless ($patron) {
return $c->render(
unless ($patron) {
return $c->render(
my @search_field_names = qw( author itype location su-geo title-series subject ccode holdingbranch homebranch ln );
my @faceted_fields = Koha::SearchFields->search(
{ name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
my @search_field_names = qw( author itype location su-geo title-series subject ccode holdingbranch homebranch ln );
my @faceted_fields = Koha::SearchFields->search(
{ name => { -in => \@search_field_names }, facet_order => { '!=' => undef } }, { order_by => ['facet_order'] }
my @not_faceted_fields = Koha::SearchFields->search(
{ name => { -in => \@search_field_names }, facet_order => undef }, { order_by => ['facet_order'] }
my @not_faceted_fields = Koha::SearchFields->search(
{ name => { -in => \@search_field_names }, facet_order => undef }, { order_by => ['facet_order'] }
# This could certainly be improved
return ( @faceted_fields, @not_faceted_fields );
}
# This could certainly be improved
return ( @faceted_fields, @not_faceted_fields );
}
if defined $biblio;
}
} else {
if defined $biblio;
}
} else {
- @libraries = Koha::Libraries->search( { pickup_location => 1 }, { order_by => ['branchname'] } )
+ @libraries = Koha::Libraries->search( { pickup_location => 1 }, { order_by => ['branchname'] } )->as_list
my ($self) = @_;
my $branch_limit =
C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
my ($self) = @_;
my $branch_limit =
C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
- return scalar Koha::Desks->search(
+ return Koha::Desks->search(
{ branchcode => $branch_limit },
{ order_by => { '-asc' => 'desk_name' } }
);
{ branchcode => $branch_limit },
{ order_by => { '-asc' => 'desk_name' } }
);
# Do something with $upload->count, $upload->result or $upload->err
# get some upload records (in staff) via Koha::UploadedFiles
# Do something with $upload->count, $upload->result or $upload->err
# get some upload records (in staff) via Koha::UploadedFiles
- my @uploads1 = Koha::UploadedFiles->search({ filename => $name });
- my @uploads2 = Koha::UploadedFiles->search_term({ term => $term });
+ my $uploads1 = Koha::UploadedFiles->search({ filename => $name });
+ my $uploads2 = Koha::UploadedFiles->search_term({ term => $term });
# staff download (via Koha::UploadedFile[s])
my $rec = Koha::UploadedFiles->find( $id );
# staff download (via Koha::UploadedFile[s])
my $rec = Koha::UploadedFiles->find( $id );
} elsif ($op eq "batch_details"){
#display lines inside the selected batch
# get currencies (for change rates calcs if needed)
} elsif ($op eq "batch_details"){
#display lines inside the selected batch
# get currencies (for change rates calcs if needed)
- my @currencies = Koha::Acquisition::Currencies->search;
+ my @currencies = Koha::Acquisition::Currencies->search->as_list;
$template->param("batch_details" => 1,
"basketno" => $cgiparams->{'basketno'},
$template->param("batch_details" => 1,
"basketno" => $cgiparams->{'basketno'},
my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
my $item_action = GetImportBatchItemAction($import_batch_id);
my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
my $item_action = GetImportBatchItemAction($import_batch_id);
- my @itypes = Koha::ItemTypes->search;
+ my @itypes = Koha::ItemTypes->search->as_list;
$template->param(biblio_list => \@list,
num_results => $num_records,
import_batch_id => $import_batch_id,
$template->param(biblio_list => \@list,
num_results => $num_records,
import_batch_id => $import_batch_id,
unclosable => @orders || @cancelledorders ? $basket->{is_standing} : 1,
has_budgets => $has_budgets,
duplinbatch => $duplinbatch,
unclosable => @orders || @cancelledorders ? $basket->{is_standing} : 1,
has_budgets => $has_budgets,
duplinbatch => $duplinbatch,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }) ],
- available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' })->as_list ],
+ available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ],
additional_field_values => { map {
$_->field->name => $_->value
} Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
additional_field_values => { map {
$_->field->name => $_->value
} Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
my $op = $input->param('op');
my $is_an_edit = $input->param('is_an_edit');
my $op = $input->param('op');
my $is_an_edit = $input->param('is_an_edit');
-$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ] );
+$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ] );
if ( $op eq 'add_form' ) {
my @contractloop;
if ( $op eq 'add_form' ) {
my @contractloop;
}
my @booksellers = Koha::Acquisition::Booksellers->search(
undef,
}
my @booksellers = Koha::Acquisition::Booksellers->search(
undef,
- { order_by => { -asc => 'name' } } );
+ { order_by => { -asc => 'name' } } )->as_list;
$template->param( add_form => 1,
basketname => $basket->{'basketname'},
$template->param( add_form => 1,
basketname => $basket->{'basketname'},
} else {
@suppliers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$supplier%" } },
} else {
@suppliers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$supplier%" } },
- { order_by => { -asc => 'name' } } );
+ { order_by => { -asc => 'name' } } )->as_list;
}
my $supplier_count = @suppliers;
}
my $supplier_count = @suppliers;
@{$budget_loop} =
sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
@{$budget_loop} =
sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
- my @currencies = Koha::Acquisition::Currencies->search;
+ my @currencies = Koha::Acquisition::Currencies->search->as_list;
$template->param(
currencies => \@currencies,
budget_loop => $budget_loop,
$template->param(
currencies => \@currencies,
budget_loop => $budget_loop,
}
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
}
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
-my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
+my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } )->as_list;
$template->param( available_additional_fields => \@additional_fields );
my @additional_field_filters;
foreach my $additional_field (@additional_fields) {
$template->param( available_additional_fields => \@additional_fields );
my @additional_field_filters;
foreach my $additional_field (@additional_fields) {
-my @suppliers = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } );
+my @suppliers = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } )->as_list;
my $suppliers_loop = [];
my $suppliername;
foreach (@suppliers) {
my $suppliers_loop = [];
my $suppliername;
foreach (@suppliers) {
estimateddeliverydatefrom => $estimateddeliverydatefrom,
estimateddeliverydateto => $estimateddeliverydateto,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
estimateddeliverydatefrom => $estimateddeliverydatefrom,
estimateddeliverydateto => $estimateddeliverydateto,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' })->as_list ],
);
output_html_with_http_headers $input, $cookie, $template->output;
);
output_html_with_http_headers $input, $cookie, $template->output;
my $suggestion;
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
my $suggestion;
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
-my @currencies = Koha::Acquisition::Currencies->search;
+my @currencies = Koha::Acquisition::Currencies->search->as_list;
my $active_currency = Koha::Acquisition::Currencies->get_active;
# build bookfund list
my $active_currency = Koha::Acquisition::Currencies->get_active;
# build bookfund list
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
my @itemtypes;
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
my @itemtypes;
-@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
+@itemtypes = Koha::ItemTypes->search->as_list unless C4::Context->preference('item-level_itypes');
if ( defined $from_subscriptionid ) {
# Get the last received order for this subscription
if ( defined $from_subscriptionid ) {
# Get the last received order for this subscription
freight => $freight,
name => $bookseller->name,
active_currency => $active_currency,
freight => $freight,
name => $bookseller->name,
active_currency => $active_currency,
- currencies => scalar $currencies->search({ rate => { '!=' => 1 } }),
+ currencies => $currencies->search({ rate => { '!=' => 1 } }),
invoiceincgst => $bookseller->invoiceincgst,
bookfund => $budget->{budget_name},
creator => $creator,
invoiceincgst => $bookseller->invoiceincgst,
bookfund => $budget->{budget_name},
creator => $creator,
print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
exit;
} else {
print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
exit;
} else {
- my @currencies = Koha::Acquisition::Currencies->search;
+ my @currencies = Koha::Acquisition::Currencies->search->as_list;
# get option values from TaxRates syspref
my @gst_values = map {
# get option values from TaxRates syspref
my @gst_values = map {
if( $op eq "do_search" ) {
my @booksellers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$query%" } },
if( $op eq "do_search" ) {
my @booksellers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$query%" } },
- { order_by => { -asc => 'name' } } );
+ { order_by => { -asc => 'name' } } )->as_list;
$template->param(
query => $query,
do_search => 1,
$template->param(
query => $query,
do_search => 1,
Koha::AudioAlerts->fix_precedences();
}
Koha::AudioAlerts->fix_precedences();
}
-$template->param( AudioAlertsPage => 1, audio_alerts => scalar Koha::AudioAlerts->search() );
+$template->param( AudioAlertsPage => 1, audio_alerts => Koha::AudioAlerts->search() );
output_html_with_http_headers $cgi, $cookie, $template->output;
output_html_with_http_headers $cgi, $cookie, $template->output;
push @authorised_value_categories, 'itemtypes';
# build thesaurus categories list
push @authorised_value_categories, 'itemtypes';
# build thesaurus categories list
- my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
+ my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );
# build value_builder list
my @value_builder=('');
# build value_builder list
my @value_builder=('');
if ( $op eq 'list' ) {
# build categories list
if ( $op eq 'list' ) {
# build categories list
- my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } );
+ my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } )->as_list;
my @category_list;
for my $category ( @categories ) {
push( @category_list, $category->category_name );
my @category_list;
for my $category ( @categories ) {
push( @category_list, $category->category_name );
$searchfield ||= $category_list[0];
$searchfield ||= $category_list[0];
- my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } );
+ my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list;
my @loop_data = ();
# builds value list
for my $av ( @avs_by_category ) {
my @loop_data = ();
# builds value list
for my $av ( @avs_by_category ) {
$template->param( selected_smtp_server => $library->smtp_server );
}
$template->param( selected_smtp_server => $library->smtp_server );
}
- my @smtp_servers = Koha::SMTP::Servers->search;
+ my @smtp_servers = Koha::SMTP::Servers->search->as_list;
$template->param(
library => $library,
$template->param(
library => $library,
$cn_source ? Koha::ClassSources->find($cn_source) : undef;
$template->param(
class_source => $class_source,
$cn_source ? Koha::ClassSources->find($cn_source) : undef;
$template->param(
class_source => $class_source,
- sort_rules => scalar Koha::ClassSortRules->search,
- split_rules => scalar Koha::ClassSplitRules->search,
+ sort_rules => Koha::ClassSortRules->search,
+ split_rules => Koha::ClassSplitRules->search,
);
}
elsif ( $op eq "add_source_validate" ) {
);
}
elsif ( $op eq "add_source_validate" ) {
);
my $branch = $input->param('branch') || '*';
);
my $branch = $input->param('branch') || '*';
- my @categories = Koha::Patron::Categories->search_with_library_limits;
- my @item_types = Koha::ItemTypes->search;
+ my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
+ my @item_types = Koha::ItemTypes->search->as_list;
my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
my $grid_checkin = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
my $grid_checkin = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
foreach my $col ( @cols ) {
my $found;
my $readonly = $col =~ /\.(biblio|biblioitem|item)number$/;
foreach my $col ( @cols ) {
my $found;
my $readonly = $col =~ /\.(biblio|biblioitem|item)number$/;
- foreach my $row ( $kohafields->search({ kohafield => $col }) ) {
+ foreach my $row ( $kohafields->search({ kohafield => $col })->as_list ) {
$found = 1;
push @loop_data, {
kohafield => $col,
$found = 1;
push @loop_data, {
kohafield => $col,
$sth2->finish;
$sth2 = $dbh->prepare("select distinct category from authorised_values");
$sth2->execute;
$sth2->finish;
$sth2 = $dbh->prepare("select distinct category from authorised_values");
$sth2->execute;
- my @av_cat = Koha::AuthorisedValueCategories->search;
+ my @av_cat = Koha::AuthorisedValueCategories->search->as_list;
my @authorised_values = map { $_->category_name } @av_cat;
# build thesaurus categories list
my @authorised_values = map { $_->category_name } @av_cat;
# build thesaurus categories list
- my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
+ my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );
# build value_builder list
my @value_builder = ('');
# build value_builder list
my @value_builder = ('');
-my @branches = Koha::Libraries->search();
+my @branches = Koha::Libraries->search->as_list;
my @branch_od_info;
foreach my $branch ( @branches ){
my $od_info = Koha::Library::OverDriveInfos->find($branch->branchcode);
my @branch_od_info;
foreach my $branch ( @branches ){
my $od_info = Koha::Library::OverDriveInfos->find($branch->branchcode);
} elsif ( $options{'choices'} eq 'staff-templates' ) {
$options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) }
} elsif ( $options{choices} eq 'patron-categories' ) {
} elsif ( $options{'choices'} eq 'staff-templates' ) {
$options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) }
} elsif ( $options{choices} eq 'patron-categories' ) {
- $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search };
+ $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search->as_list };
$add_blank = 1;
} else {
die 'Unrecognized source of preference values: ' . $options{'choices'};
$add_blank = 1;
} else {
die 'Unrecognized source of preference values: ' . $options{'choices'};
$provider->delete() if $provider;
}
$provider->delete() if $provider;
}
-my @providers = Koha::SMS::Providers->search();
+my @providers = Koha::SMS::Providers->search->as_list;
$template->param( providers => \@providers );
$template->param( providers => \@providers );
$have_matrix = keys %$cost_matrix if $cost_matrix;
}
$have_matrix = keys %$cost_matrix if $cost_matrix;
}
-my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' });
+my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
my (@branchfromloop, @errors);
foreach my $branchfrom ( @branchloop ) {
my $fromcode = $branchfrom->{code};
my (@branchfromloop, @errors);
foreach my $branchfrom ( @branchloop ) {
my $fromcode = $branchfrom->{code};
$template->param(
BIBLIO_RESULTS => $resultsarray,
$template->param(
BIBLIO_RESULTS => $resultsarray,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
+ csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }),
bib_list => $bib_list,
);
bib_list => $bib_list,
);
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
+ $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }));
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}
join => 'item',
order_by => 'timestamp',
}
join => 'item',
order_by => 'timestamp',
}
my @old_checkouts = Koha::Old::Checkouts->search(
{ biblionumber => $biblionumber },
{
join => 'item',
order_by => 'timestamp',
}
my @old_checkouts = Koha::Old::Checkouts->search(
{ biblionumber => $biblionumber },
{
join => 'item',
order_by => 'timestamp',
}
my $biblio = Koha::Biblios->find( $biblionumber );
my $biblio = Koha::Biblios->find( $biblionumber );
my @itemnumbers = $cgi->multi_param('itemnumber');
my $format = $cgi->param('format') // 'csv';
my @itemnumbers = $cgi->multi_param('itemnumber');
my $format = $cgi->param('format') // 'csv';
-my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } });
+my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } })->as_list;
if ($format eq 'barcodes') {
print $cgi->header({
if ($format eq 'barcodes') {
print $cgi->header({
# Display the search form
# Display the search form
-my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } );
+my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
-foreach my $itemtype ( Koha::ItemTypes->search_with_localization ) {
+foreach my $itemtype ( Koha::ItemTypes->search_with_localization->as_list ) {
push @itemtypes, {
value => $itemtype->itemtype,
label => $itemtype->translated_description,
push @itemtypes, {
value => $itemtype->itemtype,
label => $itemtype->translated_description,
- Koha::Library::Groups->get_search_groups( { interface => 'staff' } );
+ Koha::Library::Groups->get_search_groups( { interface => 'staff' } )->as_list;
@search_groups = sort { $a->title cmp $b->title } @search_groups;
$template->param(
@search_groups = sort { $a->title cmp $b->title } @search_groups;
$template->param(
my $schema = Koha::Database->new->schema;
my $schema = Koha::Database->new->schema;
-my @keyboard_shortcuts = Koha::KeyboardShortcuts->search();
+my @keyboard_shortcuts = Koha::KeyboardShortcuts->search->as_list;
# Keyboard shortcuts
$template->param(
# Keyboard shortcuts
$template->param(
}
my $cn_source = $cgi->param('cn_source') || C4::Context->preference("DefaultClassificationSource");
}
my $cn_source = $cgi->param('cn_source') || C4::Context->preference("DefaultClassificationSource");
- my @class_sources = Koha::ClassSources->search({ used => 1});
+ my @class_sources = Koha::ClassSources->search({ used => 1})->as_list;
#Don't show half the results of show lt or gt
$real_limit = $results_per_page if $search ne $q;
#Don't show half the results of show lt or gt
$real_limit = $results_per_page if $search ne $q;
- my @itemtypes = Koha::ItemTypes->search;
+ my @itemtypes = Koha::ItemTypes->search->as_list;
$template->param(
itypeloop => \@itemtypes,
$template->param(
itypeloop => \@itemtypes,
- my @itemtypes = Koha::ItemTypes->search;
+ my @itemtypes = Koha::ItemTypes->search->as_list;
$template->param( #classlist => $classlist,
itypeloop => \@itemtypes,
$template->param( #classlist => $classlist,
itypeloop => \@itemtypes,
$template->param(
branchcode => $branchcode,
$template->param(
branchcode => $branchcode,
- article_requests_requested => scalar Koha::ArticleRequests->requested($branchcode),
- article_requests_pending => scalar Koha::ArticleRequests->pending($branchcode),
- article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode),
+ article_requests_requested => Koha::ArticleRequests->requested($branchcode),
+ article_requests_pending => Koha::ArticleRequests->pending($branchcode),
+ article_requests_processing => Koha::ArticleRequests->processing($branchcode),
);
output_html_with_http_headers $query, $cookie, $template->output;
);
output_html_with_http_headers $query, $cookie, $template->output;
my @relatives;
if ( $patron ) {
my @relatives;
if ( $patron ) {
- if ( my @guarantors = $patron->guarantor_relationships()->guarantors() ) {
+ if ( my @guarantors = $patron->guarantor_relationships()->guarantors->as_list ) {
push( @relatives, $_->id ) for @guarantors;
push( @relatives, $_->id ) for @guarantors;
- push( @relatives, $_->id ) for $patron->siblings();
+ push( @relatives, $_->id ) for $patron->siblings->as_list;
- push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees();
+ push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees->as_list;
}
}
my $relatives_issues_count =
}
}
my $relatives_issues_count =
if ( C4::Context->preference("ExportCircHistory") ) {
if ( C4::Context->preference("ExportCircHistory") ) {
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
}
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
}
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
prefetch => 'branchtransfers_tobranches',
order_by => 'branchtransfers_tobranches.tobranch'
}
prefetch => 'branchtransfers_tobranches',
order_by => 'branchtransfers_tobranches.tobranch'
}
$template->param(
libraries => \@transfers,
$template->param(
libraries => \@transfers,
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
-my @club_templates = Koha::Club::Templates->search();
-my @clubs = Koha::Clubs->search();
+my @club_templates = Koha::Club::Templates->search->as_list;
+my @clubs = Koha::Clubs->search->as_list;
$template->param(
stored => $stored,
$template->param(
stored => $stored,
my $patron = Koha::Patrons->find($patronnumber);
my $patron = Koha::Patrons->find($patronnumber);
-my @enrollments = $patron->get_club_enrollments();
-my @clubs = $patron->get_enrollable_clubs();
+my @enrollments = $patron->get_club_enrollments->as_list;
+my @clubs = $patron->get_enrollable_clubs->as_list;
$template->param(
enrollments => \@enrollments,
$template->param(
enrollments => \@enrollments,
backends => $backends,
types => [ "Book", "Article", "Journal" ],
query_type => $op,
backends => $backends,
types => [ "Book", "Article", "Journal" ],
query_type => $op,
- branches => scalar Koha::Libraries->search,
+ branches => Koha::Libraries->search,
);
output_html_with_http_headers( $cgi, $cookie, $template->output );
);
output_html_with_http_headers( $cgi, $cookie, $template->output );
$template->param(
fresh_api_key => $api_key,
$template->param(
fresh_api_key => $api_key,
- api_keys => scalar Koha::ApiKeys->search({ patron_id => $patron_id }),
+ api_keys => Koha::ApiKeys->search({ patron_id => $patron_id }),
-my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id });
+my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id })->as_list;
$template->param(
api_keys => \@api_keys,
$template->param(
api_keys => \@api_keys,
my @accountlines = Koha::Account::Lines->search(
{ borrowernumber => $patron->borrowernumber },
{ order_by => { -desc => 'accountlines_id' } }
my @accountlines = Koha::Account::Lines->search(
{ borrowernumber => $patron->borrowernumber },
{ order_by => { -desc => 'accountlines_id' } }
my $totalcredit;
if($total <= 0){
my $totalcredit;
if($total <= 0){
my @credit_types = Koha::Account::CreditTypes->search_with_library_limits(
{ can_be_added_manually => 1, archived => 0 },
my @credit_types = Koha::Account::CreditTypes->search_with_library_limits(
{ can_be_added_manually => 1, archived => 0 },
+ {}, $library_id )->as_list;
$template->param(
patron => $patron,
$template->param(
patron => $patron,
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
{ can_be_invoiced => 1, archived => 0 },
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
{ can_be_invoiced => 1, archived => 0 },
+ {}, $library_id )->as_list;
$template->param(
debit_types => \@debit_types,
$template->param(
debit_types => \@debit_types,
}
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
}
if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) {
- my @providers = Koha::SMS::Providers->search();
+ my @providers = Koha::SMS::Providers->search->as_list;
$template->param( sms_providers => \@providers );
}
$template->param( sms_providers => \@providers );
}
my @messages;
## Deal with guarantor stuff
my @messages;
## Deal with guarantor stuff
-$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
+$template->param( relationships => $patron->guarantor_relationships ) if $patron;
my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1;
@relations = ('') unless @relations;
my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1;
@relations = ('') unless @relations;
$template->param(no_branches => 1);
}
$template->param(no_branches => 1);
}
-my @categories = Koha::Patron::Categories->search_with_library_limits;
+my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
if(scalar(@categories) < 1){
$no_add = 1;
$template->param(no_categories => 1);
if(scalar(@categories) < 1){
$no_add = 1;
$template->param(no_categories => 1);
foreach my $type (@modified_atypes) {
my $type_obj = Koha::Patron::Attribute::Types->find($type);
my @before = Koha::Patron::Attributes->search(
foreach my $type (@modified_atypes) {
my $type_obj = Koha::Patron::Attribute::Types->find($type);
my @before = Koha::Patron::Attributes->search(
- { borrowernumber => $pm->{borrowernumber}, code => $type } );
+ { borrowernumber => $pm->{borrowernumber}, code => $type } )->as_list;
my @after = grep { $_->code eq $type } @{ $pm->{extended_attributes} };
push @{$modified_attributes}, { type => $type_obj, before => \@before, after => \@after };
}
my @after = grep { $_->code eq $type } @{ $pm->{extended_attributes} };
push @{$modified_attributes}, { type => $type_obj, before => \@before, after => \@after };
}
my @relatives;
my $guarantor_relationships = $patron->guarantor_relationships;
my @relatives;
my $guarantor_relationships = $patron->guarantor_relationships;
-my @guarantees = $patron->guarantee_relationships->guarantees;
-my @guarantors = $guarantor_relationships->guarantors;
+my @guarantees = $patron->guarantee_relationships->guarantees->as_list;
+my @guarantors = $guarantor_relationships->guarantors->as_list;
if (@guarantors) {
push( @relatives, $_->id ) for @guarantors;
if (@guarantors) {
push( @relatives, $_->id ) for @guarantors;
- push( @relatives, $_->id ) for $patron->siblings();
+ push( @relatives, $_->id ) for $patron->siblings->as_list;
}
else {
push( @relatives, $_->id ) for @guarantees;
}
else {
push( @relatives, $_->id ) for @guarantees;
}
if ( C4::Context->preference("ExportCircHistory") ) {
}
if ( C4::Context->preference("ExportCircHistory") ) {
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
}
my $patron_messages = Koha::Patron::Messages->search(
}
my $patron_messages = Koha::Patron::Messages->search(
@selected_accountlines = Koha::Account::Lines->search(
$search_params,
{ order_by => 'date' }
@selected_accountlines = Koha::Account::Lines->search(
$search_params,
{ order_by => 'date' }
my $sum = Koha::Account::Lines->search(
$search_params,
my $sum = Koha::Account::Lines->search(
$search_params,
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
my $overdues = [
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
my $overdues = [
- map { $_->unblessed_all_relateds } $patron->get_overdues
+ map { $_->unblessed_all_relateds } $patron->get_overdues->as_list
];
my $letter = parse_overdues_letter(
];
my $letter = parse_overdues_letter(
# But we should not hit that with a normal use of the interface
die "You are doing something wrong updating this child" unless $adult_category;
# But we should not hit that with a normal use of the interface
die "You are doing something wrong updating this child" unless $adult_category;
- $_->delete() for $patron->guarantor_relationships();
+ $_->delete() for $patron->guarantor_relationships->as_list;
$patron->categorycode($adult_category->categorycode);
$patron->store;
$patron->categorycode($adult_category->categorycode);
$patron->store;
if ($delete_items) {
my $deleted_count = 0;
my $biblio = Koha::Biblios->find( $biblionumber );
if ($delete_items) {
my $deleted_count = 0;
my $biblio = Koha::Biblios->find( $biblionumber );
- my @items = Koha::Items->search( { biblionumber => $biblionumber } );
+ my @items = Koha::Items->search( { biblionumber => $biblionumber } )->as_list;
foreach my $item ( @items ) {
my $itemnumber = $item->itemnumber;
foreach my $item ( @items ) {
my $itemnumber = $item->itemnumber;
columns => [ qw/borrowernumber/ ],
distinct => 1,
}
columns => [ qw/borrowernumber/ ],
distinct => 1,
}
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });
my $borrower = Koha::Patrons->find($borrowernumber);
my $borrower = Koha::Patrons->find($borrowernumber);
-my @enrollments = $borrower->get_club_enrollments();
-my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 );
+my @enrollments = $borrower->get_club_enrollments->as_list;
+my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 )->as_list;
$template->param(
enrollments => \@enrollments,
$template->param(
enrollments => \@enrollments,
my @relatives;
# Filter out guarantees that don't want guarantor to see checkouts
my @relatives;
# Filter out guarantees that don't want guarantor to see checkouts
- foreach my $gr ( $patron->guarantee_relationships() ) {
+ foreach my $gr ( $patron->guarantee_relationships->as_list ) {
my $g = $gr->guarantee;
if ( $g->privacy_guarantor_fines ) {
my $g = $gr->guarantee;
if ( $g->privacy_guarantor_fines ) {
csv_profiles => [
Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 }
csv_profiles => [
Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 }
],
bib_list => $bib_list,
BIBLIO_RESULTS => $resultsarray,
],
bib_list => $bib_list,
BIBLIO_RESULTS => $resultsarray,
used_for => 'export_records',
staff_only => 0
}
used_for => 'export_records',
staff_only => 0
}
]
);
$template->param(bib_list => $bib_list);
]
);
$template->param(bib_list => $bib_list);
used_for => 'export_records',
staff_only => 0
}
used_for => 'export_records',
staff_only => 0
}
]
);
$template->param( shelf => $shelf );
]
);
$template->param( shelf => $shelf );
$params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
if @PatronSelfRegistrationLibraryList;
}
$params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
if @PatronSelfRegistrationLibraryList;
}
-my @libraries = Koha::Libraries->search($params);
+my @libraries = Koha::Libraries->search($params)->as_list;
my ( $min, $max ) = C4::Members::get_cardnumber_length();
if ( defined $min ) {
my ( $min, $max ) = C4::Members::get_cardnumber_length();
if ( defined $min ) {
my @values = $cgi->multi_param('patron_attribute_value');
my @editable_attribute_types
my @values = $cgi->multi_param('patron_attribute_value');
my @editable_attribute_types
- = map { $_->code } Koha::Patron::Attribute::Types->search({ opac_editable => 1 });
+ = map { $_->code } Koha::Patron::Attribute::Types->search({ opac_editable => 1 })->as_list;
my $ea = each_array( @codes, @values );
my @attributes;
my $ea = each_array( @codes, @values );
my @attributes;
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") );
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") );
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
- my @providers = Koha::SMS::Providers->search();
+ my @providers = Koha::SMS::Providers->search->as_list;
$template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
}
$template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
}
if (@searchCategories > 0) {
my @tabcat;
foreach my $typecategory (@searchCategories) {
if (@searchCategories > 0) {
my @tabcat;
foreach my $typecategory (@searchCategories) {
- my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory });
+ my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory })->as_list;
push @tabcat, $_->itemtype for @itemtypes;
}
push @tabcat, $_->itemtype for @itemtypes;
}
csv_profiles => [
Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 }
csv_profiles => [
Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 }
{
my @relatives;
# Filter out guarantees that don't want guarantor to see checkouts
{
my @relatives;
# Filter out guarantees that don't want guarantor to see checkouts
- foreach my $gr ( $patron->guarantee_relationships() ) {
+ foreach my $gr ( $patron->guarantee_relationships->as_list ) {
my $g = $gr->guarantee;
push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
}
my $g = $gr->guarantee;
push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
}
{
my @relatives_with_fines;
# Filter out guarantees that don't want guarantor to see checkouts
{
my @relatives_with_fines;
# Filter out guarantees that don't want guarantor to see checkouts
- foreach my $gr ( $patron->guarantee_relationships() ) {
+ foreach my $gr ( $patron->guarantee_relationships->as_list ) {
my $g = $gr->guarantee;
push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
}
my $g = $gr->guarantee;
push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
}
my $CGIsepChoice = GetDelimiterChoices;
my $CGIsepChoice = GetDelimiterChoices;
- my @branches = Koha::Libraries->search({}, { order_by => 'branchname' });
+ my @branches = Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
my $ccode_label;
my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
my $ccode_label;
- my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
+ my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
($status ) and push @loopfilter,{crit=>"Status", filter=>$status };
($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
# year of activity
($status ) and push @loopfilter,{crit=>"Status", filter=>$status };
($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
# year of activity
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
-our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
+our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
$template->param(do_it => $do_it,
);
$template->param(do_it => $do_it,
);
-my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
+my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
}
}
elsif ( $crit =~ /category/ ) {
}
}
elsif ( $crit =~ /category/ ) {
- my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
+ my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
foreach my $patron_category ( @patron_categories ) {
( $value eq $patron_category->categorycode ) or next;
$display_value = $patron_category->description and last;
foreach my $patron_category ( @patron_categories ) {
( $value eq $patron_category->categorycode ) or next;
$display_value = $patron_category->description and last;
$template->param( always_show_holds => $always_show_holds );
my $show_holds_now = $input->param('show_holds_now');
unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){
$template->param( always_show_holds => $always_show_holds );
my $show_holds_now = $input->param('show_holds_now');
unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){
- my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } );
+ my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } )->as_list;
foreach my $res (
sort {
my $a_found = $a->found() || '';
foreach my $res (
sort {
my $a_found = $a->found() || '';
my $supplier=$query->param('supplier');
my @suppliers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$supplier%" } },
my $supplier=$query->param('supplier');
my @suppliers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$supplier%" } },
- { order_by => { -asc => 'name' } } );
+ { order_by => { -asc => 'name' } } )->as_list;
#build result page
my $loop_suppliers = [];
#build result page
my $loop_suppliers = [];
supplierid => $supplierid,
claimletter => $claimletter,
additional_fields_for_subscription => $additional_fields,
supplierid => $supplierid,
claimletter => $claimletter,
additional_fields_for_subscription => $additional_fields,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' })->as_list ],
letters => $letters,
(uc(C4::Context->preference("marcflavour"))) => 1
);
letters => $letters,
(uc(C4::Context->preference("marcflavour"))) => 1
);
-my @additional_fields = Koha::AdditionalFields->search( { tablename => 'subscription', searchable => 1 } );
+my @additional_fields = Koha::AdditionalFields->search( { tablename => 'subscription', searchable => 1 } )->as_list;
my @additional_field_filters;
for my $field ( @additional_fields ) {
my $value = $query->param( 'additional_field_' . $field->id );
my @additional_field_filters;
for my $field ( @additional_fields ) {
my $value = $query->param( 'additional_field_' . $field->id );
- my @branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] } );
+ my @branches = Koha::Libraries->search( {}, { order_by => ['branchcode'] } )->as_list;
my @branches_loop;
foreach my $b ( @branches ) {
my $selected = 0;
my @branches_loop;
foreach my $b ( @branches ) {
my $selected = 0;
locations_loop=>$locations_loop,
);
locations_loop=>$locations_loop,
);
-my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
+my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' })->as_list;
my %additional_field_values;
if ($subscriptionid) {
my $subscription = Koha::Subscriptions->find($subscriptionid);
my %additional_field_values;
if ($subscriptionid) {
my $subscription = Koha::Subscriptions->find($subscriptionid);
push @subscriptions, $subscription if $subscription;
}
push @subscriptions, $subscription if $subscription;
}
-my @additional_fields = Koha::AdditionalFields->search({tablename => 'subscription'});
+my @additional_fields = Koha::AdditionalFields->search({tablename => 'subscription'})->as_list;
my $batchedit = $cgi->param('batchedit');
if ($batchedit) {
my $batchedit = $cgi->param('batchedit');
if ($batchedit) {
$template->param(
subscriptions => \@subscriptions,
$template->param(
subscriptions => \@subscriptions,
- booksellers => [ Koha::Acquisition::Booksellers->search() ],
+ booksellers => [ Koha::Acquisition::Booksellers->search->as_list ],
additional_fields => \@additional_fields,
referrer => scalar $cgi->param('referrer'),
);
additional_fields => \@additional_fields,
referrer => scalar $cgi->param('referrer'),
);
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
$template->param(
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
$template->param(
- available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } ) ],
+ available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } )->as_list ],
additional_field_values => {
map { $_->field->name => $_->value }
$subscription_object->additional_field_values->as_list
additional_field_values => {
map { $_->field->name => $_->value }
$subscription_object->additional_field_values->as_list
-my @currencies = Koha::Acquisition::Currencies->search;
+my @currencies = Koha::Acquisition::Currencies->search->as_list;
$template->param(
currencies => \@currencies,
suggestion => $suggestion_ref,
$template->param(
currencies => \@currencies,
suggestion => $suggestion_ref,
my $schema = Koha::Database->new()->schema();
$schema->storage->txn_begin();
my $schema = Koha::Database->new()->schema();
$schema->storage->txn_begin();
-map { $_->delete() } Koha::AudioAlerts->search();
+map { $_->delete() } Koha::AudioAlerts->search->as_list;
## Check the basics
# Creating 3 audio alerts named a, b and c
## Check the basics
# Creating 3 audio alerts named a, b and c
$a->move('bottom');
# Changed precedence order from database insert order
# Insert order was a, b, c. Precedence order is now b, c, a.
$a->move('bottom');
# Changed precedence order from database insert order
# Insert order was a, b, c. Precedence order is now b, c, a.
-( $b, $c, $a ) = Koha::AudioAlerts->search();
+( $b, $c, $a ) = Koha::AudioAlerts->search->as_list;
is( $b->selector, 'B', 'First sound is indeed B' );
is( $b->precedence, 1, "Alert B has a precedence of 1" );
is( $b->selector, 'B', 'First sound is indeed B' );
is( $b->precedence, 1, "Alert B has a precedence of 1" );
is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' );
my @authorised_values =
is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' );
my @authorised_values =
- Koha::AuthorisedValues->new()->search( { category => 'av_for_testing' } );
+ Koha::AuthorisedValues->new()->search( { category => 'av_for_testing' } )->as_list;
is( @authorised_values, 3, "Get correct number of values" );
my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode};
is( @authorised_values, 3, "Get correct number of values" );
my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode};
$av1->add_library_limit( $branchcode1 );
$av1->add_library_limit( $branchcode1 );
-@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode1 );
+@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode1 )->as_list;
is( @authorised_values, 3, "Search including value with a branch limit ( branch can use the limited value ) gives correct number of results" );
is( @authorised_values, 3, "Search including value with a branch limit ( branch can use the limited value ) gives correct number of results" );
-@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 );
+@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 )->as_list;
is( @authorised_values, 2, "Search including value with a branch limit ( branch *cannot* use the limited value ) gives correct number of results" );
$av1->del_library_limit( $branchcode1 );
is( @authorised_values, 2, "Search including value with a branch limit ( branch *cannot* use the limited value ) gives correct number of results" );
$av1->del_library_limit( $branchcode1 );
-@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 );
+@authorised_values = Koha::AuthorisedValues->search_with_library_limits( { category => 'av_for_testing' }, {}, $branchcode2 )->as_list;
is( @authorised_values, 3, "Branch limitation deleted successfully" );
$av1->add_library_limit( $branchcode1 );
is( @authorised_values, 3, "Branch limitation deleted successfully" );
$av1->add_library_limit( $branchcode1 );
# CloneBudgetPeriod
# Let's make sure our timestamp is old
# CloneBudgetPeriod
# Let's make sure our timestamp is old
-my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id });
+my @orig_funds = Koha::Acquisition::Funds->search({ budget_period_id => $budget_period_id })->as_list;
foreach my $fund (@orig_funds){
$fund->timestamp('1999-12-31 23:59:59')->store;
}
foreach my $fund (@orig_funds){
$fund->timestamp('1999-12-31 23:59:59')->store;
}
$insertSth->execute('BKghjklo3', 'Yet another type of book', 'Qwertyware', 0);
# Azertyware should not exist.
$insertSth->execute('BKghjklo3', 'Yet another type of book', 'Qwertyware', 0);
# Azertyware should not exist.
- my @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Azertyware' });
+ my @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Azertyware' })->as_list;
is( @itemtypes, 0, 'Search item types by searchcategory: Invalid category returns nothing');
is( @itemtypes, 0, 'Search item types by searchcategory: Invalid category returns nothing');
- @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Qwertyware' });
+ @itemtypes = Koha::ItemTypes->search({ searchcategory => 'Qwertyware' })->as_list;
my @got = map { $_->itemtype } @itemtypes;
my @expected = ( 'BKghjklo2', 'BKghjklo3' );
is_deeply(\@got,\@expected,'Search item types by searchcategory: valid category returns itemtypes');
my @got = map { $_->itemtype } @itemtypes;
my @expected = ( 'BKghjklo2', 'BKghjklo3' );
is_deeply(\@got,\@expected,'Search item types by searchcategory: valid category returns itemtypes');
id => $foo->id,
value => 'foo value for basket1',
},
id => $foo->id,
value => 'foo value for basket1',
},
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
id => $foo->id,
value => 'foo value for basket2',
},
id => $foo->id,
value => 'foo value for basket2',
},
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket2->basketno, 'result is basket2');
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket2->basketno, 'result is basket2');
id => $bar->id,
value => 'bar value for basket1',
},
id => $bar->id,
value => 'bar value for basket1',
},
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
id => $bar->id,
value => 'bar value for basket2',
},
id => $bar->id,
value => 'bar value for basket2',
},
is(scalar @baskets, 0, 'search returns no result');
is(scalar @baskets, 0, 'search returns no result');
id => $foo->id,
value => 'foo',
},
id => $foo->id,
value => 'foo',
},
is(scalar @baskets, 2, 'search returns two results');
is(scalar @baskets, 2, 'search returns two results');
id => $foo->id,
value => 'basket1',
},
id => $foo->id,
value => 'basket1',
},
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
is(scalar @baskets, 1, 'search returns only one result');
is($baskets[0]->basketno, $basket1->basketno, 'result is basket1');
my $root_group =
Koha::Library::Group->new( { title => "Test root group" } )->store();
my $root_group =
Koha::Library::Group->new( { title => "Test root group" } )->store();
-my @root_groups = Koha::Library::Groups->get_root_groups();
+my @root_groups = Koha::Library::Groups->get_root_groups->as_list;
my $in_list = any { $_->id eq $root_group->id } @root_groups;
ok( $in_list, 'New root group is in the list returned by the get_root_groups method');
my $in_list = any { $_->id eq $root_group->id } @root_groups;
ok( $in_list, 'New root group is in the list returned by the get_root_groups method');
is( ref( $library ), 'Koha::Library', 'Method library returns a Koha::Library object' );
is( $library->id, $groupA_library1->branchcode, 'Branchcode for fetched library matches' );
is( ref( $library ), 'Koha::Library', 'Method library returns a Koha::Library object' );
is( $library->id, $groupA_library1->branchcode, 'Branchcode for fetched library matches' );
-my @libraries_not_direct_children = $groupA->libraries_not_direct_children();
+my @libraries_not_direct_children = $groupA->libraries_not_direct_children->as_list;
$in_list = any { $_->id eq $groupA_library1->branchcode } @libraries_not_direct_children;
ok( !$in_list, 'Method libraries_not_direct_children returns all libraries not direct descendants of group, library 1 is not in the list');
$in_list = any { $_->id eq $groupA1_library2->branchcode } @libraries_not_direct_children;
$in_list = any { $_->id eq $groupA_library1->branchcode } @libraries_not_direct_children;
ok( !$in_list, 'Method libraries_not_direct_children returns all libraries not direct descendants of group, library 1 is not in the list');
$in_list = any { $_->id eq $groupA1_library2->branchcode } @libraries_not_direct_children;
$groupA = Koha::Library::Groups->find( $groupA->id );
$groupB = Koha::Library::Groups->find( $groupB->id );
$groupA = Koha::Library::Groups->find( $groupA->id );
$groupB = Koha::Library::Groups->find( $groupB->id );
- my @groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' });
+ my @groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list;
is_deeply( $groups[0]->unblessed, $groupA->unblessed, 'Get search groups opac should return enabled group' );
is_deeply( $groups[0]->unblessed, $groupA->unblessed, 'Get search groups opac should return enabled group' );
- @groups = Koha::Library::Groups->get_search_groups({ interface => 'staff' });
+ @groups = Koha::Library::Groups->get_search_groups({ interface => 'staff' })->as_list;
is_deeply( $groups[0]->unblessed, $groupB->unblessed, 'Get search groups staff should return enabled group' );
};
is_deeply( $groups[0]->unblessed, $groupB->unblessed, 'Get search groups staff should return enabled group' );
};
( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 )
|);
( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 )
|);
-my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
+my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' );
my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' );
$b3_new = Koha::Patrons->find( $b3->borrowernumber() );
is( t::lib::Dates::compare( $b3_new->updated_on, $now), 0, "borrowers.updated_on should have been set to now on updating" );
$b3_new = Koha::Patrons->find( $b3->borrowernumber() );
is( t::lib::Dates::compare( $b3_new->updated_on, $now), 0, "borrowers.updated_on should have been set to now on updating" );
-my @patrons = Koha::Patrons->search( { branchcode => $branchcode } );
+my @patrons = Koha::Patrons->search( { branchcode => $branchcode } )->as_list;
is( @patrons, 3, "Found 3 patrons with Search" );
my $unexistent = Koha::Patrons->find( '1234567890' );
is( @patrons, 3, "Found 3 patrons with Search" );
my $unexistent = Koha::Patrons->find( '1234567890' );
is($holds->next->priority, 1, 'Item is correctly priority 1');
is($holds->next->priority, 2, 'Item is correctly priority 2');
is($holds->next->priority, 1, 'Item is correctly priority 1');
is($holds->next->priority, 2, 'Item is correctly priority 2');
-my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting();
+my @reserves = Koha::Holds->search({ borrowernumber => $requesters{$branch_3} })->waiting->as_list;
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the reserve for the correct borrower' );
is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the reserve for the correct borrower' );
subtest 'Call search_term with[out] private flag' => sub {
plan tests => 3;
subtest 'Call search_term with[out] private flag' => sub {
plan tests => 3;
- my @recs = Koha::UploadedFiles->search_term({ term => 'file' });
+ my @recs = Koha::UploadedFiles->search_term({ term => 'file' })->as_list;
is( @recs, 1, 'Returns only one public result' );
is( $recs[0]->filename, 'file3', 'Should be file3' );
is( @recs, 1, 'Returns only one public result' );
is( $recs[0]->filename, 'file3', 'Should be file3' );
my $today = dt_from_string;
$today->subtract( minutes => 2 ); # should be enough :)
my $dt = $today->clone->subtract( days => 1 );
my $today = dt_from_string;
$today->subtract( minutes => 2 ); # should be enough :)
my $dt = $today->clone->subtract( days => 1 );
- foreach my $rec ( Koha::UploadedFiles->search({ permanent => 1 }) ) {
+ foreach my $rec ( Koha::UploadedFiles->search({ permanent => 1 })->as_list ) {
$rec->dtcreated($dt)->store;
}
$rec->dtcreated($dt)->store;
}
- my @recs = Koha::UploadedFiles->search({ permanent => 0 });
+ my @recs = Koha::UploadedFiles->search({ permanent => 0 })->as_list;
$dt = $today->clone->subtract( days => 3 );
$recs[0]->dtcreated($dt)->store;
$dt = $today->clone->subtract( days => 5 );
$dt = $today->clone->subtract( days => 3 );
$recs[0]->dtcreated($dt)->store;
$dt = $today->clone->subtract( days => 5 );
location => $additional_content->location,
branchcode => $additional_content->branchcode,
}
location => $additional_content->location,
branchcode => $additional_content->branchcode,
}
};
$category = $additional_content->category;
}
};
$category = $additional_content->category;
}
# Display the form
$template->param(
op => 'form',
# Display the form
$template->param(
op => 'form',
- lists => scalar Koha::Virtualshelves->search(
+ lists => Koha::Virtualshelves->search(
[
{ public => 0, owner => $loggedinuser },
{ public => 1 }
[
{ public => 0, owner => $loggedinuser },
{ public => 1 }
# Display the form
$template->param(
view => 'form',
# Display the form
$template->param(
view => 'form',
- lists => scalar Koha::Virtualshelves->search(
+ lists => Koha::Virtualshelves->search(
[
{ public => 0, owner => $loggedinuser },
{ public => 1 }
[
{ public => 0, owner => $loggedinuser },
{ public => 1 }
itemtypes => $itemtypes,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
itemtypes => $itemtypes,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ],
messages => \@messages,
);
messages => \@messages,
);
);
# get the patron categories and pass them to the template
);
# get the patron categories and pass them to the template
-my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
+my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
$template->param( categories => \@patron_categories );
my $columns = C4::Templates::GetColumnDefs( $input )->{borrowers};
$columns = [ grep { $_->{field} ne 'borrowernumber' ? $_ : () } @$columns ];
$template->param( categories => \@patron_categories );
my $columns = C4::Templates::GetColumnDefs( $input )->{borrowers};
$columns = [ grep { $_->{field} ne 'borrowernumber' ? $_ : () } @$columns ];
# the full set.
@notforloans = @{$staton->{'items.notforloan'}} if defined $staton->{'items.notforloan'} and scalar @{$staton->{'items.notforloan'}} > 0;
# the full set.
@notforloans = @{$staton->{'items.notforloan'}} if defined $staton->{'items.notforloan'} and scalar @{$staton->{'items.notforloan'}} > 0;
-my @class_sources = Koha::ClassSources->search({ used => 1 });
+my @class_sources = Koha::ClassSources->search({ used => 1 })->as_list;
my $pref_class = C4::Context->preference("DefaultClassificationSource");
my $pref_class = C4::Context->preference("DefaultClassificationSource");
-my @itemtypes = Koha::ItemTypes->search;
+my @itemtypes = Koha::ItemTypes->search->as_list;
my @selected_itemtypes;
foreach my $itemtype ( @itemtypes ) {
if ( defined $input->param('itemtype-' . $itemtype->itemtype) ) {
my @selected_itemtypes;
foreach my $itemtype ( @itemtypes ) {
if ( defined $input->param('itemtype-' . $itemtype->itemtype) ) {
my @patron_attributes_codes;
my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
my @patron_attributes_codes;
my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
- my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
+ my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
while ( my $attr_type = $patron_attribute_types->next ) {
# TODO Repeatable attributes are not correctly managed and can cause data lost.
# This should be implemented.
while ( my $attr_type = $patron_attribute_types->next ) {
# TODO Repeatable attributes are not correctly managed and can cause data lost.
# This should be implemented.
our $input = CGI->new;
my $dbh = C4::Context->dbh;
our $input = CGI->new;
my $dbh = C4::Context->dbh;
-my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } );
+my @patron_categories = Koha::Patron::Categories->search( { overduenoticerequired => { '>' => 0 } } )->as_list;
my @category_codes = map { $_->categorycode } @patron_categories;
our @rule_params = qw(delay letter debarred);
my @category_codes = map { $_->categorycode } @patron_categories;
our @rule_params = qw(delay letter debarred);
$search_params{object} = $object if $object;
}
$search_params{object} = $object if $object;
}
- my @logs = Koha::ActionLogs->search(\%search_params);
+ my @logs = Koha::ActionLogs->search(\%search_params)->as_list;
my @data;
foreach my $log (@logs) {
my @data;
foreach my $log (@logs) {
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ]);
$template->param(shelfid => $shelfid);
}
$template->param( messages => \@messages );
$template->param(shelfid => $shelfid);
}
$template->param( messages => \@messages );
messages => \@messages,
public => $public,
print => scalar $query->param('print') || 0,
messages => \@messages,
public => $public,
print => scalar $query->param('print') || 0,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ],
);
output_html_with_http_headers $query, $cookie, $template->output;
);
output_html_with_http_headers $query, $cookie, $template->output;