From 912e78d8200e9c2009f34754f3a5d273442a3b52 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Tue, 8 May 2012 14:20:24 -0400 Subject: [PATCH] Acq: Use scope to constrain choice of lineitem alerts This commit addresses this launchpad bug: https://bugs.launchpad.net/evergreen/+bug/996033 The controlled vocabulary of acq lineitem alert text is set up in an interface labeled "Line Item Alerts" in the staff client admin menu. In the PO and selection list interfaces (where alerts can be applied), we will limit the user to selecting alerts from those owned at the user's workstation org unit (or its ancestors). When we display applied alerts, we can also display the shortname of the org unit at which the alert text is defined (the owning_lib column). This should help clarify what's going on with alerts that have already been applied using alert text from another org unit. [Amended since original reference on Launchpad to also show the owning_lib's shortname when confirming alerts at receive time.] Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson --- .../web/js/ui/default/acq/common/li_table.js | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 9e3e350aee..8215946449 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 @@ -691,7 +691,11 @@ function AcqLiTable() { { "data": acqliat.toStoreData( this.pcrud.search( - "acqliat", {"id": {"!=": null}} + "acqliat", { + "owning_lib": aou.orgNodeTrail( + aou.findOrgUnit(openils.User.user.ws_ou()) + ).map(function(o) { return o.id(); }) + } ) ) } @@ -771,7 +775,12 @@ function AcqLiTable() { nodeByName("value", row).innerHTML = note.value(); var alert_node = nodeByName("alert_code", row); if (note.alert_text()) { - alert_node.innerHTML = note.alert_text().code(); + alert_node.innerHTML = dojo.string.substitute( + "[${0}] ${1}", [ + aou.findOrgUnit(note.alert_text().owning_lib()).shortname(), + note.alert_text().code() + ] + ); if (note.alert_text().description()) { new dijit.Tooltip( { @@ -1868,8 +1877,17 @@ function AcqLiTable() { localeStrings.CONFIRM_LI_ALERT, [ (new openils.acq.Lineitem({"lineitem": li})).findAttr( "title", "lineitem_marc_attr_definition" + ), ( + /* XXX it's really better add a parameter and to adjust + * the format string rather than do this concatenation + * here, but if someone wants this for 2.2 in a hurry, + * we can sidestep the problem of updating the strings + * while the translators are working. */ + "[" + + aou.findOrgUnit(lin.alert_text().owning_lib()).shortname() + + "] " + + lin.alert_text().code() ), - lin.alert_text().code(), lin.alert_text().description() || "", lin.value() ] -- 2.43.2