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

(-)a/api/v1/swagger/definitions/order.json (-2 / +2 lines)
Lines 302-310 Link Here
302
                "null"
302
                "null"
303
            ]
303
            ]
304
        },
304
        },
305
        "holds_count": {
305
        "current_holds_count": {
306
            "type": "integer",
306
            "type": "integer",
307
            "description": "Holds count for associated items"
307
            "description": "Current holds count for associated items"
308
        },
308
        },
309
        "fund": {
309
        "fund": {
310
            "type": [
310
            "type": [
(-)a/api/v1/swagger/paths/acquisitions_orders.json (-8 / +8 lines)
Lines 103-114 Link Here
103
                "basket.basket_group",
103
                "basket.basket_group",
104
                "basket.creator",
104
                "basket.creator",
105
                "biblio",
105
                "biblio",
106
                "biblio.active_orders_count",
106
                "biblio.active_orders+count",
107
                "biblio.holds_count",
107
                "biblio.holds+count",
108
                "biblio.items_count",
108
                "biblio.items+count",
109
                "biblio.suggestions.suggester",
109
                "biblio.suggestions.suggester",
110
                "fund",
110
                "fund",
111
                "holds_count",
111
                "current_holds+count",
112
                "invoice",
112
                "invoice",
113
                "items",
113
                "items",
114
                "subscription"
114
                "subscription"
Lines 250-261 Link Here
250
                "basket.basket_group",
250
                "basket.basket_group",
251
                "basket.creator",
251
                "basket.creator",
252
                "biblio",
252
                "biblio",
253
                "biblio.active_orders_count",
253
                "biblio.active_orders+count",
254
                "biblio.holds_count",
254
                "biblio.holds+count",
255
                "biblio.items_count",
255
                "biblio.items+count",
256
                "biblio.suggestions.suggester",
256
                "biblio.suggestions.suggester",
257
                "fund",
257
                "fund",
258
                "holds_count",
258
                "current_holds+count",
259
                "invoice",
259
                "invoice",
260
                "items",
260
                "items",
261
                "subscription"
261
                "subscription"
(-)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 (-10 / +245 lines)
Lines 3-8 Link Here
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE Price %]
5
[% USE Price %]
6
[% USE Currencies %]
6
[% USE currency = format('%.2f') -%]
7
[% USE currency = format('%.2f') -%]
7
[% PROCESS 'i18n.inc' %]
8
[% PROCESS 'i18n.inc' %]
8
[% SET footerjs = 1 %]
9
[% SET footerjs = 1 %]
Lines 87-92 Link Here
87
        </div>
88
        </div>
88
    [% END %]
89
    [% END %]
89
90
91
<h3>Pending orders (api)</h3>
92
<table id="pending_orders" class="table table-bordered table-striped">
93
    <thead>
94
        <tr>
95
            <th>Basket</th>
96
            <th>Basket group</th>
97
            <th>Order line</th>
98
            <th>Summary</th>
99
            <th>More</th>
100
            <th>Replacement price</th>
101
            <th>Quantity</th>
102
            <th>Unit cost</th>
103
            <th>Order cost</th>
104
            <th>Fund</th>
105
            <th>&nbsp;</th>
106
            <th>&nbsp;</th>
107
        </tr>
108
    </thead>
109
</table>
110
90
[% UNLESS no_orders_to_display %]
111
[% UNLESS no_orders_to_display %]
91
<div id="acqui_receive_summary">
112
<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>
113
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Received by:</strong> [% logged_in_user.userid | html %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
Lines 181-206 Link Here
181
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
202
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
182
				</td>
203
				</td>
183
				<td>
204
				<td>
184
                        [% IF ( loop_order.left_holds_on_order ) %]
205
                        [% 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>
206
                        <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 %]
207
                        [% 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 />
208
                        <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 %]
209
                        [% END %] [%# DONE %]
189
                        [% IF ( loop_order.can_del_bib ) %]
210
                        [% 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 />
211
                        <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 %]
212
                        [% 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>
213
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
193
                        [% END %]
214
                        [% END %]
194
                        [% IF ( loop_order.left_item ) %]
215
                        [% 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>
216
                        <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 %]
217
                        [% END %]
197
                        [% IF ( loop_order.left_biblio ) %]
218
                        [% 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>
219
                        <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 %]
220
                        [% END %]
200
                        [% IF ( loop_order.left_subscription ) %]
221
                        [% 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>
222
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</b><br>
202
                        [% END %]
223
                        [% END %]
203
                        [% IF ( loop_order.left_holds ) %]
224
                        [% 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>
225
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</b>
205
                        [% END %]
226
                        [% END %]
206
                    </td>
227
                    </td>
Lines 452-457 Link Here
452
[% MACRO jsinclude BLOCK %]
473
[% MACRO jsinclude BLOCK %]
453
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
474
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
454
    [% INCLUDE 'datatables.inc' %]
475
    [% INCLUDE 'datatables.inc' %]
476
    [% INCLUDE 'currency.inc' %]
455
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
477
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
456
    [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
478
    [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
457
    <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
479
    <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
Lines 533-538 Link Here
533
            }));
555
            }));
534
          }
556
          }
535
557
558
        var pendig_orders_tb = $("#pending_orders").api({
559
            "ajax": {
560
                "url": "/api/v1/acquisitions/orders"
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_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 = "<a href=\"opac-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
638
                      var internal_note = row.internal_note;
639
                      if ( internal_note != '' ) {
640
                          result += '<p class="ordernote"><strong>'
641
                                    + _("Internal note: ")
642
                                    + '</strong>' + internal_note
643
                                    + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
644
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
645
                                    + '&type=internal">' + _("Change internal note") + '</a>]</p>';
646
                      }
647
                      else {
648
                          result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
649
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
650
                                    + '&type=internal">' + _("Add internal note") + '</a>]';
651
                      }
652
653
                      var vendor_note = row.vendor_note;
654
                      if ( vendor_note != '' ) {
655
                          result += '<p class="ordernote"><strong>'
656
                                    + _("Vendor note: ")
657
                                    + '</strong>' + vendor_note + '</p>';
658
                      }
659
                      else {
660
                          result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
661
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
662
                                    + '&type=vendor">' + _("Add vendor note") + '</a>]';
663
                      }
664
665
                    return result;
666
                  },
667
                  "orderable": false // FIXME
668
                },
669
                { "data": function( row, type, val, meta) {
670
                        var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + row.order_id + '" class="previewData">' + _('Order') + '</a><br>'
671
                             + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + row.biblio_id + '" class="previewData">' + _("MARC") + '</a><br>'
672
                             + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=' + row.biblio_id + '" class="previewData">' + _("Card") + '</a>';
673
                        return result;
674
                  },
675
                  "orderable": false
676
                },
677
                { "data": "replacement_price",
678
                  "render": function(data, type, val, meta) {
679
                      if (type != 'display') return data;
680
                      return $currency(data);                  }
681
                },
682
                { "data": "quantity" },
683
                { "data": "ecost",
684
                  "render": function(data, type, val, meta) {
685
                      if (type != 'display') return data;
686
                      return $currency(data);
687
                  }
688
                },
689
                { "data": function ( row, type, val, meta ) {
690
                        return $currency(row.quantity * row.ecost);
691
                  }
692
                },
693
                { "data": "fund_id",
694
                  "render": function(data, type, row, meta) {
695
                      if (type != 'display') return data;
696
                      return row.fund.name;
697
                  }
698
                },
699
                {
700
                  "data": function( row, type, val, meta ) {
701
                      return '<a href="orderreceive.pl?ordernumber='
702
                            + row.order_id + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
703
                            + _("Receive") + '</a><br/>'
704
                            + '<a href="#" onclick="transfer_order_popup(' + row.order_id + '); return false;">'
705
                            + _("Transfer") + '</a>';
706
                  },
707
                  "orderable": false
708
                },
709
                {
710
                    "data": function( row, type, val, meta ) {
711
                        var result = "";
712
713
                        if ( row.current_holds_count > 0 ) {
714
                            result += '<span class="button" title="'
715
                                      + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count ) + '">'
716
                                      + _("Can't cancel order") + '</span><br/>';
717
                        }
718
                        else {
719
                            result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
720
                                        + row.order_id
721
                                        + '&biblionumber=' + row.biblio_id
722
                                        + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
723
                                        + _("Cancel order") + '</a><br/>';
724
                        }
725
726
                        if ( row.items.length > 0 ||
727
                             row.biblio.active_orders_count > 1 ||
728
                             row.biblio.subscriptions_count > 0 ||
729
                             row.bibio.holds_count > 0 ) { // biblio can be deleted
730
                            result += '<span class="button" title="'
731
                                       + _("Can't delete catalog record, see constraints below") + '">'
732
                                       + _("Can't cancel order and delete catalog record") + '</span><br>';
733
                        }
734
                        else {
735
                            result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
736
                                       + row.order_id + '&biblionumber=' + row.biblio_id
737
                                       + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
738
                                       + _("Cancel order and catalog record") + '</a><br/>';
739
                        }
740
741
                        if ( row.biblio.items_count - row.items.length > 0 ) {
742
                            result += '<b title="'
743
                                      + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
744
                                      +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</b><br/>';
745
                        }
746
747
                        if ( row.biblio.active_orders_count > 1 ) {
748
                            result += '<b title="'
749
                                      + _("Can't delete catalog record, delete other orders linked to it first") + '">'
750
                                      + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</b><br/>';
751
                        }
752
753
                        if ( row.biblio.subscriptions_count > 0 ) {
754
                            result += '<b title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
755
                                      + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
756
                                      + '</b><br>';
757
                        }
758
759
                        if ( row.biblio.holds_count > 0 ) {
760
                            result += '<b title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
761
                                      + _("%s hold(s) left").format(row.bibio.holds_count) + '</b>';
762
                        }
763
764
                        return result;
765
                    },
766
                    "orderable": false
767
                }
768
            ]
769
        });
770
771
536
          // Keep filters from finishreceive.pl to parcel.pl
772
          // Keep filters from finishreceive.pl to parcel.pl
537
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
773
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
538
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
774
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
539
- 

Return to bug 20212