TW-1763: Removing the due date of a task with no due date modifies the task

- Thanks to Scott Kostyshak.
This commit is contained in:
Paul Beckingham 2016-02-02 01:03:19 -05:00
parent 4b37fea21f
commit 23ac9895ab
2 changed files with 13 additions and 3 deletions

View file

@ -52,6 +52,8 @@
(thanks to Misty De Meo). (thanks to Misty De Meo).
- TW-1752 cleanup of diag output (thanks to David Patrick). - TW-1752 cleanup of diag output (thanks to David Patrick).
- TW-1756 The columns.t unit test fails two tests after 2300 local. - TW-1756 The columns.t unit test fails two tests after 2300 local.
- TW-1763 Removing the due date of a task with no due date modifies the task
(thanks to Scott Kostyshak).
- Fixed broken build for Cygwin and older GCC (thanks to Richard Boß). - Fixed broken build for Cygwin and older GCC (thanks to Richard Boß).
- The default configuration is now 256-color only. - The default configuration is now 256-color only.
- The 'columns' report now shows whether a column is modifiable or read only. - The 'columns' report now shows whether a column is modifiable or read only.

View file

@ -105,7 +105,7 @@ bool Task::operator== (const Task& other)
if (data.size () != other.data.size ()) if (data.size () != other.data.size ())
return false; return false;
for (auto& i : data) for (const auto& i : data)
if (i.first != "uuid" && if (i.first != "uuid" &&
i.second != other.get (i.first)) i.second != other.get (i.first))
return false; return false;
@ -780,10 +780,12 @@ std::string Task::composeF4 () const
bool first = true; bool first = true;
for (auto it : data) for (auto it : data)
{ {
// Orphans have no type, treat as string.
std::string type = Task::attributes[it.first]; std::string type = Task::attributes[it.first];
if (type == "") if (type == "")
type = "string"; type = "string";
// If there is a value.
if (it.second != "") if (it.second != "")
{ {
ff4 += (first ? "" : " "); ff4 += (first ? "" : " ");
@ -1967,9 +1969,15 @@ void Task::modify (modType type, bool text_required /* = false */)
{ {
// ::composeF4 will skip if the value is blank, but the presence of // ::composeF4 will skip if the value is blank, but the presence of
// the attribute will prevent ::validate from applying defaults. // the attribute will prevent ::validate from applying defaults.
set (name, ""); if ((has (name) && get (name) != "") ||
(name == "due" && context.config.has ("default.due")) ||
(name == "project" && context.config.has ("default.project")))
{
mods = true;
set (name, "");
}
context.debug (label + name + " <-- ''"); context.debug (label + name + " <-- ''");
mods = true;
} }
else else
{ {