improving moving around locations
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -250,9 +250,11 @@ public class StockModule extends BaseHandler implements StockService {
|
||||
if (json.has(PARENT_LOCATION_ID) && json.get(PARENT_LOCATION_ID) instanceof Number parentId){
|
||||
if (parentId.longValue() != 0L) {
|
||||
var target = stockDb.loadLocation(parentId.longValue());
|
||||
if (target.id() == location.id()) throw forbidden("Location must not be it`s own parent!");
|
||||
var targetOwner = target.owner().resolve();
|
||||
if (!assigned(targetOwner, user)) throw forbidden("You are not allowed to edit \"{0}\"!", target.name());
|
||||
if (!targetOwner.equals(owner)) throw unprocessable("You may not move locations from one owner ({0}) to another ({1})", owner, targetOwner);
|
||||
LOG.log(WARNING,"Not checking, if location is moved to on of its own children!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user