Acq: support manual claiming as always intended, which to some users means
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Dec 2010 23:10:42 +0000 (23:10 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Dec 2010 23:10:42 +0000 (23:10 +0000)
claiming with no predefined policy

git-svn-id: svn://svn.open-ils.org/ILS/trunk@19040 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/common/claim_dialog.js
Open-ILS/web/js/ui/default/acq/common/li_table.js

index a34e2be..28042b2 100644 (file)
@@ -172,10 +172,9 @@ function ClaimDialogManager(
 
     this.claim = function(lid_ids) {
         progressDialog.show(true);
-        var win = null;
 
         fieldmapper.standardRequest(
-            ["open-ils.acq", "open-ils.acq.claim.lineitem_detail"], {
+            ["open-ils.acq", "open-ils.acq.claim.lineitem_detail.atomic"], {
                 "params": [
                     openils.User.authtoken, lid_ids, null,
                     this.claimType.attr("value"),
@@ -184,20 +183,17 @@ function ClaimDialogManager(
                 "async": true,
                 "onresponse": function(r) {
                     if (r = openils.Util.readResponse(r)) {
-                        if (!win)
-                            win = openClaimVoucherWindow();
-                        dojo.byId("main", win.document).innerHTML +=
-                            (r.template_output().data() + "<hr />");
-                    }
-                    else {
-                        progressDialog.hide();
+                        if (r.length) {
+                            openils.Util.printHtmlString(
+                                r.map(
+                                    function(o) {
+                                        return o.template_output().data();
+                                    }
+                                ).join("<hr />")
+                            );
+                        }
                     }
-                },
-                "oncomplete": function() {
                     progressDialog.hide();
-                    dojo.byId("print", win.document).innerHTML =
-                        localeStrings.PRINT;
-                    dojo.byId("print", win.document).disabled = false;
                     self.claimCallback(self.workingLi);
                 }
             }
index bbaf048..3088b68 100644 (file)
@@ -376,10 +376,10 @@ function AcqLiTable() {
     };
 
     this.reconsiderClaimControl = function(li, row) {
+        if (!row) row = this._findLiRow(li);
         var option = nodeByName("action_manage_claims", row);
         var eligible = this.claimEligibleLidByLi[li.id()].length;
         var count = this._liCountClaims(li);
-        if (!row) row = this._findLiRow(li);
 
         option.disabled = !(count || eligible);
         option.innerHTML =
@@ -409,6 +409,19 @@ function AcqLiTable() {
     };
 
     this.checkClaimEligibility = function(li, callback, row) {
+        /* Assume always eligible, i.e. from this interface we don't care about
+         * claim eligibility any more. this is where the user would force a
+         * claime. */
+        this.clearEligibility(li);
+        this.claimEligibleLidByLi[li.id()] = li.lineitem_details().map(
+            function(lid) { return lid.id(); }
+        );
+        li.lineitem_details().forEach(
+            function(lid) { self.claimEligibleLid[lid.id()] = true; }
+        );
+        this.reconsiderClaimControl(li, row);
+        if (callback) callback();
+        /*
         this.clearEligibility(li);
         fieldmapper.standardRequest(
             ["open-ils.acq", "open-ils.acq.claim.eligible.lineitem_detail"], {
@@ -429,6 +442,7 @@ function AcqLiTable() {
                 }
             }
         );
+        */
     };
 
     this.updateLiNotesCount = function(li, row) {