Browse Source

Bug 29859: Use iterator instead of as_list

On bug 29844 we decided to remove wantarray from Koha::Objects->search.
Reviewing the difference occurrences I found some unnecessary uses of ->as_list,
where iterators should be used instead.

This patch only removes the obvious places, not the tricky ones.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
master
Jonathan Druart 4 months ago
committed by Fridolin Somers
parent
commit
d02e91f269
  1. 2
      C4/Overdues.pm
  2. 8
      Koha/Acquisition/Currency.pm
  3. 4
      Koha/AudioAlerts.pm
  4. 30
      Koha/Holds.pm
  5. 6
      Koha/Library/Group.pm
  6. 10
      acqui/addorderiso2709.pl
  7. 4
      acqui/basket.pl
  8. 8
      acqui/basketheader.pl
  9. 3
      acqui/duplicate_orders.pl
  10. 6
      acqui/histsearch.pl
  11. 2
      acqui/lateorders.pl
  12. 4
      acqui/neworderempty.pl
  13. 3
      acqui/supplier.pl
  14. 6
      acqui/transferorder.pl
  15. 16
      admin/authorised_values.pl
  16. 12
      admin/branches.pl
  17. 13
      admin/item_circulation_alerts.pl
  18. 2
      admin/itemtypes.pl
  19. 3
      admin/marc_subfields_structure.pl
  20. 4
      admin/sms_providers.pl
  21. 6
      catalogue/item-export.pl
  22. 8
      catalogue/itemsearch.pl
  23. 4
      cataloguing/editor.pl
  24. 2
      circ/circulation.pl
  25. 6
      circ/transfers_to_send.pl
  26. 7
      clubs/clubs.pl
  27. 4
      koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc
  28. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
  29. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
  30. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
  31. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
  32. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
  33. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt
  34. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
  35. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
  36. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt
  37. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt
  38. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt
  39. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt
  40. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt
  41. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
  42. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt
  43. 4
      members/apikeys.pl
  44. 6
      members/boraccount.pl
  45. 6
      members/maninvoice.pl
  46. 7
      members/members-home.pl
  47. 2
      members/moremember.pl
  48. 4
      misc/cronjobs/reconcile_balances.pl
  49. 7
      opac/opac-basket.pl
  50. 18
      opac/opac-downloadcart.pl
  51. 18
      opac/opac-downloadshelf.pl
  52. 8
      opac/opac-memberentry.pl
  53. 4
      opac/opac-messaging.pl
  54. 3
      opac/opac-search.pl
  55. 12
      opac/opac-shelves.pl
  56. 4
      reports/acquisitions_stats.pl
  57. 2
      reports/borrowers_stats.pl
  58. 2
      serials/claims.pl
  59. 2
      serials/subscription-detail.pl
  60. 4
      suggestion/suggestion.pl

2
C4/Overdues.pm

@ -652,7 +652,7 @@ sub GetBranchcodesWithOverdueRules {
|);
if ( $branchcodes->[0] eq '' ) {
# If a default rule exists, all branches should be returned
return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
}
return @$branchcodes;
}

8
Koha/Acquisition/Currency.pm

@ -42,16 +42,12 @@ sub store {
$self->_result->result_source->schema->txn_do( sub {
if ( $self->active ) {
# Remove the active flag from all other active currencies
my @currencies = Koha::Acquisition::Currencies->search(
Koha::Acquisition::Currencies->search(
{
currency => { '!=' => $self->currency },
active => 1,
}
)->as_list;
for my $currency ( @currencies ) {
$currency->active(0);
$currency->store;
}
)->update({ active => 0 });
}
$result = $self->SUPER::store;
});

4
Koha/AudioAlerts.pm

@ -91,14 +91,14 @@ sub move {
if ( $where eq 'up' ) {
unless ( $alert->precedence() == 1 ) {
my ($other) = $self->search( { precedence => $alert->precedence() - 1 } )->as_list;
my $other = $self->search( { precedence => $alert->precedence() - 1 } )->next;
$other->precedence( $alert->precedence() )->store();
$alert->precedence( $alert->precedence() - 1 )->store();
}
}
elsif ( $where eq 'down' ) {
unless ( $alert->precedence() == $self->get_last_precedence() ) {
my ($other) = $self->search( { precedence => $alert->precedence() + 1 } )->as_list;
my $other = $self->search( { precedence => $alert->precedence() + 1 } )->next;
$other->precedence( $alert->precedence() )->store();
$alert->precedence( $alert->precedence() + 1 )->store();
}

30
Koha/Holds.pm

@ -117,22 +117,20 @@ sub get_items_that_can_fill {
push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers;
push @bibs_or_items, 'biblionumber' => { in => \@biblionumbers } if @biblionumbers;
my @branchtransfers = map { $_->itemnumber }
Koha::Item::Transfers->search(
{ datearrived => undef },
{
columns => ['itemnumber'],
collapse => 1,
}
)->as_list;
my @waiting_holds = map { $_->itemnumber }
Koha::Holds->search(
{ 'found' => 'W' },
{
columns => ['itemnumber'],
collapse => 1,
}
)->as_list;
my @branchtransfers = Koha::Item::Transfers->search(
{ datearrived => undef },
{
columns => ['itemnumber'],
collapse => 1,
}
)->get_columns('itemnumber');
my @waiting_holds = Koha::Holds->search(
{ 'found' => 'W' },
{
columns => ['itemnumber'],
collapse => 1,
}
)->get_column('itemnumber');
return Koha::Items->search(
{

6
Koha/Library/Group.pm

@ -111,15 +111,13 @@ sub libraries {
my $in_or_not = $invert ? '-not_in' : '-in';
my @children = Koha::Library::Groups->search(
my @branchcodes = Koha::Library::Groups->search(
{
parent_id => $self->id,
branchcode => { '!=' => undef },
},
{ order_by => 'branchcode' }
)->as_list;
my @branchcodes = map { $_->branchcode } @children;
)->get_column('branchcode');
return Koha::Libraries->search(
{

10
acqui/addorderiso2709.pl

@ -96,12 +96,11 @@ if ($op eq ""){
#
} elsif ($op eq "batch_details"){
#display lines inside the selected batch
# get currencies (for change rates calcs if needed)
my @currencies = Koha::Acquisition::Currencies->search->as_list;
$template->param("batch_details" => 1,
"basketno" => $cgiparams->{'basketno'},
currencies => \@currencies,
# get currencies (for change rates calcs if needed)
currencies => Koha::Acquisition::Currencies->search,
bookseller => $bookseller,
"allmatch" => $allmatch,
);
@ -611,7 +610,6 @@ sub import_biblios_list {
my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
my $item_action = GetImportBatchItemAction($import_batch_id);
my @itypes = Koha::ItemTypes->search->as_list;
$template->param(biblio_list => \@list,
num_results => $num_records,
import_batch_id => $import_batch_id,
@ -622,9 +620,9 @@ sub import_biblios_list {
"item_action_${item_action}" => 1,
item_action => $item_action,
item_error => $item_error,
libraries => scalar Koha::Libraries->search(),
libraries => Koha::Libraries->search,
locationloop => \@locations,
itypeloop => \@itypes,
itemtypes => Koha::ItemTypes->search,
ccodeloop => \@ccodes,
notforloanloop => \@notforloans,
);

4
acqui/basket.pl

@ -424,8 +424,8 @@ if ( $op eq 'list' ) {
unclosable => @orders || @cancelledorders ? $basket->{is_standing} : 1,
has_budgets => $has_budgets,
duplinbatch => $duplinbatch,
csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' })->as_list ],
available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ],
csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }),
available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ),
additional_field_values => { map {
$_->field->name => $_->value
} Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },

8
acqui/basketheader.pl

@ -74,7 +74,7 @@ my $basket;
my $op = $input->param('op');
my $is_an_edit = $input->param('is_an_edit');
$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ] );
$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) );
if ( $op eq 'add_form' ) {
my @contractloop;
@ -116,9 +116,9 @@ if ( $op eq 'add_form' ) {
$template->param(contractloop => \@contractloop,
basketcontractnumber => $basket->{'contractnumber'});
}
my @booksellers = Koha::Acquisition::Booksellers->search(
my $booksellers = Koha::Acquisition::Booksellers->search(
undef,
{ order_by => { -asc => 'name' } } )->as_list;
{ order_by => { -asc => 'name' } } );
$template->param( add_form => 1,
basketname => $basket->{'basketname'},
@ -127,7 +127,7 @@ if ( $op eq 'add_form' ) {
booksellername => $bookseller->name,
booksellerid => $booksellerid,
basketno => $basketno,
booksellers => \@booksellers,
booksellers => $booksellers,
is_standing => $basket->{is_standing},
create_items => $basket->{create_items},
);

3
acqui/duplicate_orders.pl

@ -117,9 +117,8 @@ elsif ( $op eq 'batch_edit' ) {
@{$budget_loop} =
sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
my @currencies = Koha::Acquisition::Currencies->search->as_list;
$template->param(
currencies => \@currencies,
currencies => Koha::Acquisition::Currencies->search,
budget_loop => $budget_loop,
);
}

6
acqui/histsearch.pl

@ -99,10 +99,10 @@ unless ( $input->param('from') ) {
}
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } )->as_list;
$template->param( available_additional_fields => \@additional_fields );
my $additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
$template->param( available_additional_fields => $additional_fields );
my @additional_field_filters;
foreach my $additional_field (@additional_fields) {
while ( my $additional_field = $additional_fields->next ) {
my $value = $input->param('additional_field_' . $additional_field->id);
if (defined $value and $value ne '') {
push @additional_field_filters, {

2
acqui/lateorders.pl

@ -157,6 +157,6 @@ $template->param(
estimateddeliverydatefrom => $estimateddeliverydatefrom,
estimateddeliverydateto => $estimateddeliverydateto,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' })->as_list ],
csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' }),
);
output_html_with_http_headers $input, $cookie, $template->output;

4
acqui/neworderempty.pl

@ -207,7 +207,6 @@ if ( not $ordernumber ) { # create order
}
if ( not $biblionumber and Koha::BiblioFrameworks->find('ACQ') ) {
#my $acq_mss = Koha::MarcSubfieldStructures->search({ frameworkcode => 'ACQ', tagfield => { '!=' => $itemnumber_tag } });
foreach my $tag ( sort keys %{$tagslib} ) {
next if $tag eq '';
next if $tag eq $itemnumber_tag; # skip items fields
@ -326,7 +325,6 @@ $template->param( catalog_details => \@catalog_details, );
my $suggestion;
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
my @currencies = Koha::Acquisition::Currencies->search->as_list;
my $active_currency = Koha::Acquisition::Currencies->get_active;
# build bookfund list
@ -452,7 +450,7 @@ $template->param(
invoiceincgst => $bookseller->invoiceincgst,
cur_active_sym => $active_currency->symbol,
cur_active => $active_currency->currency,
currencies => \@currencies,
currencies => Koha::Acquisition::Currencies->search,
currency => $data->{currency},
vendor_currency => $bookseller->listprice,
orderexists => ( $new eq 'yes' ) ? 0 : 1,

3
acqui/supplier.pl

@ -96,7 +96,6 @@ if ( $op eq 'display' ) {
print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
exit;
} else {
my @currencies = Koha::Acquisition::Currencies->search->as_list;
# get option values from TaxRates syspref
my @gst_values = map {
@ -108,7 +107,7 @@ if ( $op eq 'display' ) {
active => $supplier ? $supplier->active : 1,
tax_rate => $supplier ? $supplier->tax_rate + 0.0 : 0,
gst_values => \@gst_values,
currencies => \@currencies,
currencies => Koha::Acquisition::Currencies->search,
enter => 1,
);
}

6
acqui/transferorder.pl

@ -117,13 +117,13 @@ if( $basketno && $ordernumber) {
# Search for booksellers to transfer from/to
$op = '' unless $op;
if( $op eq "do_search" ) {
my @booksellers = Koha::Acquisition::Booksellers->search(
my $booksellers = Koha::Acquisition::Booksellers->search(
{ name => { -like => "%$query%" } },
{ order_by => { -asc => 'name' } } )->as_list;
{ order_by => { -asc => 'name' } } );
$template->param(
query => $query,
do_search => 1,
booksellersloop => \@booksellers,
booksellers => $booksellers,
);
}
}

16
admin/authorised_values.pl

@ -212,13 +212,15 @@ $template->param(
if ( $op eq 'list' ) {
# build categories list
my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } )->as_list;
my @category_list;
for my $category ( @categories ) {
push( @category_list, $category->category_name );
}
my @category_names = Koha::AuthorisedValueCategories->search(
{
category_name =>
{ -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] }
},
{ order_by => ['category_name'] }
)->get_column('category_name');
$searchfield ||= $category_list[0];
$searchfield ||= $category_names[0];
my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list;
my @loop_data = ();
@ -238,7 +240,7 @@ if ( $op eq 'list' ) {
$template->param(
loop => \@loop_data,
category => Koha::AuthorisedValueCategories->find($searchfield), # TODO Move this up and add a Koha::AVC->authorised_values method to replace call for avs_by_category
categories => \@category_list,
category_names => \@category_names,
);
}

12
admin/branches.pl

@ -49,17 +49,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
if ( $op eq 'add_form' ) {
my $library;
if ($branchcode) {
$library = Koha::Libraries->find($branchcode);
$template->param( selected_smtp_server => $library->smtp_server );
}
my @smtp_servers = Koha::SMTP::Servers->search->as_list;
$template->param(
library => $library,
smtp_servers => \@smtp_servers
library => Koha::Libraries->find($branchcode),
smtp_servers => Koha::SMTP::Servers->search,
);
} elsif ( $op eq 'add_validate' ) {
my @fields = qw(

13
admin/item_circulation_alerts.pl

@ -47,16 +47,15 @@ sub show {
);
my $branch = $input->param('branch') || '*';
my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
my @item_types = Koha::ItemTypes->search->as_list;
my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
my $grid_checkin = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
$template->param(branch => $branch);
$template->param(categories => \@categories);
$template->param(item_types => \@item_types);
$template->param(grid_checkout => $grid_checkout);
$template->param(grid_checkin => $grid_checkin);
$template->param(
branch => $branch,
item_types => Koha::ItemTypes->search,
grid_checkout => $grid_checkout,
grid_checkin => $grid_checkin,
);
output_html_with_http_headers $input, $cookie, $template->output;
}

2
admin/itemtypes.pl

@ -198,7 +198,7 @@ if ( $op eq 'add_form' ) {
if ( $op eq 'list' ) {
$template->param(
itemtypes => scalar Koha::ItemTypes->search,
itemtypes => Koha::ItemTypes->search,
messages => \@messages,
);
}

3
admin/marc_subfields_structure.pl

@ -97,8 +97,7 @@ if ( $op eq 'add_form' ) {
$sth2->finish;
$sth2 = $dbh->prepare("select distinct category from authorised_values");
$sth2->execute;
my @av_cat = Koha::AuthorisedValueCategories->search->as_list;
my @authorised_values = map { $_->category_name } @av_cat;
my @authorised_values= Koha::AuthorisedValueCategories->search->get_column('category_name');
# build thesaurus categories list
my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );

4
admin/sms_providers.pl

@ -62,8 +62,8 @@ elsif ( $op eq 'delete' ) {
$provider->delete() if $provider;
}
my @providers = Koha::SMS::Providers->search->as_list;
my $providers = Koha::SMS::Providers->search;
$template->param( providers => \@providers );
$template->param( providers => $providers );
output_html_with_http_headers $cgi, $cookie, $template->output;

6
catalogue/item-export.pl

@ -36,7 +36,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({
my @itemnumbers = $cgi->multi_param('itemnumber');
my $format = $cgi->param('format') // 'csv';
my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } })->as_list;
my $items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } });
if ($format eq 'barcodes') {
print $cgi->header({
@ -44,14 +44,14 @@ if ($format eq 'barcodes') {
attachment => 'barcodes.txt',
});
foreach my $item (@items) {
while ( my $item = $items->next ) {
print $item->barcode . "\n";
}
exit;
}
$template->param(
results => \@items,
results => $items,
);
print $cgi->header({

8
catalogue/itemsearch.pl

@ -260,13 +260,7 @@ if ( defined $format ) {
# Display the search form
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
my @itemtypes;
foreach my $itemtype ( Koha::ItemTypes->search_with_localization->as_list ) {
push @itemtypes, {
value => $itemtype->itemtype,
label => $itemtype->translated_description,
};
}
my @itemtypes = map { value => $_->itemtype, label => $_->translated_description }, Koha::ItemTypes->search_with_localization->as_list;
my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' });
foreach my $ccode (@ccodes) {

4
cataloguing/editor.pl

@ -49,11 +49,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $schema = Koha::Database->new->schema;
my @keyboard_shortcuts = Koha::KeyboardShortcuts->search->as_list;
# Keyboard shortcuts
$template->param(
shortcuts => \@keyboard_shortcuts,
shortcuts => Koha::KeyboardShortcuts->search,
);
# Available import batches

2
circ/circulation.pl

@ -603,7 +603,7 @@ $template->param(
if ( C4::Context->preference("ExportCircHistory") ) {
$template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
$template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc' }));
}
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;

6
circ/transfers_to_send.pl

@ -41,7 +41,7 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
my $branchcode = C4::Context->userenv->{'branch'};
# transfers requested but not yet sent
my @transfers = Koha::Libraries->search(
my $transfers = Koha::Libraries->search(
{
'branchtransfers_tobranches.frombranch' => $branchcode,
'branchtransfers_tobranches.daterequested' => { '!=' => undef },
@ -53,10 +53,10 @@ my @transfers = Koha::Libraries->search(
prefetch => 'branchtransfers_tobranches',
order_by => 'branchtransfers_tobranches.tobranch'
}
)->as_list;
);
$template->param(
libraries => \@transfers,
libraries => $transfers,
show_date => dt_from_string
);

7
clubs/clubs.pl

@ -45,15 +45,12 @@ my $club_id = $cgi->param('club_id');
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
my @club_templates = Koha::Club::Templates->search->as_list;
my @clubs = Koha::Clubs->search->as_list;
$template->param(
stored => $stored,
club_template => $club_template,
club => $club,
club_templates => \@club_templates,
clubs => \@clubs,
club_templates => Koha::Club::Templates->search,
clubs => Koha::Clubs->search,
);
output_html_with_http_headers( $cgi, $cookie, $template->output );

4
koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc

@ -64,12 +64,12 @@
<select name="issues-table-output-format" id="issues-table-output-format">
<option value="iso2709_995">MARC with items</option>
<option value="iso2709">MARC without items</option>
[% IF csv_profiles.size %]
[% IF csv_profiles.count %]
<option value="csv">CSV</option>
[% END %]
</select>
[% IF csv_profiles.size %]
[% IF csv_profiles.count %]
<select name="csv_profile_id">
[% FOREACH csv_profile IN csv_profiles %]
<option value="[% csv_profile.export_format_id | html %]">[% csv_profile.profile | html %]</option>

8
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt

@ -215,11 +215,11 @@ Batch list
</select>
</li>
<li><label for="itype_item_[% item.item_id | html %]">itype</label><select id="itype_item_[% item.item_id | html %]" name="itype_[% item.biblio_count | html %]">
[% FOREACH itypeloo IN itypeloop %]
[% IF ( itypeloo.itemtype ) == ( item.itype ) %]
<option value="[% itypeloo.itemtype | html %]" selected="selected">[% itypeloo.description | html %]</option>
[% FOREACH itemtype IN itemtypes %]
[% IF itemtype.itemtype == item.itype %]
<option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option>
[% ELSE %]
<option value="[% itypeloo.itemtype | html %]">[% itypeloo.description | html %]</option>
<option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
[% END %]
[% END %]
</select>

2
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt

@ -7,7 +7,7 @@
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
<ul class="dropdown-menu" id="export-csv-menu">
<li><a href="#">Default</a></li>
[% IF csv_profiles %]
[% IF csv_profiles.count %]
[% FOR csv IN csv_profiles %]
<li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
[% END %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt

@ -148,7 +148,7 @@
</ol>
</fieldset>
[% IF available_additional_fields %]
[% IF available_additional_fields.count %]
[% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
[% END %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt

@ -204,7 +204,7 @@
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
<ul class="dropdown-menu" id="export-csv-menu">
<li><a href="#">Default</a></li>
[% IF csv_profiles %]
[% IF csv_profiles.count %]
[% FOR csv IN csv_profiles %]
<li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
[% END %]

4
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt

@ -145,7 +145,7 @@
<input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
<input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
[% FOREACH c IN currencies %]
[% FOREACH c IN currencies.count %]
<input type="hidden" id="currency_rate_[% c.currency | html %]" name="[% c.currency | html %]" value="[% c.rate | html %]" />
[% END %]
@ -399,7 +399,7 @@
<li>
<label for="currency">Currency:</label>
<select name="currency" id="currency" onchange="updateCosts();">
[% FOREACH c IN currencies %]
[% FOREACH c IN currencies.count %]
[% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %]
<option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
[% ELSIF not c.archived %]

4
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt

@ -98,7 +98,7 @@
[% ELSE %]
<h3>Choose a vendor to transfer from</h3>
[% END %]
[% IF ( booksellersloop ) %]
[% IF booksellers.count %]
<table>
<thead>
<tr>
@ -107,7 +107,7 @@
</tr>
</thead>
<tbody>
[% FOREACH bookseller IN booksellersloop %]
[% FOREACH bookseller IN booksellers %]
<tr>
<td>[% bookseller.name | html %]</td>
<td><a class="btn btn-default btn-xs" href="transferorder.pl?[% IF (bookselleridfrom) %]bookselleridto[% ELSE %]bookselleridfrom[% END %]=[% bookseller.id | html %][% IF (ordernumber) %]&ordernumber=[% ordernumber | html %][% END %]">Choose</a></td>

4
koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt

@ -240,7 +240,7 @@ Authorized values &rsaquo; Administration &rsaquo; Koha
<p>
<label for="category_search">Show category: </label>
<select name="searchfield" id="category_search">
[% FOR c IN categories %]
[% FOR c IN category_names %]
[% IF c == searchfield %]
<option value="[% c | html %]" selected="selected">[% c | html %]</option>
[% ELSE %]
@ -323,7 +323,7 @@ Authorized values &rsaquo; Administration &rsaquo; Koha
</tr>
</thead>
<tbody>
[% FOR c IN categories %]
[% FOR c IN category_names %]
<tr>
<td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td>
<td>

4
koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt

@ -220,13 +220,13 @@ Libraries &rsaquo; Administration &rsaquo; Koha
</li>
<li><label for="smtp_server">SMTP server: </label>
<select name="smtp_server" id="smtp_server">
[% IF selected_smtp_server.is_system_default %]
[% IF library AND library.smtp_server.is_system_default %]
<option value="*" selected="selected">Default</option>
[% ELSE %]
<option value="*">Default</option>
[% END %]
[% FOREACH smtp_server IN smtp_servers %]
[% IF smtp_server.id == selected_smtp_server.id %]
[% IF library AND smtp_server.id == library.smtp_server.id %]
<option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
[% ELSE %]
<option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt

@ -37,7 +37,7 @@
<h2>SMS cellular providers</h2>
[% IF providers.size %]
[% IF providers.count %]
<table id="providerst">
<thead>

2
koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt

@ -43,7 +43,7 @@
<h1>Transfers requested of your library as of [% show_date | $KohaDates %]</h1>
[% IF ( libraries ) %]
[% IF libraries.count %]
<p>Your library is the origin for the following transfer(s)</p>
<div id="resultlist">
[% FOREACH library IN libraries %]

8
koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt

@ -65,7 +65,7 @@
</div>
[% END %]
[% IF club_templates %]
[% IF club_templates.count %]
<table id="club-templates-table">
<thead>
<tr>
@ -120,7 +120,7 @@
[% IF CAN_user_clubs_edit_clubs %]
<div class="btn-toolbar">
<div class="btn-group">
[% IF club_templates %]
[% IF club_templates.count %]
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
[% ELSE %]
<button disabled="disabled" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
@ -134,10 +134,10 @@
</div>
[% END %]
[% IF clubs %]
[% IF clubs.count %]
[% INCLUDE 'clubs-table.inc' %]
[% ELSE %]
[% IF club_templates %]
[% IF club_templates.count %]
<div class="dialog message">No clubs defined.</div>
[% ELSE %]
<div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>

2
koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt

@ -74,7 +74,7 @@
</form>
<div id="keys">
[% IF api_keys && api_keys.size > 0 %]
[% IF api_keys.count %]
<p>
<button class="btn btn-default toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new client id/key pair</button>
</p>

2
koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt

@ -185,7 +185,7 @@
[% END %]</tbody>
</table>
[% IF csv_profiles %]
[% IF csv_profiles.count %]
<fieldset class="action">
<label for="csv_code">Select CSV profile:</label>
<select id="csv_profile_for_export">

2
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt

@ -157,7 +157,7 @@
</div> <!-- /.col-sm-6 -->
</div> <!-- /.row -->
[% IF available_additional_fields %]
[% IF available_additional_fields.count %]
<hr>
<div class="row">
<div class="col-sm-6">

2
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt

@ -245,7 +245,7 @@
[% UNLESS hidden.defined('branchcode') %]
<li>
[% IF ( libraries.size > 1 ) %]
[% IF libraries.count %]
<label for="borrower_branchcode" class="[% required.branchcode | html %]">Home library:</label>
<select id="borrower_branchcode" name="borrower_branchcode" class="[% required.branchcode | html %]">

4
members/apikeys.pl

@ -121,10 +121,8 @@ if ($op) {
}
}
my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id })->as_list;
$template->param(
api_keys => \@api_keys,
api_keys => Koha::ApiKeys->search({ patron_id => $patron_id }),
csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $cgi->cookie('CGISESSID') }),
patron => $patron
);

6
members/boraccount.pl

@ -174,10 +174,10 @@ if ( $action eq 'discount' ) {
#get account details
my $total = $patron->account->balance;
my @accountlines = Koha::Account::Lines->search(
my $accountlines = Koha::Account::Lines->search(
{ borrowernumber => $patron->borrowernumber },
{ order_by => { -desc => 'accountlines_id' } }
)->as_list;
);
my $totalcredit;
if($total <= 0){
@ -209,7 +209,7 @@ $template->param(
finesview => 1,
total => sprintf("%.2f",$total),
totalcredit => $totalcredit,
accounts => \@accountlines,
accounts => $accountlines,
payment_id => $payment_id,
change_given => $change_given,
renew_results => $renew_results_display,

6
members/maninvoice.pl

@ -205,12 +205,12 @@ if ($add) {
}
}
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
my $debit_types = Koha::Account::DebitTypes->search_with_library_limits(
{ can_be_invoiced => 1, archived => 0 },
{}, $library_id )->as_list;
{}, $library_id );
$template->param(
debit_types => \@debit_types,
debit_types => $debit_types,
csrf_token => Koha::Token->new->generate_csrf(
{ session_id => scalar $input->cookie('CGISESSID') }
),

7
members/members-home.pl

@ -43,13 +43,14 @@ if( Koha::Libraries->search->count < 1){
$template->param(no_branches => 1);
}
my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
if(scalar(@categories) < 1){
my $categories = Koha::Patron::Categories->search_with_library_limits;
unless ( $categories->count ) {
$no_add = 1;
$template->param(no_categories => 1);
}
else {
$template->param(categories=>\@categories);
# FIXME This does not seem to be used in the template
$template->param(categories => $categories);
}
my $branch =

2
members/moremember.pl

@ -162,7 +162,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) {
}
if ( C4::Context->preference("ExportCircHistory") ) {
$template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
$template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc' }));
}
my $patron_messages = Koha::Patron::Messages->search(

4
misc/cronjobs/reconcile_balances.pl

@ -72,7 +72,7 @@ GetOptions(
pod2usage(1) if $help;
cronlogaction();
my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search(
my @patron_ids = Koha::Account::Lines->search(
{
amountoutstanding => { '<' => 0 },
borrowernumber => { '!=' => undef }
@ -81,7 +81,7 @@ my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search(
columns => [ qw/borrowernumber/ ],
distinct => 1,
}
)->as_list;
)->get_column('borrowernumber');
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });

7
opac/opac-basket.pl

@ -176,11 +176,8 @@ my $resultsarray = \@results;
# my $itemsarray=\@items;
$template->param(
csv_profiles => [
Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 }
)->as_list
],
csv_profiles => Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 } ),
bib_list => $bib_list,
BIBLIO_RESULTS => $resultsarray,
);

18
opac/opac-downloadcart.pl

@ -130,16 +130,14 @@ if ($bib_list && $format) {
} else {
$template->param(
csv_profiles => [
Koha::CsvProfiles->search(
{
type => 'marc',
used_for => 'export_records',
staff_only => 0
}
)->as_list
]
csv_profiles => Koha::CsvProfiles->search(
{
type => 'marc',
used_for => 'export_records',
staff_only => 0
}
),
bib_list => $bib_list,
);
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}

18
opac/opac-downloadshelf.pl

@ -146,17 +146,15 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
$template->param(fullpage => 1);
}
$template->param(
csv_profiles => [
Koha::CsvProfiles->search(
{
type => 'marc',
used_for => 'export_records',
staff_only => 0
}
)->as_list
]
csv_profiles => Koha::CsvProfiles->search(
{
type => 'marc',
used_for => 'export_records',
staff_only => 0
}
),
shelf => $shelf,
);
$template->param( shelf => $shelf );
output_html_with_http_headers $query, $cookie, $template->output;
}

8
opac/opac-memberentry.pl

@ -86,7 +86,7 @@ if ( $action eq 'create' || $action eq 'new' ) {
$params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
if @PatronSelfRegistrationLibraryList;
}
my @libraries = Koha::Libraries->search($params)->as_list;
my $libraries = Koha::Libraries->search($params);
my ( $min, $max ) = C4::Members::get_cardnumber_length();
if ( defined $min ) {
@ -102,7 +102,7 @@ $template->param(
action => $action,
hidden => GetHiddenFields( $mandatory, $action ),
mandatory => $mandatory,
libraries => \@libraries,
libraries => $libraries,
OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
defaultCategory => $defaultCategory,
);
@ -162,7 +162,7 @@ if ( $action eq 'create' ) {
borrower => \%borrower
);
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( undef, $attributes ) );
} elsif ( ! grep { $borrower{branchcode} eq $_->branchcode } @libraries ) {
} elsif ( $libraries->find($borrower{branchcode}) ) {
die "Branchcode not allowed"; # They hack the form
}
else {
@ -625,7 +625,7 @@ sub GeneratePatronAttributesForm {
my ( $borrowernumber, $entered_attributes ) = @_;
# Get all attribute types and the values for this patron (if applicable)
my @types = grep { $_->opac_editable() or $_->opac_display }
my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
Koha::Patron::Attribute::Types->search()->as_list();
if ( scalar(@types) == 0 ) {
return [];

4
opac/opac-messaging.pl

@ -79,8 +79,8 @@ $template->param(
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") );
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
my @providers = Koha::SMS::Providers->search->as_list;
$template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
my $providers = Koha::SMS::Providers->search;
$template->param( sms_providers => $providers, sms_provider_id => $patron->sms_provider_id );
}
my $new_session_id = $cookie->value;

3
opac/opac-search.pl

@ -436,8 +436,7 @@ my %is_nolimit = map { $_ => 1 } @nolimits;
if (@searchCategories > 0) {
my @tabcat;
foreach my $typecategory (@searchCategories) {
my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory })->as_list;
push @tabcat, $_->itemtype for @itemtypes;
push @tabcat, Koha::ItemTypes->search({ searchcategory => $typecategory })->get_column('itemtype');
}
foreach my $itemtypeInCategory (@tabcat) {

12
opac/opac-shelves.pl

@ -397,11 +397,13 @@ if ( $op eq 'view' ) {
itemsloop => \@items_info,
sortfield => $sortfield,
direction => $direction,
csv_profiles => [
Koha::CsvProfiles->search(
{ type => 'marc', used_for => 'export_records', staff_only => 0 }
)->as_list
],
csv_profiles => Koha::CsvProfiles->search(
{
type => 'marc',
used_for => 'export_records',
staff_only => 0
}
),
);
if ( $page ) {
my $pager = $contents->pager;

4
reports/acquisitions_stats.pl

@ -181,7 +181,7 @@ else {
my $CGIsepChoice = GetDelimiterChoices;
my @branches = Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
my $libraries = Koha::Libraries->search({}, { order_by => 'branchname' });
my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
my $ccode_label;
@ -201,7 +201,7 @@ else {
Sort1 => $Sort1,
Sort2 => $Sort2,
CGIsepChoice => $CGIsepChoice,
branches => \@branches,
branches => $libraries,
ccode_label => $ccode_label,
ccode_avlist => $ccode_avlist,
);

2
reports/borrowers_stats.pl

@ -219,7 +219,7 @@ sub calculate {
}
}
my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
my @branchcodes = Koha::Libraries->search->get_column('branchcode');
($status ) and push @loopfilter,{crit=>"Status", filter=>$status };
($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
# year of activity

2
serials/claims.pl

@ -96,7 +96,7 @@ $template->param(
supplierid => $supplierid,
claimletter => $claimletter,
additional_fields_for_subscription => $additional_fields,
csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' })->as_list ],
csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }),
letters => $letters,
(uc(C4::Context->preference("marcflavour"))) => 1
);

2
serials/subscription-detail.pl

@ -126,7 +126,7 @@ my $default_bib_view = get_default_view();
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
$template->param(
available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } )->as_list ],
available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ),
additional_field_values => {
map { $_->field->name => $_->value }
$subscription_object->additional_field_values->as_list

4
suggestion/suggestion.pl

@ -456,9 +456,9 @@ if( $suggestion_ref->{STATUS} ) {
);
}
my @currencies = Koha::Acquisition::Currencies->search->as_list;
my $currencies = Koha::Acquisition::Currencies->search;
$template->param(
currencies => \@currencies,
currencies => $currencies,
suggestion => $suggestion_ref,
price => sprintf("%.2f", $$suggestion_ref{'price'}||0),
total => sprintf("%.2f", $$suggestion_ref{'total'}||0),

Loading…
Cancel
Save