Browse Source

Bug 12502: Add vendor note, internal note, ordernumber and isbn to late orders page

Test plan:

0) Make sure you have a late order
    a) Create a test vendor unless you have one
    b) Create a test basket unless you have one
    c) Close the basket to mark the order as late
1) Go to the late orders table
Before patch : Orderno, ISBN, vendor notes, internal notes are absent
After patch: fields are present

2) Edit the vendor note and/or the internal note
3) Press the save notes button
4) Refresh page and cache (CTRL+F5), if notes have been correctly saved, your modifications should be displayed.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
David Bourgault 5 years ago
committed by Martin Renvoize
parent
commit
34dfe783c6
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 5
      C4/Acquisition.pm
  2. 3
      acqui/lateorders-export.pl
  3. 23
      acqui/lateorders.pl
  4. 9
      admin/columns_settings.yml
  5. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt
  6. 47
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt

5
C4/Acquisition.pm

@ -2165,7 +2165,7 @@ sub GetLateOrders {
my @query_params = ();
my $select = "
SELECT aqbasket.basketno,
aqorders.ordernumber,
aqorders.ordernumber AS ordernumber,
DATE(aqbasket.closedate) AS orderdate,
aqbasket.basketname AS basketname,
aqbasket.basketgroupid AS basketgroupid,
@ -2174,6 +2174,8 @@ sub GetLateOrders {
aqorders.ecost AS unitpricelib,
aqorders.claims_count AS claims_count,
aqorders.claimed_date AS claimed_date,
aqorders.order_internalnote AS internalnote,
aqorders.order_vendornote AS vendornote,
aqbudgets.budget_name AS budget,
borrowers.branchcode AS branch,
aqbooksellers.name AS supplier,
@ -2181,6 +2183,7 @@ sub GetLateOrders {
biblio.author, biblio.title,
biblioitems.publishercode AS publisher,
biblioitems.publicationyear,
biblioitems.isbn AS isbn,
ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
";
my $from = "

3
acqui/lateorders-export.pl

@ -53,6 +53,9 @@ for my $ordernumber ( @ordernumbers ) {
basketno => $order->{basketno},
claims_count => $order->{claims_count},
claimed_date => $order->{claimed_date},
internalnote => $order->{internalnote},
vendornote => $order->{vendornote},
isbn => $order->{isbn},
}
;
}

23
acqui/lateorders.pl

@ -53,6 +53,7 @@ use C4::Context;
use C4::Acquisition;
use C4::Letters;
use Koha::DateUtils;
use Koha::Acquisition::Orders;
my $input = new CGI;
my ($template, $loggedinuser, $cookie) = get_template_and_user(
@ -122,6 +123,28 @@ if ($op and $op eq "send_alert"){
}
}
if ($op && $op eq "save"){
my $listorders;
my @orders = $input->param;
foreach my $order (@orders){
if ( $order ne "op"){
my @split = split (/_/,$order);
$listorders->{$split[0]}->{$split[1]} = $input->param($order);
}
}
my $orders_rs = Koha::Acquisition::Orders->search({ ordernumber => [ keys %$listorders ] });
while ( my $order = $orders_rs->next ) {
my $internalnote = $listorders->{$order->ordernumber}->{i};
my $vendornote = $listorders->{$order->ordernumber}->{v};
$order->order_internalnote($internalnote) if defined $internalnote;
$order->order_vendornote($vendornote) if defined $vendornote;
$order->store;
}
}
my @parameters = ( $delay );
push @parameters, $estimateddeliverydatefrom_dt
? $estimateddeliverydatefrom_dt->ymd()

9
admin/columns_settings.yml

@ -37,6 +37,8 @@ modules:
columnname: checkbox
cannot_be_toggled: 1
cannot_be_modified: 1
-
columnname: order_line
-
columnname: order_date
-
@ -59,6 +61,13 @@ modules:
columnname: claims_count
-
columnname: claimed_date
-
columnname: internal_note
-
columnname: vendor_note
-
columnname: isbn
basket:
orders:
-

2
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt

@ -1,4 +1,4 @@
[%- USE Koha -%]
[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%]
[%- 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 -%]
[%- 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 -%]

47
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt

@ -56,6 +56,7 @@
[% ELSE %]
<th></th>
[% END %]
<th>Order line</th>
<th class="title-string">Order date</th>
<th class="title-string">Estimated delivery date</th>
<th>Vendor</th>
@ -67,6 +68,9 @@
<th>Fund</th>
<th>Claims count</th>
<th class="title-string">Claimed date</th>
<th>Internal note</th>
<th>Vendor note</th>
<th>ISBN</th>
</tr>
</thead>
<tbody>
@ -75,6 +79,9 @@
<td>
<input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
</td>
<td>
[% lateorder.ordernumber | $raw %]
</td>
<td>
<span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
</td>
@ -131,14 +138,17 @@
<span title="0000-00-00"></span>
[% END %]
</td>
<td><input name="internalnote" id="internalnote" type="text" value="[% lateorder.internalnote | html %]"></td>
<td><input name="vendornote" id="vendornote" type="text" value="[% lateorder.vendornote | html %]"></td>
<td>[% lateorder.isbn | $raw %]</td>
</tr>
[% END %]
</tbody>
<tfoot>
<tr>
<th colspan="5">Total</th>
<th colspan="6">Total</th>
<th>[% total | html %]</th>
<th colspan="6">&nbsp;</th>
<th colspan="9">&nbsp;</th>
</tr>
</tfoot>
</table>
@ -149,6 +159,7 @@
[% UNLESS lateorder.budget_lock %]
<input type="submit" value="Claim order" />
[% END %]
<input type="button" value="Save notes" id="savenotes"/>
</p>
</form>
[% ELSE %]<p>There are no late orders.</p>
@ -252,6 +263,38 @@
location.href = url;
return false;
});
// Update all notes
$("#savenotes").click(function(){
$("#savenotes").after("<span id=\"loading\" style=\"margin:4px;\"><img src=\"[% interface | html %]/[% theme | html %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</span>");
var all_nodes = $(late_orderst.fnGetNodes());
var req = new XMLHttpRequest();
var url = '/cgi-bin/koha/acqui/lateorders.pl';
var data = new FormData();
data.append("op","save");
for (var i = 0; i < all_nodes.length; i++) {
var order = $(all_nodes[i]).find("input[name='ordernumber']");
var internalnote = $(all_nodes[i]).find("input[name='internalnote']")[0].value;
var vendornote = $(all_nodes[i]).find("input[name='vendornote']")[0].value;
var internalnote_key = order[0].value + "_i";
var vendornote_key = order[0].value + "_v";
data.append(internalnote_key, internalnote);
data.append(vendornote_key, vendornote);
}
req.open("POST",url);
req.send(data);
req.onreadystatechange = function () {
$("#loading").remove();
if (req.readyState == '4' ){
if ( req.status == 200 ){
alert(_("Notes successfully saved"));
}
else {
alert(_("Error while saving the notes. Please try again"));
}
}
}
});
});
</script>
[% END %]

Loading…
Cancel
Save