// if newItem is not null, it is the item to be moved, otherwise the original inventoryItem is the one to be moved
if (inventoryType.equals("NON_SERIAL_INV_ITEM")) {
// set the transfered inventory item's atp to 0 and the qoh to the xferQty; at this point atp and qoh will always be the same, so we can safely zero the atp for now
GenericValue inventoryItemToClear = newItem == null ? inventoryItem : newItem;
inventoryItemToClear.refresh();
BigDecimal atp = inventoryItemToClear.get("availableToPromiseTotal") == null ? BigDecimal.ZERO : inventoryItemToClear.getBigDecimal("availableToPromiseTotal");
if (atp.compareTo(BigDecimal.ZERO) != 0) {
Map<String, Object> createDetailMap = UtilMisc.toMap("availableToPromiseDiff", atp.negate(),
"inventoryItemId", inventoryItemToClear.get("inventoryItemId"), "userLogin", userLogin);
try {