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

(-)a/admin/marc_order_accounts.pl (-12 / +3 lines)
Lines 55-72 $op ||= 'display'; Link Here
55
55
56
if ( $op eq 'acct_form' ) {
56
if ( $op eq 'acct_form' ) {
57
    $template->param( acct_form => 1 );
57
    $template->param( acct_form => 1 );
58
    my @vendors = Koha::Acquisition::Booksellers->search(
59
        undef,
60
        {
61
            columns  => [ 'name', 'id' ],
62
            order_by => { -asc => 'name' }
63
        }
64
    )->as_list;
65
    my $budgets = GetBudgets();
58
    my $budgets = GetBudgets();
66
    $template->param(
59
    $template->param( budgets => $budgets );
67
        vendors => \@vendors,
68
        budgets => $budgets
69
    );
70
    my @matchers = C4::Matcher::GetMatcherList();
60
    my @matchers = C4::Matcher::GetMatcherList();
71
    $template->param( available_matchers => \@matchers );
61
    $template->param( available_matchers => \@matchers );
72
62
Lines 127-133 sub show_account { Link Here
127
    if ($acct_id) {
117
    if ($acct_id) {
128
        my $acct = Koha::MarcOrderAccounts->find($acct_id);
118
        my $acct = Koha::MarcOrderAccounts->find($acct_id);
129
        if ($acct) {
119
        if ($acct) {
130
            $template->param( account => $acct );
120
            my $vendor = Koha::Acquisition::Booksellers->find( $acct->vendor_id );
121
            $template->param( vendor => $vendor, account => $acct );
131
        }
122
        }
132
    }
123
    }
133
    return;
124
    return;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt (-16 / +60 lines)
Lines 34-41 MARC Order Accounts Link Here
34
34
35
<div class="main container-fluid">
35
<div class="main container-fluid">
36
    <div class="row">
36
    <div class="row">
37
        <div class="col-sm-10 col-sm-push-2">
37
        <div class="col-md-10 order-md-2 order-sm-1">
38
            <main>
38
            <main>
39
                [% INCLUDE 'messages.inc' %]
39
                [% IF display %]
40
                [% IF display %]
40
                    <div id="toolbar" class="btn-toolbar">
41
                    <div id="toolbar" class="btn-toolbar">
41
                    <a class="btn btn-default" id="newmarcorderacct" href="/cgi-bin/koha/admin/marc_order_accounts.pl?op=acct_form">
42
                    <a class="btn btn-default" id="newmarcorderacct" href="/cgi-bin/koha/admin/marc_order_accounts.pl?op=acct_form">
Lines 95-113 MARC Order Accounts Link Here
95
                            <ol>
96
                            <ol>
96
                                <li>
97
                                <li>
97
                                    <label for="vendor_id">Vendor: </label>
98
                                    <label for="vendor_id">Vendor: </label>
98
                                    <select name="vendor_id" id="vendor_id">
99
                                    <select class="select2" name="vendor_id" id="vendor_id">
99
                                        [% FOREACH vendor IN vendors %]
100
                                        [% IF (vendor) %]
100
                                            [% IF account.vendor_id == vendor.id %]
101
                                            <option value="[% account.vendor_id | html %]" selected="selected">Current vendor ([% vendor.name | html %])</option>
101
                                                <option value="[% vendor.id | html %]" selected="selected">[% vendor.name | html %]</option>
102
                                            [% ELSE %]
103
                                                <option value="[% vendor.id | html %]">[% vendor.name | html %]</option>
104
                                            [% END %]
105
                                        [% END %]
102
                                        [% END %]
106
                                    </select>
103
                                    </select>
107
                                </li>
104
                                </li>
108
                                <li>
105
                                <li>
109
                                    <label for="budget_id">Budget: </label>
106
                                    <label for="budget_id">Budget: </label>
110
                                    <select name="budget_id" id="budget_id">
107
                                    <select class="select2" name="budget_id" id="budget_id">
111
                                        [% FOREACH budget IN budgets %]
108
                                        [% FOREACH budget IN budgets %]
112
                                            [% IF account.budget_id == budget.budget_id %]
109
                                            [% IF account.budget_id == budget.budget_id %]
113
                                                <option value="[% budget.budget_id | html %]" selected="selected">[% budget.budget_name | html %]</option>
110
                                                <option value="[% budget.budget_id | html %]" selected="selected">[% budget.budget_name | html %]</option>
Lines 144-150 MARC Order Accounts Link Here
144
                            <ol>
141
                            <ol>
145
                                <li>
142
                                <li>
146
                                        <label for='record_type'>Record type:</label>
143
                                        <label for='record_type'>Record type:</label>
147
                                        <select name='record_type' id='record_type'>
144
                                        <select class="select2" name='record_type' id='record_type'>
148
                                            [% IF ( account.record_type == 'biblio' ) %]
145
                                            [% IF ( account.record_type == 'biblio' ) %]
149
                                                <option value="biblio" selected="selected">
146
                                                <option value="biblio" selected="selected">
150
                                            [% ELSE %]
147
                                            [% ELSE %]
Lines 161-167 MARC Order Accounts Link Here
161
                                    </li>
158
                                    </li>
162
                                    <li>
159
                                    <li>
163
                                        <label for="encoding">Character encoding: </label>
160
                                        <label for="encoding">Character encoding: </label>
164
                                        <select name="encoding" id="encoding">
161
                                        <select class="select2" name="encoding" id="encoding">
165
                                            [% IF ( account.encoding == 'UTF-8' ) %]
162
                                            [% IF ( account.encoding == 'UTF-8' ) %]
166
                                                <option value="UTF-8" selected="selected">
163
                                                <option value="UTF-8" selected="selected">
167
                                            [% ELSE %]
164
                                            [% ELSE %]
Lines 207-213 MARC Order Accounts Link Here
207
                            <ol>
204
                            <ol>
208
                                <li>
205
                                <li>
209
                                    <label for="matcher">Record matching rule:</label>
206
                                    <label for="matcher">Record matching rule:</label>
210
                                    <select name="matcher" id="matcher">
207
                                    <select class="select2" name="matcher" id="matcher">
211
                                        [% FOREACH available_matcher IN available_matchers %]
208
                                        [% FOREACH available_matcher IN available_matchers %]
212
                                            [% IF available_matcher.matcher_id == account.matcher_id %]
209
                                            [% IF available_matcher.matcher_id == account.matcher_id %]
213
                                                <option value="[% available_matcher.matcher_id | html %]" selected="selected">[% available_matcher.code | html %] ([% available_matcher.description | html %])</option>
210
                                                <option value="[% available_matcher.matcher_id | html %]" selected="selected">[% available_matcher.code | html %] ([% available_matcher.description | html %])</option>
Lines 219-225 MARC Order Accounts Link Here
219
                                </li>
216
                                </li>
220
                                <li>
217
                                <li>
221
                                    <label for="overlay_action">Action if matching record found: </label>
218
                                    <label for="overlay_action">Action if matching record found: </label>
222
                                    <select name="overlay_action" id="overlay_action">
219
                                    <select class="select2" name="overlay_action" id="overlay_action">
223
                                        [% IF ( account.overlay_action == 'replace' ) %]
220
                                        [% IF ( account.overlay_action == 'replace' ) %]
224
                                            <option value="replace"  selected="selected">
221
                                            <option value="replace"  selected="selected">
225
                                        [% ELSE %]
222
                                        [% ELSE %]
Lines 242-248 MARC Order Accounts Link Here
242
                                </li>
239
                                </li>
243
                                <li>
240
                                <li>
244
                                    <label for="nomatch_action">Action if no match is found: </label>
241
                                    <label for="nomatch_action">Action if no match is found: </label>
245
                                    <select name="nomatch_action" id="nomatch_action">
242
                                    <select class="select2" name="nomatch_action" id="nomatch_action">
246
                                        [% IF ( account.nomatch_action == 'create_new' ) %]
243
                                        [% IF ( account.nomatch_action == 'create_new' ) %]
247
                                            <option value="create_new" selected="selected">
244
                                            <option value="create_new" selected="selected">
248
                                        [% ELSE %]
245
                                        [% ELSE %]
Lines 282-288 MARC Order Accounts Link Here
282
                            <ol>
279
                            <ol>
283
                                <li>
280
                                <li>
284
                                    <label for="item_action">How to process items: </label>
281
                                    <label for="item_action">How to process items: </label>
285
                                    <select name="item_action" id="item_action">
282
                                    <select class="select2" name="item_action" id="item_action">
286
                                    [% IF ( account.item_action == 'always_add' ) %]
283
                                    [% IF ( account.item_action == 'always_add' ) %]
287
                                        <option value="always_add" selected="selected">
284
                                        <option value="always_add" selected="selected">
288
                                    [% ELSE %]
285
                                    [% ELSE %]
Lines 361-365 MARC Order Accounts Link Here
361
358
362
[% MACRO jsinclude BLOCK %]
359
[% MACRO jsinclude BLOCK %]
363
    [% Asset.js("js/admin-menu.js") | $raw %]
360
    [% Asset.js("js/admin-menu.js") | $raw %]
361
    [% INCLUDE 'select2.inc' %]
362
<script>
363
364
$(document).ready(function() {
365
366
    function display_vendor(vendor) {
367
        var $text;
368
        $text = $('<span>'+vendor.text+'</span>');
369
370
        return $text;
371
    };
372
373
    $("#vendor_id").kohaSelect({
374
        width: '10%',
375
        allowClear: false,
376
        ajax: {
377
            url: '/api/v1/acquisitions/vendors',
378
            delay: 300, // wait 300 milliseconds before triggering the request
379
            cache: true,
380
            dataType: 'json',
381
            data: function (params) {
382
                var search_term = (params.term === undefined) ? '' : params.term;
383
                var query = {
384
                    "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}),
385
                    "_order_by": "name",
386
                    "_page": params.page
387
                };
388
389
                return query;
390
            },
391
            processResults: function (data) {
392
                var results = [];
393
                data.results.forEach( function ( vendor ) {
394
                    results.push(
395
                        {
396
                            "id": vendor.id,
397
                            "text": vendor.name.escapeHtml()
398
                        }
399
                    );
400
                });
401
                return { "results": results, "pagination": { "more": data.pagination.more } };
402
            }
403
        },
404
        templateResult: display_vendor,
405
        templateSelection: display_vendor
406
    });
407
});
408
</script>
364
[% END %]
409
[% END %]
365
[% INCLUDE 'intranet-bottom.inc' %]
410
[% INCLUDE 'intranet-bottom.inc' %]
366
- 

Return to bug 34355