Acq: better error message if trying to create PO without provider or agency
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 6 Oct 2011 20:13:51 +0000 (16:13 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 4 Nov 2011 17:04:30 +0000 (13:04 -0400)
Before now, if you leave either the provider or ordering agency
fields blank in the "Create Purchase Order" dialog, you get a
nonsensical warning about prepayment.

This fixes that.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>

Open-ILS/web/js/dojo/openils/acq/nls/acq.js
Open-ILS/web/js/ui/default/acq/common/li_table.js

index d2b69f4..9e29f0f 100644 (file)
@@ -84,5 +84,6 @@
     "ADD_LI_TO_PO_BAD_PO_STATE" : "The selected PO has already been activated",
     "ADD_LI_TO_PO_BAD_LI_STATE" : "The selected lineitem is not in a state that can be added to a purchase order",
     "INVOICE_NUMBER": "Invoice #${0}",
-    "COPIES_TO_RECEIVE": "Number of copies to receive: "
+    "COPIES_TO_RECEIVE": "Number of copies to receive: ",
+    "CREATE_PO_INVALID": "A purchase order must have an ordering agency and a provider."
 }
index 3733314..addf137 100644 (file)
@@ -86,7 +86,11 @@ function AcqLiTable() {
     };
 
     acqLitCreatePoSubmit.onClick = function() {
-        if (self._confirmPoPrepaySituation()) {
+        if (!self.createPoProviderSelector.attr("value") ||
+                !self.createPoAgencySelector.attr("value")) {
+            alert(localeStrings.CREATE_PO_INVALID);
+            return false;
+        } else if (self._confirmPoPrepaySituation()) {
             acqLitPoCreateDialog.hide();
             self._createPO(acqLitPoCreateDialog.getValues());
         } else {