rework the parameters for circ.util.renew_via_barcode so that we can more easily...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Oct 2009 15:55:32 +0000 (15:55 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Oct 2009 15:55:32 +0000 (15:55 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14535 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/circ/checkout.js
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/circ/renew.js
Open-ILS/xul/staff_client/server/circ/util.js
Open-ILS/xul/staff_client/server/patron/items.js

index 20100f3..e695a4d 100644 (file)
@@ -873,7 +873,7 @@ circ.checkout.prototype = {
                                     }
                                 } else { // EITHER AUTO-RENEW OR OFFER CANCEL, NORMAL CHECKIN, AND RENEW
                                     if (payload.auto_renew) {
-                                        circ.util.renew_via_barcode( params.barcode, obj.patron_id, function(r) {
+                                        circ.util.renew_via_barcode( { 'barcode': params.barcode, 'patron' : obj.patron_id }, function(r) {
                                             try {
                                                 params.renewal = true;
                                                 obj._checkout( params, r[0] ); 
@@ -897,7 +897,7 @@ circ.checkout.prototype = {
                                                 obj.checkout(params);
                                             break;
                                             case 2:
-                                                circ.util.renew_via_barcode( params.barcode, obj.patron_id, function(r) {
+                                                circ.util.renew_via_barcode( { 'barcode' : params.barcode, 'patron' : obj.patron_id }, function(r) {
                                                     try {
                                                         params.renewal = true;
                                                         obj._checkout( params, r[0] ); 
index 53fc641..c7c7dd6 100644 (file)
@@ -268,7 +268,7 @@ circ.copy_status.prototype = {
                                                                var test = obj.selection_list[i].renewable;
                                                                var barcode = obj.selection_list[i].barcode;
                                                                if (test == 't') {
-                                                                       circ.util.renew_via_barcode( barcode );
+                                                                       circ.util.renew_via_barcode( { 'barcode' : barcode } );
                                                                        funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
                                                                } else {
                                                                        alert(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.sel_renew.not_circulating', [barcode]));
index cac53e2..2d48dc9 100644 (file)
@@ -261,8 +261,7 @@ circ.renew.prototype = {
                        if (auto_print) auto_print = auto_print.checked;
                        JSAN.use('circ.util');
                        var renew = circ.util.renew_via_barcode(
-                barcode,
-                null,
+                { 'barcode' : barcode, 'return_patron' : true },
                 function( r ) {
                     obj.renew_followup( r, barcode );
                 }
index 3f99b40..deee41d 100644 (file)
@@ -2877,15 +2877,12 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
        }
 };
 
-circ.util.renew_via_barcode = function ( barcode, patron_id, async ) {
+circ.util.renew_via_barcode = function ( params, async ) {
        try {
                var obj = {};
                JSAN.use('util.network'); obj.network = new util.network();
                JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.stash_retrieve();
 
-               var params = { barcode: barcode };
-               if (patron_id) params.patron = patron_id;
-
                function renew_callback(req) {
                        try {
                        JSAN.use('util.error'); var error = new util.error();
@@ -2938,7 +2935,7 @@ circ.util.renew_via_barcode = function ( barcode, patron_id, async ) {
                                return renew;
                        } catch(E) {
                                JSAN.use('util.error'); var error = new util.error();
-                               error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [barcode]), E);
+                               error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E);
                                return null;
                        }
                }
@@ -2968,31 +2965,31 @@ circ.util.renew_via_barcode = function ( barcode, patron_id, async ) {
                                        7013 /* PATRON_EXCEEDS_FINES */,
                                ],
                                'text' : {
-                                       '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
-                                       '1213' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
-                                       '1215' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
+                                       '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+                                       '1213' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+                                       '1215' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
                     '1232' : function(r) {
-                        return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_deposit_required.warning.barcode', [barcode]);
+                        return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_deposit_required.warning.barcode', [params.barcode]);
                     },
                     '1233' : function(r) {
-                        return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_rental_fee_required.warning.barcode', [barcode]);
+                        return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_rental_fee_required.warning.barcode', [params.barcode]);
                     },
                                        '1234' : function(r) {
                                                return document.getElementById('circStrings').getFormattedString('staff.circ.utils.checkin.override.item_deposit_paid.warning');
                                        },
-                                       '7002' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
-                                       '7003' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
+                                       '7002' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+                                       '7003' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
                                        '7004' : function(r) {
-                                               return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.status', [barcode, typeof r.payload.status() == 'object' ? r.payload.status().name() : obj.data.hash.ccs[ r.payload.status() ].name()]);
+                                               return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.status', [params.barcode, typeof r.payload.status() == 'object' ? r.payload.status().name() : obj.data.hash.ccs[ r.payload.status() ].name()]);
                                        },
-                                       '7006' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
-                                       '7007' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
-                                       '7008' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
-                                       '7009' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); },
+                                       '7006' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+                                       '7007' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+                                       '7008' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+                                       '7009' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
                                        '7010' : function(r) {
-                                               return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.msg', [barcode, r.payload]);
+                                               return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.msg', [params.barcode, r.payload]);
                                        },
-                                       '7013' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }
+                                       '7013' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }
                                }
                        }
                );
@@ -3002,7 +2999,7 @@ circ.util.renew_via_barcode = function ( barcode, patron_id, async ) {
 
        } catch(E) {
                JSAN.use('util.error'); var error = new util.error();
-               error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [barcode]), E);
+               error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E);
                return null;
        }
 };
index 2f282c3..9e6d21a 100644 (file)
@@ -275,7 +275,7 @@ patron.items.prototype = {
                                        l.setAttribute('value', $("patronStrings").getFormattedString('staff.patron.items.items_renew.renewing',[bc]));
                                        x.appendChild(l);
                                }
-                               var renew = circ.util.renew_via_barcode( bc, obj.patron_id, 
+                               var renew = circ.util.renew_via_barcode( { 'barcode' : bc, 'patron' : obj.patron_id },
                                        function(r) {
                         try {
                             if ( (typeof r[0].ilsevent != 'undefined' && r[0].ilsevent == 0) ) {