Bugzilla – Attachment 95439 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: (follow-up) Use modal to add/edit order notes
Bug-12502-follow-up-Use-modal-to-addedit-order-not.patch (text/plain), 11.19 KB, created by
Séverine Queune
on 2019-11-14 16:51:03 UTC
(
hide
)
Description:
Bug 12502: (follow-up) Use modal to add/edit order notes
Filename:
MIME Type:
Creator:
Séverine Queune
Created:
2019-11-14 16:51:03 UTC
Size:
11.19 KB
patch
obsolete
>From 6b0edc75bcea5b013c1d880799bad4b2931fba37 Mon Sep 17 00:00:00 2001 >From: Maryse Simard <maryse.simard@inlibro.com> >Date: Tue, 16 Jul 2019 15:24:51 -0400 >Subject: [PATCH] Bug 12502: (follow-up) Use modal to add/edit order notes >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Replace inputs to edit notes by a link opening a modal, similar >to the basket summary page. This makes it possible for the notes >to appear in the datatable exports. > >Also fix exporting with the export as csv button at the bottom >of the page to export notes. > >Test plan : >1) In the late orders table (acqui/lateorders.pl), a link should >appear in both the internal and vendor note column, following the >current value if it exist. > -> This link should read "Add ..." if there is no existing note > or "Edit ..." if there is. >2) Click on the link. A modal should appear. Confirm that saving a >note works as expected. >3) Try exporting to any format using either the button at the top >of the table or the one at the bottom of the page. > -> The three new columns and their values should appear in the > export. > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >--- > acqui/lateorders-export.pl | 4 +- > acqui/lateorders.pl | 22 ----- > .../prog/en/modules/acqui/csv/lateorders.tt | 5 +- > .../prog/en/modules/acqui/lateorders.tt | 104 ++++++++++++++------- > 4 files changed, 78 insertions(+), 57 deletions(-) > >diff --git a/acqui/lateorders-export.pl b/acqui/lateorders-export.pl >index 332f652..cefe613 100755 >--- a/acqui/lateorders-export.pl >+++ b/acqui/lateorders-export.pl >@@ -53,8 +53,8 @@ for my $ordernumber ( @ordernumbers ) { > basketno => $order->{basketno}, > claims_count => $order->{claims_count}, > claimed_date => $order->{claimed_date}, >- internalnote => $order->{internalnote}, >- vendornote => $order->{vendornote}, >+ internalnote => $order->{order_internalnote}, >+ vendornote => $order->{order_vendornote}, > isbn => $order->{isbn}, > } > ; >diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl >index 5232dd7..e2e0ee2 100755 >--- a/acqui/lateorders.pl >+++ b/acqui/lateorders.pl >@@ -123,28 +123,6 @@ 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() >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt >index 68b2467..1ce7d8c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt >@@ -13,7 +13,10 @@ > "[% o.unitpricesupplier | html %] x [% o.quantity_to_receive | html %] = [% o.subtotal | html %] ([% o.budget | html %])"[%- delimiter | html -%] > "[% o.basketname | html %] ([% o.basketno | html %])"[%- delimiter | html -%] > "[% o.claims_count | html %]"[%- delimiter | html -%] >-"[% o.claimed_date | html %]" >+"[% o.claimed_date | html %]"[%- delimiter | html -%] >+"[% o.internalnote | html %]"[%- delimiter | html -%] >+"[% o.vendornote | html %]"[%- delimiter | html -%] >+"[% o.isbn | html %]" > [%- INCLUDE empty_line.inc -%] > [%- END -%] > [%- delimiter | html -%] >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 caa5653..5d3c78d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >@@ -138,8 +138,34 @@ > <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> >+ [% IF ( lateorder.internalnote ) %] >+ <p class="ordernote"> >+ <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.internalnote | html %]</span> >+ <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"> >+ <i class="fa fa-pencil"></i> Edit internal note >+ </a> >+ </p> >+ [% ELSE %] >+ <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"> >+ <i class="fa fa-plus"></i> Add internal note >+ </a> >+ [% END %] >+ </td> >+ <td> >+ [% IF ( lateorder.vendornote ) %] >+ <p class="ordernote"> >+ <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.vendornote | html %]</span> >+ <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"> >+ <i class="fa fa-pencil"></i> Edit vendor note >+ </a> >+ </p> >+ [% ELSE %] >+ <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"> >+ <i class="fa fa-plus"></i> Add vendor note >+ </a> >+ [% END %] >+ </td> > <td>[% lateorder.isbn | $raw %]</td> > </tr> > [% END %] >@@ -204,6 +230,30 @@ > </div> <!-- /.col-sm-2.col-sm-pull-10 --> > </div> > >+<!-- Modal for editing vendor and internal notes --> >+<div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel"> >+ <div class="modal-dialog" role="document"> >+ <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ <h4 class="modal-title" id="noteEditorLabel">Order note</h4> >+ </div> >+ <div class="modal-body"> >+ <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea> >+ <input type="hidden" id="ordernumber" name="ordernumber" value="" /> >+ <input type="hidden" name="op" value="save" /> >+ <input type="hidden" id="type" name="type" value="" /> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-default">Save</button> >+ <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button> >+ </div> >+ </div> >+ </form> >+ </div> >+</div> >+ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >@@ -263,37 +313,27 @@ > 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")); >- } >- } >- } >+ $(".edit_note").on("click", function(e) { >+ e.preventDefault(); >+ var ordernumber = $(this).data("ordernumber"); >+ var note_type = $(this).data("note_type"); >+ var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")"; >+ var note_text = $( "#" + note_type + "-note-" + ordernumber ).html(); >+ $("#noteEditor .modal-title").text(modalTitle); >+ $("#ordernumber").val( ordernumber ); >+ $("#ordernotes").html( note_text ); >+ $("#type").val( note_type ); >+ $("#noteEditor").modal("show"); >+ $("#ordernotes").focus(); >+ }); >+ >+ $("#noteEditor").on('hidden.bs.modal', function (e) { >+ $("#noteEditorLabel").html(""); >+ $("#noteEditor .modal-title").text(""); >+ $("#ordernotes").html( "" ); >+ $("#ordernumber").val(""); >+ $("#type").val(""); > }); > }); > </script> >-- >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