I tried to preserve the complicated boolean logic in the replaced block of code, but if I got something wrong, just leave a message on the dev mailing list.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1535129 13f79535-47bb-0310-9956-ffa450edef68