[open-ils-commits] r15584 - trunk/Open-ILS/web/js/ui/default/acq/po (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Feb 18 12:05:14 EST 2010
Author: senator
Date: 2010-02-18 12:05:11 -0500 (Thu, 18 Feb 2010)
New Revision: 15584
Modified:
trunk/Open-ILS/web/js/ui/default/acq/po/search.js
Log:
Acq: Minor bugfixes to PO search interface
1) Avoid a problem with floating point math when summing
amount_{encumbered,spent} in the combined PO view.
2) When redirected to the combined PO view after using the "split PO" function,
check the "show results as a virtual combined PO" checkbox for
interface consistency's sake.
Modified: trunk/Open-ILS/web/js/ui/default/acq/po/search.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/search.js 2010-02-18 16:10:29 UTC (rev 15583)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/search.js 2010-02-18 17:05:11 UTC (rev 15584)
@@ -82,6 +82,7 @@
}).build();
if (poIds && poIds.length > 0) {
+ dijit.byId("metapo_view").attr("checked", true);
doSearch({"id": poIds, "metapo_view": [true] /* [sic] */});
} else {
doSearch({"ordering_agency": openils.User.user.ws_ou()});
@@ -129,6 +130,11 @@
case "po":
target.innerHTML = self.working_po_list.length;
break;
+ /* Any numeric fields should be named here. */
+ case "amount_encumbered":
+ case "amount_spent":
+ target.innerHTML = self.numericFieldTotal(part);
+ break;
default:
/* assume a field on the acqpo's themselves */
target.innerHTML = self.anyFieldTotal(part);
@@ -141,10 +147,22 @@
);
}
};
+ metaPO.numericFieldTotal = function(field) {
+ var self = this;
+ var pennies = self.working_po_list.reduce(
+ /* working_po_list contains unfleshed acqpo's, so we must
+ * find the same PO in the poCache */
+ function(p, c) {
+ c = self.poCache[c.id()][field]();
+ return p + Number(c) * 100;
+ }, 0
+ );
+ return pennies / 100;
+ };
metaPO.anyFieldTotal = function(field) {
var self = this;
return self.working_po_list.reduce(
- /* working_po_list contains unfleshed, acqpo's, so we must
+ /* working_po_list contains unfleshed acqpo's, so we must
* find the same PO in the poCache */
function(p, c) {
c = self.poCache[c.id()][field]();
More information about the open-ils-commits
mailing list