if (parameterMap.get("actionAdd") != null && "reverse".equals(parameterMap.get("actionAdd")[0])) { if (entity.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_reverse_reversed::" + pAddParam.get("user"));
/** * <p>Process entity request.</p> * @param pAddParam additional param, e.g. return this line's * document in "nextEntity" for farther process * @param pRequestData Request Data * @param pEntity Entity to process * @return Entity processed for farther process or null * @throws Exception - an exception **/ @Override public final BeginningInventoryLine process( final Map<String, Object> pAddParam, final BeginningInventoryLine pEntityPb, final IRequestData pRequestData) throws Exception { BeginningInventoryLine entity = this.prcAccEntityPbCopy .process(pAddParam, pEntityPb, pRequestData); if (entity.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_reverse_reversed"); } entity.setReversedId(pEntityPb.getItsId()); entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setItsTotal(entity.getItsTotal().negate()); return entity; }
if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() <= 0 && pEntity.getReversedId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "quantity_less_or_equal_zero::" + pAddParam.get("user")); .lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings(pAddParam).getRoundingMode())); if (pEntity.getReversedId() != null) { pEntity.setTheRest(BigDecimal.ZERO); if (pEntity.getReversedId() != null) { BeginningInventoryLine reversed = getSrvOrm().retrieveEntityById( pAddParam, BeginningInventoryLine.class, pEntity.getReversedId()); if (reversed.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_reverse_reversed");
if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() <= 0 && pEntity.getReversedId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "quantity_less_or_equal_zero::" + pAddParam.get("user")); .lazyGetAccSettings().getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); if (pEntity.getReversedId() != null) { pEntity.setTheRest(BigDecimal.ZERO); if (pEntity.getReversedId() != null) { BeginningInventoryLine reversed = getSrvOrm().retrieveEntityById( BeginningInventoryLine.class, pEntity.getReversedId()); if (reversed.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_reverse_reversed");
BeginningInventory.class, pEntity.getReversedId()); for (BeginningInventoryLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) {
String langDef = (String) pAddParam.get("langDef"); for (BeginningInventoryLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) {