From: pines Date: Wed, 1 Nov 2006 16:02:20 +0000 (+0000) Subject: some titles are Numbers and needed to be cast into Strings. resolves elpdesk ticket... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8d32e1e0b82d873e25beecbe64957747e180ea70;p=evergreen%2Fpines.git some titles are Numbers and needed to be cast into Strings. resolves elpdesk ticket #3970 git-svn-id: svn://svn.open-ils.org/ILS/trunk@6537 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/text.js b/Open-ILS/xul/staff_client/chrome/content/util/text.js index 6556eb29f7..9d5ce34717 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/text.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/text.js @@ -10,17 +10,18 @@ util.text.EXPORT_TAGS = { ':all' : util.text.EXPORT_OK }; util.text.wrap_on_space = function( text, length ) { try { - if (text.length <= length) return [ text, '' ]; - var truncated_text = text.substr(0,length); + if (String(text).length <= length) return [ text, '' ]; + + var truncated_text = String(text).substr(0,length); var pivot_pos = truncated_text.lastIndexOf(' '); - return [ text.substr(0,pivot_pos).replace(/\s*$/,''), text.substr(pivot_pos+1) ]; + return [ text.substr(0,pivot_pos).replace(/\s*$/,''), String(text).substr(pivot_pos+1) ]; } catch(E) { alert('FIXME: util.text.wrap_on_space( "' + text + '", ' + length + ")"); - return [ text.substr(0,length), text.substr(length) ]; + return [ String(text).substr(0,length), String(text).substr(length) ]; } } diff --git a/Open-ILS/xul/staff_client/server/cat/bib_brief.xul b/Open-ILS/xul/staff_client/server/cat/bib_brief.xul index 269cae1886..c658858221 100644 --- a/Open-ILS/xul/staff_client/server/cat/bib_brief.xul +++ b/Open-ILS/xul/staff_client/server/cat/bib_brief.xul @@ -66,7 +66,7 @@ var mods = req.getResultObject(); if (mods.title()) document.getElementById('title').appendChild( - document.createTextNode(mods.title().substr(0,50)) + document.createTextNode(String(mods.title()).substr(0,50)) ); if (mods.author()) document.getElementById('author').appendChild( document.createTextNode(mods.author()) diff --git a/Open-ILS/xul/staff_client/server/patron/bill_details.xul b/Open-ILS/xul/staff_client/server/patron/bill_details.xul index a5e805d8bc..62ebb09b39 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_details.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_details.xul @@ -117,7 +117,7 @@ var r_mvr = rreq.getResultObject(); if (instanceOf(r_mvr,mvr)) { util.widgets.remove_children('title'); - $('title').appendChild( document.createTextNode( r_mvr.title().substr(0,50) ) ); + $('title').appendChild( document.createTextNode( String(r_mvr.title()).substr(0,50) ) ); } else { g.network.simple_request( 'FM_ACP_RETRIEVE', diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.xul b/Open-ILS/xul/staff_client/server/patron/bill_history.xul index d5cdbd409e..e609939548 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.xul @@ -160,7 +160,7 @@ function (rreq) { var r_mvr = rreq.getResultObject(); if (instanceOf(r_mvr,mvr)) { - $('title').appendChild( document.createTextNode( r_mvr.title().substr(0,50) ) ); + $('title').appendChild( document.createTextNode( String(r_mvr.title()).substr(0,50) ) ); } else { g.network.simple_request( 'FM_ACP_RETRIEVE', diff --git a/Open-ILS/xul/staff_client/server/patron/bills.js b/Open-ILS/xul/staff_client/server/patron/bills.js index 58fed9da15..cf107b9407 100644 --- a/Open-ILS/xul/staff_client/server/patron/bills.js +++ b/Open-ILS/xul/staff_client/server/patron/bills.js @@ -828,7 +828,7 @@ patron.bills.prototype = { function (rreq) { var r_mvr = rreq.getResultObject(); if (instanceOf(r_mvr,mvr)) { - xt_value.appendChild( document.createTextNode( r_mvr.title().substr(0,50) ) ); + xt_value.appendChild( document.createTextNode( String( r_mvr.title() ).substr(0,50) ) ); obj.bill_map[ my.mobts.id() ].title = r_mvr.title(); } }