Acq: fix inaccurate word choice in "related lineitems" link; hide when only 1
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 13 Mar 2010 00:05:41 +0000 (00:05 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 13 Mar 2010 00:05:41 +0000 (00:05 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15842 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/templates/default/acq/common/detail.tt2

index d3af1ed..13398e6 100644 (file)
@@ -537,26 +537,30 @@ function AcqLiTable() {
     }
 
     this.drawInfo = function(liId) {
-        if (!this.relCache[liId]) {
-            fieldmapper.standardRequest(
-                [
-                    "open-ils.acq",
-                    "open-ils.acq.lineitems_for_bib.by_lineitem_id.count"
-                ], {
-                    "async": true,
-                    "params": [openils.User.authtoken, liId],
-                    "onresponse": function(r) {
-                        self.relCache[liId] = openils.Util.readResponse(r);
-                        nodeByName(
-                            "related_number", dojo.byId("acq-lit-info-related")
-                        ).innerHTML = self.relCache[liId];
+        if (!this._isRelatedViewer) {
+            var d = dojo.byId("acq-lit-info-related");
+            if (!this.relCache[liId]) {
+                fieldmapper.standardRequest(
+                    [
+                        "open-ils.acq",
+                        "open-ils.acq.lineitems_for_bib.by_lineitem_id.count"
+                    ], {
+                        "async": true,
+                        "params": [openils.User.authtoken, liId],
+                        "onresponse": function(r) {
+                            self.relCache[liId] = openils.Util.readResponse(r);
+                            nodeByName("related_number", d).innerHTML =
+                                self.relCache[liId];
+                            openils.Util[
+                                self.relCache[liId] >1 ? "show" : "hide"
+                            ](d);
+                        }
                     }
-                }
-            );
-        } else {
-            nodeByName(
-                "related_number", dojo.byId("acq-lit-info-related")
-            ).innerHTML = this.relCache[liId];
+                );
+            } else {
+                nodeByName("related_number", d).innerHTML = this.relCache[liId];
+                openils.Util[this.relCache[liId] > 1 ? "show" : "hide"](d);
+            }
         }
 
         this.show('info');
@@ -629,10 +633,8 @@ function AcqLiTable() {
                 this.infoTbody.appendChild(row);
             }
 
-            var rel_div = dojo.byId("acq-lit-info-related");
-            nodeByName("rel_link", rel_div).href =
+            nodeByName("rel_link", dojo.byId("acq-lit-info-related")).href =
                 "/eg/acq/lineitem/related/" + li.id();
-            openils.Util.show(rel_div);
         }
 
         if(li.eg_bib_id()) {
index 60188db..9284aa6 100644 (file)
@@ -13,7 +13,7 @@
         </div>
 [% IF which == "Lit" %]
         <div class="hidden" id="acq-[% which_lc %]-info-related">
-            Show the <a name="rel_link" href="#"><span name="related_number"></span> other lineitem(s)</a> related to this bibliographic record.
+            Show the <a name="rel_link" href="#"><span name="related_number"></span> lineitem(s)</a> related to the same bibliographic record.
         </div>
         <div style="margin-top:40px;">
             <h3 id="acq-[% which_lc %]-marc-order-record-label">MARC Order Record</h3>