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

(-)a/C4/Acquisition.pm (-1 / +4 lines)
Lines 2126-2132 sub GetLateOrders { Link Here
2126
    my @query_params = ();
2126
    my @query_params = ();
2127
    my $select = "
2127
    my $select = "
2128
    SELECT aqbasket.basketno,
2128
    SELECT aqbasket.basketno,
2129
        aqorders.ordernumber,
2129
        aqorders.ordernumber      AS ordernumber,
2130
        DATE(aqbasket.closedate)  AS orderdate,
2130
        DATE(aqbasket.closedate)  AS orderdate,
2131
        aqbasket.basketname       AS basketname,
2131
        aqbasket.basketname       AS basketname,
2132
        aqbasket.basketgroupid    AS basketgroupid,
2132
        aqbasket.basketgroupid    AS basketgroupid,
Lines 2135-2140 sub GetLateOrders { Link Here
2135
        aqorders.ecost            AS unitpricelib,
2135
        aqorders.ecost            AS unitpricelib,
2136
        aqorders.claims_count     AS claims_count,
2136
        aqorders.claims_count     AS claims_count,
2137
        aqorders.claimed_date     AS claimed_date,
2137
        aqorders.claimed_date     AS claimed_date,
2138
        aqorders.order_internalnote AS internalnote,
2139
        aqorders.order_vendornote   AS vendornote,
2138
        aqbudgets.budget_name     AS budget,
2140
        aqbudgets.budget_name     AS budget,
2139
        borrowers.branchcode      AS branch,
2141
        borrowers.branchcode      AS branch,
2140
        aqbooksellers.name        AS supplier,
2142
        aqbooksellers.name        AS supplier,
Lines 2142-2147 sub GetLateOrders { Link Here
2142
        biblio.author, biblio.title,
2144
        biblio.author, biblio.title,
2143
        biblioitems.publishercode AS publisher,
2145
        biblioitems.publishercode AS publisher,
2144
        biblioitems.publicationyear,
2146
        biblioitems.publicationyear,
2147
        biblioitems.isbn          AS isbn,
2145
        ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
2148
        ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
2146
    ";
2149
    ";
2147
    my $from = "
2150
    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 (+24 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 $ordernumber;
129
    my @orders = $input->param;
130
131
    foreach my $order (@orders){
132
        if ( $order ne "op"){
133
            my @split = split (/_/,$order);
134
            $listorders->{$split[0]}->{$split[1]} = $input->param($order);
135
        }
136
    }
137
138
    my $orders_rs = Koha::Acquisition::Orders->search({ ordernumber => [ keys %$listorders ] });
139
    while ( my $order = $orders_rs->next ) {
140
        my $internalnote = $listorders->{$order->ordernumber}->{i};
141
        my $vendornote   = $listorders->{$order->ordernumber}->{v};
142
143
        $order->order_internalnote($internalnote) if defined $internalnote;
144
        $order->order_vendornote($vendornote)     if defined $vendornote;
145
        $order->store;
146
    }
147
}
148
125
my @parameters = ( $delay );
149
my @parameters = ( $delay );
126
push @parameters, $estimateddeliverydatefrom_dt
150
push @parameters, $estimateddeliverydatefrom_dt
127
    ? $estimateddeliverydatefrom_dt->ymd()
151
    ? $estimateddeliverydatefrom_dt->ymd()
(-)a/admin/columns_settings.yml (+8 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
62
70
63
  admin:
71
  admin:
64
    currency:
72
    currency:
(-)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 57-62 Link Here
57
            [% ELSE %]
57
            [% ELSE %]
58
                <th></th>
58
                <th></th>
59
            [% END %]
59
            [% END %]
60
            <th>Order line</th>
60
            <th class="title-string">Order date</th>
61
            <th class="title-string">Order date</th>
61
            <th class="title-string">Estimated delivery date</th>
62
            <th class="title-string">Estimated delivery date</th>
62
            <th>Vendor</th>
63
            <th>Vendor</th>
Lines 68-73 Link Here
68
            <th>Fund</th>
69
            <th>Fund</th>
69
            <th>Claims count</th>
70
            <th>Claims count</th>
70
            <th class="title-string">Claimed date</th>
71
            <th class="title-string">Claimed date</th>
72
            <th>Internal note</th>
73
            <th>Vendor note</th>
74
            <th>ISBN</th>
71
        </tr>
75
        </tr>
72
      </thead>
76
      </thead>
73
      <tbody>
77
      <tbody>
Lines 77-82 Link Here
77
                <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
81
                <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
78
            </td>
82
            </td>
79
            <td>
83
            <td>
84
                [% lateorder.ordernumber %]
85
            </td>
86
            <td>
80
                <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
87
                <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
81
            </td>
88
            </td>
82
            <td>
89
            <td>
Lines 132-145 Link Here
132
                    <span title="0000-00-00"></span>
139
                    <span title="0000-00-00"></span>
133
                [% END %]
140
                [% END %]
134
            </td>
141
            </td>
142
            <td><input name="internalnote" id="internalnote" type="text" value="[% lateorder.internalnote %]"></td>
143
            <td><input name="vendornote" id="vendornote" type="text" value="[% lateorder.vendornote %]"></td>
144
            <td>[% lateorder.isbn %]</td>
135
        </tr>
145
        </tr>
136
      [% END %]
146
      [% END %]
137
      </tbody>
147
      </tbody>
138
      <tfoot>
148
      <tfoot>
139
        <tr>
149
        <tr>
140
            <th colspan="5">Total</th>
150
            <th colspan="6">Total</th>
141
            <th>[% total | html %]</th>
151
            <th>[% total | html %]</th>
142
            <th colspan="6">&nbsp;</th>
152
            <th colspan="9">&nbsp;</th>
143
        </tr>
153
        </tr>
144
      </tfoot>
154
      </tfoot>
145
    </table>
155
    </table>
Lines 150-155 Link Here
150
        [% UNLESS lateorder.budget_lock %]
160
        [% UNLESS lateorder.budget_lock %]
151
            <input type="submit"  value="Claim order" />
161
            <input type="submit"  value="Claim order" />
152
        [% END %]
162
        [% END %]
163
        <input type="button" value="Save notes" id="savenotes"/>
153
    </p>
164
    </p>
154
</form>
165
</form>
155
[% ELSE %]<p>There are no late orders.</p>
166
[% ELSE %]<p>There are no late orders.</p>
Lines 253-258 Link Here
253
                location.href = url;
264
                location.href = url;
254
                return false;
265
                return false;
255
            });
266
            });
267
            // Update all notes
268
            $("#savenotes").click(function(){
269
                $("#savenotes").after("<span id=\"loading\" style=\"margin:4px;\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</span>");
270
                var all_nodes = $(late_orderst.fnGetNodes());
271
                var req = new XMLHttpRequest();
272
                var url = '/cgi-bin/koha/acqui/lateorders.pl';
273
                var data = new FormData();
274
                data.append("op","save");
275
                for (var i = 0; i < all_nodes.length; i++) {
276
                    var order = $(all_nodes[i]).find("input[name='ordernumber']");
277
                    var internalnote = $(all_nodes[i]).find("input[name='internalnote']")[0].value;
278
                    var vendornote = $(all_nodes[i]).find("input[name='vendornote']")[0].value;
279
                    var internalnote_key = order[0].value + "_i";
280
                    var vendornote_key = order[0].value + "_v";
281
                    data.append(internalnote_key, internalnote);
282
                    data.append(vendornote_key, vendornote);
283
                }
284
285
                req.open("POST",url);
286
                req.send(data);
287
                req.onreadystatechange = function () {
288
                    $("#loading").remove();
289
                    if (req.readyState == '4' ){
290
                        if ( req.status == 200 ){
291
                            alert(_("Notes successfully saved"));
292
                        }
293
                        else {
294
                            alert(_("Error while saving the notes. Please try again"));
295
                        }
296
                    }
297
                }
298
            });
256
        });
299
        });
257
    </script>
300
    </script>
258
[% END %]
301
[% END %]
259
- 

Return to bug 12502