[open-ils-commits] r16741 - in trunk/Open-ILS/xul/staff_client: chrome/content/util server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jun 16 23:58:42 EDT 2010
Author: phasefx
Date: 2010-06-16 23:58:39 -0400 (Wed, 16 Jun 2010)
New Revision: 16741
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
trunk/Open-ILS/xul/staff_client/server/patron/util.js
Log:
more column id collisions and code to rename such id's if they slip through in the future
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js 2010-06-17 03:39:22 UTC (rev 16740)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js 2010-06-17 03:58:39 UTC (rev 16741)
@@ -75,10 +75,25 @@
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') {
Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.js 2010-06-17 03:39:22 UTC (rev 16740)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.js 2010-06-17 03:58:39 UTC (rev 16741)
@@ -424,7 +424,7 @@
}
].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({
Modified: trunk/Open-ILS/xul/staff_client/server/patron/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/util.js 2010-06-17 03:39:22 UTC (rev 16740)
+++ trunk/Open-ILS/xul/staff_client/server/patron/util.js 2010-06-17 03:58:39 UTC (rev 16741)
@@ -72,12 +72,12 @@
'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 @@
'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 @@
'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}" ); }
},
More information about the open-ils-commits
mailing list