- Fixed bug that caused entry, end, start and wait dates to not use report-
  specific date format overrides (thanks to Eric Fluger).
This commit is contained in:
Paul Beckingham 2011-01-14 22:12:17 -05:00
parent 47f2758c8f
commit d4772fe060
3 changed files with 31 additions and 5 deletions

View file

@ -228,6 +228,12 @@ int handleCustomReport (const std::string& report, std::string& outs)
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
std::string format = context.config.get ("report." + report + ".dateformat");
if (format == "")
format = context.config.get ("dateformat.report");
if (format == "")
format = context.config.get ("dateformat");
std::string entered;
for (unsigned int row = 0; row < tasks.size(); ++row)
{
@ -235,7 +241,7 @@ int handleCustomReport (const std::string& report, std::string& outs)
if (entered.length ())
{
Date dt (::atoi (entered.c_str ()));
entered = dt.toString (context.config.get ("dateformat"));
entered = dt.toString (format);
context.hooks.trigger ("format-entry", "entry", entered);
table.addCell (row, columnCount, entered);
}
@ -248,6 +254,12 @@ int handleCustomReport (const std::string& report, std::string& outs)
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
std::string format = context.config.get ("report." + report + ".dateformat");
if (format == "")
format = context.config.get ("dateformat.report");
if (format == "")
format = context.config.get ("dateformat");
std::string started;
for (unsigned int row = 0; row < tasks.size(); ++row)
{
@ -255,7 +267,7 @@ int handleCustomReport (const std::string& report, std::string& outs)
if (started.length ())
{
Date dt (::atoi (started.c_str ()));
started = dt.toString (context.config.get ("dateformat"));
started = dt.toString (format);
context.hooks.trigger ("format-start", "start", started);
table.addCell (row, columnCount, started);
}
@ -268,6 +280,12 @@ int handleCustomReport (const std::string& report, std::string& outs)
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
std::string format = context.config.get ("report." + report + ".dateformat");
if (format == "")
format = context.config.get ("dateformat.report");
if (format == "")
format = context.config.get ("dateformat");
std::string ended;
for (unsigned int row = 0; row < tasks.size(); ++row)
{
@ -275,7 +293,7 @@ int handleCustomReport (const std::string& report, std::string& outs)
if (ended.length ())
{
Date dt (::atoi (ended.c_str ()));
ended = dt.toString (context.config.get ("dateformat"));
ended = dt.toString (format);
context.hooks.trigger ("format-end", "end", ended);
table.addCell (row, columnCount, ended);
}
@ -500,6 +518,12 @@ int handleCustomReport (const std::string& report, std::string& outs)
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
std::string format = context.config.get ("report." + report + ".dateformat");
if (format == "")
format = context.config.get ("dateformat.report");
if (format == "")
format = context.config.get ("dateformat");
int row = 0;
std::string wait;
foreach (task, tasks)
@ -508,7 +532,7 @@ int handleCustomReport (const std::string& report, std::string& outs)
if (wait != "")
{
Date dt (::atoi (wait.c_str ()));
wait = dt.toString (context.config.get ("dateformat"));
wait = dt.toString (format);
context.hooks.trigger ("format-wait", "wait", wait);
table.addCell (row++, columnCount, wait);
}