From: Mike Rylander Date: Thu, 20 Jul 2017 21:52:38 +0000 (-0400) Subject: LP#1705524: Use the new grid configuration for date format in the bills list X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=eac6f6fa265c7b8e04808d012aef562d3b15855d;p=working%2FEvergreen.git LP#1705524: Use the new grid configuration for date format in the bills list The bills list in the patron interface predated any grid date formatting, so we bring it into the modern world. This also enhances the grid autoformatting for dates to support both flattened and dot-pathed item layout. Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 index 7d71951570..e0baf9fbee 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 @@ -85,9 +85,7 @@ - + diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 3b8ae904b3..0b9963d43a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -1855,6 +1855,15 @@ angular.module('egGridMod', * Others likely to follow... */ .filter('egGridValueFilter', ['$filter','egCore', function($filter,egCore) { + function traversePath(obj,path) { + var list = path.split('.'); + for (var part in path) { + if (obj[path]) obj = obj[path] + else return undef; + } + return obj; + } + var GVF = function(value, column, item) { switch(column.datatype) { case 'bool': @@ -1876,10 +1885,16 @@ angular.module('egGridMod', ? item[column.dateonlyinterval]() : item[column.dateonlyinterval]; + if (column.dateonlyinterval && !interval) // try it as a dotted path + interval = traversePath(item, column.dateonlyinterval); + var context = angular.isFunction(item[column.datecontext]) ? item[column.datecontext]() : item[column.datecontext]; + if (column.datecontext && !context) // try it as a dotted path + context = traversePath(item, column.datecontext); + var date_filter = column.datefilter || 'egOrgDateInContext'; return $filter(date_filter)(value, column.dateformat, context, interval);