// NOTE DEJ20070805 I'm not sure why we would want to auto-approve the header... adding at least this one exeption so that we don't have to add processing, held, etc statuses to the item status list
// NOTE2 related to the above: appears this was a weird way to set the order header status by setting all order item statuses... changing that to be less weird and more direct
// this is a bit of a pain: if the current statusId = ProductStore.headerApprovedStatus and we don't have that status in the history then we don't want to change it on approving the items
if (UtilValidate.isNotEmpty(orderHeader.getString("productStoreId"))) {
try {
GenericValue productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId")));
if (productStore != null) {
String headerApprovedStatus = productStore.getString("headerApprovedStatus");
if (UtilValidate.isNotEmpty(headerApprovedStatus)) {
if (headerApprovedStatus.equals(orderHeaderStatusId)) {
Map<String, Object> orderStatusCheckMap = UtilMisc.<String, Object>toMap("orderId", orderId, "statusId", headerApprovedStatus, "orderItemSeqId", null);