[open-ils-commits] r19710 - branches/rel_2_0/Open-ILS/web/js/ui/default/acq/financial (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 11 15:45:57 EST 2011
Author: senator
Date: 2011-03-11 15:45:52 -0500 (Fri, 11 Mar 2011)
New Revision: 19710
Modified:
branches/rel_2_0/Open-ILS/web/js/ui/default/acq/financial/claim_eligible.js
Log:
Backport r19709 from trunk
Acq: The "Claim-Ready Items" interface did not render correctly for > 1 item
The problem was racy async rendering logic. Now we look at our whole result
set and build our table accordingly at the end.
This interface should probably learn about paging one day in order to
handle large result sets.
Modified: branches/rel_2_0/Open-ILS/web/js/ui/default/acq/financial/claim_eligible.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/default/acq/financial/claim_eligible.js 2011-03-11 20:44:33 UTC (rev 19709)
+++ branches/rel_2_0/Open-ILS/web/js/ui/default/acq/financial/claim_eligible.js 2011-03-11 20:45:52 UTC (rev 19710)
@@ -81,21 +81,24 @@
var count = 0;
this.reset();
fieldmapper.standardRequest(
- ["open-ils.acq", "open-ils.acq.claim.eligible.lineitem_detail"], {
+ ["open-ils.acq", "open-ils.acq.claim.eligible.lineitem_detail.atomic"], {
"params": [openils.User.authtoken, this.filter],
"async": true,
- "onresponse": function(r) {
- if (r = openils.Util.readResponse(r)) {
- if (!count++)
- openils.Util.show("acq-eligible-claim-controls");
- self.addIfMissing(r.lineitem());
- } else {
- progressDialog.hide();
+ "oncomplete": function(r) {
+ progressDialog.hide();
+ var rset = openils.Util.readResponse(r);
+ if (rset.length < 1) self.showEmpty();
+ else {
+ var byLi = {};
+ rset.forEach(
+ function(r) {
+ byLi[r.lineitem()] =
+ (byLi[r.lineitem()] || 0) + 1;
+ }
+ );
+ for (var key in byLi)
+ self.addIfMissing(key, byLi[key]);
}
- },
- "oncomplete": function() {
- if (count < 1) self.showEmpty();
- progressDialog.hide();
}
}
);
@@ -113,7 +116,7 @@
nodeByName("lid_link", "eligible-li-" + liId).onclick =
function() {
location.href = oilsBasePath + "/acq/po/view/" +
- self.liCache[liId].purchase_order().id() + "," +
+ self.liCache[liId].purchase_order().id() + "/" +
liId;
};
openils.Util.show(
@@ -124,10 +127,7 @@
/* Despite being called with an argument that's a lineitem ID, this method
* is actually called once per lineitem _detail_. */
- this.addIfMissing = function(liId) {
- this._updateLidLink(liId);
- if (this.liCache[liId]) return;
-
+ this.addIfMissing = function(liId, number_of_appearances) {
var row = dojo.clone(this.rowTemplate);
var checkbox = nodeByName("selector", row);
@@ -141,6 +141,9 @@
dojo.attr(row, "id", "eligible-li-" + liId);
dojo.attr(checkbox, "value", liId);
dojo.place(row, self.tBody, "last");
+
+ for (var i = 0; i < number_of_appearances; i++)
+ self._updateLidLink(liId);
}
);
};
More information about the open-ils-commits
mailing list