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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-233 / +376 lines)
Lines 34-49 Link Here
34
        <div class="col-sm-10 col-sm-push-2">
34
        <div class="col-sm-10 col-sm-push-2">
35
            <main>
35
            <main>
36
36
37
	[% IF ( receive_error ) %]
37
    [% IF ( receive_error ) %]
38
	<div class="dialog alert">
38
    <div class="dialog alert">
39
	<h3>Error adding items:</h3>
39
    <h3>Error adding items:</h3>
40
	<ul>
40
    <ul>
41
	[% FOREACH error_loo IN error_loop %]
41
    [% FOREACH error_loo IN error_loop %]
42
		<li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
42
        <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
43
	[% END %]
43
    [% END %]
44
	</ul>
44
    </ul>
45
	</div>
45
    </div>
46
	[% END %]
46
    [% END %]
47
    <h1>
47
    <h1>
48
        [% IF datereceived %]
48
        [% IF datereceived %]
49
            Receipt summary for <i>[% name | html %]</i> [% IF ( invoice ) %] <i> [ [% invoice | html %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
49
            Receipt summary for <i>[% name | html %]</i> [% IF ( invoice ) %] <i> [ [% invoice | html %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
Lines 55-66 Link Here
55
    [% IF ( success_delorder ) %]
55
    [% IF ( success_delorder ) %]
56
    <div class="dialog message">The order has been successfully canceled.</div>
56
    <div class="dialog message">The order has been successfully canceled.</div>
57
    [% ELSE %]
57
    [% ELSE %]
58
	[% IF ( error_delitem ) %]
58
    [% IF ( error_delitem ) %]
59
	    <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
59
        <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
60
	[% END %]
60
    [% END %]
61
	[% IF ( error_delbiblio ) %]
61
    [% IF ( error_delbiblio ) %]
62
	    <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
62
        <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
63
	[% END %]
63
    [% END %]
64
    [% END %]
64
    [% END %]
65
65
66
    [% IF (error_cancelling_receipt) %]
66
    [% IF (error_cancelling_receipt) %]
Lines 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
                        <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 %]
197
                        [% IF ( loop_order.left_biblio ) %]
198
                        <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 %]
200
                        [% IF ( loop_order.left_subscription ) %]
201
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</b><br>
202
                        [% END %]
203
                        [% IF ( loop_order.left_holds ) %]
204
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</b>
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 365-376 Link Here
365
                    [% END %]
271
                    [% END %]
366
                </td>
272
                </td>
367
            </tr>
273
            </tr>
368
	    [% END %]
274
        [% END %]
369
	</tbody>
275
    </tbody>
370
    </table>
276
    </table>
371
    </form>
277
    </form>
372
278
373
	[% ELSE %]There are no received orders.[% END %]
279
    [% ELSE %]There are no received orders.[% END %]
374
</div>
280
</div>
375
281
376
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
282
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
Lines 431-437 Link Here
431
      </li>
337
      </li>
432
      [% IF (UNIMARC) %]
338
      [% IF (UNIMARC) %]
433
        <li>
339
        <li>
434
          <label for="eanfilter">EAN :</label>
340
          <label for="eanfilter">EAN:</label>
435
          <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter | html %]"/>
341
          <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter | html %]"/>
436
        </li>
342
        </li>
437
      [% END %]
343
      [% END %]
Lines 440-446 Link Here
440
      <input type="hidden" value="search" name="op" />
346
      <input type="hidden" value="search" name="op" />
441
      <input type="hidden" value="[% invoiceid | html %]" name="invoiceid" />
347
      <input type="hidden" value="[% invoiceid | html %]" name="invoiceid" />
442
      <input type="submit" value="Filter" />
348
      <input type="submit" value="Filter" />
443
      <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">Clear</a>
349
      <a href="#" id="clear_form_filters">Clear</a>
444
    </fieldset>
350
    </fieldset>
445
  </fieldset>
351
  </fieldset>
446
</form>
352
</form>
Lines 460-552 Link Here
460
        var sticky_filters = [% sticky_filters | html %];
366
        var sticky_filters = [% sticky_filters | html %];
461
367
462
        $(document).ready(function(){
368
        $(document).ready(function(){
463
          if ( $("#pendingt").length ) {
369
464
            var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
370
            if ( $("#receivedt").length ) {
465
                "bStateSave": true,
371
                var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
466
                "iCookieDuration": 60*60*24*1000, // 1000 days
372
                    "bStateSave": true,
467
                "iDisplayLength": 10,
373
                    "iCookieDuration": 60*60*24*1000, // 1000 days
468
                "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
374
                    "iDisplayLength": 10,
469
                "aoColumnDefs": [
375
                    "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
470
                    { "aTargets": [ 4, 9, 10 ], "bSortable": false, "bSearchable": false },
376
                    "aoColumnDefs": [
471
                ],
377
                        { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
472
                "aoColumns": [
378
                    ],
473
                    { "sType": "html" },
379
                    "aoColumns": [
474
                    { "sType": "html" },
380
                        { "sType": "html" },
475
                    { "sType": "num-html" },
381
                        { "sType": "html" },
476
                    { "sType": "anti-the" },
382
                        { "sType": "html" },
477
                    null,
383
                        { "sType": "num-html" },
478
                    null,
384
                        { "sType": "anti-the" },
479
                    null,
385
                        null,
480
                    null,
386
                        null,
481
                    null,
387
                        null,
482
                    null,
388
                        null,
483
                    null,
389
                        null,
484
                    null,
390
                        null,
391
                        null,
392
                        null
393
                    ],
394
                    "sPaginationType": "full"
395
                }));
396
            }
397
398
            var pending_orders_url = '/api/v1/acquisitions/orders?q={"-or": [{"status":"ordered"},{"status":"partial"}]}';
399
            var pending_orders_table = $("#pending_orders").api({
400
                "ajax": {
401
                    "url": pending_orders_url
402
                },
403
                "embed": [
404
                    "basket.basket_group",
405
                    "biblio.active_orders+count",
406
                    "biblio.holds+count",
407
                    "biblio.items+count",
408
                    "biblio.suggestions.suggester",
409
                    "fund",
410
                    "current_item_level_holds+count",
411
                    "items"
485
                ],
412
                ],
486
                'bAutoWidth': false,
413
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
487
                "sPaginationType": "full"
414
                "columns": [
488
            } )
415
                    { "data": "basket.name",
489
            ).columnFilter({
416
                      "orderable": true,
490
                sPlaceHolder: "head:after",
417
                      "render": function(data, type, row, meta) {
491
                aoColumns: [
418
                        if (type != 'display') return data;
492
                    { type: "text" },
419
                        return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + row.basket.basket_id + "\">" + data + " (" + row.basket.basket_id + ")</a>";
493
                    { type: "text" },
420
                      }
494
                    { type: "text" },
421
                    },
495
                    { type: "text" },
422
                    { "data": "basket.basket_group.name",
496
                    null,
423
                      "orderable": true,
497
                    { type: "text" },
424
                      "render": function(data, type, row, meta) {
498
                    { type: "text" },
425
                        if ( type != 'display' ) return data;
499
                    { type: "text" },
426
                        if ( row.basket.basket_group_id == null ) {
500
                    { type: "text" },
427
                            return _("No basket group");
501
                    { type: "text" },
428
                        }
502
                    null,
429
                        else {
503
                    null
430
                            return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
431
                                    + row.basket.vendor_id + "&amp;basketgroupid="
432
                                    + row.basket.basket_group_id + "\">"
433
                                    + row.basket.basket_group.name + " (" + row.basket.basket_group_id + ")</a>";
434
                        }
435
                      }
436
                    },
437
                    { "data": "order_id",
438
                      "render": function(data, type, row, meta) {
439
                        if (type != 'display') return data;
440
                        return "<a href=\"neworderempty.pl?ordernumber="+data+"&amp;booksellerid="+row.basket.vendor_id+"\">"+data+"</a>";
441
                      }
442
                    },
443
                    {
444
                        "data": "biblio.author",
445
                        "visible": false,
446
                        "searchable": true,
447
                        "orderable": false
448
                    },
449
                    {
450
                        "data": "biblio.title",
451
                        "visible": false,
452
                        "searchable": true,
453
                        "orderable": false
454
                    },
455
                    {
456
                        "data": "biblio.isbn",
457
                        "visible": false,
458
                        "searchable": true,
459
                        "orderable": false
460
                    },
461
                    { "data": function(row, type, val, meta) {
462
                        var result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+row.biblio_id+"\">"+row.biblio.title+"</a>";
463
                        if ( row.biblio.author != null )
464
                            result += _(" by ") + row.biblio.author;
465
                        if ( row.biblio.isbn != null )
466
                            result += " &ndash; " + row.biblio.isbn;
467
                        if ( row.biblio.publisher != null ) {
468
                            result += "<br/>" + _("Publisher: ") + row.biblio.publisher;
469
                            if ( row.biblio.publication_year != null ) {
470
                                result += ", " + row.biblio.publication_year;
471
                            }
472
                            else if ( row.biblio.copyright_date != null ) {
473
                                result += row.biblio.copyright_date;
474
                            }
475
                        }
476
                        var suggestions = row.biblio.suggestions;
477
                        if ( suggestions != null && suggestions.length > 0 ) {
478
                            var suggestion = suggestions[0];
479
                            if ( suggestion.suggester != null ) {
480
                                var suggester = suggestion.suggester;
481
                                var suggested_by = [];
482
                                if ( suggester.surname != null ) {
483
                                    suggested_by.push(suggester.surname);
484
                                }
485
                                if ( suggester.firstname != null ) {
486
                                    suggested_by.push(suggester.firstname);
487
                                }
488
489
                                    result += "<br/>" + _("Suggested by: ") +
490
                                                '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
491
                                                    + suggestion.suggestionid
492
                                                    + '&amp;op=show">'
493
                                                    + suggested_by.join(", ")
494
                                                    + " (#" + suggestions[0].suggestionid + ")</a>";
495
                            }
496
                        }
497
                        result += '</p>';
498
499
                        var internal_note = row.internal_note;
500
                        if ( internal_note != '' ) {
501
                            result += '<p class="ordernote"><strong>'
502
                                        + _("Internal note: ")
503
                                        + '</strong>' + internal_note
504
                                        + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
505
                                        + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
506
                                        + '&type=internal">' + _("Change internal note") + '</a>]</p>';
507
                        }
508
                        else {
509
                            result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
510
                                        + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
511
                                        + '&type=internal">' + _("Add internal note") + '</a>]';
512
                        }
513
514
                        var vendor_note = row.vendor_note;
515
                        if ( vendor_note != '' ) {
516
                            result += '<p class="ordernote"><strong>'
517
                                        + _("Vendor note: ")
518
                                        + '</strong>' + vendor_note + '</p>';
519
                        }
520
                        else {
521
                            result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
522
                                        + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
523
                                        + '&type=vendor">' + _("Add vendor note") + '</a>]';
524
                        }
525
526
                        return result;
527
                      },
528
                      "orderable": false // FIXME
529
                    },
530
                    { "data": function( row, type, val, meta) {
531
                            var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + row.order_id + '" class="previewData">' + _("Order") + '</a><br>'
532
                                + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + row.biblio_id + '" class="previewData">' + _("MARC") + '</a><br>'
533
                                + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=' + row.biblio_id + '" class="previewData">' + _("Card") + '</a>';
534
                            return result;
535
                      },
536
                      "orderable": false
537
                    },
538
                    { "data": "replacement_price",
539
                      "render": function(data, type, val, meta) {
540
                        if (type != 'display') return data;
541
                        return data.format_price();
542
                      }
543
                    },
544
                    { "data": "quantity",
545
                      "orderable": true
546
                    },
547
                    { "data": "ecost",
548
                      "render": function(data, type, val, meta) {
549
                        if (type != 'display') return data;
550
                        return data.format_price();
551
                      },
552
                      "orderable": true
553
                    },
554
                    { "data": function ( row, type, val, meta ) {
555
                            return (row.quantity * row.ecost).format_price();
556
                      },
557
                      "orderable": false // FIXME: How can we do it in DBIC?
558
                    },
559
                    { "data": "fund_id",
560
                      "render": function(data, type, row, meta) {
561
                        if (type != 'display') return data;
562
                        return row.fund.name;
563
                      }
564
                    },
565
                    { "data": function( row, type, val, meta ) {
566
                        return '<a href="orderreceive.pl?ordernumber='
567
                                + row.order_id + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
568
                                + _("Receive") + '</a><br/>'
569
                                + '<a href="#" onclick="transfer_order_popup(' + row.order_id + '); return false;">'
570
                                + _("Transfer") + '</a>';
571
                      },
572
                      "orderable": false
573
                    },
574
                    { "data": function( row, type, val, meta ) {
575
                            var result = "";
576
577
                            if ( row.current_holds_count > 0 ) {
578
                                result += '<span class="button" title="'
579
                                        + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count ) + '">'
580
                                        + _("Can't cancel order") + '</span><br/>';
581
                            }
582
                            else {
583
                                result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
584
                                            + row.order_id
585
                                            + '&biblionumber=' + row.biblio_id
586
                                            + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
587
                                            + _("Cancel order") + '</a><br/>';
588
                            }
589
590
                            if ( row.items.length > 0 ||
591
                                row.biblio.active_orders_count > 1 ||
592
                                row.biblio.subscriptions_count > 0 ||
593
                                row.bibio.holds_count > 0 ) { // biblio can be deleted
594
                                result += '<span class="button" title="'
595
                                        + _("Can't delete catalog record, see constraints below") + '">'
596
                                        + _("Can't cancel order and delete catalog record") + '</span><br>';
597
                            }
598
                            else {
599
                                result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
600
                                        + row.order_id + '&biblionumber=' + row.biblio_id
601
                                        + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
602
                                        + _("Cancel order and catalog record") + '</a><br/>';
603
                            }
604
605
                            if ( row.biblio.items_count - row.items.length > 0 ) {
606
                                result += '<b title="'
607
                                        + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
608
                                        +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</b><br/>';
609
                            }
610
611
                            if ( row.biblio.active_orders_count > 1 ) {
612
                                result += '<b title="'
613
                                        + _("Can't delete catalog record, delete other orders linked to it first") + '">'
614
                                        + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</b><br/>';
615
                            }
616
617
                            if ( row.biblio.subscriptions_count > 0 ) {
618
                                result += '<b title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
619
                                        + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
620
                                        + '</b><br>';
621
                            }
622
623
                            if ( row.biblio.holds_count > 0 ) {
624
                                result += '<b title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
625
                                        + _("%s hold(s) left").format(row.bibio.holds_count) + '</b>';
626
                            }
627
628
                            return result;
629
                      },
630
                      "orderable": false
631
                    }
504
                ]
632
                ]
505
            });
633
            });
506
          }
634
507
635
            $("#filterform").on("submit", function(e) {
508
          if ( $("#receivedt").length ) {
636
                e.preventDefault();
509
            var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
637
                // Update the datatable URL
510
                "bStateSave": true,
638
                var summary      = $("#summaryfilter").val();
511
                "iCookieDuration": 60*60*24*1000, // 1000 days
639
                var basket_name  = $("#basketfilter").val();
512
                "iDisplayLength": 10,
640
                var basket_group = $("#basketgroupnamefilter").val();
513
                "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
641
                var order_id     = $("#orderfilter").val();
514
                "aoColumnDefs": [
642
                var ean          = $("#eanfilter").val();
515
                    { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
643
516
                ],
644
                var q = {};
517
                "aoColumns": [
645
518
                    { "sType": "html" },
646
                if (order_id != "") {
519
                    { "sType": "html" },
647
                    q['order_id'] = order_id;
520
                    { "sType": "html" },
648
                }
521
                    { "sType": "num-html" },
649
                if (basket_name != "") {
522
                    { "sType": "anti-the" },
650
                    q['basket.name'] = { "like": '%'+basket_name+'%' };
523
                    null,
651
                }
524
                    null,
652
                if (basket_group != "") {
525
                    null,
653
                    q['basket.basket_group.name'] = { "like": '%'+basket_group+'%' };
526
                    null,
654
                }
527
                    null,
655
                if (summary != "") {
528
                    null,
656
                    q["-or"] = [{"biblio.title":  { "like": '%'+summary+'%' } },
529
                    null,
657
                                {"biblio.author": { "like": '%'+summary+'%' } },
530
                    null
658
                                {"biblio.isbn":   { "like": '%'+summary+'%' } } ];
531
                ],
659
                }
532
                "sPaginationType": "full"
660
            [% IF (UNIMARC) %]
533
            }));
661
                if (ean != "") {
534
          }
662
                    q['biblio.ean'] = ean;
535
663
                }
536
          // Keep filters from finishreceive.pl to parcel.pl
664
            [% END %]
537
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
665
538
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
666
                if ( !jQuery.isEmptyObject(q) ) {
539
          $.cookie("filter_parcel_orderno", $("#orderfilter").val());
667
                    pending_orders_table.api().ajax.url( pending_orders_url + '&q=' + encodeURI(JSON.stringify(q)) );
540
          $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
668
                }
541
          $.cookie("filter_parcel_ean", $("#eanfilter").val());
669
                else {
542
670
                    pending_orders_table.api().ajax.url( pending_orders_url );
543
          $("#filterform").on('submit', function(){
671
                }
672
                pending_orders_table.api().ajax.reload( null, false );
673
            });
674
675
            $('#clear_form_filters').on("click", function(){
676
                $(this).closest('form').find("input[type=text], textarea").val("");
677
                pending_orders_table.api().ajax.url(pending_orders_url).draw();
678
            });
679
680
            // Keep filters from finishreceive.pl to parcel.pl
544
            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
681
            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
545
            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
682
            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
546
            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
683
            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
547
            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
684
            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
548
            $.cookie("filter_parcel_ean", $("#eanfilter").val());
685
            $.cookie("filter_parcel_ean", $("#eanfilter").val());
549
          });
686
687
            $("#filterform").on('submit', function(){
688
                $.cookie("filter_parcel_summary", $("#summaryfilter").val());
689
                $.cookie("filter_parcel_basketname", $("#basketfilter").val());
690
                $.cookie("filter_parcel_orderno", $("#orderfilter").val());
691
                $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
692
                $.cookie("filter_parcel_ean", $("#eanfilter").val());
693
            });
550
694
551
            $(".previewData").on("click", function(e){
695
            $(".previewData").on("click", function(e){
552
                e.preventDefault();
696
                e.preventDefault();
Lines 556-583 Link Here
556
                $("#dataPreview .modal-body").load(page + " div");
700
                $("#dataPreview .modal-body").load(page + " div");
557
                $('#dataPreview').modal({show:true});
701
                $('#dataPreview').modal({show:true});
558
            });
702
            });
703
559
            $("#dataPreview").on("hidden.bs.modal", function(){
704
            $("#dataPreview").on("hidden.bs.modal", function(){
560
                $("#dataPreviewLabel").html("");
705
                $("#dataPreviewLabel").html("");
561
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
706
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
562
            });
707
            });
708
        });
709
710
        // Case-insensitive version of jquery's contains function
711
        jQuery.extend(jQuery.expr[':'], {
712
            icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
713
        });
563
714
715
        // Contains exactly function
716
        jQuery.extend(jQuery.expr[':'], {
717
            containsExactly: "$(a).text() == m[3]"
564
        });
718
        });
565
719
566
         // Case-insensitive version of jquery's contains function
720
        function transfer_order_popup(ordernumber) {
567
         jQuery.extend(jQuery.expr[':'], {
721
        var url = "/cgi-bin/koha/acqui/transferorder.pl?"
568
	    icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
722
            + "ordernumber=" + ordernumber
569
         });
723
            window.open(url, 'TransferOrder');
570
724
        }
571
         // Contains exactly function
572
         jQuery.extend(jQuery.expr[':'], {
573
              containsExactly: "$(a).text() == m[3]"
574
         });
575
576
         function transfer_order_popup(ordernumber) {
577
            var url = "/cgi-bin/koha/acqui/transferorder.pl?"
578
                + "ordernumber=" + ordernumber
579
                window.open(url, 'TransferOrder');
580
         }
581
    </script>
725
    </script>
582
[% END %]
726
[% END %]
583
727
584
- 

Return to bug 20212