We were shoving a fieldmapper actor.usr object into hold slip templates as params...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Sep 2010 06:50:02 +0000 (06:50 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Sep 2010 06:50:02 +0000 (06:50 +0000)
So you can add something like this to the hold slip template:

<script>
    var x = params.data.user_stat_cat_entries;
    for (var i = 0; i < x.length; i++) {
        document.write(x[i].stat_cat.name + ' : ' + x[i].stat_cat_entry + '<br/>');
    }
</script>

However, such pig-trickery with inline Javascript only works with the Mozilla Print strategy (where we render HTML and execute Javascript).

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17509 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/circ/util.js

index 380cbed..03a2b13 100644 (file)
@@ -2428,7 +2428,9 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
             'request_date' : '',
             'request_date_msg' : '',
             'slip_date' : '',
-            'slip_date_msg' : ''
+            'slip_date_msg' : '',
+            'user' : '',
+            'user_stat_cat_entries' : ''
         };
 
         if (check.payload && check.payload.cancelled_hold_transit) {
@@ -2531,6 +2533,26 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
                         msg += '\n';
                         var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
                         print_data.user = au_obj;
+                        print_data.user_stat_cat_entries = [];
+                        var entries = au_obj.stat_cat_entries();
+                        for (var i = 0; i < entries.length; i++) {
+                            var stat_cat = data.hash.my_actsc[ entries[i].stat_cat() ];
+                            if (!stat_cat) {
+                                stat_cat = data.lookup('actsc', entries[i].stat_cat());
+                            }
+                            print_data.user_stat_cat_entries.push( { 
+                                'id' : entries[i].id(),
+                                'stat_cat' : {
+                                    'id' : stat_cat.id(),
+                                    'name' : stat_cat.name(),
+                                    'opac_visible' : stat_cat.opac_visible(),
+                                    'owner' : stat_cat.owner(),
+                                    'usr_summary' : stat_cat.usr_summary()
+                                },
+                                'stat_cat_entry' : entries[i].stat_cat_entry(),
+                                'target_usr' : entries[i].target_usr() 
+                            } );
+                        }
                         msg += '\n';
                         if (au_obj.alias()) {
                             print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias',  [au_obj.alias()]);