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

(-)a/C4/Overdues.pm (-1 / +1 lines)
Lines 652-658 sub GetBranchcodesWithOverdueRules { Link Here
652
    |);
652
    |);
653
    if ( $branchcodes->[0] eq '' ) {
653
    if ( $branchcodes->[0] eq '' ) {
654
        # If a default rule exists, all branches should be returned
654
        # If a default rule exists, all branches should be returned
655
        return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
655
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
656
    }
656
    }
657
    return @$branchcodes;
657
    return @$branchcodes;
658
}
658
}
(-)a/Koha/Acquisition/Currency.pm (-6 / +2 lines)
Lines 42-57 sub store { Link Here
42
    $self->_result->result_source->schema->txn_do( sub {
42
    $self->_result->result_source->schema->txn_do( sub {
43
        if ( $self->active ) {
43
        if ( $self->active ) {
44
            # Remove the active flag from all other active currencies
44
            # Remove the active flag from all other active currencies
45
            my @currencies = Koha::Acquisition::Currencies->search(
45
            Koha::Acquisition::Currencies->search(
46
                {
46
                {
47
                    currency => { '!=' => $self->currency },
47
                    currency => { '!=' => $self->currency },
48
                    active => 1,
48
                    active => 1,
49
                }
49
                }
50
            )->as_list;
50
            )->update({ active => 0 });
51
            for my $currency ( @currencies ) {
52
                $currency->active(0);
53
                $currency->store;
54
            }
55
        }
51
        }
56
        $result = $self->SUPER::store;
52
        $result = $self->SUPER::store;
57
    });
53
    });
(-)a/Koha/AudioAlerts.pm (-2 / +2 lines)
Lines 91-104 sub move { Link Here
91
91
92
    if ( $where eq 'up' ) {
92
    if ( $where eq 'up' ) {
93
        unless ( $alert->precedence() == 1 ) {
93
        unless ( $alert->precedence() == 1 ) {
94
            my ($other) = $self->search( { precedence => $alert->precedence() - 1 } )->as_list;
94
            my $other = $self->search( { precedence => $alert->precedence() - 1 } )->next;
95
            $other->precedence( $alert->precedence() )->store();
95
            $other->precedence( $alert->precedence() )->store();
96
            $alert->precedence( $alert->precedence() - 1 )->store();
96
            $alert->precedence( $alert->precedence() - 1 )->store();
97
        }
97
        }
98
    }
98
    }
99
    elsif ( $where eq 'down' ) {
99
    elsif ( $where eq 'down' ) {
100
        unless ( $alert->precedence() == $self->get_last_precedence() ) {
100
        unless ( $alert->precedence() == $self->get_last_precedence() ) {
101
            my ($other) = $self->search( { precedence => $alert->precedence() + 1 } )->as_list;
101
            my $other = $self->search( { precedence => $alert->precedence() + 1 } )->next;
102
            $other->precedence( $alert->precedence() )->store();
102
            $other->precedence( $alert->precedence() )->store();
103
            $alert->precedence( $alert->precedence() + 1 )->store();
103
            $alert->precedence( $alert->precedence() + 1 )->store();
104
        }
104
        }
(-)a/Koha/Holds.pm (-16 / +14 lines)
Lines 117-138 sub get_items_that_can_fill { Link Here
117
    push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers;
117
    push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers;
118
    push @bibs_or_items, 'biblionumber' => { in => \@biblionumbers } if @biblionumbers;
118
    push @bibs_or_items, 'biblionumber' => { in => \@biblionumbers } if @biblionumbers;
119
119
120
    my @branchtransfers = map { $_->itemnumber }
120
    my @branchtransfers = Koha::Item::Transfers->search(
121
      Koha::Item::Transfers->search(
121
        { datearrived => undef },
122
          { datearrived => undef },
122
        {
123
          {
123
            columns  => ['itemnumber'],
124
              columns => ['itemnumber'],
124
            collapse => 1,
125
              collapse => 1,
125
        }
126
          }
126
    )->get_columns('itemnumber');
127
      )->as_list;
127
    my @waiting_holds = Koha::Holds->search(
128
    my @waiting_holds = map { $_->itemnumber }
128
        { 'found' => 'W' },
129
      Koha::Holds->search(
129
        {
130
          { 'found' => 'W' },
130
            columns  => ['itemnumber'],
131
          {
131
            collapse => 1,
132
              columns => ['itemnumber'],
132
        }
133
              collapse => 1,
133
    )->get_column('itemnumber');
134
          }
135
      )->as_list;
136
134
137
    return Koha::Items->search(
135
    return Koha::Items->search(
138
        {
136
        {
(-)a/Koha/Library/Group.pm (-4 / +2 lines)
Lines 111-125 sub libraries { Link Here
111
111
112
    my $in_or_not = $invert ? '-not_in' : '-in';
112
    my $in_or_not = $invert ? '-not_in' : '-in';
113
113
114
    my @children = Koha::Library::Groups->search(
114
    my @branchcodes = Koha::Library::Groups->search(
115
        {
115
        {
116
            parent_id  => $self->id,
116
            parent_id  => $self->id,
117
            branchcode => { '!=' => undef },
117
            branchcode => { '!=' => undef },
118
        },
118
        },
119
        { order_by => 'branchcode' }
119
        { order_by => 'branchcode' }
120
    )->as_list;
120
    )->get_column('branchcode');
121
122
    my @branchcodes = map { $_->branchcode } @children;
123
121
124
    return Koha::Libraries->search(
122
    return Koha::Libraries->search(
125
        {
123
        {
(-)a/acqui/addorderiso2709.pl (-6 / +4 lines)
Lines 96-107 if ($op eq ""){ Link Here
96
#
96
#
97
} elsif ($op eq "batch_details"){
97
} elsif ($op eq "batch_details"){
98
#display lines inside the selected batch
98
#display lines inside the selected batch
99
    # get currencies (for change rates calcs if needed)
100
    my @currencies = Koha::Acquisition::Currencies->search->as_list;
101
99
102
    $template->param("batch_details" => 1,
100
    $template->param("batch_details" => 1,
103
                     "basketno"      => $cgiparams->{'basketno'},
101
                     "basketno"      => $cgiparams->{'basketno'},
104
                     currencies => \@currencies,
102
                     # get currencies (for change rates calcs if needed)
103
                     currencies => Koha::Acquisition::Currencies->search,
105
                     bookseller => $bookseller,
104
                     bookseller => $bookseller,
106
                     "allmatch" => $allmatch,
105
                     "allmatch" => $allmatch,
107
                     );
106
                     );
Lines 611-617 sub import_biblios_list { Link Here
611
    my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
610
    my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
612
    my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
611
    my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
613
    my $item_action = GetImportBatchItemAction($import_batch_id);
612
    my $item_action = GetImportBatchItemAction($import_batch_id);
614
    my @itypes = Koha::ItemTypes->search->as_list;
615
    $template->param(biblio_list => \@list,
613
    $template->param(biblio_list => \@list,
616
                        num_results => $num_records,
614
                        num_results => $num_records,
617
                        import_batch_id => $import_batch_id,
615
                        import_batch_id => $import_batch_id,
Lines 622-630 sub import_biblios_list { Link Here
622
                        "item_action_${item_action}" => 1,
620
                        "item_action_${item_action}" => 1,
623
                        item_action => $item_action,
621
                        item_action => $item_action,
624
                        item_error => $item_error,
622
                        item_error => $item_error,
625
                        libraries => scalar Koha::Libraries->search(),
623
                        libraries => Koha::Libraries->search,
626
                        locationloop => \@locations,
624
                        locationloop => \@locations,
627
                        itypeloop => \@itypes,
625
                        itemtypes => Koha::ItemTypes->search,
628
                        ccodeloop => \@ccodes,
626
                        ccodeloop => \@ccodes,
629
                        notforloanloop => \@notforloans,
627
                        notforloanloop => \@notforloans,
630
                    );
628
                    );
(-)a/acqui/basket.pl (-2 / +2 lines)
Lines 424-431 if ( $op eq 'list' ) { Link Here
424
        unclosable           => @orders || @cancelledorders ? $basket->{is_standing} : 1,
424
        unclosable           => @orders || @cancelledorders ? $basket->{is_standing} : 1,
425
        has_budgets          => $has_budgets,
425
        has_budgets          => $has_budgets,
426
        duplinbatch          => $duplinbatch,
426
        duplinbatch          => $duplinbatch,
427
        csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' })->as_list ],
427
        csv_profiles         => Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }),
428
        available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ],
428
        available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ),
429
        additional_field_values => { map {
429
        additional_field_values => { map {
430
            $_->field->name => $_->value
430
            $_->field->name => $_->value
431
        } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
431
        } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
(-)a/acqui/basketheader.pl (-4 / +4 lines)
Lines 74-80 my $basket; Link Here
74
my $op = $input->param('op');
74
my $op = $input->param('op');
75
my $is_an_edit = $input->param('is_an_edit');
75
my $is_an_edit = $input->param('is_an_edit');
76
76
77
$template->param( available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } )->as_list ] );
77
$template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) );
78
78
79
if ( $op eq 'add_form' ) {
79
if ( $op eq 'add_form' ) {
80
    my @contractloop;
80
    my @contractloop;
Lines 116-124 if ( $op eq 'add_form' ) { Link Here
116
        $template->param(contractloop => \@contractloop,
116
        $template->param(contractloop => \@contractloop,
117
                         basketcontractnumber => $basket->{'contractnumber'});
117
                         basketcontractnumber => $basket->{'contractnumber'});
118
    }
118
    }
119
    my @booksellers = Koha::Acquisition::Booksellers->search(
119
    my $booksellers = Koha::Acquisition::Booksellers->search(
120
                        undef,
120
                        undef,
121
                        { order_by => { -asc => 'name' } } )->as_list;
121
                        { order_by => { -asc => 'name' } } );
122
122
123
    $template->param( add_form => 1,
123
    $template->param( add_form => 1,
124
                    basketname => $basket->{'basketname'},
124
                    basketname => $basket->{'basketname'},
Lines 127-133 if ( $op eq 'add_form' ) { Link Here
127
                    booksellername => $bookseller->name,
127
                    booksellername => $bookseller->name,
128
                    booksellerid => $booksellerid,
128
                    booksellerid => $booksellerid,
129
                    basketno => $basketno,
129
                    basketno => $basketno,
130
                    booksellers => \@booksellers,
130
                    booksellers => $booksellers,
131
                    is_standing => $basket->{is_standing},
131
                    is_standing => $basket->{is_standing},
132
                    create_items => $basket->{create_items},
132
                    create_items => $basket->{create_items},
133
    );
133
    );
(-)a/acqui/duplicate_orders.pl (-2 / +1 lines)
Lines 117-125 elsif ( $op eq 'batch_edit' ) { Link Here
117
    @{$budget_loop} =
117
    @{$budget_loop} =
118
      sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
118
      sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
119
119
120
    my @currencies = Koha::Acquisition::Currencies->search->as_list;
121
    $template->param(
120
    $template->param(
122
        currencies  => \@currencies,
121
        currencies  => Koha::Acquisition::Currencies->search,
123
        budget_loop => $budget_loop,
122
        budget_loop => $budget_loop,
124
    );
123
    );
125
}
124
}
(-)a/acqui/histsearch.pl (-3 / +3 lines)
Lines 99-108 unless ( $input->param('from') ) { Link Here
99
}
99
}
100
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
100
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } );
101
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
101
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } );
102
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } )->as_list;
102
my $additional_fields = Koha::AdditionalFields->search( { tablename => 'aqbasket', searchable => 1 } );
103
$template->param( available_additional_fields => \@additional_fields );
103
$template->param( available_additional_fields => $additional_fields );
104
my @additional_field_filters;
104
my @additional_field_filters;
105
foreach my $additional_field (@additional_fields) {
105
while ( my $additional_field = $additional_fields->next ) {
106
    my $value = $input->param('additional_field_' . $additional_field->id);
106
    my $value = $input->param('additional_field_' . $additional_field->id);
107
    if (defined $value and $value ne '') {
107
    if (defined $value and $value ne '') {
108
        push @additional_field_filters, {
108
        push @additional_field_filters, {
(-)a/acqui/lateorders.pl (-1 / +1 lines)
Lines 157-162 $template->param( Link Here
157
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
157
    estimateddeliverydatefrom => $estimateddeliverydatefrom,
158
    estimateddeliverydateto   => $estimateddeliverydateto,
158
    estimateddeliverydateto   => $estimateddeliverydateto,
159
	intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
159
	intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
160
    csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' })->as_list ],
160
    csv_profiles         => Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_orders' }),
161
);
161
);
162
output_html_with_http_headers $input, $cookie, $template->output;
162
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/neworderempty.pl (-3 / +1 lines)
Lines 207-213 if ( not $ordernumber ) { # create order Link Here
207
    }
207
    }
208
208
209
    if ( not $biblionumber and Koha::BiblioFrameworks->find('ACQ') ) {
209
    if ( not $biblionumber and Koha::BiblioFrameworks->find('ACQ') ) {
210
        #my $acq_mss = Koha::MarcSubfieldStructures->search({ frameworkcode => 'ACQ', tagfield => { '!=' => $itemnumber_tag } });
211
        foreach my $tag ( sort keys %{$tagslib} ) {
210
        foreach my $tag ( sort keys %{$tagslib} ) {
212
            next if $tag eq '';
211
            next if $tag eq '';
213
            next if $tag eq $itemnumber_tag;    # skip items fields
212
            next if $tag eq $itemnumber_tag;    # skip items fields
Lines 326-332 $template->param( catalog_details => \@catalog_details, ); Link Here
326
my $suggestion;
325
my $suggestion;
327
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
326
$suggestion = GetSuggestionInfo($suggestionid) if $suggestionid;
328
327
329
my @currencies = Koha::Acquisition::Currencies->search->as_list;
330
my $active_currency = Koha::Acquisition::Currencies->get_active;
328
my $active_currency = Koha::Acquisition::Currencies->get_active;
331
329
332
# build bookfund list
330
# build bookfund list
Lines 452-458 $template->param( Link Here
452
    invoiceincgst    => $bookseller->invoiceincgst,
450
    invoiceincgst    => $bookseller->invoiceincgst,
453
    cur_active_sym   => $active_currency->symbol,
451
    cur_active_sym   => $active_currency->symbol,
454
    cur_active       => $active_currency->currency,
452
    cur_active       => $active_currency->currency,
455
    currencies       => \@currencies,
453
    currencies       => Koha::Acquisition::Currencies->search,
456
    currency         => $data->{currency},
454
    currency         => $data->{currency},
457
    vendor_currency  => $bookseller->listprice,
455
    vendor_currency  => $bookseller->listprice,
458
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
456
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
(-)a/acqui/supplier.pl (-2 / +1 lines)
Lines 96-102 if ( $op eq 'display' ) { Link Here
96
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
96
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
97
    exit;
97
    exit;
98
} else {
98
} else {
99
    my @currencies = Koha::Acquisition::Currencies->search->as_list;
100
99
101
    # get option values from TaxRates syspref
100
    # get option values from TaxRates syspref
102
    my @gst_values = map {
101
    my @gst_values = map {
Lines 108-114 if ( $op eq 'display' ) { Link Here
108
        active     => $supplier ? $supplier->active         : 1,
107
        active     => $supplier ? $supplier->active         : 1,
109
        tax_rate   => $supplier ? $supplier->tax_rate + 0.0 : 0,
108
        tax_rate   => $supplier ? $supplier->tax_rate + 0.0 : 0,
110
        gst_values    => \@gst_values,
109
        gst_values    => \@gst_values,
111
        currencies    => \@currencies,
110
        currencies    => Koha::Acquisition::Currencies->search,
112
        enter         => 1,
111
        enter         => 1,
113
    );
112
    );
114
}
113
}
(-)a/acqui/transferorder.pl (-3 / +3 lines)
Lines 117-129 if( $basketno && $ordernumber) { Link Here
117
    # Search for booksellers to transfer from/to
117
    # Search for booksellers to transfer from/to
118
    $op = '' unless $op;
118
    $op = '' unless $op;
119
    if( $op eq "do_search" ) {
119
    if( $op eq "do_search" ) {
120
        my @booksellers = Koha::Acquisition::Booksellers->search(
120
        my $booksellers = Koha::Acquisition::Booksellers->search(
121
                            { name     => { -like => "%$query%" } },
121
                            { name     => { -like => "%$query%" } },
122
                            { order_by => { -asc => 'name' } } )->as_list;
122
                            { order_by => { -asc => 'name' } } );
123
        $template->param(
123
        $template->param(
124
            query => $query,
124
            query => $query,
125
            do_search => 1,
125
            do_search => 1,
126
            booksellersloop => \@booksellers,
126
            booksellers => $booksellers,
127
        );
127
        );
128
    }
128
    }
129
}
129
}
(-)a/admin/authorised_values.pl (-7 / +9 lines)
Lines 212-224 $template->param( Link Here
212
212
213
if ( $op eq 'list' ) {
213
if ( $op eq 'list' ) {
214
    # build categories list
214
    # build categories list
215
    my @categories = Koha::AuthorisedValueCategories->search({ category_name => { -not_in => ['', 'branches', 'itemtypes', 'cn_source']}}, { order_by => ['category_name'] } )->as_list;
215
    my @category_names = Koha::AuthorisedValueCategories->search(
216
    my @category_list;
216
        {
217
    for my $category ( @categories ) {
217
            category_name =>
218
        push( @category_list, $category->category_name );
218
              { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] }
219
    }
219
        },
220
        { order_by => ['category_name'] }
221
    )->get_column('category_name');
220
222
221
    $searchfield ||= $category_list[0];
223
    $searchfield ||= $category_names[0];
222
224
223
    my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list;
225
    my @avs_by_category = Koha::AuthorisedValues->new->search( { category => $searchfield } )->as_list;
224
    my @loop_data = ();
226
    my @loop_data = ();
Lines 238-244 if ( $op eq 'list' ) { Link Here
238
    $template->param(
240
    $template->param(
239
        loop     => \@loop_data,
241
        loop     => \@loop_data,
240
        category => Koha::AuthorisedValueCategories->find($searchfield), # TODO Move this up and add a Koha::AVC->authorised_values method to replace call for avs_by_category
242
        category => Koha::AuthorisedValueCategories->find($searchfield), # TODO Move this up and add a Koha::AVC->authorised_values method to replace call for avs_by_category
241
        categories => \@category_list,
243
        category_names => \@category_names,
242
    );
244
    );
243
245
244
}
246
}
(-)a/admin/branches.pl (-10 / +2 lines)
Lines 49-65 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
49
);
49
);
50
50
51
if ( $op eq 'add_form' ) {
51
if ( $op eq 'add_form' ) {
52
    my $library;
53
    if ($branchcode) {
54
        $library = Koha::Libraries->find($branchcode);
55
        $template->param( selected_smtp_server => $library->smtp_server );
56
    }
57
58
    my @smtp_servers = Koha::SMTP::Servers->search->as_list;
59
60
    $template->param(
52
    $template->param(
61
        library      => $library,
53
        library      => Koha::Libraries->find($branchcode),
62
        smtp_servers => \@smtp_servers
54
        smtp_servers => Koha::SMTP::Servers->search,
63
    );
55
    );
64
} elsif ( $op eq 'add_validate' ) {
56
} elsif ( $op eq 'add_validate' ) {
65
    my @fields = qw(
57
    my @fields = qw(
(-)a/admin/item_circulation_alerts.pl (-7 / +6 lines)
Lines 47-62 sub show { Link Here
47
    );
47
    );
48
48
49
    my $branch   = $input->param('branch') || '*';
49
    my $branch   = $input->param('branch') || '*';
50
    my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
51
    my @item_types = Koha::ItemTypes->search->as_list;
52
    my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
50
    my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
53
    my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
51
    my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
54
52
55
    $template->param(branch             => $branch);
53
    $template->param(
56
    $template->param(categories         => \@categories);
54
        branch        => $branch,
57
    $template->param(item_types         => \@item_types);
55
        item_types    => Koha::ItemTypes->search,
58
    $template->param(grid_checkout      => $grid_checkout);
56
        grid_checkout => $grid_checkout,
59
    $template->param(grid_checkin       => $grid_checkin);
57
        grid_checkin  => $grid_checkin,
58
    );
60
59
61
    output_html_with_http_headers $input, $cookie, $template->output;
60
    output_html_with_http_headers $input, $cookie, $template->output;
62
}
61
}
(-)a/admin/itemtypes.pl (-1 / +1 lines)
Lines 198-204 if ( $op eq 'add_form' ) { Link Here
198
198
199
if ( $op eq 'list' ) {
199
if ( $op eq 'list' ) {
200
    $template->param(
200
    $template->param(
201
        itemtypes => scalar Koha::ItemTypes->search,
201
        itemtypes => Koha::ItemTypes->search,
202
        messages  => \@messages,
202
        messages  => \@messages,
203
    );
203
    );
204
}
204
}
(-)a/admin/marc_subfields_structure.pl (-2 / +1 lines)
Lines 97-104 if ( $op eq 'add_form' ) { Link Here
97
    $sth2->finish;
97
    $sth2->finish;
98
    $sth2 = $dbh->prepare("select distinct category from authorised_values");
98
    $sth2 = $dbh->prepare("select distinct category from authorised_values");
99
    $sth2->execute;
99
    $sth2->execute;
100
    my @av_cat = Koha::AuthorisedValueCategories->search->as_list;
100
    my @authorised_values= Koha::AuthorisedValueCategories->search->get_column('category_name');
101
    my @authorised_values = map { $_->category_name } @av_cat;
102
101
103
    # build thesaurus categories list
102
    # build thesaurus categories list
104
    my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );
103
    my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search->as_list );
(-)a/admin/sms_providers.pl (-2 / +2 lines)
Lines 62-69 elsif ( $op eq 'delete' ) { Link Here
62
    $provider->delete() if $provider;
62
    $provider->delete() if $provider;
63
}
63
}
64
64
65
my @providers = Koha::SMS::Providers->search->as_list;
65
my $providers = Koha::SMS::Providers->search;
66
66
67
$template->param( providers => \@providers );
67
$template->param( providers => $providers );
68
68
69
output_html_with_http_headers $cgi, $cookie, $template->output;
69
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/catalogue/item-export.pl (-3 / +3 lines)
Lines 36-42 my ($template, $borrowernumber, $cookie) = get_template_and_user({ Link Here
36
my @itemnumbers = $cgi->multi_param('itemnumber');
36
my @itemnumbers = $cgi->multi_param('itemnumber');
37
my $format = $cgi->param('format') // 'csv';
37
my $format = $cgi->param('format') // 'csv';
38
38
39
my @items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } })->as_list;
39
my $items = Koha::Items->search({ itemnumber => { -in => \@itemnumbers } });
40
40
41
if ($format eq 'barcodes') {
41
if ($format eq 'barcodes') {
42
    print $cgi->header({
42
    print $cgi->header({
Lines 44-57 if ($format eq 'barcodes') { Link Here
44
        attachment => 'barcodes.txt',
44
        attachment => 'barcodes.txt',
45
    });
45
    });
46
46
47
    foreach my $item (@items) {
47
    while ( my $item = $items->next ) {
48
        print $item->barcode . "\n";
48
        print $item->barcode . "\n";
49
    }
49
    }
50
    exit;
50
    exit;
51
}
51
}
52
52
53
$template->param(
53
$template->param(
54
    results => \@items,
54
    results => $items,
55
);
55
);
56
56
57
print $cgi->header({
57
print $cgi->header({
(-)a/catalogue/itemsearch.pl (-7 / +1 lines)
Lines 260-272 if ( defined $format ) { Link Here
260
# Display the search form
260
# Display the search form
261
261
262
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
262
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
263
my @itemtypes;
263
my @itemtypes = map { value => $_->itemtype, label => $_->translated_description }, Koha::ItemTypes->search_with_localization->as_list;
264
foreach my $itemtype ( Koha::ItemTypes->search_with_localization->as_list ) {
265
    push @itemtypes, {
266
        value => $itemtype->itemtype,
267
        label => $itemtype->translated_description,
268
    };
269
}
270
264
271
my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' });
265
my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' });
272
foreach my $ccode (@ccodes) {
266
foreach my $ccode (@ccodes) {
(-)a/cataloguing/editor.pl (-3 / +1 lines)
Lines 49-59 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
49
49
50
my $schema = Koha::Database->new->schema;
50
my $schema = Koha::Database->new->schema;
51
51
52
my @keyboard_shortcuts = Koha::KeyboardShortcuts->search->as_list;
53
54
# Keyboard shortcuts
52
# Keyboard shortcuts
55
$template->param(
53
$template->param(
56
    shortcuts => \@keyboard_shortcuts,
54
    shortcuts => Koha::KeyboardShortcuts->search,
57
);
55
);
58
56
59
# Available import batches
57
# Available import batches
(-)a/circ/circulation.pl (-1 / +1 lines)
Lines 603-609 $template->param( Link Here
603
603
604
604
605
if ( C4::Context->preference("ExportCircHistory") ) {
605
if ( C4::Context->preference("ExportCircHistory") ) {
606
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
606
    $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc' }));
607
}
607
}
608
608
609
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
609
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
(-)a/circ/transfers_to_send.pl (-3 / +3 lines)
Lines 41-47 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
41
my $branchcode = C4::Context->userenv->{'branch'};
41
my $branchcode = C4::Context->userenv->{'branch'};
42
42
43
# transfers requested but not yet sent
43
# transfers requested but not yet sent
44
my @transfers = Koha::Libraries->search(
44
my $transfers = Koha::Libraries->search(
45
    {
45
    {
46
        'branchtransfers_tobranches.frombranch'    => $branchcode,
46
        'branchtransfers_tobranches.frombranch'    => $branchcode,
47
        'branchtransfers_tobranches.daterequested' => { '!=' => undef },
47
        'branchtransfers_tobranches.daterequested' => { '!=' => undef },
Lines 53-62 my @transfers = Koha::Libraries->search( Link Here
53
        prefetch => 'branchtransfers_tobranches',
53
        prefetch => 'branchtransfers_tobranches',
54
        order_by => 'branchtransfers_tobranches.tobranch'
54
        order_by => 'branchtransfers_tobranches.tobranch'
55
    }
55
    }
56
)->as_list;
56
);
57
57
58
$template->param(
58
$template->param(
59
    libraries => \@transfers,
59
    libraries => $transfers,
60
    show_date => dt_from_string
60
    show_date => dt_from_string
61
);
61
);
62
62
(-)a/clubs/clubs.pl (-5 / +2 lines)
Lines 45-59 my $club_id = $cgi->param('club_id'); Link Here
45
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
45
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
46
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
46
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
47
47
48
my @club_templates = Koha::Club::Templates->search->as_list;
49
my @clubs          = Koha::Clubs->search->as_list;
50
51
$template->param(
48
$template->param(
52
    stored         => $stored,
49
    stored         => $stored,
53
    club_template  => $club_template,
50
    club_template  => $club_template,
54
    club           => $club,
51
    club           => $club,
55
    club_templates => \@club_templates,
52
    club_templates => Koha::Club::Templates->search,
56
    clubs          => \@clubs,
53
    clubs          => Koha::Clubs->search,
57
);
54
);
58
55
59
output_html_with_http_headers( $cgi, $cookie, $template->output );
56
output_html_with_http_headers( $cgi, $cookie, $template->output );
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (-2 / +2 lines)
Lines 64-75 Link Here
64
                        <select name="issues-table-output-format" id="issues-table-output-format">
64
                        <select name="issues-table-output-format" id="issues-table-output-format">
65
                            <option value="iso2709_995">MARC with items</option>
65
                            <option value="iso2709_995">MARC with items</option>
66
                            <option value="iso2709">MARC without items</option>
66
                            <option value="iso2709">MARC without items</option>
67
                            [% IF csv_profiles.size %]
67
                            [% IF csv_profiles.count %]
68
                                <option value="csv">CSV</option>
68
                                <option value="csv">CSV</option>
69
                            [% END %]
69
                            [% END %]
70
                        </select>
70
                        </select>
71
71
72
                        [% IF csv_profiles.size %]
72
                        [% IF csv_profiles.count %]
73
                            <select name="csv_profile_id">
73
                            <select name="csv_profile_id">
74
                                [% FOREACH csv_profile IN csv_profiles %]
74
                                [% FOREACH csv_profile IN csv_profiles %]
75
                                    <option value="[% csv_profile.export_format_id | html %]">[% csv_profile.profile | html %]</option>
75
                                    <option value="[% csv_profile.export_format_id | html %]">[% csv_profile.profile | html %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-4 / +4 lines)
Lines 215-225 Batch list Link Here
215
                        </select>
215
                        </select>
216
                        </li>
216
                        </li>
217
                        <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 %]">
217
                        <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 %]">
218
                        [% FOREACH itypeloo IN itypeloop %]
218
                        [% FOREACH itemtype IN itemtypes %]
219
                          [% IF ( itypeloo.itemtype ) == ( item.itype ) %]
219
                          [% IF itemtype.itemtype == item.itype %]
220
                            <option value="[% itypeloo.itemtype | html %]" selected="selected">[% itypeloo.description | html %]</option>
220
                            <option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option>
221
                          [% ELSE %]
221
                          [% ELSE %]
222
                            <option value="[% itypeloo.itemtype | html %]">[% itypeloo.description | html %]</option>
222
                            <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
223
                          [% END %]
223
                          [% END %]
224
                        [% END %]
224
                        [% END %]
225
                        </select>
225
                        </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +1 lines)
Lines 7-13 Link Here
7
      <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
7
      <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
8
      <ul class="dropdown-menu" id="export-csv-menu">
8
      <ul class="dropdown-menu" id="export-csv-menu">
9
          <li><a href="#">Default</a></li>
9
          <li><a href="#">Default</a></li>
10
          [% IF csv_profiles %]
10
          [% IF csv_profiles.count %]
11
              [% FOR csv IN csv_profiles %]
11
              [% FOR csv IN csv_profiles %]
12
                <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
12
                <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
13
              [% END %]
13
              [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-1 / +1 lines)
Lines 148-154 Link Here
148
            </ol>
148
            </ol>
149
        </fieldset>
149
        </fieldset>
150
150
151
        [% IF available_additional_fields %]
151
        [% IF available_additional_fields.count %]
152
            [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
152
            [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
153
        [% END %]
153
        [% END %]
154
154
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-1 / +1 lines)
Lines 204-210 Link Here
204
          <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
204
          <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
205
          <ul class="dropdown-menu" id="export-csv-menu">
205
          <ul class="dropdown-menu" id="export-csv-menu">
206
              <li><a href="#">Default</a></li>
206
              <li><a href="#">Default</a></li>
207
              [% IF csv_profiles %]
207
              [% IF csv_profiles.count %]
208
                  [% FOR csv IN csv_profiles %]
208
                  [% FOR csv IN csv_profiles %]
209
                    <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
209
                    <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
210
                  [% END %]
210
                  [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-2 / +2 lines)
Lines 145-151 Link Here
145
        <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
145
        <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
146
        <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
146
        <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
147
147
148
        [% FOREACH c IN currencies %]
148
        [% FOREACH c IN currencies.count %]
149
            <input type="hidden" id="currency_rate_[% c.currency | html %]"  name="[% c.currency | html %]" value="[% c.rate | html %]" />
149
            <input type="hidden" id="currency_rate_[% c.currency | html %]"  name="[% c.currency | html %]" value="[% c.rate | html %]" />
150
        [% END %]
150
        [% END %]
151
151
Lines 399-405 Link Here
399
		<li>
399
		<li>
400
			<label for="currency">Currency:</label>
400
			<label for="currency">Currency:</label>
401
            <select name="currency" id="currency" onchange="updateCosts();">
401
            <select name="currency" id="currency" onchange="updateCosts();">
402
                [% FOREACH c IN currencies %]
402
                [% FOREACH c IN currencies.count %]
403
                    [% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %]
403
                    [% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %]
404
                        <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
404
                        <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
405
                    [% ELSIF not c.archived %]
405
                    [% ELSIF not c.archived %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt (-2 / +2 lines)
Lines 98-104 Link Here
98
            [% ELSE %]
98
            [% ELSE %]
99
                <h3>Choose a vendor to transfer from</h3>
99
                <h3>Choose a vendor to transfer from</h3>
100
            [% END %]
100
            [% END %]
101
            [% IF ( booksellersloop ) %]
101
            [% IF booksellers.count %]
102
                <table>
102
                <table>
103
                    <thead>
103
                    <thead>
104
                        <tr>
104
                        <tr>
Lines 107-113 Link Here
107
                        </tr>
107
                        </tr>
108
                    </thead>
108
                    </thead>
109
                    <tbody>
109
                    <tbody>
110
                        [% FOREACH bookseller IN booksellersloop %]
110
                        [% FOREACH bookseller IN booksellers %]
111
                          <tr>
111
                          <tr>
112
                            <td>[% bookseller.name | html %]</td>
112
                            <td>[% bookseller.name | html %]</td>
113
                            <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>
113
                            <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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt (-2 / +2 lines)
Lines 240-246 Authorized values &rsaquo; Administration &rsaquo; Koha Link Here
240
        <p>
240
        <p>
241
            <label for="category_search">Show category: </label>
241
            <label for="category_search">Show category: </label>
242
            <select name="searchfield" id="category_search">
242
            <select name="searchfield" id="category_search">
243
                [% FOR c IN categories %]
243
                [% FOR c IN category_names %]
244
                    [% IF c == searchfield %]
244
                    [% IF c == searchfield %]
245
                        <option value="[% c | html %]" selected="selected">[% c | html %]</option>
245
                        <option value="[% c | html %]" selected="selected">[% c | html %]</option>
246
                    [% ELSE %]
246
                    [% ELSE %]
Lines 323-329 Authorized values &rsaquo; Administration &rsaquo; Koha Link Here
323
            </tr>
323
            </tr>
324
        </thead>
324
        </thead>
325
        <tbody>
325
        <tbody>
326
            [% FOR c IN categories %]
326
            [% FOR c IN category_names %]
327
                <tr>
327
                <tr>
328
                    <td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td>
328
                    <td><a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% c | uri %]">[% c | html %]</a></td>
329
                    <td>
329
                    <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-2 / +2 lines)
Lines 220-232 Libraries &rsaquo; Administration &rsaquo; Koha Link Here
220
                </li>
220
                </li>
221
                <li><label for="smtp_server">SMTP server: </label>
221
                <li><label for="smtp_server">SMTP server: </label>
222
                    <select name="smtp_server" id="smtp_server">
222
                    <select name="smtp_server" id="smtp_server">
223
                    [% IF selected_smtp_server.is_system_default %]
223
                    [% IF library AND library.smtp_server.is_system_default %]
224
                        <option value="*" selected="selected">Default</option>
224
                        <option value="*" selected="selected">Default</option>
225
                    [% ELSE %]
225
                    [% ELSE %]
226
                        <option value="*">Default</option>
226
                        <option value="*">Default</option>
227
                    [% END %]
227
                    [% END %]
228
                    [% FOREACH smtp_server IN smtp_servers %]
228
                    [% FOREACH smtp_server IN smtp_servers %]
229
                        [% IF smtp_server.id == selected_smtp_server.id %]
229
                        [% IF library AND smtp_server.id == library.smtp_server.id %]
230
                            <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
230
                            <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
231
                        [% ELSE %]
231
                        [% ELSE %]
232
                            <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
232
                            <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt (-1 / +1 lines)
Lines 37-43 Link Here
37
37
38
                <h2>SMS cellular providers</h2>
38
                <h2>SMS cellular providers</h2>
39
39
40
                [% IF providers.size %]
40
                [% IF providers.count %]
41
41
42
                    <table id="providerst">
42
                    <table id="providerst">
43
                        <thead>
43
                        <thead>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt (-1 / +1 lines)
Lines 43-49 Link Here
43
43
44
                        <h1>Transfers requested of your library as of [% show_date | $KohaDates %]</h1>
44
                        <h1>Transfers requested of your library as of [% show_date | $KohaDates %]</h1>
45
45
46
                        [% IF ( libraries ) %]
46
                        [% IF libraries.count %]
47
                        <p>Your library is the origin for the following transfer(s)</p>
47
                        <p>Your library is the origin for the following transfer(s)</p>
48
                        <div id="resultlist">
48
                        <div id="resultlist">
49
                            [% FOREACH library IN libraries %]
49
                            [% FOREACH library IN libraries %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt (-4 / +4 lines)
Lines 65-71 Link Here
65
                    </div>
65
                    </div>
66
                [% END %]
66
                [% END %]
67
67
68
                [% IF club_templates %]
68
                [% IF club_templates.count %]
69
                    <table id="club-templates-table">
69
                    <table id="club-templates-table">
70
                        <thead>
70
                        <thead>
71
                            <tr>
71
                            <tr>
Lines 120-126 Link Here
120
                [% IF CAN_user_clubs_edit_clubs %]
120
                [% IF CAN_user_clubs_edit_clubs %]
121
                    <div class="btn-toolbar">
121
                    <div class="btn-toolbar">
122
                        <div class="btn-group">
122
                        <div class="btn-group">
123
                            [% IF club_templates %]
123
                            [% IF club_templates.count %]
124
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
124
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
125
                            [% ELSE %]
125
                            [% ELSE %]
126
                                <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>
126
                                <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>
Lines 134-143 Link Here
134
                    </div>
134
                    </div>
135
                [% END %]
135
                [% END %]
136
136
137
                [% IF clubs %]
137
                [% IF clubs.count %]
138
                    [% INCLUDE 'clubs-table.inc' %]
138
                    [% INCLUDE 'clubs-table.inc' %]
139
                [% ELSE %]
139
                [% ELSE %]
140
                    [% IF club_templates %]
140
                    [% IF club_templates.count %]
141
                        <div class="dialog message">No clubs defined.</div>
141
                        <div class="dialog message">No clubs defined.</div>
142
                    [% ELSE %]
142
                    [% ELSE %]
143
                        <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
143
                        <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt (-1 / +1 lines)
Lines 74-80 Link Here
74
                </form>
74
                </form>
75
75
76
                <div id="keys">
76
                <div id="keys">
77
                    [% IF api_keys && api_keys.size > 0 %]
77
                    [% IF api_keys.count %]
78
                        <p>
78
                        <p>
79
                            <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>
79
                            <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>
80
                        </p>
80
                        </p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt (-1 / +1 lines)
Lines 185-191 Link Here
185
                [% END %]</tbody>
185
                [% END %]</tbody>
186
            </table>
186
            </table>
187
187
188
            [% IF csv_profiles %]
188
            [% IF csv_profiles.count %]
189
              <fieldset class="action">
189
              <fieldset class="action">
190
                <label for="csv_code">Select CSV profile:</label>
190
                <label for="csv_code">Select CSV profile:</label>
191
                <select id="csv_profile_for_export">
191
                <select id="csv_profile_for_export">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +1 lines)
Lines 157-163 Link Here
157
                            </div> <!-- /.col-sm-6 -->
157
                            </div> <!-- /.col-sm-6 -->
158
                        </div> <!-- /.row -->
158
                        </div> <!-- /.row -->
159
159
160
                        [% IF available_additional_fields %]
160
                        [% IF available_additional_fields.count %]
161
                            <hr>
161
                            <hr>
162
                            <div class="row">
162
                            <div class="row">
163
                                <div class="col-sm-6">
163
                                <div class="col-sm-6">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-1 / +1 lines)
Lines 245-251 Link Here
245
245
246
                                            [% UNLESS hidden.defined('branchcode') %]
246
                                            [% UNLESS hidden.defined('branchcode') %]
247
                                                <li>
247
                                                <li>
248
                                                    [% IF ( libraries.size > 1 ) %]
248
                                                    [% IF libraries.count %]
249
                                                        <label for="borrower_branchcode" class="[% required.branchcode | html %]">Home library:</label>
249
                                                        <label for="borrower_branchcode" class="[% required.branchcode | html %]">Home library:</label>
250
250
251
                                                        <select id="borrower_branchcode" name="borrower_branchcode" class="[% required.branchcode | html %]">
251
                                                        <select id="borrower_branchcode" name="borrower_branchcode" class="[% required.branchcode | html %]">
(-)a/members/apikeys.pl (-3 / +1 lines)
Lines 121-130 if ($op) { Link Here
121
    }
121
    }
122
}
122
}
123
123
124
my @api_keys = Koha::ApiKeys->search({ patron_id => $patron_id })->as_list;
125
126
$template->param(
124
$template->param(
127
    api_keys   => \@api_keys,
125
    api_keys   => Koha::ApiKeys->search({ patron_id => $patron_id }),
128
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $cgi->cookie('CGISESSID') }),
126
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $cgi->cookie('CGISESSID') }),
129
    patron     => $patron
127
    patron     => $patron
130
);
128
);
(-)a/members/boraccount.pl (-3 / +3 lines)
Lines 174-183 if ( $action eq 'discount' ) { Link Here
174
#get account details
174
#get account details
175
my $total = $patron->account->balance;
175
my $total = $patron->account->balance;
176
176
177
my @accountlines = Koha::Account::Lines->search(
177
my $accountlines = Koha::Account::Lines->search(
178
    { borrowernumber => $patron->borrowernumber },
178
    { borrowernumber => $patron->borrowernumber },
179
    { order_by       => { -desc => 'accountlines_id' } }
179
    { order_by       => { -desc => 'accountlines_id' } }
180
)->as_list;
180
);
181
181
182
my $totalcredit;
182
my $totalcredit;
183
if($total <= 0){
183
if($total <= 0){
Lines 209-215 $template->param( Link Here
209
    finesview           => 1,
209
    finesview           => 1,
210
    total               => sprintf("%.2f",$total),
210
    total               => sprintf("%.2f",$total),
211
    totalcredit         => $totalcredit,
211
    totalcredit         => $totalcredit,
212
    accounts            => \@accountlines,
212
    accounts            => $accountlines,
213
    payment_id          => $payment_id,
213
    payment_id          => $payment_id,
214
    change_given        => $change_given,
214
    change_given        => $change_given,
215
    renew_results       => $renew_results_display,
215
    renew_results       => $renew_results_display,
(-)a/members/maninvoice.pl (-3 / +3 lines)
Lines 205-216 if ($add) { Link Here
205
    }
205
    }
206
}
206
}
207
207
208
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
208
my $debit_types = Koha::Account::DebitTypes->search_with_library_limits(
209
  { can_be_invoiced => 1, archived => 0 },
209
  { can_be_invoiced => 1, archived => 0 },
210
  {}, $library_id )->as_list;
210
  {}, $library_id );
211
211
212
$template->param(
212
$template->param(
213
  debit_types => \@debit_types,
213
  debit_types => $debit_types,
214
  csrf_token  => Koha::Token->new->generate_csrf(
214
  csrf_token  => Koha::Token->new->generate_csrf(
215
      { session_id => scalar $input->cookie('CGISESSID') }
215
      { session_id => scalar $input->cookie('CGISESSID') }
216
  ),
216
  ),
(-)a/members/members-home.pl (-3 / +4 lines)
Lines 43-55 if( Koha::Libraries->search->count < 1){ Link Here
43
    $template->param(no_branches => 1);
43
    $template->param(no_branches => 1);
44
}
44
}
45
45
46
my @categories = Koha::Patron::Categories->search_with_library_limits->as_list;
46
my $categories = Koha::Patron::Categories->search_with_library_limits;
47
if(scalar(@categories) < 1){
47
unless ( $categories->count ) {
48
    $no_add = 1;
48
    $no_add = 1;
49
    $template->param(no_categories => 1);
49
    $template->param(no_categories => 1);
50
}
50
}
51
else {
51
else {
52
    $template->param(categories=>\@categories);
52
    # FIXME This does not seem to be used in the template
53
    $template->param(categories => $categories);
53
}
54
}
54
55
55
my $branch =
56
my $branch =
(-)a/members/moremember.pl (-1 / +1 lines)
Lines 162-168 if (C4::Context->preference('EnhancedMessagingPreferences')) { Link Here
162
}
162
}
163
163
164
if ( C4::Context->preference("ExportCircHistory") ) {
164
if ( C4::Context->preference("ExportCircHistory") ) {
165
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' })->as_list ]);
165
    $template->param(csv_profiles => Koha::CsvProfiles->search({ type => 'marc' }));
166
}
166
}
167
167
168
my $patron_messages = Koha::Patron::Messages->search(
168
my $patron_messages = Koha::Patron::Messages->search(
(-)a/misc/cronjobs/reconcile_balances.pl (-2 / +2 lines)
Lines 72-78 GetOptions( Link Here
72
pod2usage(1) if $help;
72
pod2usage(1) if $help;
73
cronlogaction();
73
cronlogaction();
74
74
75
my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search(
75
my @patron_ids = Koha::Account::Lines->search(
76
        {
76
        {
77
            amountoutstanding => { '<' => 0 },
77
            amountoutstanding => { '<' => 0 },
78
            borrowernumber => { '!=' => undef }
78
            borrowernumber => { '!=' => undef }
Lines 81-87 my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search( Link Here
81
            columns  => [ qw/borrowernumber/ ],
81
            columns  => [ qw/borrowernumber/ ],
82
            distinct => 1,
82
            distinct => 1,
83
        }
83
        }
84
    )->as_list;
84
    )->get_column('borrowernumber');
85
85
86
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });
86
my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } });
87
87
(-)a/opac/opac-basket.pl (-5 / +2 lines)
Lines 176-186 my $resultsarray = \@results; Link Here
176
# my $itemsarray=\@items;
176
# my $itemsarray=\@items;
177
177
178
$template->param(
178
$template->param(
179
    csv_profiles => [
179
    csv_profiles => Koha::CsvProfiles->search(
180
        Koha::CsvProfiles->search(
180
        { type => 'marc', used_for => 'export_records', staff_only => 0 } ),
181
            { type => 'marc', used_for => 'export_records', staff_only => 0 }
182
        )->as_list
183
    ],
184
    bib_list => $bib_list,
181
    bib_list => $bib_list,
185
    BIBLIO_RESULTS => $resultsarray,
182
    BIBLIO_RESULTS => $resultsarray,
186
);
183
);
(-)a/opac/opac-downloadcart.pl (-10 / +8 lines)
Lines 130-145 if ($bib_list && $format) { Link Here
130
130
131
} else { 
131
} else { 
132
    $template->param(
132
    $template->param(
133
        csv_profiles => [
133
        csv_profiles => Koha::CsvProfiles->search(
134
            Koha::CsvProfiles->search(
134
            {
135
                {
135
                type       => 'marc',
136
                    type       => 'marc',
136
                used_for   => 'export_records',
137
                    used_for   => 'export_records',
137
                staff_only => 0
138
                    staff_only => 0
138
            }
139
                }
139
        ),
140
            )->as_list
140
        bib_list => $bib_list,
141
        ]
142
    );
141
    );
143
    $template->param(bib_list => $bib_list); 
144
    output_html_with_http_headers $query, $cookie, $template->output;
142
    output_html_with_http_headers $query, $cookie, $template->output;
145
}
143
}
(-)a/opac/opac-downloadshelf.pl (-10 / +8 lines)
Lines 146-162 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
146
            $template->param(fullpage => 1);
146
            $template->param(fullpage => 1);
147
        }
147
        }
148
        $template->param(
148
        $template->param(
149
            csv_profiles => [
149
            csv_profiles => Koha::CsvProfiles->search(
150
                Koha::CsvProfiles->search(
150
                {
151
                    {
151
                    type       => 'marc',
152
                        type       => 'marc',
152
                    used_for   => 'export_records',
153
                        used_for   => 'export_records',
153
                    staff_only => 0
154
                        staff_only => 0
154
                }
155
                    }
155
            ),
156
                )->as_list
156
            shelf => $shelf,
157
            ]
158
        );
157
        );
159
        $template->param( shelf => $shelf );
160
        output_html_with_http_headers $query, $cookie, $template->output;
158
        output_html_with_http_headers $query, $cookie, $template->output;
161
    }
159
    }
162
160
(-)a/opac/opac-memberentry.pl (-4 / +4 lines)
Lines 86-92 if ( $action eq 'create' || $action eq 'new' ) { Link Here
86
    $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
86
    $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
87
      if @PatronSelfRegistrationLibraryList;
87
      if @PatronSelfRegistrationLibraryList;
88
}
88
}
89
my @libraries = Koha::Libraries->search($params)->as_list;
89
my $libraries = Koha::Libraries->search($params);
90
90
91
my ( $min, $max ) = C4::Members::get_cardnumber_length();
91
my ( $min, $max ) = C4::Members::get_cardnumber_length();
92
if ( defined $min ) {
92
if ( defined $min ) {
Lines 102-108 $template->param( Link Here
102
    action            => $action,
102
    action            => $action,
103
    hidden            => GetHiddenFields( $mandatory, $action ),
103
    hidden            => GetHiddenFields( $mandatory, $action ),
104
    mandatory         => $mandatory,
104
    mandatory         => $mandatory,
105
    libraries         => \@libraries,
105
    libraries         => $libraries,
106
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
106
    OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
107
    defaultCategory  => $defaultCategory,
107
    defaultCategory  => $defaultCategory,
108
);
108
);
Lines 162-168 if ( $action eq 'create' ) { Link Here
162
            borrower       => \%borrower
162
            borrower       => \%borrower
163
        );
163
        );
164
        $template->param( patron_attribute_classes => GeneratePatronAttributesForm( undef, $attributes ) );
164
        $template->param( patron_attribute_classes => GeneratePatronAttributesForm( undef, $attributes ) );
165
    } elsif ( ! grep { $borrower{branchcode} eq $_->branchcode } @libraries ) {
165
    } elsif ( $libraries->find($borrower{branchcode}) ) {
166
        die "Branchcode not allowed"; # They hack the form
166
        die "Branchcode not allowed"; # They hack the form
167
    }
167
    }
168
    else {
168
    else {
Lines 625-631 sub GeneratePatronAttributesForm { Link Here
625
    my ( $borrowernumber, $entered_attributes ) = @_;
625
    my ( $borrowernumber, $entered_attributes ) = @_;
626
626
627
    # Get all attribute types and the values for this patron (if applicable)
627
    # Get all attribute types and the values for this patron (if applicable)
628
    my @types = grep { $_->opac_editable() or $_->opac_display }
628
    my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC
629
        Koha::Patron::Attribute::Types->search()->as_list();
629
        Koha::Patron::Attribute::Types->search()->as_list();
630
    if ( scalar(@types) == 0 ) {
630
    if ( scalar(@types) == 0 ) {
631
        return [];
631
        return [];
(-)a/opac/opac-messaging.pl (-2 / +2 lines)
Lines 79-86 $template->param( Link Here
79
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
79
                  TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
80
80
81
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
81
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
82
    my @providers = Koha::SMS::Providers->search->as_list;
82
    my $providers = Koha::SMS::Providers->search;
83
    $template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
83
    $template->param( sms_providers => $providers, sms_provider_id => $patron->sms_provider_id );
84
}
84
}
85
85
86
my $new_session_id = $cookie->value;
86
my $new_session_id = $cookie->value;
(-)a/opac/opac-search.pl (-2 / +1 lines)
Lines 436-443 my %is_nolimit = map { $_ => 1 } @nolimits; Link Here
436
if (@searchCategories > 0) {
436
if (@searchCategories > 0) {
437
    my @tabcat;
437
    my @tabcat;
438
    foreach my $typecategory (@searchCategories) {
438
    foreach my $typecategory (@searchCategories) {
439
        my @itemtypes = Koha::ItemTypes->search({ searchcategory => $typecategory })->as_list;
439
        push @tabcat, Koha::ItemTypes->search({ searchcategory => $typecategory })->get_column('itemtype');
440
        push @tabcat, $_->itemtype for @itemtypes;
441
    }
440
    }
442
441
443
    foreach my $itemtypeInCategory (@tabcat) {
442
    foreach my $itemtypeInCategory (@tabcat) {
(-)a/opac/opac-shelves.pl (-5 / +7 lines)
Lines 397-407 if ( $op eq 'view' ) { Link Here
397
                itemsloop          => \@items_info,
397
                itemsloop          => \@items_info,
398
                sortfield          => $sortfield,
398
                sortfield          => $sortfield,
399
                direction          => $direction,
399
                direction          => $direction,
400
                csv_profiles => [
400
                csv_profiles => Koha::CsvProfiles->search(
401
                    Koha::CsvProfiles->search(
401
                    {
402
                        { type => 'marc', used_for => 'export_records', staff_only => 0 }
402
                        type       => 'marc',
403
                    )->as_list
403
                        used_for   => 'export_records',
404
                ],
404
                        staff_only => 0
405
                    }
406
                  ),
405
            );
407
            );
406
            if ( $page ) {
408
            if ( $page ) {
407
                my $pager = $contents->pager;
409
                my $pager = $contents->pager;
(-)a/reports/acquisitions_stats.pl (-2 / +2 lines)
Lines 181-187 else { Link Here
181
181
182
    my $CGIsepChoice = GetDelimiterChoices;
182
    my $CGIsepChoice = GetDelimiterChoices;
183
183
184
    my @branches = Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
184
    my $libraries = Koha::Libraries->search({}, { order_by => 'branchname' });
185
185
186
    my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
186
    my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode');
187
    my $ccode_label;
187
    my $ccode_label;
Lines 201-207 else { Link Here
201
        Sort1         => $Sort1,
201
        Sort1         => $Sort1,
202
        Sort2         => $Sort2,
202
        Sort2         => $Sort2,
203
        CGIsepChoice  => $CGIsepChoice,
203
        CGIsepChoice  => $CGIsepChoice,
204
        branches      => \@branches,
204
        branches      => $libraries,
205
        ccode_label   => $ccode_label,
205
        ccode_label   => $ccode_label,
206
        ccode_avlist  => $ccode_avlist,
206
        ccode_avlist  => $ccode_avlist,
207
    );
207
    );
(-)a/reports/borrowers_stats.pl (-1 / +1 lines)
Lines 219-225 sub calculate { Link Here
219
        }
219
        }
220
    }
220
    }
221
221
222
    my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list;
222
    my @branchcodes = Koha::Libraries->search->get_column('branchcode');
223
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
223
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
224
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
224
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
225
# year of activity
225
# year of activity
(-)a/serials/claims.pl (-1 / +1 lines)
Lines 96-102 $template->param( Link Here
96
        supplierid => $supplierid,
96
        supplierid => $supplierid,
97
        claimletter => $claimletter,
97
        claimletter => $claimletter,
98
        additional_fields_for_subscription => $additional_fields,
98
        additional_fields_for_subscription => $additional_fields,
99
        csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' })->as_list ],
99
        csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }),
100
        letters => $letters,
100
        letters => $letters,
101
        (uc(C4::Context->preference("marcflavour"))) => 1
101
        (uc(C4::Context->preference("marcflavour"))) => 1
102
        );
102
        );
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 126-132 my $default_bib_view = get_default_view(); Link Here
126
126
127
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
127
my $subscription_object = Koha::Subscriptions->find( $subscriptionid );
128
$template->param(
128
$template->param(
129
    available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'subscription' } )->as_list ],
129
    available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ),
130
    additional_field_values => {
130
    additional_field_values => {
131
        map { $_->field->name => $_->value }
131
        map { $_->field->name => $_->value }
132
          $subscription_object->additional_field_values->as_list
132
          $subscription_object->additional_field_values->as_list
(-)a/suggestion/suggestion.pl (-3 / +2 lines)
Lines 456-464 if( $suggestion_ref->{STATUS} ) { Link Here
456
    );
456
    );
457
}
457
}
458
458
459
my @currencies = Koha::Acquisition::Currencies->search->as_list;
459
my $currencies = Koha::Acquisition::Currencies->search;
460
$template->param(
460
$template->param(
461
    currencies   => \@currencies,
461
    currencies   => $currencies,
462
    suggestion   => $suggestion_ref,
462
    suggestion   => $suggestion_ref,
463
    price        => sprintf("%.2f", $$suggestion_ref{'price'}||0),
463
    price        => sprintf("%.2f", $$suggestion_ref{'price'}||0),
464
    total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
464
    total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
465
- 

Return to bug 29859