From b1bf664dcda65d91199305af15cf36b04c36d9d8 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 17 Jun 2010 03:58:39 +0000 Subject: [PATCH] more column id collisions and code to rename such id's if they slip through in the future git-svn-id: svn://svn.open-ils.org/ILS/trunk@16741 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/chrome/content/util/list.js | 17 ++++++++++++++++- Open-ILS/xul/staff_client/server/patron/bill2.js | 2 +- Open-ILS/xul/staff_client/server/patron/util.js | 8 ++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index 8f3c9b0d7f..421139c43d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -75,10 +75,25 @@ util.list.prototype = { this.node.appendChild(treecols); this.treecols = treecols; + var check_for_id_collisions = {}; for (var i = 0; i < this.columns.length; i++) { var treecol = document.createElement('treecol'); for (var j in this.columns[i]) { - treecol.setAttribute(j,this.columns[i][j]); + var value = this.columns[i][j]; + if (j=='id') { + if (typeof check_for_id_collisions[value] == 'undefined') { + check_for_id_collisions[value] = true; + } else { + // Column id's are important for sorting and saving list configuration. Collisions started happening because + // we were using field names as id's, and then later combining column definitions for multiple objects that + // shared field names. The downside to this sort of automatic collision prevention is that these generated + // id's can change as we add and remove columns, possibly breaking saved list configurations. + dump('Column collision with id = ' + value + ', renaming to '); + value = value + '_collision_' + i; + dump(value + '\n'); + } + } + treecol.setAttribute(j,value); } treecols.appendChild(treecol); if (this.columns[i].type == 'checkbox') { diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index 7520e641c6..3cd9864499 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -424,7 +424,7 @@ function init_lists() { } ].concat( patron.util.mbts_columns({ - 'xact_finish' : { 'hidden' : xul_param('current') ? true : false } + 'mbts_xact_finish' : { 'hidden' : xul_param('current') ? true : false } } ).concat( circ.util.columns({ diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index c757ba0bfd..805818f51b 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -72,12 +72,12 @@ patron.util.mbts_columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_payment_ts(), "%{localized}" ); } }, { - 'persist' : 'hidden width ordinal', 'id' : 'xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1, + 'persist' : 'hidden width ordinal', 'id' : 'mbts_xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_start() ? util.date.formatted_date( my.mbts.xact_start(), "%{localized}" ) : ""; } }, { - 'persist' : 'hidden width ordinal', 'id' : 'xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1, + 'persist' : 'hidden width ordinal', 'id' : 'mbts_xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_finish() ? util.date.formatted_date( my.mbts.xact_finish(), "%{localized}" ) : ""; } }, @@ -423,7 +423,7 @@ patron.util.columns = function(modify,params) { 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.suffix(); } }, { - 'persist' : 'hidden width ordinal', 'id' : 'alert_message', 'label' : commonStrings.getString('staff.au_alert_message_label'), 'flex' : 1, + 'persist' : 'hidden width ordinal', 'id' : 'au_alert_message', 'label' : commonStrings.getString('staff.au_alert_message_label'), 'flex' : 1, 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.alert_message(); } }, { @@ -432,7 +432,7 @@ patron.util.columns = function(modify,params) { 'sort_type' : 'number' }, { - 'persist' : 'hidden width ordinal', 'id' : 'create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1, + 'persist' : 'hidden width ordinal', 'id' : 'au_create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.create_date(), "%{localized}" ); } }, -- 2.11.0