Fix self-fetching callnumber columns
authorJason Etheridge <jason@esilibrary.com>
Mon, 9 Jan 2012 20:18:15 +0000 (15:18 -0500)
committerBill Erickson <berick@esilibrary.com>
Fri, 20 Jan 2012 21:40:59 +0000 (16:40 -0500)
The callnumber (and related) columns from circ.util.columns() is meant to
retrieve call number objects if given call number id's instead of objects,
but there was a bug preventing that.

This fixes LP#906523, no call number information in billing interface

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/xul/staff_client/server/circ/util.js

index 76ab082..6bc54d2 100644 (file)
@@ -580,7 +580,7 @@ circ.util.columns = function(modify,params) {
                         acn_id = my.acn;
                     }
                 } else if (my.acp) {
-                    if (typeof my.acp.call_number() == 'object') {
+                    if (typeof my.acp.call_number() == 'object' && my.acp.call_number() != null) {
                         acn_id = my.acp.call_number().id();
                     } else {
                         acn_id = my.acp.call_number();
@@ -594,6 +594,9 @@ circ.util.columns = function(modify,params) {
                     return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
                 } else {
                     if (!my.acn) {
+                        if (typeof scratch_data == 'undefined' || scratch_data == null) {
+                            scratch_data = {};
+                        }
                         if (typeof scratch_data['acn_map'] == 'undefined') {
                             scratch_data['acn_map'] = {};
                         }
@@ -646,7 +649,7 @@ circ.util.columns = function(modify,params) {
                         acn_id = my.acn;
                     }
                 } else if (my.acp) {
-                    if (typeof my.acp.call_number() == 'object') {
+                    if (typeof my.acp.call_number() == 'object' && my.acp.call_number() != null) {
                         acn_id = my.acp.call_number().id();
                     } else {
                         acn_id = my.acp.call_number();
@@ -660,6 +663,9 @@ circ.util.columns = function(modify,params) {
                     return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
                 } else {
                     if (!my.acn) {
+                        if (typeof scratch_data == 'undefined' || scratch_data == null) {
+                            scratch_data = {};
+                        }
                         if (typeof scratch_data['acn_map'] == 'undefined') {
                             scratch_data['acn_map'] = {};
                         }
@@ -700,7 +706,7 @@ circ.util.columns = function(modify,params) {
                         acn_id = my.acn;
                     }
                 } else if (my.acp) {
-                    if (typeof my.acp.call_number() == 'object') {
+                    if (typeof my.acp.call_number() == 'object' && my.acp.call_number() != null) {
                         acn_id = my.acp.call_number().id();
                     } else {
                         acn_id = my.acp.call_number();
@@ -714,6 +720,9 @@ circ.util.columns = function(modify,params) {
                     return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
                 } else {
                     if (!my.acn) {
+                        if (typeof scratch_data == 'undefined' || scratch_data == null) {
+                            scratch_data = {};
+                        }
                         if (typeof scratch_data['acn_map'] == 'undefined') {
                             scratch_data['acn_map'] = {};
                         }
@@ -754,7 +763,7 @@ circ.util.columns = function(modify,params) {
                         acn_id = my.acn;
                     }
                 } else if (my.acp) {
-                    if (typeof my.acp.call_number() == 'object') {
+                    if (typeof my.acp.call_number() == 'object' && my.acp.call_number() != null) {
                         acn_id = my.acp.call_number().id();
                     } else {
                         acn_id = my.acp.call_number();
@@ -768,6 +777,9 @@ circ.util.columns = function(modify,params) {
                     return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
                 } else {
                     if (!my.acn) {
+                        if (typeof scratch_data == 'undefined' || scratch_data == null) {
+                            scratch_data = {};
+                        }
                         if (typeof scratch_data['acn_map'] == 'undefined') {
                             scratch_data['acn_map'] = {};
                         }
@@ -2412,7 +2424,7 @@ circ.util.hold_columns = function(modify,params) {
                         acn_id = my.acn;
                     }
                 } else if (my.acp) {
-                    if (typeof my.acp.call_number() == 'object') {
+                    if (typeof my.acp.call_number() == 'object' && my.acp.call_number() != null) {
                         acn_id = my.acp.call_number().id();
                     } else {
                         acn_id = my.acp.call_number();
@@ -2426,6 +2438,9 @@ circ.util.hold_columns = function(modify,params) {
                     return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
                 } else {
                     if (!my.acn) {
+                        if (typeof scratch_data == 'undefined' || scratch_data == null) {
+                            scratch_data = {};
+                        }
                         if (typeof scratch_data['acn_map'] == 'undefined') {
                             scratch_data['acn_map'] = {};
                         }