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

(-)a/acqui/basketheader.pl (-4 lines)
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(
120
                        undef,
121
                        { order_by => { -asc => 'name' } } );
122
119
123
    $template->param( add_form => 1,
120
    $template->param( add_form => 1,
124
                    basketname => $basket->{'basketname'},
121
                    basketname => $basket->{'basketname'},
Lines 127-133 if ( $op eq 'add_form' ) { Link Here
127
                    booksellername => $bookseller->name,
124
                    booksellername => $bookseller->name,
128
                    booksellerid => $booksellerid,
125
                    booksellerid => $booksellerid,
129
                    basketno => $basketno,
126
                    basketno => $basketno,
130
                    booksellers => $booksellers,
131
                    is_standing => $basket->{is_standing},
127
                    is_standing => $basket->{is_standing},
132
                    create_items => $basket->{create_items},
128
                    create_items => $basket->{create_items},
133
    );
129
    );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-9 / +50 lines)
Lines 82-95 Link Here
82
                <li>
82
                <li>
83
                    <label for="basketbooksellerid">Vendor: </label>
83
                    <label for="basketbooksellerid">Vendor: </label>
84
                    <select name="basketbooksellerid" id="basketbooksellerid">
84
                    <select name="basketbooksellerid" id="basketbooksellerid">
85
                    [% FOREACH b IN booksellers %]
85
                        <option value="[% booksellerid | html %]" selected="selected">Current vendor ([% booksellername | html %])</option>
86
                        [% IF booksellerid == b.id %]
86
                    </select>
87
                           <option value="[% b.id | html %]" selected="selected">[% b.name | html %]</option>
88
                        [% ELSE %]
89
                           <option value="[% b.id | html %]">[% b.name | html %]</option>
90
                        [% END %]
91
                    [% END %]
92
            </select>
93
                </li>
87
                </li>
94
                <li>
88
                <li>
95
                    <label for="basketnote">Internal note: </label>
89
                    <label for="basketnote">Internal note: </label>
Lines 163-168 Link Here
163
[% MACRO jsinclude BLOCK %]
157
[% MACRO jsinclude BLOCK %]
164
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
158
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
165
    [% Asset.js("js/acq.js") | $raw %]
159
    [% Asset.js("js/acq.js") | $raw %]
160
    [% INCLUDE 'select2.inc' %]
161
<script>
162
163
$(document).ready(function() {
164
165
    function display_bookseller (state) {
166
        var $text;
167
        $text = $('<span>'+state.text+'</span>');
168
169
        return $text;
170
    };
171
172
    $("#basketbooksellerid").kohaSelect({
173
        width: '50%',
174
        allowClear: false,
175
        ajax: {
176
            url: '/api/v1/acquisitions/vendors',
177
            delay: 300, // wait 300 milliseconds before triggering the request
178
            cache: true,
179
            dataType: 'json',
180
            data: function (params) {
181
                var search_term = (params.term === undefined) ? '' : params.term;
182
                var query = {
183
                    "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}),
184
                    "_order_by": "name",
185
                    "_page": params.page
186
                };
187
188
                return query;
189
            },
190
            processResults: function (data) {
191
                var results = [];
192
                data.results.forEach( function ( vendor ) {
193
                    results.push(
194
                        {
195
                            "id": vendor.id,
196
                            "text": vendor.name.escapeHtml()
197
                        }
198
                    );
199
                });
200
                return { "results": results, "pagination": { "more": data.pagination.more } };
201
            }
202
        },
203
        templateResult: display_bookseller,
204
        templateSelection: display_bookseller
205
    });
206
});
207
</script>
166
[% END %]
208
[% END %]
167
209
168
[% INCLUDE 'intranet-bottom.inc' %]
210
[% INCLUDE 'intranet-bottom.inc' %]
169
- 

Return to bug 34509