diff --git a/ChangeLog b/ChangeLog index 732e88db1..b350f1a05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,8 @@ Features with 'dateformat.info'. Bugs + + Applied patch for bug #919, so the holidays listed on the 'calendar' report + are sorted (thanks to Jörg Plate). + Fixed bug #954, which caused bulk deletions when using a UUID filter term and the delete command (thanks to Bryce Harrington). + Fixed bug #959, which forces use of dateformat for annotations when using the diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index ea8a351a9..f9987e1a7 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -361,6 +361,7 @@ int CmdCalendar::execute (std::string& output) holTable.add (Column::factory ("string", STRING_CMD_CAL_LABEL_HOL)); std::vector ::iterator it; + std::map hm; for (it = holidays.begin (); it != holidays.end (); ++it) if (it->substr (0, 8) == "holiday.") if (it->substr (it->size () - 4) == "name") @@ -371,20 +372,27 @@ int CmdCalendar::execute (std::string& output) if (date_after < hDate && hDate < date_before) { - std::string format = context.config.get ("report." + - context.config.get ("calendar.details.report") + - ".dateformat"); - if (format == "") - format = context.config.get ("dateformat.report"); - if (format == "") - format = context.config.get ("dateformat"); - - int row = holTable.addRow (); - holTable.set (row, 0, hDate.toString (format)); - holTable.set (row, 1, holName); + hm[hDate.toEpoch()] = holName; } } + std::string format = context.config.get ("report." + + context.config.get ("calendar.details.report") + + ".dateformat"); + if (format == "") + format = context.config.get ("dateformat.report"); + if (format == "") + format = context.config.get ("dateformat"); + + std::map ::iterator hm_it; + for (hm_it = hm.begin(); hm_it != hm.end(); ++hm_it) + { + int row = holTable.addRow (); + Date hDate (hm_it->first); + holTable.set (row, 0, hDate.toString (format)); + holTable.set (row, 1, hm_it->second); + } + out << optionalBlankLine () << holTable.render () << "\n";