Bugzilla – Attachment 80160 Details for
Bug 12502
Add columns for note, order number and ISBN to late orders page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12502: Add vendor note, internal note, ordernumber and isbn to late orders page
Bug-12502-Add-vendor-note-internal-note-ordernumbe.patch (text/plain), 10.32 KB, created by
Séverine Queune
on 2018-10-06 10:00:58 UTC
(
hide
)
Description:
Bug 12502: Add vendor note, internal note, ordernumber and isbn to late orders page
Filename:
MIME Type:
Creator:
Séverine Queune
Created:
2018-10-06 10:00:58 UTC
Size:
10.32 KB
patch
obsolete
>From 3e14622260eac066e84d7a1a4b29f0e64f7aac80 Mon Sep 17 00:00:00 2001 >From: David Bourgault <david.bourgault@inlibro.com> >Date: Mon, 25 Sep 2017 15:18:38 -0400 >Subject: [PATCH] Bug 12502: Add vendor note, internal note, ordernumber and > isbn to late orders page >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > C4/Acquisition.pm | 5 ++- > acqui/lateorders-export.pl | 3 ++ > acqui/lateorders.pl | 24 +++++++++++ > admin/columns_settings.yml | 8 ++++ > .../en/includes/csv_headers/acqui/lateorders.tt | 2 +- > .../prog/en/modules/acqui/lateorders.tt | 47 +++++++++++++++++++++- > 6 files changed, 85 insertions(+), 4 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index d635a49..a24f098 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2126,7 +2126,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, >@@ -2135,6 +2135,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, >@@ -2142,6 +2144,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 = " >diff --git a/acqui/lateorders-export.pl b/acqui/lateorders-export.pl >index c8d86e6..332f652 100755 >--- a/acqui/lateorders-export.pl >+++ b/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}, > } > ; > } >diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl >index 9febcf6..1d81e25 100755 >--- a/acqui/lateorders.pl >+++ b/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,29 @@ if ($op and $op eq "send_alert"){ > } > } > >+if ($op && $op eq "save"){ >+ my $listorders; >+ my $ordernumber; >+ 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() >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 57bc399..83eb5cf 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -38,6 +38,8 @@ modules: > cannot_be_toggled: 1 > cannot_be_modified: 1 > - >+ columnname: order_line >+ - > columnname: order_date > - > columnname: estimated_delivery_date >@@ -59,6 +61,12 @@ modules: > columnname: claims_count > - > columnname: claimed_date >+ - >+ columnname: internal_note >+ - >+ columnname: vendor_note >+ - >+ columnname: isbn > > admin: > currency: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt >index 8231efb..f15f545 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt >+++ b/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 -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >index 69faed4..058a305 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >@@ -57,6 +57,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> >@@ -68,6 +69,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> >@@ -77,6 +81,9 @@ > <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber"> > </td> > <td> >+ [% lateorder.ordernumber %] >+ </td> >+ <td> > <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span> > </td> > <td> >@@ -132,14 +139,17 @@ > <span title="0000-00-00"></span> > [% END %] > </td> >+ <td><input name="internalnote" id="internalnote" type="text" value="[% lateorder.internalnote %]"></td> >+ <td><input name="vendornote" id="vendornote" type="text" value="[% lateorder.vendornote %]"></td> >+ <td>[% lateorder.isbn %]</td> > </tr> > [% END %] > </tbody> > <tfoot> > <tr> >- <th colspan="5">Total</th> >+ <th colspan="6">Total</th> > <th>[% total | html %]</th> >- <th colspan="6"> </th> >+ <th colspan="9"> </th> > </tr> > </tfoot> > </table> >@@ -150,6 +160,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> >@@ -253,6 +264,38 @@ > location.href = url; > return false; > }); >+ // Update all notes >+ $("#savenotes").click(function(){ >+ $("#savenotes").after("<span id=\"loading\" style=\"margin:4px;\"><img src=\"[% interface %]/[% theme %]/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 %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12502
:
67349
|
67354
|
67586
|
67587
|
72168
|
72169
|
72170
|
73499
|
73500
|
73501
|
73502
|
73503
|
79231
|
80160
|
80602
|
87236
|
91564
|
95418
|
95419
|
95438
|
95439
|
95440
|
95441
|
97427
|
97428
|
97429
|
97430