[open-ils-commits] r18531 - in branches/rel_2_0/Open-ILS: web/css/skin/default web/js/ui/default/serial web/templates/default/serial web/templates/default/serial/subscription xul/staff_client/server/serial (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 28 14:20:33 EDT 2010


Author: senator
Date: 2010-10-28 14:20:29 -0400 (Thu, 28 Oct 2010)
New Revision: 18531

Modified:
   branches/rel_2_0/Open-ILS/web/css/skin/default/serial.css
   branches/rel_2_0/Open-ILS/web/js/ui/default/serial/subscription.js
   branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription.tt2
   branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription/distribution.tt2
   branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/batch_receive.js
Log:
Backport r18530 from trunk: misc alt serials UI minor improvements, tweaks


Modified: branches/rel_2_0/Open-ILS/web/css/skin/default/serial.css
===================================================================
--- branches/rel_2_0/Open-ILS/web/css/skin/default/serial.css	2010-10-28 18:14:06 UTC (rev 18530)
+++ branches/rel_2_0/Open-ILS/web/css/skin/default/serial.css	2010-10-28 18:20:29 UTC (rev 18531)
@@ -1,5 +1,5 @@
 .oils-serial-header { margin-bottom: 20px; }
-.oils-serial-tab-container { height: 600px; }
+.oils-serial-tab-container { height: 700px; }
 .lesser { margin-top: 2px !important }
 .lesser div:first-child { font-size: 110% !important; }
 .lesser div:last-child { margin-right: 16px; }

Modified: branches/rel_2_0/Open-ILS/web/js/ui/default/serial/subscription.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/default/serial/subscription.js	2010-10-28 18:14:06 UTC (rev 18530)
+++ branches/rel_2_0/Open-ILS/web/js/ui/default/serial/subscription.js	2010-10-28 18:20:29 UTC (rev 18531)
@@ -33,15 +33,18 @@
 function load_sub_grid(id, oncomplete) {
     if (!pcrud) return; /* first run, onLoad hasn't fired yet */
     if (!sub_grid._fresh) {
+        var dist_ids = pcrud.search(
+            "sdist", {"subscription": id}, {"id_list": true}
+        );
         pcrud.retrieve(
             "ssub", id, {
                 "onresponse": function(r) {
                     if (r = openils.Util.readResponse(r)) {
                         sub = r;
+                        var data = ssub.toStoreData([r]);
+                        data.items[0].num_dist = dist_ids ? dist_ids.length : 0;
                         sub_grid.setStore(
-                            new dojo.data.ItemFileReadStore(
-                                {"data": ssub.toStoreData([r])}
-                            )
+                            new dojo.data.ItemFileReadStore({"data": data})
                         );
                         sub_grid._fresh = true;
                     }

Modified: branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription/distribution.tt2
===================================================================
--- branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription/distribution.tt2	2010-10-28 18:14:06 UTC (rev 18530)
+++ branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription/distribution.tt2	2010-10-28 18:20:29 UTC (rev 18531)
@@ -5,27 +5,30 @@
         <span dojoType="dijit.form.Button"
             onClick="dist_grid.refresh();">Refresh Grid</span>
         <span dojoType="dijit.form.Button"
-            onClick="dist_grid.showCreateDialog();">New Distribution</span>
+            onClick="sub_grid._fresh = false; dist_grid.showCreateDialog();">
+            New Distribution
+        </span>
         <span dojoType="dijit.form.Button"
-            onClick="dist_grid.deleteSelected();">Delete Selected</span>
+            onClick="sub_grid._fresh = false; dist_grid.deleteSelected();">
+            Delete Selected
+        </span>
     </div>
 </div>
 <div dojoType="dijit.layout.ContentPane" layout="top">
     <table
         jsId="dist_grid"
         dojoType="openils.widget.AutoGrid"
-        autoHeight="true"
+        style="height: 550px;"
         fieldOrder="['subscription','label','holding_lib']"
         suppressFields="['record_entry','subscription','receive_call_number','bind_call_number','bind_unit_template']"
         suppressEditFields="['record_entry','receive_call_number','bind_call_number','bind_unit_template']"
-        defaultCellWidth="'auto'"
         fmClass="sdist"
         query="{id: '*'}"
         editOnEnter="true"
         showPaginator="true">
         <thead>
             <tr>
-                <th field="label"
+                <th field="label" width="35%"
                     get="get_sdist" formatter="format_sdist_label"></th>
             </tr>
         </thead>

Modified: branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription.tt2
===================================================================
--- branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription.tt2	2010-10-28 18:14:06 UTC (rev 18530)
+++ branches/rel_2_0/Open-ILS/web/templates/default/serial/subscription.tt2	2010-10-28 18:20:29 UTC (rev 18531)
@@ -45,6 +45,7 @@
                         Bibliographic Record
                     </th>
                     <th field="expected_date_offset">Expected Date Offset</th>
+                    <th field="num_dist">Number of Distributions</th>
                 </tr>
             </thead>
         </table>

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/batch_receive.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/batch_receive.js	2010-10-28 18:14:06 UTC (rev 18530)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/serial/batch_receive.js	2010-10-28 18:20:29 UTC (rev 18531)
@@ -55,6 +55,7 @@
         this._call_number_cache = null;
         this._prepared_call_number_controls = {};
         this._location_by_lib = {};
+        this._copy_template_cache = {};
 
         /* empty the entry receiving table if we're starting over */
         if (this.item_cache) {
@@ -209,6 +210,7 @@
             dojo.query("menupopup", control)[0],
             "first"
         );
+        control.value = -1;
         return control;
     };
 
@@ -379,10 +381,18 @@
 
         var node = dojo.query("*", node_by_name(field, row))[0];
 
-        if (typeof(value) == "undefined")
+        if (typeof(value) == "undefined") {
             return node.value;
-        else
+        } else {
+            /* XXX The new two lines /should/ each do the same thing, but
+             * apparently they don't.  With only one or the other, I get
+             * skipped fields when this is called by the code that
+             * pre-populates fields based on copy templates.  This may
+             * have something to do with Dojo and XUL not getting along
+             * completely? */
+            dojo.attr(node, "value", value);
             node.value = value;
+        }
     }
 
 	this._user_wants_autogen = function() {
@@ -649,6 +659,53 @@
 
     };
 
+    this._update_copy_template_cache = function() {
+        var templates_needed = openils.Util.uniqueElements(
+            openils.Util.objectProperties(this.item_cache).map(
+                function(id) {
+                    return self.item_cache[id].stream().distribution().
+                        receive_unit_template();
+                }
+            )
+        ).filter(
+            function(id) { return !self._copy_template_cache[id]; }
+        );
+
+        if (templates_needed.length) {
+            this.pcrud.search("act", {"id": templates_needed}).forEach(
+                function(tmpl) {
+                    self._copy_template_cache[tmpl.id()] = tmpl;
+                }
+            );
+        }
+    }
+
+    this.apply_copy_templates = function() {
+        this._update_copy_template_cache(); /* sync */
+
+        for (var id in this.item_cache) {
+            var item = this.item_cache[id];
+            var template_id =
+                item.stream().distribution().receive_unit_template();
+            var template = this._copy_template_cache[template_id];
+
+            var row = this.rows[id];
+
+            var tmpl_mod = template.circ_modifier();
+            var tmpl_loc = template.location();
+            var tmpl_price = template.price();
+            if (tmpl_mod != null) {
+                this._row_field_value(
+                    row, "circ_modifier", tmpl_mod == "" ? 0 : tmpl_mod
+                );
+            }
+            if (tmpl_loc)
+                this._row_field_value(row, "location", tmpl_loc);
+            if (tmpl_price > 0)
+                this._row_field_value(row, "price", tmpl_price);
+        }
+    };
+
     this.load_entry_form = function(issuance) {
         if (typeof(issuance) == "undefined") {
             var issuance_id = dojo.byId("issuance_chooser").value;
@@ -673,7 +730,6 @@
                     busy(false);
 
                     if (list = openils.Util.readResponse(r, false, true)) {
-
                         if (list.length) {
                             busy(true);
                             show("form_holder");
@@ -681,8 +737,13 @@
                             list.forEach(function(o) {self.add_entry_row(o);});
 
                             self.build_batch_entry_row();
-                            dojo.byId("batch_receive_with_units").doCommand();
 
+                            var recv_with_units =
+                                dojo.byId("batch_receive_with_units");
+                            recv_with_units.doCommand();
+                            if (recv_with_units.checked)
+                                self.apply_copy_templates();
+
                             show("batch_receive_entry");
                             busy(false);
                         } else {



More information about the open-ils-commits mailing list