retrieve and cache asset.call_number_class
authorJason Etheridge <jason@esilibrary.com>
Mon, 7 Mar 2011 11:42:45 +0000 (06:42 -0500)
committerJason Etheridge <jason@esilibrary.com>
Mon, 7 Mar 2011 11:42:45 +0000 (06:42 -0500)
Open-ILS/examples/fm_IDL.xml
Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js

index 7077fe2..b3a5847 100644 (file)
@@ -1724,13 +1724,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             </actions>
         </permacrud>
        </class>
-    <class id="acnc" controller="open-ils.cstore" oils_obj:fieldmapper="asset::call_number_class" oils_persist:tablename="asset.call_number_class" reporter:label="Call number classification scheme">
+    <class id="acnc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::call_number_class" oils_persist:tablename="asset.call_number_class" reporter:label="Call number classification scheme">
         <fields oils_persist:primary="id" oils_persist:sequence="asset.call_number_class_id_seq">
             <field reporter:label="Call number class ID" name="id" reporter_datatype="id"/>
             <field reporter:label="Name" name="name" reporter:datatype="text"/>
             <field reporter:label="Normalizer function" name="normalizer" reporter:datatype="text"/>
             <field reporter:label="Call number fields" name="field" reporter:datatype="text"/>
         </fields>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve/>
+            </actions>
+        </permacrud>
     </class>
        <class id="acns" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::call_number_suffix" oils_persist:tablename="asset.call_number_suffix" reporter:label="Call Number/Volume Suffix">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.call_number_suffix_id_seq">
index f637bad..202024e 100644 (file)
@@ -595,6 +595,27 @@ OpenILS.data.prototype = {
         this.chain.push(
             function() {
                 var f = gen_fm_retrieval_func(
+                    'acnc',
+                    [
+                        api.FM_ACNC_RETRIEVE_VIA_PCRUD.app,
+                        api.FM_ACNC_RETRIEVE_VIA_PCRUD.method,
+                        [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"acnc":"name"}} ],
+                        false
+                    ]
+                );
+                try {
+                    f();
+                } catch(E) {
+                    var error = 'Error: ' + js2JSON(E);
+                    obj.error.sdump('D_ERROR',error);
+                    throw(E);
+                }
+            }
+        );
+
+        this.chain.push(
+            function() {
+                var f = gen_fm_retrieval_func(
                     'ahrcc',
                     [
                         api.FM_AHRCC_PCRUD_SEARCH.app,
index b2c7f8e..7ab5b6d 100644 (file)
@@ -88,6 +88,7 @@ var api = {
     'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy_tree.retrieve.authoritative', 'secure' : false },
     'FM_ACN_TRANSFER' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.batch.transfer' },
     'FM_ACN_FIND_OR_CREATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.call_number.find_or_create', 'secure' : false },
+    'FM_ACNC_RETRIEVE_VIA_PCRUD' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.acnc.atomic', 'secure' : false },
     'FM_ACP_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve' },
     'FM_ACP_DETAILS_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve.barcode' },
     'FM_ACP_DETAILS_VIA_BARCODE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve.barcode.authoritative' },
index 1d8db50..76efb96 100644 (file)
@@ -75,11 +75,12 @@ function my_init() {
 
         // Get the default callnumber classification scheme from OU settings
         dojo.require('fieldmapper.OrgUtils');
-        var label_class = g.data.hash.aous['cat.default_classification_scheme']; //fieldmapper.aou.fetchOrgSettingDefault(ses('ws_ou'), 'cat.default_classification_scheme');
+        //fieldmapper.aou.fetchOrgSettingDefault(ses('ws_ou'), 'cat.default_classification_scheme');
+        g.label_class = g.data.hash.aous['cat.default_classification_scheme'];
 
         // Assign a default value if none was returned
-        if (!label_class) {
-            label_class = 1;
+        if (!g.label_class) {
+            g.label_class = g.data.list.acnc[0].id();
         }
 
         /***********************************************************************************************************/
@@ -133,7 +134,7 @@ function my_init() {
         /***********************************************************************************************************/
         /* For the call number drop down */
 
-        g.list_callnumbers(g.doc_id, label_class);
+        g.list_callnumbers(g.doc_id, g.label_class);
 
         /***********************************************************************************************************/
         /* render the orgs and volumes/input */