* безопастности либо произошла ошибка *
*/
@Override
public int setExpenditure(ExpenditureDetails details) throws ClipsServerException {
checkCommandAccessibility(COMMAND_WRITE_EXPENDITURE);
ExpenditureDefault exp = null;
if(details.id != 0) {
exp = findEntity(ExpenditureDefault.class, details.id);
if(details.parentID != exp.getService().getId()) {
throw new EDataIntegrity("Подмена услуги запрещена");
}
} else {
exp = new ExpenditureDefault();
exp.setService(findEntity(Service.class, details.parentID));
}
exp.setQuantity(details.quantity);
exp.setType(findEntity(ExpenditureType.class, details.expenTypeID));
return saveEntity(exp);
}