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

(-)a/acqui/edifactmsgs.pl (-13 lines)
Lines 50-66 if ( $cmd && $cmd eq 'import' ) { Link Here
50
    process_invoice($invoice);
50
    process_invoice($invoice);
51
}
51
}
52
52
53
my @msgs = $schema->resultset('EdifactMessage')->search(
54
    {
55
        deleted => 0,
56
    },
57
    {
58
        join     => 'vendor',
59
        order_by => { -desc => 'transfer_date' },
60
    }
61
62
)->all;
63
64
$template->param( messages => \@msgs );
65
66
output_html_with_http_headers( $q, $cookie, $template->output );
53
output_html_with_http_headers( $q, $cookie, $template->output );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt (-64 / +77 lines)
Lines 40-97 Link Here
40
<h1>EDIFACT messages</h1>
40
<h1>EDIFACT messages</h1>
41
<div id="acqui_edifactmsgs" class="page-section">
41
<div id="acqui_edifactmsgs" class="page-section">
42
42
43
[% IF ( messages ) %]
43
<table id="edi_msgs"></table>
44
<table id="edi_msgs">
45
<thead>
46
<tr>
47
<th>Type</th>
48
<th>Transferred</th>
49
<th>Status</th>
50
<th>Vendor</th>
51
<th>Details</th>
52
<th>Filename</th>
53
<th class="noExport">Actions</th>
54
</tr>
55
</thead>
56
<tbody>
57
[% FOREACH msg IN messages %]
58
<tr>
59
<td>[% msg.message_type | html %]</td>
60
<td data-order="[% msg.transfer_date | html %]">[% msg.transfer_date | $KohaDates %]</td>
61
<td>[% msg.status | html %]</td>
62
<td>
63
    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% msg.vendor_id | uri %]">
64
        [% msg.vendor.name | html %]
65
    </a>
66
</td>
67
<td>
68
[% IF msg.message_type == 'QUOTE' || msg.message_type == 'ORDERS' %]
69
    [% IF msg.basketno %]
70
    <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% msg.basketno.basketno | uri %]">
71
    Basket: [% msg.basketno.basketno | html %]
72
    </a>
73
    [% END %]
74
[% ELSE %]
75
<!-- Assuming invoices -->
76
     <a href="/cgi-bin/koha/acqui/invoices.pl?message_id=[% msg.id | uri %]&op=do_search">
77
      Invoices
78
     </a>
79
[% END %]
80
</td>
81
<td>[% msg.filename | html %]</td>
82
83
<td class="actions">
84
    <a class="btn btn-default btn-xs view_message" target="_blank" href="/cgi-bin/koha/acqui/edimsg.pl?id=[% msg.id | html %]"><i class="fa fa-search"></i> View message</a>
85
    <a class="btn btn-default btn-xs delete_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=delete&amp;message_id=[% msg.id | html %]"><i class="fa fa-trash-can"></i> Delete</a>
86
    [% IF msg.status == 'new' %]
87
        <a class="btn btn-default btn-xs import_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=import&amp;message_id=[% msg.id | html %]"><i class="fa fa-cog"></i> Import</a>
88
    [% END %]
89
</td>
90
</tr>
91
[% END %]
92
93
</tbody>
94
</table>
95
44
96
<!-- Modal to display EDIFACT messages -->
45
<!-- Modal to display EDIFACT messages -->
97
<div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
46
<div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
Lines 111-121 Link Here
111
    </div>
60
    </div>
112
</div>
61
</div>
113
62
114
115
[% ELSE %]
116
    <div class="dialog message">There are no EDIFACT messages.</div>
117
[% END %]
118
119
</div> <!-- /#acqui_edifactmsgs -->
63
</div> <!-- /#acqui_edifactmsgs -->
120
</main>
64
</main>
121
</div> <!-- /.col-sm-10.col-sm-push-2 -->
65
</div> <!-- /.col-sm-10.col-sm-push-2 -->
Lines 132-144 Link Here
132
    [% INCLUDE 'datatables.inc' %]
76
    [% INCLUDE 'datatables.inc' %]
133
    <script>
77
    <script>
134
        $(document).ready(function() {
78
        $(document).ready(function() {
135
            $('#edi_msgs').dataTable($.extend(true, {}, dataTablesDefaults, {
79
            let edi_msgs_table_url = '/api/v1/acquisitions/edifiles?';
136
                'aaSorting': [[1, "desc" ]],
80
137
                'sPaginationType': "full",
81
            var edi_msgs_table = $("#edi_msgs").kohaTable({
138
                "aoColumnDefs": [
82
                "ajax": {
139
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }
83
                    "url": edi_msgs_table_url
84
                },
85
                "embed": [
86
                    "vendor",
87
                    "basket"
88
                ],
89
                "columns": [
90
                    {
91
                        "data": "type",
92
                        "title": "Type",
93
                        "searchable": true,
94
                        "orderable": true
95
                    },
96
                    {
97
                        "data": "transfer_date",
98
                        "title": "Transferred",
99
                        "searchable": true,
100
                        "orderable": true,
101
                        "render": function(data, type, row, meta) {
102
                            return $date(row.transfer_date);
103
                        }
104
                    },
105
                    {
106
                        "data": "status",
107
                        "title": "Status",
108
                        "searchable": true,
109
                        "orderable": true
110
                    },
111
                    {
112
                        "data": "vendor.name",
113
                        "title": "Vendor",
114
                        "searchable": true,
115
                        "orderable": true,
116
                        "render": function(data, type, row, meta) {
117
                            return '<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid="'+row.vendor_id+'>'+row.vendor.name+'</a>';
118
                        }
119
                    },
120
                    {
121
                        "title": "Details",
122
                        "searchable": false,
123
                        "orderable": false,
124
                        "render": function(data, type, row, meta) {
125
                            if ( row.type == 'QUOTE' || row.type == 'ORDERS' ) {
126
                                if ( row.basked_id ) {
127
                                    return '<a href="/cgi-bin/koha/acqui/basket.pl?basketno='+row.basked_id+'">Basket: '+row.basket_id+'</a>';
128
                                }
129
                            } else {
130
                                return '<a href="/cgi-bin/koha/acqui/invoices.pl?message_id='+row.id+'&op=do_search">Invoices</a>';
131
                            }
132
                        }
133
                    },
134
                    {
135
                        "data": "filename",
136
                        "title": "Filename",
137
                        "searchable": true,
138
                        "orderable": true
139
                    },
140
                    {
141
                        "title": "Actions",
142
                        "searchable": false,
143
                        "orderable": false,
144
                        "render": function( row, type, val, meta ) {
145
146
                            var result = '<a class="btn btn-default btn-xs view_message" target="_blank" href="/cgi-bin/koha/acqui/edimsg.pl?id='+encodeURIComponent(row.id)+'"><i class="fa fa-search"></i> View message</a>';
147
                            result += '<a class="btn btn-default btn-xs delete_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=delete&amp;message_id='+encodeURIComponent(row.id)+'"><i class="fa fa-trash-can"></i> Delete</a>';
148
                            if ( row.status == 'new' ) {
149
                                reslt += '<a class="btn btn-default btn-xs import_msg" href="/cgi-bin/koha/acqui/edifactmsgs.pl?op=import&amp;message_id='+encodeURIComponent(row.id)+'"><i class="fa fa-cog"></i> Import</a>';
150
                            }
151
                            return result;
152
                        }
153
                    }
140
                ]
154
                ]
141
            }));
155
            }, {}, 0);
142
156
143
            var EDIModal = $("#EDI_modal");
157
            var EDIModal = $("#EDI_modal");
144
            var EDIModalBody = $("#EDI_modal .modal-body");
158
            var EDIModalBody = $("#EDI_modal .modal-body");
145
- 

Return to bug 30070