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

(-)a/C4/Acquisition.pm (-1 / +4 lines)
Lines 2155-2161 sub GetLateOrders { Link Here
2155
    my @query_params = ();
2155
    my @query_params = ();
2156
    my $select = "
2156
    my $select = "
2157
    SELECT aqbasket.basketno,
2157
    SELECT aqbasket.basketno,
2158
        aqorders.ordernumber,
2158
        aqorders.ordernumber      AS ordernumber,
2159
        DATE(aqbasket.closedate)  AS orderdate,
2159
        DATE(aqbasket.closedate)  AS orderdate,
2160
        aqbasket.basketname       AS basketname,
2160
        aqbasket.basketname       AS basketname,
2161
        aqbasket.basketgroupid    AS basketgroupid,
2161
        aqbasket.basketgroupid    AS basketgroupid,
Lines 2164-2169 sub GetLateOrders { Link Here
2164
        aqorders.ecost            AS unitpricelib,
2164
        aqorders.ecost            AS unitpricelib,
2165
        aqorders.claims_count     AS claims_count,
2165
        aqorders.claims_count     AS claims_count,
2166
        aqorders.claimed_date     AS claimed_date,
2166
        aqorders.claimed_date     AS claimed_date,
2167
        aqorders.order_internalnote AS internalnote,
2168
        aqorders.order_vendornote   AS vendornote,
2167
        aqbudgets.budget_name     AS budget,
2169
        aqbudgets.budget_name     AS budget,
2168
        borrowers.branchcode      AS branch,
2170
        borrowers.branchcode      AS branch,
2169
        aqbooksellers.name        AS supplier,
2171
        aqbooksellers.name        AS supplier,
Lines 2171-2176 sub GetLateOrders { Link Here
2171
        biblio.author, biblio.title,
2173
        biblio.author, biblio.title,
2172
        biblioitems.publishercode AS publisher,
2174
        biblioitems.publishercode AS publisher,
2173
        biblioitems.publicationyear,
2175
        biblioitems.publicationyear,
2176
        biblioitems.isbn          AS isbn,
2174
        ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
2177
        ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
2175
    ";
2178
    ";
2176
    my $from = "
2179
    my $from = "
(-)a/acqui/lateorders-export.pl (+3 lines)
Lines 53-58 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},
57
            vendornote   => $order->{vendornote},
58
            isbn => $order->{isbn},
56
        }
59
        }
57
    ;
60
    ;
58
}
61
}
(-)a/acqui/lateorders.pl (+23 lines)
Lines 53-58 use C4::Context; Link Here
53
use C4::Acquisition;
53
use C4::Acquisition;
54
use C4::Letters;
54
use C4::Letters;
55
use Koha::DateUtils;
55
use Koha::DateUtils;
56
use Koha::Acquisition::Orders;
56
57
57
my $input = new CGI;
58
my $input = new CGI;
58
my ($template, $loggedinuser, $cookie) = get_template_and_user(
59
my ($template, $loggedinuser, $cookie) = get_template_and_user(
Lines 122-127 if ($op and $op eq "send_alert"){ Link Here
122
    }
123
    }
123
}
124
}
124
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
125
my @parameters = ( $delay );
148
my @parameters = ( $delay );
126
push @parameters, $estimateddeliverydatefrom_dt
149
push @parameters, $estimateddeliverydatefrom_dt
127
    ? $estimateddeliverydatefrom_dt->ymd()
150
    ? $estimateddeliverydatefrom_dt->ymd()
(-)a/admin/columns_settings.yml (+9 lines)
Lines 38-43 modules: Link Here
38
          cannot_be_toggled: 1
38
          cannot_be_toggled: 1
39
          cannot_be_modified: 1
39
          cannot_be_modified: 1
40
        -
40
        -
41
          columnname: order_line
42
        -
41
          columnname: order_date
43
          columnname: order_date
42
        -
44
        -
43
          columnname: estimated_delivery_date
45
          columnname: estimated_delivery_date
Lines 59-64 modules: Link Here
59
          columnname: claims_count
61
          columnname: claims_count
60
        -
62
        -
61
          columnname: claimed_date
63
          columnname: claimed_date
64
        -
65
          columnname: internal_note
66
        -
67
          columnname: vendor_note
68
        -
69
          columnname: isbn
70
62
    basket:
71
    basket:
63
      orders:
72
      orders:
64
        -
73
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt (-1 / +1 lines)
Lines 1-4 Link Here
1
[%- USE Koha -%]
1
[%- USE Koha -%]
2
[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%]
2
[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%]
3
3
4
[%- BLOCK -%]ORDER DATE[%- delimiter | html -%]ESTIMATED DELIVERY DATE[%- delimiter | html -%]VENDOR[%- delimiter | html -%]INFORMATION[%- delimiter | html -%]TOTAL COST[%- delimiter | html -%]BASKET[%- delimiter | html -%]CLAIMS COUNT[%- delimiter | html -%]CLAIMED DATE[%- END -%]
4
[%- BLOCK -%]ORDER DATE[%- delimiter | html -%]ESTIMATED DELIVERY DATE[%- delimiter | html -%]VENDOR[%- delimiter | html -%]INFORMATION[%- delimiter | html -%]TOTAL COST[%- delimiter | html -%]BASKET[%- delimiter | html -%]CLAIMS COUNT[%- delimiter | html -%]CLAIMED DATE[%- delimiter | html -%]INTERNAL NOTE[%- delimiter | html -%]VENDOR NOTE[%- delimiter | html -%]ISBN[%- END -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-3 / +45 lines)
Lines 56-61 Link Here
56
            [% ELSE %]
56
            [% ELSE %]
57
                <th></th>
57
                <th></th>
58
            [% END %]
58
            [% END %]
59
            <th>Order line</th>
59
            <th class="title-string">Order date</th>
60
            <th class="title-string">Order date</th>
60
            <th class="title-string">Estimated delivery date</th>
61
            <th class="title-string">Estimated delivery date</th>
61
            <th>Vendor</th>
62
            <th>Vendor</th>
Lines 67-72 Link Here
67
            <th>Fund</th>
68
            <th>Fund</th>
68
            <th>Claims count</th>
69
            <th>Claims count</th>
69
            <th class="title-string">Claimed date</th>
70
            <th class="title-string">Claimed date</th>
71
            <th>Internal note</th>
72
            <th>Vendor note</th>
73
            <th>ISBN</th>
70
        </tr>
74
        </tr>
71
      </thead>
75
      </thead>
72
      <tbody>
76
      <tbody>
Lines 76-81 Link Here
76
                <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
80
                <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
77
            </td>
81
            </td>
78
            <td>
82
            <td>
83
                [% lateorder.ordernumber | $raw %]
84
            </td>
85
            <td>
79
                <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
86
                <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
80
            </td>
87
            </td>
81
            <td>
88
            <td>
Lines 131-144 Link Here
131
                    <span title="0000-00-00"></span>
138
                    <span title="0000-00-00"></span>
132
                [% END %]
139
                [% END %]
133
            </td>
140
            </td>
141
            <td><input name="internalnote" id="internalnote" type="text" value="[% lateorder.internalnote | html %]"></td>
142
            <td><input name="vendornote" id="vendornote" type="text" value="[% lateorder.vendornote | html %]"></td>
143
            <td>[% lateorder.isbn | $raw %]</td>
134
        </tr>
144
        </tr>
135
      [% END %]
145
      [% END %]
136
      </tbody>
146
      </tbody>
137
      <tfoot>
147
      <tfoot>
138
        <tr>
148
        <tr>
139
            <th colspan="5">Total</th>
149
            <th colspan="6">Total</th>
140
            <th>[% total | html %]</th>
150
            <th>[% total | html %]</th>
141
            <th colspan="6">&nbsp;</th>
151
            <th colspan="9">&nbsp;</th>
142
        </tr>
152
        </tr>
143
      </tfoot>
153
      </tfoot>
144
    </table>
154
    </table>
Lines 149-154 Link Here
149
        [% UNLESS lateorder.budget_lock %]
159
        [% UNLESS lateorder.budget_lock %]
150
            <input type="submit"  value="Claim order" />
160
            <input type="submit"  value="Claim order" />
151
        [% END %]
161
        [% END %]
162
        <input type="button" value="Save notes" id="savenotes"/>
152
    </p>
163
    </p>
153
</form>
164
</form>
154
[% ELSE %]<p>There are no late orders.</p>
165
[% ELSE %]<p>There are no late orders.</p>
Lines 252-257 Link Here
252
                location.href = url;
263
                location.href = url;
253
                return false;
264
                return false;
254
            });
265
            });
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
284
                req.open("POST",url);
285
                req.send(data);
286
                req.onreadystatechange = function () {
287
                    $("#loading").remove();
288
                    if (req.readyState == '4' ){
289
                        if ( req.status == 200 ){
290
                            alert(_("Notes successfully saved"));
291
                        }
292
                        else {
293
                            alert(_("Error while saving the notes. Please try again"));
294
                        }
295
                    }
296
                }
297
            });
255
        });
298
        });
256
    </script>
299
    </script>
257
[% END %]
300
[% END %]
258
- 

Return to bug 12502