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

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

Return to bug 20212