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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-8 / +233 lines)
Lines 87-92 Link Here
87
        </div>
87
        </div>
88
    [% END %]
88
    [% END %]
89
89
90
<h3>Pending orders (api)</h3>
91
<table id="pending_orders" class="table table-bordered table-striped">
92
    <thead>
93
        <tr>
94
            <th>Basket</th>
95
            <th>Basket group</th>
96
            <th>Order line</th>
97
            <th>Summary</th>
98
            <th>More</th>
99
            <th>Replacement price</th>
100
            <th>Quantity</th>
101
            <th>Unit cost</th>
102
            <th>Order cost</th>
103
            <th>Fund</th>
104
            <th>&nbsp;</th>
105
            <th>&nbsp;</th>
106
        </tr>
107
    </thead>
108
</table>
109
90
[% UNLESS no_orders_to_display %]
110
[% UNLESS no_orders_to_display %]
91
<div id="acqui_receive_summary">
111
<div id="acqui_receive_summary">
92
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Received by:</strong> [% logged_in_user.userid | html %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
112
<p><strong>Invoice number:</strong> [% invoice | html %] <strong>Received by:</strong> [% logged_in_user.userid | html %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
Lines 181-206 Link Here
181
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
201
                    <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber | html %]); return false;">Transfer</a>
182
				</td>
202
				</td>
183
				<td>
203
				<td>
184
                        [% IF ( loop_order.left_holds_on_order ) %]
204
                        [% IF ( loop_order.left_holds_on_order ) %] [%# DONE %]
185
                        <span class="button" title="Can't cancel order, ([% loop_order.holds_on_order | html %]) holds are linked with this order. Cancel holds first">Can't cancel order</span><br>
205
                        <span class="button" title="Can't cancel order, ([% loop_order.holds_on_order | html %]) holds are linked with this order. Cancel holds first">Can't cancel order</span><br>
186
                        [% ELSE %]
206
                        [% ELSE %] [%# DONE %]
187
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order</a><br />
207
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order</a><br />
188
                        [% END %]
208
                        [% END %] [%# DONE %]
189
                        [% IF ( loop_order.can_del_bib ) %]
209
                        [% IF ( loop_order.can_del_bib ) %]
190
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&del_biblio=1&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order and catalog record</a><br />
210
                        <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber | uri %]&biblionumber=[% loop_order.biblionumber | uri %]&del_biblio=1&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order and catalog record</a><br />
191
                        [% ELSE %]
211
                        [% ELSE %]
192
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
212
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
193
                        [% END %]
213
                        [% END %]
194
                        [% IF ( loop_order.left_item ) %]
214
                        [% IF ( loop_order.left_item ) %] [%# DONE %]
195
                        <b title="Can't delete catalog record, because of [% loop_order.items | html %] existing item(s)" >[% loop_order.items | html %] item(s) left</b><br>
215
                        <b title="Can't delete catalog record, because of [% loop_order.items | html %] existing item(s)" >[% loop_order.items | html %] item(s) left</b><br>
196
                        [% END %]
216
                        [% END %]
197
                        [% IF ( loop_order.left_biblio ) %]
217
                        [% IF ( loop_order.left_biblio ) %]  [%# DONE %]
198
                        <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios | html %] order(s) left</b><br>
218
                        <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios | html %] order(s) left</b><br>
199
                        [% END %]
219
                        [% END %]
200
                        [% IF ( loop_order.left_subscription ) %]
220
                        [% IF ( loop_order.left_subscription ) %] [%# DONE %]
201
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</b><br>
221
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions | html %] subscription(s) left</b><br>
202
                        [% END %]
222
                        [% END %]
203
                        [% IF ( loop_order.left_holds ) %]
223
                        [% IF ( loop_order.left_holds ) %] [%# DONE %]
204
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</b>
224
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds | html %] hold(s) left</b>
205
                        [% END %]
225
                        [% END %]
206
                    </td>
226
                    </td>
Lines 533-538 Link Here
533
            }));
553
            }));
534
          }
554
          }
535
555
556
        var pendig_orders_tb = $("#pending_orders").api({
557
            "ajax": {
558
                "url": "/api/v1/acquisitions/orders"
559
            },
560
            "embed": [
561
                "basket",
562
                "biblio.active_orders_count",
563
                "biblio.holds_count",
564
                "biblio.items_count",
565
                "biblio.suggestions.suggester",
566
                "fund",
567
                "holds_count",
568
                "items"
569
            ],
570
            'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
571
            "columnDefs": [
572
                { "targets": [ "nosort" ],"sortable": false,"searchable": false },
573
                { "type": "anti-the", "targets" : [ "anti-the" ] },
574
                { "type": "title-string", "targets" : [ "title-string" ] }
575
            ],
576
            "columns": [
577
                { "data": "basket_id",
578
                  "render": function(data, type, row, meta) {
579
                      if (type != 'display') return data;
580
                      return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + data + "\">" + row.basket.name + " (" + data + ")</a>";
581
                  }
582
                },
583
                { "data": "basket_group_id",
584
                  "render": function(data, type, row, meta) {
585
                      if (type != 'display') return data;
586
                      if ( typeof data == "undefined") {
587
                          return _("No basket group");
588
                      }
589
                      else {
590
                          return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
591
                                 + row.basket.vendor_id + "&amp;basketgroupid="
592
                                 + data + "\">"
593
                                 + "loop_order.basketgroupname " + data + ")</a>";
594
                      }
595
                  }
596
                },
597
                { "data": "order_id",
598
                  "render": function(data, type, row, meta) {
599
                      if (type != 'display') return data;
600
                      return "<a href=\"neworderempty.pl?ordernumber="+data+"&amp;booksellerid="+row.basket.vendor_id+"\">"+data+"</a>";
601
                  }
602
                },
603
                { "data": function(row, type, val, meta) {
604
                      var result = "<a href=\"opac-detail.pl?biblionumber="+row.biblio_id+"\">"+row.biblio.title+"</a>";
605
                      if ( row.biblio.author != null )
606
                        result += _(" by ") + row.biblio.author;
607
                      if ( row.biblio.isbn != null )
608
                        result += " &ndash; " + row.biblio.isbn;
609
                      if ( row.biblio.publisher != null ) {
610
                        result += "<br/>" + _("Publisher: ") + row.biblio.publisher;
611
                        if ( row.biblio.publication_year != null ) {
612
                            result += ", " + row.biblio.publication_year;
613
                        }
614
                        else if ( row.biblio.copyright_date != null ) {
615
                            result += row.biblio.copyright_date;
616
                        }
617
                      }
618
                      var suggestions = row.biblio.suggestions;
619
                      if ( suggestions != null && suggestions.length > 0 ) {
620
                          var suggestion = suggestions[0];
621
                          if ( suggestion.suggestor != null ) {
622
                              var suggestor = suggestion.suggestor;
623
                              var suggested_by = [];
624
                              if ( suggestor.surname != null ) {
625
                                  suggested_by.push(suggestor.surname);
626
                              }
627
                              if ( suggestor.firstname != null ) {
628
                                  suggested_by.push(suggestor.firstname);
629
                              }
630
631
                                result += "<br/>" + _("Suggested by: ") +
632
                                            '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
633
                                                + suggestion.suggestionid
634
                                                + '&amp;op=show">'
635
                                                + suggested_by.join(", ")
636
                                                + " (#" + suggestions[0].suggestionid + ")</a>";
637
                          }
638
                      }
639
640
                      var internal_note = row.internal_note;
641
                      if ( internal_note != '' ) {
642
                          result += '<p class="ordernote"><strong>'
643
                                    + _("Internal note: ")
644
                                    + '</strong>' + internal_note
645
                                    + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
646
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
647
                                    + '&type=internal">' + _("Change internal note") + '</a>]</p>';
648
                      }
649
                      else {
650
                          result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
651
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
652
                                    + '&type=internal">' + _("Add internal note") + '</a>]';
653
                      }
654
655
                      var vendor_note = row.vendor_note;
656
                      if ( vendor_note != '' ) {
657
                          result += '<p class="ordernote"><strong>'
658
                                    + _("Vendor note: ")
659
                                    + '</strong>' + vendor_note + '</p>';
660
                      }
661
                      else {
662
                          result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
663
                                    + row.order_id + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
664
                                    + '&type=vendor">' + _("Add vendor note") + '</a>]';
665
                      }
666
667
                    return result;
668
                  }
669
                },
670
                { "data": function( row, type, val, meta) {
671
                        if (type != 'display') return data;
672
                        var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + row.order_id + '" class="previewData">' + _('Order') + '</a><br>'
673
                             + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + row.biblio_id + '" class="previewData">' + _("MARC") + '</a><br>'
674
                             + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=' + row.biblio_id + '" class="previewData">' + _("Card") + '</a>';
675
                        return result;
676
                  }
677
                },
678
                { "data": "replacement_price" },
679
                { "data": "quantity" },
680
                { "data": "ecost" },
681
                { "data": function ( row, type, val, meta ) {
682
                        return row.quantity * row.ecost;
683
                  }
684
                },
685
                { "data": "fund_id",
686
                  "render": function(data, type, row, meta) {
687
                      if (type != 'display') return data;
688
                      return row.fund.name;
689
                  }
690
                },
691
                {
692
                  "data": function( row, type, val, meta ) {
693
                      return '<a href="orderreceive.pl?ordernumber='
694
                            + row.order_id + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
695
                            + _("Receive") + '</a><br/>'
696
                            + '<a href="#" onclick="transfer_order_popup(' + row.order_id + '); return false;">'
697
                            + _("Transfer") + '</a>';
698
                  }
699
                },
700
                {
701
                    "data": function( row, type, val, meta ) {
702
                        var result = "";
703
704
                        if ( row.holds_count > 0 ) {
705
                            result += '<span class="button" title="'
706
                                      + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count ) + '">'
707
                                      + _("Can't cancel order") + '</span><br/>';
708
                        }
709
                        else {
710
                            result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
711
                                        + row.order_id
712
                                        + '&biblionumber=' + row.biblio_id
713
                                        + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
714
                                        + _("Cancel order") + '</a><br/>';
715
                        }
716
717
                        if ( row.items.length > 0 ||
718
                             row.biblio.active_orders_count > 1 ||
719
                             row.biblio.subscriptions_count > 0 ||
720
                             row.bibio.holds_count > 0 ) { // biblio can be deleted
721
                            result += '<span class="button" title="'
722
                                       + _("Can't delete catalog record, see constraints below") + '">'
723
                                       + _("Can't cancel order and delete catalog record") + '</span><br>';
724
                        }
725
                        else {
726
                            result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
727
                                       + row.order_id + '&biblionumber=' + row.biblio_id
728
                                       + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
729
                                       + _("Cancel order and catalog record") + '</a><br/>';
730
                        }
731
732
                        if ( row.items.length > 0 ) {
733
                            result += '<b title="'
734
                                      + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
735
                                      +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</b><br/>';
736
                        }
737
738
                        if ( row.biblio.active_orders_count > 1 ) {
739
                            result += '<b title="'
740
                                      + _("Can't delete catalog record, delete other orders linked to it first") + '">'
741
                                      + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</b><br/>';
742
                        }
743
744
                        if ( row.biblio.subscriptions_count > 0 ) {
745
                            result += '<b title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
746
                                      + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
747
                                      + '</b><br>';
748
                        }
749
750
                        if ( row.biblio.holds_count > 0 ) {
751
                            result += '<b title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
752
                                      + _("%s hold(s) left").format(row.bibio.holds_count) + '</b>';
753
                        }
754
755
                        return result;
756
                    }
757
                }
758
            ]
759
        });
760
761
536
          // Keep filters from finishreceive.pl to parcel.pl
762
          // Keep filters from finishreceive.pl to parcel.pl
537
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
763
          $.cookie("filter_parcel_summary", $("#summaryfilter").val());
538
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
764
          $.cookie("filter_parcel_basketname", $("#basketfilter").val());
539
- 

Return to bug 20212