Stat Cats (where usr_summary is true) in horizontal patron summary pane. Give pcrud...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Dec 2009 07:48:10 +0000 (07:48 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Dec 2009 07:48:10 +0000 (07:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15173 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/patron/summary.js
Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul

index 520ea51..6ee8c63 100644 (file)
@@ -3181,7 +3181,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="usr" reltype="has_a" key="id" map="" class="au"/>
                </links>
        </class>
-       <class id="actsc" controller="open-ils.cstore" oils_obj:fieldmapper="actor::stat_cat" oils_persist:tablename="actor.stat_cat" reporter:label="User Statistical Category">
+       <class id="actsc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::stat_cat" oils_persist:tablename="actor.stat_cat" reporter:label="User Statistical Category">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.stat_cat_id_seq">
                        <field reporter:label="Entries" name="entries" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Stat Cat ID" name="id" reporter:datatype="id" reporter:selector="name"/>
@@ -3194,6 +3194,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
                        <link field="entries" reltype="has_many" key="stat_cat" map="" class="actsce"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_PATRON_STAT_CAT" context_field="owner"/>
+                <retrieve />
+                <update permission="UPDATE_PATRON_STAT_CAT" context_field="owner"/>
+                <delete permission="DELETE_PATRON_STAT_CAT" context_field="owner"/>
+            </actions>
+        </permacrud>
        </class>
        <class id="msefe" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::series_field_entry" oils_persist:tablename="metabib.series_field_entry" reporter:label="Series Field Entry">
                <fields oils_persist:primary="id" oils_persist:sequence="metabib.series_field_entry_id_seq">
index bc16f85..dd3d0f5 100644 (file)
@@ -92,6 +92,7 @@ const api = {
     'FM_ACPN_DELETE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.delete', 'secure' : false },
     'FM_ACTSC_RETRIEVE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.batch', 'secure' : false },
     'FM_ACTSC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.all', 'secure' : false },
+    'FM_ACTSC_RETRIEVE_VIA_PCRUD' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.actsc.atomic', 'secure' : false },
     'FM_AHRN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_note.create' },
     'FM_AHN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.create' },
     'FM_AHN_RETRIEVE_VIA_AHR' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold' },
index 2ccdbe9..62be648 100644 (file)
@@ -30,7 +30,9 @@ patron.summary.prototype = {
         obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
         var obscure_dob = String( obj.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true';
 
-        JSAN.use('util.functional'); JSAN.use('patron.util'); JSAN.use('util.list'); obj.group_list = new util.list('group_list');
+        JSAN.use('util.functional'); JSAN.use('patron.util'); JSAN.use('util.list'); 
+
+        obj.group_list = new util.list('group_list');
         obj.group_list.init( {
             'columns' : [
                 { 'id' : 'gl_family_name', 'flex' : 1, 
@@ -63,6 +65,23 @@ patron.summary.prototype = {
         $('group_list_actions').appendChild( obj.group_list.render_list_actions() );
         obj.group_list.set_list_actions();
 
+        obj.stat_cat_list = new util.list('stat_cat_list');
+        obj.stat_cat_list.init( {
+            'columns' : [].concat(
+                obj.stat_cat_list.fm_columns( 'actsc', {
+                    'actsc_id' : { 'hidden' : true },
+                    'actsc_opac_visible' : { 'hidden' : true },
+                    'actsc_usr_summary' : { 'hidden' : true }
+                } )
+            ).concat(
+                obj.stat_cat_list.fm_columns( 'actscecm', {
+                    'actscecm_id' : { 'hidden' : true }
+                } )
+            )
+        } );
+        $('stat_cat_list_actions').appendChild( obj.stat_cat_list.render_list_actions() );
+        obj.stat_cat_list.set_list_actions();
+
         JSAN.use('util.controller'); obj.controller = new util.controller();
         obj.controller.init(
             {
@@ -92,6 +111,42 @@ patron.summary.prototype = {
                             }
                         }
                     ],
+                    'stat_cat_tab' : [
+                        ['command'],
+                        function() {
+                            try {
+                                obj.stat_cat_list.clear();
+                                var entries = obj.patron.stat_cat_entries();
+                                for (var i = 0; i < entries.length; i++) {
+                                    var stat_cat = obj.OpenILS.data.hash.my_actsc[ entries[i].stat_cat() ];
+                                    if (!stat_cat) {
+                                        stat_cat = obj.OpenILS.data.hash.actsc[ entries[i].stat_cat() ];
+                                    }
+                                    if (!stat_cat) {
+                                        var robj = obj.network.simple_request('FM_ACTSC_RETRIEVE_VIA_PCRUD',[ ses(), { 'id' : { '=' : entries[i].stat_cat() } }]);
+                                        if (typeof robj == 'object' && typeof robj.ilsevent != 'undefined') {
+                                            obj.OpenILS.data.hash.actsc[ entries[i].stat_cat() ] = robj;
+                                            obj.OpenILS.data.stash( 'hash' );
+                                            stat_cat = robj;
+                                        }
+                                    }
+                                    if (!stat_cat) { continue; }
+                                    if (get_bool( stat_cat.usr_summary() )) {
+                                        obj.stat_cat_list.append( {
+                                            'row' : {
+                                                'my' : {
+                                                    'actsc' : stat_cat,
+                                                    'actscecm' : entries[i],
+                                                }
+                                            }
+                                        } );
+                                    }
+                                }
+                            } catch(E) {
+                                alert('Error in summary.js, stat_cat_tab: ' + E);
+                            }
+                        }
+                    ],
                     'group_tab_retrieve_patron' : [
                         ['command'],
                         function() {
index e4c060c..7bd07ba 100644 (file)
@@ -37,7 +37,7 @@
                 <tab label="&staff.patron_display.tab.account_info.label;" accesskey="&staff.patron_display.tab.account_info.accesskey;"/>
                 <tab label="&staff.patron_display.tab.identification.label;" accesskey="&staff.patron_display.tab.identification.accesskey;"/>
                 <tab id="group_tab" label="&staff.patron_display.tab.group.label;" accesskey="&staff.patron_display.tab.group.accesskey;"/>
-                <tab label="&staff.patron_display.tab.stat_cats.label;" accesskey="&staff.patron_display.tab.stat_cats.accesskey;"/>
+                <tab id="stat_cat_tab" label="&staff.patron_display.tab.stat_cats.label;" accesskey="&staff.patron_display.tab.stat_cats.accesskey;"/>
             </tabs>
             <tabpanels flex="1">
                 <tabpanel><vbox id="account_info" flex="1" /></tabpanel>
                             accesskey="&staff.patron.summary_overlay.group_tab.retrieve_patron.accesskey;" />
                     </hbox>
                 </tabpanel>
-                <tabpanel>
-                    <vbox>
-                    </vbox>
+                <tabpanel orient="vertical">
+                    <tree id="stat_cat_list" flex="1" enableColumnDrag="true" seltype="multiple" />
+                    <hbox>
+                        <hbox id="stat_cat_list_actions" />
+                        <spacer flex="1" />
+                    </hbox>
                 </tabpanel>
                 <tabpanel hidden="true"><grid id="PatronSummaryStatus_grid" flex="1"/></tabpanel>
             </tabpanels>