Applied fix from trunk for revision: 1611321 
===

This reverts most of the changes committed in rev.951013 for OFBIZ-3802 because they caused a few issues as reported in the same Jira ticket.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/release12.04@1611323 13f79535-47bb-0310-9956-ffa450edef68