prevented deletion of tasks with subtasks
This commit is contained in:
@@ -112,6 +112,11 @@ CREATE TABLE IF NOT EXISTS {0} (
|
|||||||
@Override
|
@Override
|
||||||
public void delete(Task task) throws UmbrellaException {
|
public void delete(Task task) throws UmbrellaException {
|
||||||
try {
|
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).where(ID,equal(task.id())).execute(db);
|
||||||
Query.delete().from(TABLE_TASKS_USERS).where(TASK_ID,equal(task.id())).execute(db);
|
Query.delete().from(TABLE_TASKS_USERS).where(TASK_ID,equal(task.id())).execute(db);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ li.task > button{
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.task:hover{
|
li.task{
|
||||||
padding: 15px 0;
|
padding: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.task:hover > button{
|
li.task:hover > button{
|
||||||
|
|||||||
Reference in New Issue
Block a user