Related to bug #649

- You can no longer directly complete or delete parent recurring tasks.
This commit is contained in:
Paul Beckingham 2011-02-12 15:30:05 -05:00
parent 6608cbf287
commit f93273ef23
2 changed files with 77 additions and 64 deletions

View file

@ -1572,6 +1572,9 @@ int handleDelete (std::string& outs)
sprintf (endTime, "%u", (unsigned int) time (NULL));
foreach (task, tasks)
{
if (task->getStatus () == Task::pending ||
task->getStatus () == Task::waiting)
{
if (context.hooks.trigger ("pre-delete", *task))
{
@ -1670,6 +1673,16 @@ int handleDelete (std::string& outs)
context.hooks.trigger ("post-delete", *task);
}
}
else
{
out << "Task "
<< task->id
<< " '"
<< task->get ("description")
<< "' is neither pending nor waiting.\n";
rc = 1;
}
}
context.tdb.commit ();
context.tdb.unlock ();

View file

@ -47,7 +47,7 @@ qx{../src/task rc:bug.rc add Test due:3d rec:1w};
# Result: Immediately delete the created task
my $output = qx{../src/task rc:bug.rc done 1};
like ($output, qr/Completed/ms, 'New recurring task can be immediately deleted.');
unlike ($output, qr/Completed/ms, 'New recurring task cannot be immediately completed.');
# Cleanup.
unlink 'pending.data';