make %PATRON_BARCODE% macro work for checkout receipts
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 13 Sep 2006 20:26:29 +0000 (20:26 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 13 Sep 2006 20:26:29 +0000 (20:26 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6084 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/print.js
Open-ILS/xul/staff_client/server/circ/checkout.js

index 769660c..b8231f1 100644 (file)
@@ -209,7 +209,7 @@ util.print.prototype = {
                        catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
                try{b = s; s = s.replace(/%PATRON_LASTNAME%/,params.patron.family_name());}
                        catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
-               try{b = s; s = s.replace(/%PATRON_BARCODE%/,params.patron.card().barcode());}
+               try{b = s; s = s.replace(/%PATRON_BARCODE%/,typeof params.patron.card() == 'object' ? params.patron.card().barcode() : util.functional.find_id_object_in_list( params.patron.cards(), params.patron.card() ).barcode() ) ;}
                        catch(E){s = b; this.error.sdump('D_WARN','string = <' + s + '> error = ' + js2JSON(E)+'\n');}
 
                try{b = s; s=s.replace(/%TODAY%/g,(new Date()));}
index f51993d..e7ca7ea 100644 (file)
@@ -15,7 +15,6 @@ circ.checkout.prototype = {
                var obj = this;
 
                obj.patron_id = params['patron_id'];
-               obj.patron = obj.network.simple_request('FM_AU_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
 
                JSAN.use('circ.util');
                var columns = circ.util.columns( 
@@ -247,6 +246,7 @@ circ.checkout.prototype = {
        'print' : function(silent,f) {
                var obj = this;
                try {
+                       obj.patron = obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
                        dump( js2JSON( obj.list.dump_with_keys() ) + '\n' );
                        obj.list.on_all_fleshed = function() {
                                try {