prevented deletion of tasks with subtasks
This commit is contained in:
@@ -112,6 +112,11 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
@Override
|
||||
public void delete(Task task) throws UmbrellaException {
|
||||
try {
|
||||
var rs = select("count(*)").from(TABLE_TASKS).where(PARENT_TASK_ID,equal(task.id())).exec(db);
|
||||
long count = 0;
|
||||
if (rs.next()) count = rs.getLong(1);
|
||||
rs.close();
|
||||
if (count>0) throw new UmbrellaException("Task \"{0}\" has child tasks and thus cannot be deleted!",task.name());
|
||||
Query.delete().from(TABLE_TASKS).where(ID,equal(task.id())).execute(db);
|
||||
Query.delete().from(TABLE_TASKS_USERS).where(TASK_ID,equal(task.id())).execute(db);
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -132,8 +132,8 @@ li.task > button{
|
||||
display: none;
|
||||
}
|
||||
|
||||
li.task:hover{
|
||||
padding: 15px 0;
|
||||
li.task{
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
li.task:hover > button{
|
||||
|
||||
Reference in New Issue
Block a user