From fc8f8957c4813329e96b79fe43eacc746f54ac42 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 4 Aug 2009 16:26:23 -0600 Subject: [PATCH] Bug Fix - recurring task with no due date - A recurring task may not be added without a due date. Previously, this restriction only applied to modified tasks. --- ChangeLog | 1 + src/command.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index febd1aa08..3524f7dc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ Federico Hernandez). + Fixed bug #242 that sometimes causes the ID echoed after a task is added to be incorrect (thanks to John Florian). + + Fixed bug that allowed a recurring task to be added without a due date. ------ old releases ------------------------------ diff --git a/src/command.cpp b/src/command.cpp index 6432eafb7..a08503522 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -84,6 +84,15 @@ std::string handleAdd () foreach (tag, context.tagAdditions) context.task.addTag (*tag); + // Perform some logical consistency checks. + if (context.task.has ("recur") && + !context.task.has ("due")) + throw std::string ("You cannot specify a recurring task without a due date."); + + if (context.task.has ("until") && + !context.task.has ("recur")) + throw std::string ("You cannot specify an until date for a non-recurring task."); + // Only valid tasks can be added. context.task.validate ();