From 92ae1ecae956c2a2772a585f7d8602712cbfd9e9 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 13 Jul 2012 12:07:56 -0400 Subject: [PATCH] ACQ : lineitem recovers focus from various interfaces 1. When viewing an invoice then clicking on the title link for a lineitem, the user is taken away to the copy grid within the PO page for the lineitem.This adds a "Return to Invoice" button in the copy grid which takes the user back to the invoice, focused on the lineitem in question. 2. Adds a "Return to Search" button for PL/PO pages to return to the lineitem in question when the PL or PO links are selected for a lineitem in a set of search results. 3. Adds a "Return to Invoice" button to PO/Picklist pages with lineitem focus when the page was accessed from the invoice UI. Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/templates/acq/common/li_table.tt2 | 4 ++++ Open-ILS/src/templates/acq/picklist/view.tt2 | 7 +++++++ Open-ILS/src/templates/acq/po/view.tt2 | 10 ++++++++++ Open-ILS/web/js/dojo/openils/acq/nls/acq.js | 2 +- Open-ILS/web/js/ui/default/acq/common/li_table.js | 13 +++++++++++-- Open-ILS/web/js/ui/default/acq/picklist/view.js | 19 +++++++++++++++++++ Open-ILS/web/js/ui/default/acq/po/view_po.js | 20 ++++++++++++++++++++ 7 files changed, 72 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2 index 8c6b065db7..9eb8d35ff8 100644 --- a/Open-ILS/src/templates/acq/common/li_table.tt2 +++ b/Open-ILS/src/templates/acq/common/li_table.tt2 @@ -158,6 +158,10 @@ + +
+
↖ Return
Item Count: diff --git a/Open-ILS/src/templates/acq/picklist/view.tt2 b/Open-ILS/src/templates/acq/picklist/view.tt2 index a209c3eda7..65af63b653 100644 --- a/Open-ILS/src/templates/acq/picklist/view.tt2 +++ b/Open-ILS/src/templates/acq/picklist/view.tt2 @@ -12,6 +12,13 @@ + + + [% INCLUDE 'acq/common/li_table.tt2' %] diff --git a/Open-ILS/src/templates/acq/po/view.tt2 b/Open-ILS/src/templates/acq/po/view.tt2 index 605ad7a13d..2084e10dad 100644 --- a/Open-ILS/src/templates/acq/po/view.tt2 +++ b/Open-ILS/src/templates/acq/po/view.tt2 @@ -109,6 +109,16 @@
[% l('Allow activation with
zero-copy lineitems') %]
+ + + +
${0}, by ${1} (${2})
\n
\n${3} Ordered, ${4} Received, ${7} Invoiced, ${8} Claimed, ${9} Cancelled
\n
Estimated $${6}, Encumbered $${16}, Paid $${17}
\n", + "LINEITEM_SUMMARY" : "
${0}, by ${1} (${2})
\n
\n${3} Ordered, ${4} Received, ${7} Invoiced, ${8} Claimed, ${9} Cancelled
\n
Estimated $${6}, Encumbered $${16}, Paid $${17}
\n", "INVOICE_CONFIRM_PRORATE" : "Prorate charges?\n\nAny subsequent changes to the invoice that would affect prorated amounts should be resolved manually.", "INVOICE_EXTRA_COPIES" : "You are attempting to invoice ${0} more copies than originally ordered.

To add these items to the original order, select a fund and choose 'Add New Items' below.
After saving the invoice, you may finish editing and importing the new copies from the lineitem details page.", "INVOICE_ITEM_PO_DETAILS" : "${0}
PO #${3} ${4}
Total Estimated Cost: $${5}", diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 54ce6cc531..d0a9d849ab 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -459,7 +459,7 @@ function AcqLiTable() { if(po && !this.isMeta) { openils.Util.show(nodeByName('po', row), 'inline'); var link = nodeByName('po_link', row); - link.setAttribute('href', oilsBasePath + '/acq/po/view/' + li.purchase_order()); + link.setAttribute('href', oilsBasePath + '/acq/po/view/' + li.purchase_order() + '?focus_li=' + li.id()); link.innerHTML += po.name(); openils.Util.show(nodeByName('pro', row), 'inline'); @@ -485,7 +485,7 @@ function AcqLiTable() { openils.Util.show(nodeByName('pl', row), 'inline'); var link = nodeByName('pl_link', row); - link.setAttribute('href', oilsBasePath + '/acq/picklist/view/' + li.picklist()); + link.setAttribute('href', oilsBasePath + '/acq/picklist/view/' + li.picklist() + '?focus_li=' + li.id()); link.innerHTML += pl.name(); } } @@ -1121,6 +1121,15 @@ function AcqLiTable() { if (typeof force_fetch == "undefined") force_fetch = false; + if (document.referrer.match(/invoice/)) { + // got here from the invoice page, show the 'return-to-invoice' button + var cgi = new openils.CGI({url : document.referrer}); + cgi.param('focus_li', liId); + openils.Util.show(dojo.byId('acq-lit-copies-back-to-invoice-button-wrapper'), 'inline'); + var button = dojo.byId('acq-lit-copies-back-to-invoice-button'); + button.onclick = function() { location.href = cgi.url() }; + } + openils.acq.Lineitem.fetchAndRender(liId, {}, function(li, html) { dojo.byId('acq-lit-copies-li-summary').innerHTML = html; diff --git a/Open-ILS/web/js/ui/default/acq/picklist/view.js b/Open-ILS/web/js/ui/default/acq/picklist/view.js index 7cbc0c5f25..c125dafef7 100644 --- a/Open-ILS/web/js/ui/default/acq/picklist/view.js +++ b/Open-ILS/web/js/ui/default/acq/picklist/view.js @@ -2,6 +2,7 @@ dojo.require('dojo.date.stamp'); dojo.require('dojo.date.locale'); dojo.require('openils.User'); dojo.require('openils.Util'); +dojo.require('openils.CGI'); dojo.require('dijit.layout.ContentPane'); var plist; @@ -25,6 +26,24 @@ function load() { } ); + /* if we got here from the search/invoice page with a focused LI, + * return to the previous page with the same LI focused */ + var cgi = new openils.CGI(); + if (cgi.param('focus_li')) { + dojo.forEach( + ['search', 'invoice'], // perhaps a wee bit too loose + function(source) { + if (document.referrer.match(new RegExp(source))) { + openils.Util.show('acq-pl-return-to-' + source); + var newCgi = new openils.CGI({url : document.referrer}); + newCgi.param('focus_li', cgi.param('focus_li')); + dojo.byId('acq-pl-return-to-' + source + '-button').onclick = function() { + location.href = newCgi.url(); + } + } + } + ); + } } function drawPl() { diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js index 53acfa444d..19b7527238 100644 --- a/Open-ILS/web/js/ui/default/acq/po/view_po.js +++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js @@ -353,6 +353,26 @@ function renderPo() { ); openils.Util.show("acq-po-view-history", "inline"); + + /* if we got here from the search/invoice page with a focused LI, + * return to the previous page with the same LI focused */ + var cgi = new openils.CGI(); + if (cgi.param('focus_li')) { + dojo.forEach( + ['search', 'invoice'], // perhaps a wee bit too loose + function(source) { + if (document.referrer.match(new RegExp(source))) { + openils.Util.show('acq-po-return-to-' + source); + var newCgi = new openils.CGI({url : document.referrer}); + newCgi.param('focus_li', cgi.param('focus_li')); + dojo.byId('acq-po-return-to-' + source + '-button').onclick = function() { + location.href = newCgi.url(); + } + } + } + ); + } + prepareInvoiceFeatures(); } -- 2.11.0