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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (+229 lines)
Lines 29-34 Link Here
29
                    [% PROCESS filter_form context => "main" %]
29
                    [% PROCESS filter_form context => "main" %]
30
                [% END %]
30
                [% END %]
31
31
32
	<div id="acqui_histsearch_api">
33
        <table id="histsearcht_api">
34
            <thead>
35
			<tr>
36
                <th>Order line (parent)</th>
37
                <th>Status</th>
38
				<th>Basket</th>
39
                <th>Basket creator</th>
40
                <th>Basket group</th>
41
                <th>Managing library</th>
42
                <th>Invoice number</th>
43
                <th class="anti-the">Summary</th>
44
				<th>Vendor</th>
45
                <th class="title-string">Placed on</th>
46
                <th class="title-string">Received on</th>
47
                <th>Quantity received</th>
48
                <th>Pending order</th>
49
				<th>Unit cost</th>
50
                <th>Fund</th>
51
			</tr>
52
            </thead>
53
        </table>
54
    </div>
32
55
33
    [% IF ( order_loop ) %]<h1>Search results</h1>
56
    [% IF ( order_loop ) %]<h1>Search results</h1>
34
	<div id="acqui_histsearch">
57
	<div id="acqui_histsearch">
Lines 145-150 Link Here
145
                patron_input_name: 'created_by',
168
                patron_input_name: 'created_by',
146
                field_to_retrieve: 'borrowernumber'
169
                field_to_retrieve: 'borrowernumber'
147
            });
170
            });
171
172
        var pendig_orders_tb = $("#histsearcht_api").api({
173
            "ajax": {
174
                "url": "/api/v1/acquisitions/orders"
175
            },
176
            "embed": [
177
                "basket.basket_group",
178
                "biblio.active_orders_count",
179
                "biblio.holds_count",
180
                "biblio.items_count",
181
                "biblio.suggestions.suggester",
182
                "fund",
183
                "holds_count",
184
                "items"
185
            ],
186
            'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
187
            "columnDefs": [
188
                { "targets": [ "nosort" ],"sortable": false,"searchable": false },
189
                { "type": "anti-the", "targets" : [ "anti-the" ] },
190
                { "type": "title-string", "targets" : [ "title-string" ] }
191
            ],
192
            "columns": [
193
                { "data": "order_id" },
194
                { "data": "status" },
195
                { "data": "basket_id",
196
                  "render": function(data, type, row, meta) {
197
                      if (type != 'display') return data;
198
                      return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + data + "\">" + row.basket.name + " (" + data + ")</a>";
199
                  }
200
                },
201
                { "data": function(row, type, val, meta) {
202
                      if ( type != 'display' ) return row.basket.basket_group_id;
203
                      if ( row.basket.basket_group_id == null ) {
204
                          return _("No basket group");
205
                      }
206
                      else {
207
                          return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
208
                                 + row.basket.vendor_id + "&amp;basketgroupid="
209
                                 + row.basket.basket_group_id + "\">"
210
                                 + row.basket.basket_group.name + " (" + row.basket.basket_group_id + ")</a>";
211
                      }
212
                  }
213
                },
214
                { "data": "order_id",
215
                  "render": function(data, type, row, meta) {
216
                      if (type != 'display') return data;
217
                      return "<a href=\"neworderempty.pl?ordernumber="+data+"&amp;booksellerid="+row.basket.vendor_id+"\">"+data+"</a>";
218
                  }
219
                },
220
                { "data": function(row, type, val, meta) {
221
                      var result = "<a href=\"opac-detail.pl?biblionumber="+row.biblio_id+"\">"+row.biblio.title+"</a>";
222
                      if ( row.biblio.author != null )
223
                        result += _(" by ") + row.biblio.author;
224
                      if ( row.biblio.isbn != null )
225
                        result += " &ndash; " + row.biblio.isbn;
226
                      if ( row.biblio.publisher != null ) {
227
                        result += "<br/>" + _("Publisher: ") + row.biblio.publisher;
228
                        if ( row.biblio.publication_year != null ) {
229
                            result += ", " + row.biblio.publication_year;
230
                        }
231
                        else if ( row.biblio.copyright_date != null ) {
232
                            result += row.biblio.copyright_date;
233
                        }
234
                      }
235
                      var suggestions = row.biblio.suggestions;
236
                      if ( suggestions != null && suggestions.length > 0 ) {
237
                          var suggestion = suggestions[0];
238
                          if ( suggestion.suggestor != null ) {
239
                              var suggestor = suggestion.suggestor;
240
                              var suggested_by = [];
241
                              if ( suggestor.surname != null ) {
242
                                  suggested_by.push(suggestor.surname);
243
                              }
244
                              if ( suggestor.firstname != null ) {
245
                                  suggested_by.push(suggestor.firstname);
246
                              }
247
248
                                result += "<br/>" + _("Suggested by: ") +
249
                                            '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
250
                                                + suggestion.suggestionid
251
                                                + '&amp;op=show">'
252
                                                + suggested_by.join(", ")
253
                                                + " (#" + suggestions[0].suggestionid + ")</a>";
254
                          }
255
                      }
256
257
                      var internal_note = row.internal_note;
258
                      if ( internal_note != '' ) {
259
                          result += '<p class="ordernote"><strong>'
260
                                    + _("Internal note: ")
261
                                    + '</strong>' + internal_note
262
                                    + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
263
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
264
                                    + '&type=internal">' + _("Change internal note") + '</a>]</p>';
265
                      }
266
                      else {
267
                          result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
268
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
269
                                    + '&type=internal">' + _("Add internal note") + '</a>]';
270
                      }
271
272
                      var vendor_note = row.vendor_note;
273
                      if ( vendor_note != '' ) {
274
                          result += '<p class="ordernote"><strong>'
275
                                    + _("Vendor note: ")
276
                                    + '</strong>' + vendor_note + '</p>';
277
                      }
278
                      else {
279
                          result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
280
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
281
                                    + '&type=vendor">' + _("Add vendor note") + '</a>]';
282
                      }
283
284
                    return result;
285
                  }
286
                },
287
                { "data": function( row, type, val, meta) {
288
                        if (type != 'display') return data;
289
                        var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + row.order_id + '" class="previewData">' + _('Order') + '</a><br>'
290
                             + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + row.biblio_id + '" class="previewData">' + _("MARC") + '</a><br>'
291
                             + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=' + row.biblio_id + '" class="previewData">' + _("Card") + '</a>';
292
                        return result;
293
                  }
294
                },
295
                { "data": "replacement_price" },
296
                { "data": "quantity" },
297
                { "data": "ecost" },
298
                { "data": function ( row, type, val, meta ) {
299
                        return row.quantity * row.ecost;
300
                  }
301
                },
302
                { "data": "fund_id",
303
                  "render": function(data, type, row, meta) {
304
                      if (type != 'display') return data;
305
                      return row.fund.name;
306
                  }
307
                },
308
                {
309
                  "data": function( row, type, val, meta ) {
310
                      return '<a href="orderreceive.pl?ordernumber='
311
                            + row.order_id + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
312
                            + _("Receive") + '</a><br/>'
313
                            + '<a href="#" onclick="transfer_order_popup(' + row.order_id + '); return false;">'
314
                            + _("Transfer") + '</a>';
315
                  }
316
                },
317
                {
318
                    "data": function( row, type, val, meta ) {
319
                        var result = "";
320
321
                        if ( row.holds_count > 0 ) {
322
                            result += '<span class="button" title="'
323
                                      + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count ) + '">'
324
                                      + _("Can't cancel order") + '</span><br/>';
325
                        }
326
                        else {
327
                            result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
328
                                        + row.order_id
329
                                        + '&biblionumber=' + row.biblio_id
330
                                        + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
331
                                        + _("Cancel order") + '</a><br/>';
332
                        }
333
334
                        if ( row.items.length > 0 ||
335
                             row.biblio.active_orders_count > 1 ||
336
                             row.biblio.subscriptions_count > 0 ||
337
                             row.bibio.holds_count > 0 ) { // biblio can be deleted
338
                            result += '<span class="button" title="'
339
                                       + _("Can't delete catalog record, see constraints below") + '">'
340
                                       + _("Can't cancel order and delete catalog record") + '</span><br>';
341
                        }
342
                        else {
343
                            result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
344
                                       + row.order_id + '&biblionumber=' + row.biblio_id
345
                                       + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
346
                                       + _("Cancel order and catalog record") + '</a><br/>';
347
                        }
348
349
                        if ( row.items.length > 0 ) {
350
                            result += '<b title="'
351
                                      + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
352
                                      +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</b><br/>';
353
                        }
354
355
                        if ( row.biblio.active_orders_count > 1 ) {
356
                            result += '<b title="'
357
                                      + _("Can't delete catalog record, delete other orders linked to it first") + '">'
358
                                      + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</b><br/>';
359
                        }
360
361
                        if ( row.biblio.subscriptions_count > 0 ) {
362
                            result += '<b title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
363
                                      + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
364
                                      + '</b><br>';
365
                        }
366
367
                        if ( row.biblio.holds_count > 0 ) {
368
                            result += '<b title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
369
                                      + _("%s hold(s) left").format(row.bibio.holds_count) + '</b>';
370
                        }
371
372
                        return result;
373
                    }
374
                }
375
            ]
376
        });
148
        });
377
        });
149
    </script>
378
    </script>
150
[% END %]
379
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-55 / +327 lines)
Lines 34-49 Link Here
34
        <div class="col-sm-10 col-sm-push-2">
34
        <div class="col-sm-10 col-sm-push-2">
35
            <main>
35
            <main>
36
36
37
	[% IF ( receive_error ) %]
37
    [% IF ( receive_error ) %]
38
	<div class="dialog alert">
38
    <div class="dialog alert">
39
	<h3>Error adding items:</h3>
39
    <h3>Error adding items:</h3>
40
	<ul>
40
    <ul>
41
	[% FOREACH error_loo IN error_loop %]
41
    [% FOREACH error_loo IN error_loop %]
42
		<li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
42
        <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
43
	[% END %]
43
    [% END %]
44
	</ul>
44
    </ul>
45
	</div>
45
    </div>
46
	[% END %]
46
    [% END %]
47
    <h1>
47
    <h1>
48
        [% IF datereceived %]
48
        [% IF datereceived %]
49
            Receipt summary for <i>[% name | html %]</i> [% IF ( invoice ) %] <i> [ [% invoice | html %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
49
            Receipt summary for <i>[% name | html %]</i> [% IF ( invoice ) %] <i> [ [% invoice | html %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
Lines 55-66 Link Here
55
    [% IF ( success_delorder ) %]
55
    [% IF ( success_delorder ) %]
56
    <div class="dialog message">The order has been successfully canceled.</div>
56
    <div class="dialog message">The order has been successfully canceled.</div>
57
    [% ELSE %]
57
    [% ELSE %]
58
	[% IF ( error_delitem ) %]
58
    [% IF ( error_delitem ) %]
59
	    <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
59
        <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
60
	[% END %]
60
    [% END %]
61
	[% IF ( error_delbiblio ) %]
61
    [% IF ( error_delbiblio ) %]
62
	    <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
62
        <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
63
	[% END %]
63
    [% END %]
64
    [% END %]
64
    [% END %]
65
65
66
    [% IF (error_cancelling_receipt) %]
66
    [% IF (error_cancelling_receipt) %]
Lines 87-92 Link Here
87
        </div>
87
        </div>
88
    [% END %]
88
    [% END %]
89
89
90
<h3>Pending orders (api)</h3>
91
<table id="pending_orders" class="table table-bordered table-striped">
92
    <thead>
93
        <tr>
94
            <th>Basket</th>
95
            <th>Basket group</th>
96
            <th>Order line</th>
97
            <th>Summary</th>
98
            <th>More</th>
99
            <th>Replacement price</th>
100
            <th>Quantity</th>
101
            <th>Unit cost</th>
102
            <th>Order cost</th>
103
            <th>Fund</th>
104
            <th>&nbsp;</th>
105
            <th>&nbsp;</th>
106
        </tr>
107
    </thead>
108
</table>
109
90
[% UNLESS no_orders_to_display %]
110
[% UNLESS no_orders_to_display %]
91
<div id="acqui_receive_summary">
111
<div id="acqui_receive_summary">
92
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Received by:</strong> [% logged_in_user.userid | html %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
112
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Received by:</strong> [% logged_in_user.userid | html %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
Lines 175-206 Link Here
175
                <td>[% loop_order.ecost | $Price %]</td>
195
                <td>[% loop_order.ecost | $Price %]</td>
176
                <td>[% loop_order.total | $Price %]</td>
196
                <td>[% loop_order.total | $Price %]</td>
177
                <td>[% loop_order.budget_name | html %]</td>
197
                <td>[% loop_order.budget_name | html %]</td>
178
				<td>
198
                <td>
179
                              <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;invoiceid=[% invoiceid | uri %]">Receive</a>
199
                              <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;invoiceid=[% invoiceid | uri %]">Receive</a>
180
                    <br />
200
                    <br />
181
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
201
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
182
				</td>
202
                </td>
183
				<td>
203
                <td>
184
                        [% IF ( loop_order.left_holds_on_order ) %]
204
                        [% IF ( loop_order.left_holds_on_order ) %] [%# DONE %]
185
                        <span class="button" title="Can't cancel order, ([% loop_order.holds_on_order | html %]) holds are linked with this order. Cancel holds first">Can't cancel order</span><br>
205
                        <span class="button" title="Can't cancel order, ([% loop_order.holds_on_order | html %]) holds are linked with this order. Cancel holds first">Can't cancel order</span><br>
186
                        [% ELSE %]
206
                        [% ELSE %] [%# DONE %]
187
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order</a><br />
207
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order</a><br />
188
                        [% END %]
208
                        [% END %] [%# DONE %]
189
                        [% IF ( loop_order.can_del_bib ) %]
209
                        [% IF ( loop_order.can_del_bib ) %] [%# DONE %]
190
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&del_biblio=1&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order and catalog record</a><br />
210
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&del_biblio=1&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order and catalog record</a><br />
191
                        [% ELSE %]
211
                        [% ELSE %] [%# DONE %]
192
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
212
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
193
                        [% END %]
213
                        [% END %]
194
                        [% IF ( loop_order.left_item ) %]
214
                        [% IF ( loop_order.left_item ) %] [%# DONE %]
195
                        <b title="Can't delete catalog record, because of [% loop_order.items | html %] existing item(s)" >[% loop_order.items | html %] item(s) left</b><br>
215
                        <b title="Can't delete catalog record, because of [% loop_order.items | html %] existing item(s)" >[% loop_order.items | html %] item(s) left</b><br>
196
                        [% END %]
216
                        [% END %]
197
                        [% IF ( loop_order.left_biblio ) %]
217
                        [% IF ( loop_order.left_biblio ) %]  [%# DONE %]
198
                        <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios | html %] order(s) left</b><br>
218
                        <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios | html %] order(s) left</b><br>
199
                        [% END %]
219
                        [% END %]
200
                        [% IF ( loop_order.left_subscription ) %]
220
                        [% IF ( loop_order.left_subscription ) %] [%# DONE %]
201
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</b><br>
221
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</b><br>
202
                        [% END %]
222
                        [% END %]
203
                        [% IF ( loop_order.left_holds ) %]
223
                        [% IF ( loop_order.left_holds ) %] [%# DONE %]
204
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</b>
224
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</b>
205
                        [% END %]
225
                        [% END %]
206
                    </td>
226
                    </td>
Lines 365-376 Link Here
365
                    [% END %]
385
                    [% END %]
366
                </td>
386
                </td>
367
            </tr>
387
            </tr>
368
	    [% END %]
388
        [% END %]
369
	</tbody>
389
    </tbody>
370
    </table>
390
    </table>
371
    </form>
391
    </form>
372
392
373
	[% ELSE %]There are no received orders.[% END %]
393
    [% ELSE %]There are no received orders.[% END %]
374
</div>
394
</div>
375
395
376
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
396
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
Lines 533-552 Link Here
533
            }));
553
            }));
534
          }
554
          }
535
555
536
          // Keep filters from finishreceive.pl to parcel.pl
537
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
538
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
539
          $.cookie("filter_parcel_orderno", $("#orderfilter").val());
540
          $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
541
          $.cookie("filter_parcel_ean", $("#eanfilter").val());
542
556
543
          $("#filterform").on('submit', function(){
557
            var pending_orders_url = "/api/v1/acquisitions/orders?status=ordered";
558
            var pending_orders_table = $("#pending_orders").api({
559
                "ajax": {
560
                    "url": pending_orders_url
561
                },
562
                "embed": [
563
                    "basket.basket_group",
564
                    "biblio.active_orders+count",
565
                    "biblio.holds+count",
566
                    "biblio.items+count",
567
                    "biblio.suggestions.suggester",
568
                    "fund",
569
                    "current_item_level_holds+count",
570
                    "items"
571
                ],
572
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
573
                "columns": [
574
                    { "data": "basket_id",
575
                      "orderable": true,
576
                      "render": function(data, type, row, meta) {
577
                        if (type != 'display') return data;
578
                        return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + data + "\">" + row.basket.name + " (" + data + ")</a>";
579
                    }
580
                    },
581
                    { "data": function(row, type, val, meta) {
582
                        if ( type != 'display' ) return row.basket.basket_group_id;
583
                        if ( row.basket.basket_group_id == null ) {
584
                            return _("No basket group");
585
                        }
586
                        else {
587
                            return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
588
                                    + row.basket.vendor_id + "&amp;basketgroupid="
589
                                    + row.basket.basket_group_id + "\">"
590
                                    + row.basket.basket_group.name + " (" + row.basket.basket_group_id + ")</a>";
591
                        }
592
                      },
593
                      "orderable": false // FIXME
594
                    },
595
                    { "data": "order_id",
596
                      "render": function(data, type, row, meta) {
597
                        if (type != 'display') return data;
598
                        return "<a href=\"neworderempty.pl?ordernumber="+data+"&amp;booksellerid="+row.basket.vendor_id+"\">"+data+"</a>";
599
                      }
600
                    },
601
                    { "data": function(row, type, val, meta) {
602
                        var result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+row.biblio_id+"\">"+row.biblio.title+"</a>";
603
                        if ( row.biblio.author != null )
604
                            result += _(" by ") + row.biblio.author;
605
                        if ( row.biblio.isbn != null )
606
                            result += " &ndash; " + row.biblio.isbn;
607
                        if ( row.biblio.publisher != null ) {
608
                            result += "<br/>" + _("Publisher: ") + row.biblio.publisher;
609
                            if ( row.biblio.publication_year != null ) {
610
                                result += ", " + row.biblio.publication_year;
611
                            }
612
                            else if ( row.biblio.copyright_date != null ) {
613
                                result += row.biblio.copyright_date;
614
                            }
615
                        }
616
                        var suggestions = row.biblio.suggestions;
617
                        if ( suggestions != null && suggestions.length > 0 ) {
618
                            var suggestion = suggestions[0];
619
                            if ( suggestion.suggester != null ) {
620
                                var suggester = suggestion.suggester;
621
                                var suggested_by = [];
622
                                if ( suggester.surname != null ) {
623
                                    suggested_by.push(suggester.surname);
624
                                }
625
                                if ( suggester.firstname != null ) {
626
                                    suggested_by.push(suggester.firstname);
627
                                }
628
629
                                    result += "<br/>" + _("Suggested by: ") +
630
                                                '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
631
                                                    + suggestion.suggestionid
632
                                                    + '&amp;op=show">'
633
                                                    + suggested_by.join(", ")
634
                                                    + " (#" + suggestions[0].suggestionid + ")</a>";
635
                            }
636
                        }
637
                        result += '</p>';
638
639
                        var internal_note = row.internal_note;
640
                        if ( internal_note != '' ) {
641
                            result += '<p class="ordernote"><strong>'
642
                                        + _("Internal note: ")
643
                                        + '</strong>' + internal_note
644
                                        + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
645
                                        + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
646
                                        + '&type=internal">' + _("Change internal note") + '</a>]</p>';
647
                        }
648
                        else {
649
                            result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
650
                                        + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
651
                                        + '&type=internal">' + _("Add internal note") + '</a>]';
652
                        }
653
654
                        var vendor_note = row.vendor_note;
655
                        if ( vendor_note != '' ) {
656
                            result += '<p class="ordernote"><strong>'
657
                                        + _("Vendor note: ")
658
                                        + '</strong>' + vendor_note + '</p>';
659
                        }
660
                        else {
661
                            result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
662
                                        + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
663
                                        + '&type=vendor">' + _("Add vendor note") + '</a>]';
664
                        }
665
666
                        return result;
667
                      },
668
                      "orderable": false // FIXME
669
                    },
670
                    { "data": function( row, type, val, meta) {
671
                            var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + row.order_id + '" class="previewData">' + _('Order') + '</a><br>'
672
                                + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + row.biblio_id + '" class="previewData">' + _("MARC") + '</a><br>'
673
                                + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=' + row.biblio_id + '" class="previewData">' + _("Card") + '</a>';
674
                            return result;
675
                      },
676
                      "orderable": false
677
                    },
678
                    { "data": "replacement_price",
679
                      "render": function(data, type, val, meta) {
680
                        if (type != 'display') return data;
681
                        return data.format_price();
682
                      }
683
                    },
684
                    { "data": "quantity",
685
                      "orderable": true
686
                    },
687
                    { "data": "ecost",
688
                      "render": function(data, type, val, meta) {
689
                        if (type != 'display') return data;
690
                        return data.format_price();
691
                      },
692
                      "orderable": true
693
                    },
694
                    { "data": function ( row, type, val, meta ) {
695
                            return (row.quantity * row.ecost).format_price();
696
                      },
697
                      "orderable": false // FIXME: How can we do it in DBIC?
698
                    },
699
                    { "data": "fund_id",
700
                      "render": function(data, type, row, meta) {
701
                        if (type != 'display') return data;
702
                        return row.fund.name;
703
                      }
704
                    },
705
                    { "data": function( row, type, val, meta ) {
706
                        return '<a href="orderreceive.pl?ordernumber='
707
                                + row.order_id + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
708
                                + _("Receive") + '</a><br/>'
709
                                + '<a href="#" onclick="transfer_order_popup(' + row.order_id + '); return false;">'
710
                                + _("Transfer") + '</a>';
711
                      },
712
                      "orderable": false
713
                    },
714
                    { "data": function( row, type, val, meta ) {
715
                            var result = "";
716
717
                            if ( row.current_holds_count > 0 ) {
718
                                result += '<span class="button" title="'
719
                                        + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count ) + '">'
720
                                        + _("Can't cancel order") + '</span><br/>';
721
                            }
722
                            else {
723
                                result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
724
                                            + row.order_id
725
                                            + '&biblionumber=' + row.biblio_id
726
                                            + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
727
                                            + _("Cancel order") + '</a><br/>';
728
                            }
729
730
                            if ( row.items.length > 0 ||
731
                                row.biblio.active_orders_count > 1 ||
732
                                row.biblio.subscriptions_count > 0 ||
733
                                row.bibio.holds_count > 0 ) { // biblio can be deleted
734
                                result += '<span class="button" title="'
735
                                        + _("Can't delete catalog record, see constraints below") + '">'
736
                                        + _("Can't cancel order and delete catalog record") + '</span><br>';
737
                            }
738
                            else {
739
                                result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
740
                                        + row.order_id + '&biblionumber=' + row.biblio_id
741
                                        + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
742
                                        + _("Cancel order and catalog record") + '</a><br/>';
743
                            }
744
745
                            if ( row.biblio.items_count - row.items.length > 0 ) {
746
                                result += '<b title="'
747
                                        + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
748
                                        +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</b><br/>';
749
                            }
750
751
                            if ( row.biblio.active_orders_count > 1 ) {
752
                                result += '<b title="'
753
                                        + _("Can't delete catalog record, delete other orders linked to it first") + '">'
754
                                        + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</b><br/>';
755
                            }
756
757
                            if ( row.biblio.subscriptions_count > 0 ) {
758
                                result += '<b title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
759
                                        + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
760
                                        + '</b><br>';
761
                            }
762
763
                            if ( row.biblio.holds_count > 0 ) {
764
                                result += '<b title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
765
                                        + _("%s hold(s) left").format(row.bibio.holds_count) + '</b>';
766
                            }
767
768
                            return result;
769
                      },
770
                      "orderable": false
771
                    }
772
                ]
773
            });
774
775
            $("#filterform").on("submit", function(e) {
776
                e.preventDefault();
777
                // Update the datatable URL
778
                var summary      = $("#summaryfilter").val();
779
                var basket_name  = $("#basketfilter").val();
780
                var basket_group = $("#basketgroupnamefilter").val();
781
                var order_id     = $("#orderfilter").val();
782
783
                var q = {};
784
785
                if (order_id != "") {
786
                    q['order_id'] = order_id;
787
                }
788
                if (basket_name != "") { // C4::Acquisition::SearchOrders behaviour
789
                    q['basket.name'] = { "like": '%'+basket_name+'%' };
790
                }
791
                if (basket_group != "") { // C4::Acquisition::SearchOrders behaviour
792
                    q['basket.basket_group.name'] = { "like": '%'+basket_group+'%' };
793
                }
794
                if (summary != "") { // C4::Acquisition::SearchOrders behaviour
795
                    q["-or"] = [{"biblio.title":  { "like": '%'+summary+'%' } },
796
                                {"biblio.author": { "like": '%'+summary+'%' } },
797
                                {"biblio.isbn":   { "like": '%'+summary+'%' } } ];
798
                }
799
800
                if ( !jQuery.isEmptyObject(q) ) {
801
                    pending_orders_table.api().ajax.url( pending_orders_url + '&q=' + encodeURI(JSON.stringify(q)) );
802
                }
803
                else {
804
                    pending_orders_table.api().ajax.url( pending_orders_url );
805
                }
806
                pending_orders_table.api().ajax.reload( null, false );
807
            });
808
809
            // Keep filters from finishreceive.pl to parcel.pl
544
            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
810
            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
545
            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
811
            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
546
            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
812
            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
547
            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
813
            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
548
            $.cookie("filter_parcel_ean", $("#eanfilter").val());
814
            $.cookie("filter_parcel_ean", $("#eanfilter").val());
549
          });
815
816
            $("#filterform").on('submit', function(){
817
                $.cookie("filter_parcel_summary", $("#summaryfilter").val());
818
                $.cookie("filter_parcel_basketname", $("#basketfilter").val());
819
                $.cookie("filter_parcel_orderno", $("#orderfilter").val());
820
                $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
821
                $.cookie("filter_parcel_ean", $("#eanfilter").val());
822
            });
550
823
551
            $(".previewData").on("click", function(e){
824
            $(".previewData").on("click", function(e){
552
                e.preventDefault();
825
                e.preventDefault();
Lines 556-583 Link Here
556
                $("#dataPreview .modal-body").load(page + " div");
829
                $("#dataPreview .modal-body").load(page + " div");
557
                $('#dataPreview').modal({show:true});
830
                $('#dataPreview').modal({show:true});
558
            });
831
            });
832
559
            $("#dataPreview").on("hidden.bs.modal", function(){
833
            $("#dataPreview").on("hidden.bs.modal", function(){
560
                $("#dataPreviewLabel").html("");
834
                $("#dataPreviewLabel").html("");
561
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
835
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
562
            });
836
            });
837
        });
838
839
        // Case-insensitive version of jquery's contains function
840
        jQuery.extend(jQuery.expr[':'], {
841
            icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
842
        });
563
843
844
        // Contains exactly function
845
        jQuery.extend(jQuery.expr[':'], {
846
            containsExactly: "$(a).text() == m[3]"
564
        });
847
        });
565
848
566
         // Case-insensitive version of jquery's contains function
849
        function transfer_order_popup(ordernumber) {
567
         jQuery.extend(jQuery.expr[':'], {
850
        var url = "/cgi-bin/koha/acqui/transferorder.pl?"
568
	    icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
851
            + "ordernumber=" + ordernumber
569
         });
852
            window.open(url, 'TransferOrder');
570
853
        }
571
         // Contains exactly function
572
         jQuery.extend(jQuery.expr[':'], {
573
              containsExactly: "$(a).text() == m[3]"
574
         });
575
576
         function transfer_order_popup(ordernumber) {
577
            var url = "/cgi-bin/koha/acqui/transferorder.pl?"
578
                + "ordernumber=" + ordernumber
579
                window.open(url, 'TransferOrder');
580
         }
581
    </script>
854
    </script>
582
[% END %]
855
[% END %]
583
856
584
- 

Return to bug 20212