Add restriction to prevent remove all the lines in a personal expense sheet
A personal expense sheet is bound to a resource, and the resource is specified in the lines. So, if user removes all the lines we'll be losing that relationship. FEA: ItEr76S28UserDashboard
This commit is contained in:
parent
1649e83479
commit
290c7dfb5b
1 changed files with 9 additions and 0 deletions
|
|
@ -232,4 +232,13 @@ public class ExpenseSheet extends IntegrationEntity implements IHumanIdentifiabl
|
|||
return !personal;
|
||||
}
|
||||
|
||||
@AssertTrue(message = "a personal expenses must have at least one line")
|
||||
public boolean checkConstraintPersonalExpenseMustHaveAtLeastOneLine() {
|
||||
if (!personal) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !expenseSheetLines.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue