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

(-)a/acqui/lateorders-export.pl (-2 / +2 lines)
Lines 53-60 for my $ordernumber ( @ordernumbers ) { Link Here
53
            basketno => $order->{basketno},
53
            basketno => $order->{basketno},
54
            claims_count => $order->{claims_count},
54
            claims_count => $order->{claims_count},
55
            claimed_date => $order->{claimed_date},
55
            claimed_date => $order->{claimed_date},
56
            internalnote => $order->{internalnote},
56
            internalnote => $order->{order_internalnote},
57
            vendornote   => $order->{vendornote},
57
            vendornote   => $order->{order_vendornote},
58
            isbn => $order->{isbn},
58
            isbn => $order->{isbn},
59
        }
59
        }
60
    ;
60
    ;
(-)a/acqui/lateorders.pl (-22 lines)
Lines 123-150 if ($op and $op eq "send_alert"){ Link Here
123
    }
123
    }
124
}
124
}
125
125
126
if ($op && $op eq "save"){
127
    my $listorders;
128
    my @orders = $input->param;
129
130
    foreach my $order (@orders){
131
        if ( $order ne "op"){
132
            my @split = split (/_/,$order);
133
            $listorders->{$split[0]}->{$split[1]} = $input->param($order);
134
        }
135
    }
136
137
    my $orders_rs = Koha::Acquisition::Orders->search({ ordernumber => [ keys %$listorders ] });
138
    while ( my $order = $orders_rs->next ) {
139
        my $internalnote = $listorders->{$order->ordernumber}->{i};
140
        my $vendornote   = $listorders->{$order->ordernumber}->{v};
141
142
        $order->order_internalnote($internalnote) if defined $internalnote;
143
        $order->order_vendornote($vendornote)     if defined $vendornote;
144
        $order->store;
145
    }
146
}
147
148
my @parameters = ( $delay );
126
my @parameters = ( $delay );
149
push @parameters, $estimateddeliverydatefrom_dt
127
push @parameters, $estimateddeliverydatefrom_dt
150
    ? $estimateddeliverydatefrom_dt->ymd()
128
    ? $estimateddeliverydatefrom_dt->ymd()
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt (-1 / +4 lines)
Lines 13-19 Link Here
13
"[% o.unitpricesupplier | html %] x [% o.quantity_to_receive | html %] = [% o.subtotal | html %] ([% o.budget | html %])"[%- delimiter | html -%]
13
"[% o.unitpricesupplier | html %] x [% o.quantity_to_receive | html %] = [% o.subtotal | html %] ([% o.budget | html %])"[%- delimiter | html -%]
14
"[% o.basketname | html %] ([% o.basketno | html %])"[%- delimiter | html -%]
14
"[% o.basketname | html %] ([% o.basketno | html %])"[%- delimiter | html -%]
15
"[% o.claims_count | html %]"[%- delimiter | html -%]
15
"[% o.claims_count | html %]"[%- delimiter | html -%]
16
"[% o.claimed_date | html %]"
16
"[% o.claimed_date | html %]"[%- delimiter | html -%]
17
"[% o.internalnote | html %]"[%- delimiter | html -%]
18
"[% o.vendornote | html %]"[%- delimiter | html -%]
19
"[% o.isbn | html %]"
17
[%- INCLUDE empty_line.inc -%]
20
[%- INCLUDE empty_line.inc -%]
18
[%- END -%]
21
[%- END -%]
19
[%- delimiter | html -%]
22
[%- delimiter | html -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-33 / +72 lines)
Lines 138-145 Link Here
138
                    <span title="0000-00-00"></span>
138
                    <span title="0000-00-00"></span>
139
                [% END %]
139
                [% END %]
140
            </td>
140
            </td>
141
            <td><input name="internalnote" id="internalnote" type="text" value="[% lateorder.internalnote | html %]"></td>
141
            <td>
142
            <td><input name="vendornote" id="vendornote" type="text" value="[% lateorder.vendornote | html %]"></td>
142
                [% IF ( lateorder.internalnote ) %]
143
                    <p class="ordernote">
144
                        <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.internalnote | html %]</span>
145
                        <a class="edit_note" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" title="Edit internal note">
146
                            <i class="fa fa-pencil"></i> Edit internal note
147
                        </a>
148
                    </p>
149
                [% ELSE %]
150
                    <a class="edit_note" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" title="Add internal note">
151
                        <i class="fa fa-plus"></i> Add internal note
152
                    </a>
153
                [% END %]
154
            </td>
155
            <td>
156
                [% IF ( lateorder.vendornote ) %]
157
                    <p class="ordernote">
158
                        <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.vendornote | html %]</span>
159
                        <a class="edit_note" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" title="Edit vendor note">
160
                            <i class="fa fa-pencil"></i> Edit vendor note
161
                        </a>
162
                    </p>
163
                [% ELSE %]
164
                    <a class="edit_note" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" title="Add vendor note">
165
                        <i class="fa fa-plus"></i> Add vendor note
166
                    </a>
167
                [% END %]
168
            </td>
143
            <td>[% lateorder.isbn | $raw %]</td>
169
            <td>[% lateorder.isbn | $raw %]</td>
144
        </tr>
170
        </tr>
145
      [% END %]
171
      [% END %]
Lines 204-209 Link Here
204
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
230
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
205
</div>
231
</div>
206
232
233
<!-- Modal for editing vendor and internal notes -->
234
<div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
235
    <div class="modal-dialog" role="document">
236
        <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
237
            <div class="modal-content">
238
                <div class="modal-header">
239
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
240
                    <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
241
                </div>
242
                <div class="modal-body">
243
                <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
244
                <input type="hidden" id="ordernumber" name="ordernumber" value="" />
245
                <input type="hidden" name="op" value="save" />
246
                <input type="hidden" id="type" name="type" value="" />
247
            </div>
248
            <div class="modal-footer">
249
                <button type="submit" class="btn btn-default">Save</button>
250
                <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
251
            </div>
252
            </div>
253
        </form>
254
    </div>
255
</div>
256
207
[% MACRO jsinclude BLOCK %]
257
[% MACRO jsinclude BLOCK %]
208
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
258
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
209
    [% INCLUDE 'datatables.inc' %]
259
    [% INCLUDE 'datatables.inc' %]
Lines 263-299 Link Here
263
                location.href = url;
313
                location.href = url;
264
                return false;
314
                return false;
265
            });
315
            });
266
            // Update all notes
267
            $("#savenotes").click(function(){
268
                $("#savenotes").after("<span id=\"loading\" style=\"margin:4px;\"><img src=\"[% interface | html %]/[% theme | html %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</span>");
269
                var all_nodes = $(late_orderst.fnGetNodes());
270
                var req = new XMLHttpRequest();
271
                var url = '/cgi-bin/koha/acqui/lateorders.pl';
272
                var data = new FormData();
273
                data.append("op","save");
274
                for (var i = 0; i < all_nodes.length; i++) {
275
                    var order = $(all_nodes[i]).find("input[name='ordernumber']");
276
                    var internalnote = $(all_nodes[i]).find("input[name='internalnote']")[0].value;
277
                    var vendornote = $(all_nodes[i]).find("input[name='vendornote']")[0].value;
278
                    var internalnote_key = order[0].value + "_i";
279
                    var vendornote_key = order[0].value + "_v";
280
                    data.append(internalnote_key, internalnote);
281
                    data.append(vendornote_key, vendornote);
282
                }
283
316
284
                req.open("POST",url);
317
            $(".edit_note").on("click", function(e) {
285
                req.send(data);
318
                e.preventDefault();
286
                req.onreadystatechange = function () {
319
                var ordernumber = $(this).data("ordernumber");
287
                    $("#loading").remove();
320
                var note_type = $(this).data("note_type");
288
                    if (req.readyState == '4' ){
321
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
289
                        if ( req.status == 200 ){
322
                var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
290
                            alert(_("Notes successfully saved"));
323
                $("#noteEditor .modal-title").text(modalTitle);
291
                        }
324
                $("#ordernumber").val( ordernumber );
292
                        else {
325
                $("#ordernotes").html( note_text );
293
                            alert(_("Error while saving the notes. Please try again"));
326
                $("#type").val( note_type );
294
                        }
327
                $("#noteEditor").modal("show");
295
                    }
328
                $("#ordernotes").focus();
296
                }
329
            });
330
331
             $("#noteEditor").on('hidden.bs.modal', function (e) {
332
                $("#noteEditorLabel").html("");
333
                $("#noteEditor .modal-title").text("");
334
                $("#ordernotes").html( "" );
335
                $("#ordernumber").val("");
336
                $("#type").val("");
297
            });
337
            });
298
        });
338
        });
299
    </script>
339
    </script>
300
- 

Return to bug 12502