Acq: be a little better about explaining why a PO can't be activated
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 17 Sep 2010 23:23:06 +0000 (23:23 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 17 Sep 2010 23:23:06 +0000 (23:23 +0000)
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
Open-ILS/web/js/ui/default/acq/po/view_po.js

index 6517646..f6c07ca 100644 (file)
@@ -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) {
 
index 92cb396..05ee24a 100644 (file)
@@ -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, [