From 266733b9d078bf38c195338a43c4613e5f3fc5e3 Mon Sep 17 00:00:00 2001 From: senator Date: Fri, 17 Sep 2010 23:23:06 +0000 Subject: [PATCH] Acq: be a little better about explaining why a PO can't be activated Sure, there's still room for improvement. git-svn-id: svn://svn.open-ils.org/ILS/trunk@17786 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm | 7 +++++++ Open-ILS/web/js/ui/default/acq/po/view_po.js | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm index 6517646ce2..f6c07cae6e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm @@ -669,6 +669,13 @@ sub create_lineitem_detail_debit { ]); } + unless ($lid->fund) { + $mgr->editor->event( + new OpenILS::Event("ACQ_FUND_NOT_FOUND") # close enough + ); + return 0; + } + my $amount = $li->estimated_unit_price; if($li->provider->currency_type ne $lid->fund->currency_type and !$no_translate) { 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 92cb396661..05ee24a76f 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 @@ -448,6 +448,7 @@ function checkCouldActivatePo() { d.innerHTML = localeStrings.PO_CHECKING; var warnings = []; var stops = []; + var other = []; fieldmapper.standardRequest( ["open-ils.acq", "open-ils.acq.purchase_order.activate.dry_run"], { @@ -463,6 +464,8 @@ function checkCouldActivatePo() { case "ACQ_FUND_EXCEEDS_WARN_PERCENT": warnings.push(r); break; + default: + other.push(r); } } } @@ -470,11 +473,16 @@ function checkCouldActivatePo() { "oncomplete": function() { /* XXX in the future, this might be tweaked to display info * about more than one stop or warning event from the ML. */ - if (!(warnings.length || stops.length)) { + if (!(warnings.length || stops.length || other.length)) { d.innerHTML = localeStrings.PO_COULD_ACTIVATE; openils.Util.show(a, "inline"); } else { - if (stops.length) { + if (other.length) { + /* XXX make the textcode part a tooltip one day */ + d.innerHTML = localeStrings.NO + ": " + + other[0].desc + " (" + other[0].textcode + ")"; + openils.Util.hide(a); + } else if (stops.length) { d.innerHTML = dojo.string.substitute( localeStrings.PO_STOP_BLOCKS_ACTIVATION, [ -- 2.11.0