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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-233 / +432 lines)
Lines 39-54 Link Here
39
        <div class="col-sm-10 col-sm-push-2">
39
        <div class="col-sm-10 col-sm-push-2">
40
            <main>
40
            <main>
41
41
42
	[% IF ( receive_error ) %]
42
    [% IF ( receive_error ) %]
43
	<div class="dialog alert">
43
    <div class="dialog alert">
44
	<h3>Error adding items:</h3>
44
    <h3>Error adding items:</h3>
45
	<ul>
45
    <ul>
46
	[% FOREACH error_loo IN error_loop %]
46
    [% FOREACH error_loo IN error_loop %]
47
		<li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
47
        <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
48
	[% END %]
48
    [% END %]
49
	</ul>
49
    </ul>
50
	</div>
50
    </div>
51
	[% END %]
51
    [% END %]
52
    <h1>
52
    <h1>
53
        [% IF ( invoiceclosedate ) %]
53
        [% IF ( invoiceclosedate ) %]
54
        Receipt summary for <em>[% name | html %]</em> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
54
        Receipt summary for <em>[% name | html %]</em> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
Lines 60-71 Link Here
60
    [% IF ( success_delorder ) %]
60
    [% IF ( success_delorder ) %]
61
    <div class="dialog message">The order has been successfully canceled.</div>
61
    <div class="dialog message">The order has been successfully canceled.</div>
62
    [% ELSE %]
62
    [% ELSE %]
63
	[% IF ( error_delitem ) %]
63
    [% IF ( error_delitem ) %]
64
	    <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
64
        <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
65
	[% END %]
65
    [% END %]
66
	[% IF ( error_delbiblio ) %]
66
    [% IF ( error_delbiblio ) %]
67
	    <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
67
        <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
68
	[% END %]
68
    [% END %]
69
    [% END %]
69
    [% END %]
70
70
71
    [% IF (error_cancelling_receipt) %]
71
    [% IF (error_cancelling_receipt) %]
Lines 97-220 Link Here
97
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
97
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
98
</div>
98
</div>
99
[% UNLESS (invoiceclosedate) %]
99
[% UNLESS (invoiceclosedate) %]
100
  <div id="acqui_receive_search">
100
    <div id="acqui_receive_search">
101
    <h3>Pending orders</h3>
101
        <h3>Pending orders</h3>
102
102
        <table id="pending_orders" class="table table-bordered table-striped">
103
    [% IF ( loop_orders ) %]
103
            <thead>
104
      <table id="pendingt">
104
                <tr>
105
        <thead>
105
                    <th>Basket</th>
106
          <tr>
106
                    <th>Basket group</th>
107
            <th>Basket search</th>
107
                    <th>Order line</th>
108
            <th>Basket group search</th>
108
                    <th class="hidden">Title</th>
109
            <th>Order line search</th>
109
                    <th class="hidden">Author</th>
110
            <th>Summary search</th>
110
                    <th class="hidden">ISBN</th>
111
            <th>&nbsp;</th>
111
                    <th>Summary</th>
112
            <th>Replacement price search</th>
112
                    <th>More</th>
113
            <th>Quantity search</th>
113
                    <th>Replacement price</th>
114
            <th>Unit cost search</th>
114
                    <th>Quantity</th>
115
            <th>Order cost search</th>
115
                    <th>Unit cost</th>
116
            <th>Fund search</th>
116
                    <th>Order cost</th>
117
            <th>&nbsp;</th>
117
                    <th>Fund</th>
118
            <th>&nbsp;</th>
118
                    <th>&nbsp;</th>
119
          </tr>
119
                    <th>&nbsp;</th>
120
          <tr>
121
            <th>Basket</th>
122
            <th>Basket group</th>
123
            <th>Order line</th>
124
            <th>Summary</th>
125
            <th>More</th>
126
            <th>Replacement price</th>
127
            <th>Quantity</th>
128
            <th>Unit cost</th>
129
            <th>Order cost</th>
130
            <th>Fund</th>
131
            <th>&nbsp;</th>
132
            <th>&nbsp;</th>
133
          </tr>
134
        </thead>
135
        <tbody class="filterclass">
136
        [% FOREACH loop_order IN loop_orders %]
137
            <tr>
138
                <td class="basketfilterclass"><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno | uri %]">[% loop_order.basketname | html %] ([% loop_order.basketno | html %])</a></td>
139
                <td>
140
                  [% IF loop_order.basketgroupid %]
141
                  <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | uri %]&amp;basketgroupid=[% loop_order.basketgroupid | uri %]">[% loop_order.basketgroupname | html %] ([% loop_order.basketgroupid | html %])</a>
142
                  [% ELSE %]
143
                    No basket group
144
                  [% END %]
145
                </td>
146
                <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;booksellerid=[% loop_order.booksellerid | uri %]">[% loop_order.ordernumber | html %]</a></td>
147
                <td class="summaryfilterclass">
148
                  <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber | uri %]">[% loop_order.title | html %]</a>
149
                [% IF ( loop_order.author ) %] by [% loop_order.author | html %][% END %]
150
                [% IF ( loop_order.isbn ) %] &ndash; [% loop_order.isbn | html %][% END %]
151
                [% IF ( loop_order.publishercode ) %]
152
                    <br />Publisher: [% loop_order.publishercode | html %]
153
                    [%- IF    ( loop_order.publicationyear > 0) -%], [% loop_order.publicationyear | html %]
154
                    [%- ELSIF ( loop_order.copyrightdate   > 0) -%] [% loop_order.copyrightdate | html %]
155
                    [% END %]
156
                [% END %]
157
                [% IF ( loop_order.suggestionid ) %]
158
                    <br/>
159
                    Suggested by: <a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid | uri %]&amp;op=show">[% loop_order.surnamesuggestedby | html %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby | html %] [% END %]( #[% loop_order.suggestionid | html %])</a>
160
                [% END %]
161
                <br />
162
                [% IF ( loop_order.order_internalnote ) %]
163
                    <p class="ordernote"><strong>Internal note: </strong>[% loop_order.order_internalnote | html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=internal">Change internal note</a>]</p>
164
                [% ELSE %]
165
                    [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=internal">Add internal note</a>]
166
                [% END %]
167
                [% IF ( loop_order.order_vendornote ) %]
168
                    <p class="ordernote"><strong>Vendor note: </strong>[% loop_order.order_vendornote | html %]</p>
169
                [% ELSE %]
170
                    [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=vendor">Add vendor note</a>]
171
                [% END %]
172
                </td>
173
                <td>
174
                  <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% loop_order.ordernumber | uri %]" class="previewData">[% tp('noun', 'Order') | html %]</a><br>
175
                  <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber | uri %]" class="previewData">MARC</a><br>
176
                  <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber | uri %]" class="previewData">Card</a>
177
                </td>
178
                <td>[% loop_order.replacementprice | $Price %]</td>
179
                <td>[% loop_order.quantity | html %]</td>
180
                <td>[% loop_order.ecost | $Price %]</td>
181
                <td>[% loop_order.total | $Price %]</td>
182
                <td>[% loop_order.budget_name | html %]</td>
183
				<td>
184
                              <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber | uri %]&amp;invoiceid=[% invoiceid | uri %]">Receive</a>
185
                    <br />
186
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
187
				</td>
188
				<td>
189
                        [% IF ( loop_order.left_holds_on_order ) %]
190
                        <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>
191
                        [% ELSE %]
192
                        <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 />
193
                        [% END %]
194
                        [% IF ( loop_order.can_del_bib ) %]
195
                        <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 />
196
                        [% ELSE %]
197
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
198
                        [% END %]
199
                        [% IF ( loop_order.left_item ) %]
200
                        <strong title="Can't delete catalog record, because of [% loop_order.items | html %] existing item(s)" >[% loop_order.items | html %] item(s) left</strong><br>
201
                        [% END %]
202
                        [% IF ( loop_order.left_biblio ) %]
203
                        <strong title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios | html %] order(s) left</strong><br>
204
                        [% END %]
205
                        [% IF ( loop_order.left_subscription ) %]
206
                        <strong title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</strong><br>
207
                        [% END %]
208
                        [% IF ( loop_order.left_holds ) %]
209
                        <strong title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</strong>
210
                        [% END %]
211
                    </td>
212
                </tr>
120
                </tr>
213
        [% END %]
121
            </thead>
214
        </tbody>
122
        </table>
215
      </table>
123
    </div>
216
    [% ELSE %]There are no pending orders.[% END %]
217
  </div>
218
[% ELSE %]
124
[% ELSE %]
219
    <p>
125
    <p>
220
        Invoice is closed, so you can't receive orders anymore.
126
        Invoice is closed, so you can't receive orders anymore.
Lines 372-383 Link Here
372
                    [% END %]
278
                    [% END %]
373
                </td>
279
                </td>
374
            </tr>
280
            </tr>
375
	    [% END %]
281
        [% END %]
376
	</tbody>
282
    </tbody>
377
    </table>
283
    </table>
378
    </form>
284
    </form>
379
285
380
	[% ELSE %]There are no received orders.[% END %]
286
    [% ELSE %]There are no received orders.[% END %]
381
</div>
287
</div>
382
288
383
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
289
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
Lines 438-444 Link Here
438
      </li>
344
      </li>
439
      [% IF (UNIMARC) %]
345
      [% IF (UNIMARC) %]
440
        <li>
346
        <li>
441
          <label for="eanfilter">EAN :</label>
347
          <label for="eanfilter">EAN:</label>
442
          <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter | html %]"/>
348
          <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter | html %]"/>
443
        </li>
349
        </li>
444
      [% END %]
350
      [% END %]
Lines 447-453 Link Here
447
      <input type="hidden" value="search" name="op" />
353
      <input type="hidden" value="search" name="op" />
448
      <input type="hidden" value="[% invoiceid | html %]" name="invoiceid" />
354
      <input type="hidden" value="[% invoiceid | html %]" name="invoiceid" />
449
      <input type="submit" value="Filter" />
355
      <input type="submit" value="Filter" />
450
      <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">Clear</a>
356
      <a href="#" id="clear_form_filters">Clear</a>
451
    </fieldset>
357
    </fieldset>
452
  </fieldset>
358
  </fieldset>
453
</form>
359
</form>
Lines 467-559 Link Here
467
        var sticky_filters = [% sticky_filters | html %];
373
        var sticky_filters = [% sticky_filters | html %];
468
374
469
        $(document).ready(function(){
375
        $(document).ready(function(){
470
          if ( $("#pendingt").length ) {
376
471
            var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
377
            if ( $("#receivedt").length ) {
472
                "bStateSave": true,
378
                var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
473
                "iCookieDuration": 60*60*24*1000, // 1000 days
379
                    "bStateSave": true,
474
                "iDisplayLength": 10,
380
                    "iCookieDuration": 60*60*24*1000, // 1000 days
475
                "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
381
                    "iDisplayLength": 10,
476
                "aoColumnDefs": [
382
                    "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
477
                    { "aTargets": [ 4, 9, 10 ], "bSortable": false, "bSearchable": false },
383
                    "aoColumnDefs": [
478
                ],
384
                        { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
479
                "aoColumns": [
385
                    ],
480
                    { "sType": "html" },
386
                    "aoColumns": [
481
                    { "sType": "html" },
387
                        { "sType": "html" },
482
                    { "sType": "num-html" },
388
                        { "sType": "html" },
483
                    { "sType": "anti-the" },
389
                        { "sType": "html" },
484
                    null,
390
                        { "sType": "num-html" },
485
                    null,
391
                        { "sType": "anti-the" },
486
                    null,
392
                        null,
487
                    null,
393
                        null,
488
                    null,
394
                        null,
489
                    null,
395
                        null,
490
                    null,
396
                        null,
491
                    null,
397
                        null,
398
                        null,
399
                        null
400
                    ],
401
                    "sPaginationType": "full"
402
                }));
403
            }
404
405
            var base_query = { "basket.vendor_id": [% booksellerid | html %]  };
406
            var pending_orders_url = '/api/v1/acquisitions/orders?only_active=1';
407
            var pending_orders_table = $("#pending_orders").api({
408
                "ajax": {
409
                    "url": pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query))
410
                },
411
                "header_filter": true,
412
                "embed": [
413
                    "basket.basket_group",
414
                    "biblio.active_orders+count",
415
                    "biblio.holds+count",
416
                    "biblio.items+count",
417
                    "biblio.suggestions.suggester",
418
                    "fund",
419
                    "current_item_level_holds+count",
420
                    "items"
492
                ],
421
                ],
493
                'bAutoWidth': false,
422
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
494
                "sPaginationType": "full"
423
                "drawCallback": function (settings) {
495
            } )
424
                    $(".previewData").on("click", function(e){
496
            ).columnFilter({
425
                        e.preventDefault();
497
                sPlaceHolder: "head:after",
426
                        var ltitle = $(this).text();
498
                aoColumns: [
427
                        var page = $(this).attr("href");
499
                    { type: "text" },
428
                        $("#dataPreviewLabel").text(ltitle);
500
                    { type: "text" },
429
                        $("#dataPreview .modal-body").load(page + " div");
501
                    { type: "text" },
430
                        $('#dataPreview').modal({show:true});
502
                    { type: "text" },
431
                    });
503
                    null,
432
                },
504
                    { type: "text" },
433
                "columnDefs": [ {
505
                    { type: "text" },
434
                    "targets": [3,4,5,9],
506
                    { type: "text" },
435
                    "render": function (data, type, row, meta) {
507
                    { type: "text" },
436
                        if ( data != null ) {
508
                    { type: "text" },
437
                            return data.escapeHtml();
509
                    null,
438
                        }
510
                    null
439
                        else {
440
                            return "";
441
                        }
442
                    }
443
                },
444
                {
445
                    "targets": [8,10],
446
                    "render": function (data, type, row, meta) {
447
                        if ( data != null ) {
448
                            return data.escapeHtml().format_price();
449
                        }
450
                        else {
451
                            return "";
452
                        }
453
                    }
454
                } ],
455
                "columns": [
456
                    { "data": "basket.name",
457
                      "orderable": true,
458
                      "render": function(data, type, row, meta) {
459
                        if (type != 'display') return data;
460
                        return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + row.basket.basket_id + "\">" + data + " (" + row.basket.basket_id + ")</a>";
461
                      }
462
                    },
463
                    { "data": "basket.basket_group.name",
464
                      "orderable": true,
465
                      "render": function(data, type, row, meta) {
466
                        if ( type != 'display' ) {
467
                            if ( data == null ) {
468
                                return "";
469
                            }
470
                            else {
471
                                return data;
472
                            }
473
                        }
474
                        if ( row.basket.basket_group_id == null ) {
475
                            return _("No basket group");
476
                        }
477
                        else {
478
                            return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
479
                                    + row.basket.vendor_id + "&amp;basketgroupid="
480
                                    + row.basket.basket_group_id + "\">"
481
                                    + row.basket.basket_group.name + " (" + row.basket.basket_group_id + ")</a>";
482
                        }
483
                      }
484
                    },
485
                    {
486
                        "data": "order_id",
487
                        "render": function(data, type, row, meta) {
488
                            if (type != 'display') return data;
489
                            return "<a href=\"neworderempty.pl?ordernumber="+data+"&amp;booksellerid="+row.basket.vendor_id+"\">"+data+"</a>";
490
                        }
491
                    },
492
                    {
493
                        "data": "biblio.author",
494
                        "visible": false,
495
                        "searchable": true,
496
                        "orderable": false
497
                    },
498
                    {
499
                        "data": "biblio.title",
500
                        "visible": false,
501
                        "searchable": true,
502
                        "orderable": false
503
                    },
504
                    {
505
                        "data": "biblio.isbn",
506
                        "visible": false,
507
                        "searchable": true,
508
                        "orderable": false
509
                    },
510
                    {
511
                        "data": function(row, type, val, meta) {
512
                            var result = '';
513
                            if ( row.biblio_id != null ) {
514
                                result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+row.biblio.title.escapeHtml()+"</a>";
515
                                if ( row.biblio.author != null )
516
                                    result += _(" by ") + row.biblio.author.escapeHtml();
517
                                if ( row.biblio.isbn != null )
518
                                    result += " &ndash; " + row.biblio.isbn.escapeHtml();
519
                                if ( row.biblio.publisher != null ) {
520
                                    result += "<br/>" + _("Publisher: ") + row.biblio.publisher.escapeHtml();
521
                                    if ( row.biblio.publication_year != null ) {
522
                                        result += ", " + row.biblio.publication_year.escapeHtml();
523
                                    }
524
                                    else if ( row.biblio.copyright_date != null ) {
525
                                        result += row.biblio.copyright_date.escapeHtml();
526
                                    }
527
                                }
528
                                var suggestions = row.biblio.suggestions;
529
                                if ( suggestions != null && suggestions.length > 0 ) {
530
                                    var suggestion = suggestions[0];
531
                                    if ( suggestion.suggester != null ) {
532
                                        var suggester = suggestion.suggester;
533
                                        var suggested_by = [];
534
                                        if ( suggester.surname != null ) {
535
                                            suggested_by.push(suggester.surname.escapeHtml());
536
                                        }
537
                                        if ( suggester.firstname != null ) {
538
                                            suggested_by.push(suggester.firstname.escapeHtml());
539
                                        }
540
541
                                            result += "<br/>" + _("Suggested by: ") +
542
                                                        '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
543
                                                            + encodeURIComponent(suggestion.suggestionid)
544
                                                            + '&amp;op=show">'
545
                                                            + suggested_by.join(", ")
546
                                                            + " (#" + suggestions[0].suggestionid + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
547
                                    }
548
                                }
549
                                result += '</p>';
550
                            }
551
552
                            var internal_note = row.internal_note;
553
                            if ( internal_note != null && internal_note != '' ) {
554
                                result += '<p class="ordernote"><strong>'
555
                                            + _("Internal note: ")
556
                                            + '</strong>' + internal_note.escapeHtml()
557
                                            + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
558
                                            + encodeURIComponent(row.order_id) + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
559
                                            + '&type=internal">' + _("Change internal note") + '</a>]</p>';
560
                            }
561
                            else {
562
                                result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
563
                                            + encodeURIComponent(row.order_id) + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
564
                                            + '&type=internal">' + _("Add internal note") + '</a>]';
565
                            }
566
567
                            var vendor_note = row.vendor_note;
568
                            if ( vendor_note != null && vendor_note != '' ) {
569
                                result += '<p class="ordernote"><strong>'
570
                                            + _("Vendor note: ")
571
                                            + '</strong>' + vendor_note.escapeHtml() + '</p>';
572
                            }
573
                            else {
574
                                result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
575
                                            + encodeURIComponent(row.order_id) + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
576
                                            + '&type=vendor">' + _("Add vendor note") + '</a>]';
577
                            }
578
579
                            return result;
580
                        },
581
                        "orderable": false
582
                    },
583
                    {
584
                        "data": function( row, type, val, meta) {
585
                            var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a><br>'
586
                                + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a><br>'
587
                                + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a>';
588
                            return result;
589
                        },
590
                        "orderable": false
591
                    },
592
                    {
593
                        "data": "replacement_price"
594
                    },
595
                    {
596
                        "data": "quantity",
597
                        "orderable": true
598
                    },
599
                    {
600
                        "data": "ecost"
601
                    },
602
                    {
603
                        "data": function ( row, type, val, meta ) {
604
                            return (row.quantity * row.ecost).format_price();
605
                        },
606
                        "orderable": false // FIXME: How can we do it in DBIC?
607
                    },
608
                    {
609
                        "data": "fund_id",
610
                        "render": function(data, type, row, meta) {
611
                            if (type != 'display') return data.escapeHtml();
612
                            return row.fund.name.escapeHtml();
613
                        }
614
                    },
615
                    {
616
                        "data": function( row, type, val, meta ) {
617
                            return '<a href="orderreceive.pl?ordernumber='
618
                                    + encodeURIComponent(row.order_id) + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
619
                                    + _("Receive") + '</a><br/>'
620
                                    + '<a href="#" onclick="transfer_order_popup(' + row.order_id.escapeHtml() + '); return false;">'
621
                                    + _("Transfer") + '</a>';
622
                        },
623
                        "orderable": false
624
                    },
625
                    {
626
                        "data": function( row, type, val, meta ) {
627
                            var result = "";
628
629
                            if ( row.current_holds_count > 0 ) {
630
                                result += '<span class="button" title="'
631
                                        + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count.escapeHtml() ) + '">'
632
                                        + _("Can't cancel order") + '</span><br/>';
633
                            }
634
                            else {
635
                                result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
636
                                            + encodeURIComponent(row.order_id)
637
                                            + '&biblionumber=' + encodeURIComponent(row.biblio_id)
638
                                            + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
639
                                            + _("Cancel order") + '</a><br/>';
640
                            }
641
642
                            if ( row.biblio != null ) {
643
                                if ( row.biblio.items_count - row.items.length > 0 ||
644
                                    row.biblio.active_orders_count > 1 ||
645
                                    row.biblio.subscriptions_count > 0 ||
646
                                    row.biblio.holds_count > 0 ) { // biblio can be deleted
647
                                    result += '<span class="button" title="'
648
                                            + _("Can't delete catalog record, see constraints below") + '">'
649
                                            + _("Can't cancel order and delete catalog record") + '</span><br>';
650
                                }
651
                                else {
652
                                    result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
653
                                            + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
654
                                            + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
655
                                            + _("Cancel order and catalog record") + '</a><br/>';
656
                                }
657
658
                                if ( row.biblio.items_count - row.items.length > 0 ) {
659
                                    result += '<strong title="'
660
                                            + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
661
                                            +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
662
                                }
663
664
                                if ( row.biblio.active_orders_count > 1 ) {
665
                                    result += '<strong title="'
666
                                            + _("Can't delete catalog record, delete other orders linked to it first") + '">'
667
                                            + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
668
                                }
669
670
                                if ( row.biblio.subscriptions_count > 0 ) {
671
                                    result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
672
                                            + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
673
                                            + '</strong><br>';
674
                                }
675
676
                                if ( row.biblio.holds_count > 0 ) {
677
                                    result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
678
                                            + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
679
                                }
680
                            }
681
682
                            return result;
683
                        },
684
                        "orderable": false
685
                    }
511
                ]
686
                ]
512
            });
687
            });
513
          }
688
514
689
            $("#filterform").on("submit", function(e) {
515
          if ( $("#receivedt").length ) {
690
                e.preventDefault();
516
            var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
691
                // Update the datatable URL
517
                "bStateSave": true,
692
                var summary      = $("#summaryfilter").val();
518
                "iCookieDuration": 60*60*24*1000, // 1000 days
693
                var basket_name  = $("#basketfilter").val();
519
                "iDisplayLength": 10,
694
                var basket_group = $("#basketgroupnamefilter").val();
520
                "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
695
                var order_id     = $("#orderfilter").val();
521
                "aoColumnDefs": [
696
                var ean          = $("#eanfilter").val();
522
                    { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
697
523
                ],
698
                var query_and = [];
524
                "aoColumns": [
699
525
                    { "sType": "html" },
700
                if (basket_name != "") {
526
                    { "sType": "html" },
701
                    query_and.push( { "basket.name": { "like": '%'+basket_name+'%' } } );
527
                    { "sType": "html" },
702
                }
528
                    { "sType": "num-html" },
703
                if (basket_group != "") {
529
                    { "sType": "anti-the" },
704
                    query_and.push( { "basket.basket_group.name": { "like": '%'+basket_group+'%' } } );
530
                    null,
705
                }
531
                    null,
706
                if (summary != "") {
532
                    null,
707
                    query_and.push( { "-or": [{"biblio.title":  { "like": '%'+summary+'%' } },
533
                    null,
708
                                {"biblio.author": { "like": '%'+summary+'%' } },
534
                    null,
709
                                {"biblio.isbn":   { "like": '%'+summary+'%' } } ] } );
535
                    null,
710
                }
536
                    null,
711
            [% IF (UNIMARC) %]
537
                    null
712
                if (ean != "") {
538
                ],
713
                    query_and.push( { "biblio.ean": ean } );
539
                "sPaginationType": "full"
714
                }
540
            }));
715
            [% END %]
541
          }
716
542
717
                if ( !jQuery.isEmptyObject(query_and) || order_id != "" ) {
543
          // Keep filters from finishreceive.pl to parcel.pl
718
544
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
719
                    var query_params = [];
545
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
720
546
          $.cookie("filter_parcel_orderno", $("#orderfilter").val());
721
                    if ( order_id != "" ) {
547
          $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
722
                        query_params.push("order_id="+order_id);
548
          $.cookie("filter_parcel_ean", $("#eanfilter").val());
723
                    }
549
724
550
          $("#filterform").on('submit', function(){
725
                    if ( !jQuery.isEmptyObject(query_and) ) {
726
                        query_and.push(base_query);
727
                        query_params.push('q=' + encodeURI(JSON.stringify({ "-and": query_and })));
728
                    }
729
730
                    pending_orders_table.api().ajax.url( pending_orders_url + '&' + query_params.join("&") );
731
                }
732
                else {
733
                    pending_orders_table.api().ajax.url( pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query)) );
734
                }
735
                pending_orders_table.api().ajax.reload( null, false );
736
            });
737
738
            $('#clear_form_filters').on("click", function(){
739
                $(this).closest('form').find("input[type=text], textarea").val("");
740
                pending_orders_table.api().ajax.url(pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query))).draw();
741
            });
742
743
            // Keep filters from finishreceive.pl to parcel.pl
551
            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
744
            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
552
            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
745
            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
553
            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
746
            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
554
            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
747
            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
555
            $.cookie("filter_parcel_ean", $("#eanfilter").val());
748
            $.cookie("filter_parcel_ean", $("#eanfilter").val());
556
          });
749
750
            $("#filterform").on('submit', function(){
751
                $.cookie("filter_parcel_summary", $("#summaryfilter").val());
752
                $.cookie("filter_parcel_basketname", $("#basketfilter").val());
753
                $.cookie("filter_parcel_orderno", $("#orderfilter").val());
754
                $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
755
                $.cookie("filter_parcel_ean", $("#eanfilter").val());
756
            });
557
757
558
            $(".previewData").on("click", function(e){
758
            $(".previewData").on("click", function(e){
559
                e.preventDefault();
759
                e.preventDefault();
Lines 563-590 Link Here
563
                $("#dataPreview .modal-body").load(page + " div");
763
                $("#dataPreview .modal-body").load(page + " div");
564
                $('#dataPreview').modal({show:true});
764
                $('#dataPreview').modal({show:true});
565
            });
765
            });
766
566
            $("#dataPreview").on("hidden.bs.modal", function(){
767
            $("#dataPreview").on("hidden.bs.modal", function(){
567
                $("#dataPreviewLabel").html("");
768
                $("#dataPreviewLabel").html("");
568
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
769
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
569
            });
770
            });
771
        });
772
773
        // Case-insensitive version of jquery's contains function
774
        jQuery.extend(jQuery.expr[':'], {
775
            icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
776
        });
570
777
778
        // Contains exactly function
779
        jQuery.extend(jQuery.expr[':'], {
780
            containsExactly: "$(a).text() == m[3]"
571
        });
781
        });
572
782
573
         // Case-insensitive version of jquery's contains function
783
        function transfer_order_popup(ordernumber) {
574
         jQuery.extend(jQuery.expr[':'], {
784
        var url = "/cgi-bin/koha/acqui/transferorder.pl?"
575
	    icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
785
            + "ordernumber=" + ordernumber
576
         });
786
            window.open(url, 'TransferOrder');
577
787
        }
578
         // Contains exactly function
579
         jQuery.extend(jQuery.expr[':'], {
580
              containsExactly: "$(a).text() == m[3]"
581
         });
582
583
         function transfer_order_popup(ordernumber) {
584
            var url = "/cgi-bin/koha/acqui/transferorder.pl?"
585
                + "ordernumber=" + ordernumber
586
                window.open(url, 'TransferOrder');
587
         }
588
    </script>
788
    </script>
589
[% END %]
789
[% END %]
590
790
591
- 

Return to bug 20212