Applied patch from jira issue - OFBIZ-7122 - Showing Invoice address from PartyContactMech. Thanks Rahul Singh Kushwah for your contribution.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1749888 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Patidar
2016-06-23 13:22:00 +00:00
parent a91b9edae9
commit d67750dd5b
@@ -281,8 +281,12 @@ public class InvoiceWorker {
public static GenericValue getSendFromAddress(GenericValue invoice) {
return getInvoiceAddressByType(invoice, "PAYMENT_LOCATION");
}
public static GenericValue getInvoiceAddressByType(GenericValue invoice, String contactMechPurposeTypeId) {
return getInvoiceAddressByType(invoice, contactMechPurposeTypeId, true);
}
public static GenericValue getInvoiceAddressByType(GenericValue invoice, String contactMechPurposeTypeId, boolean fetchPartyAddress) {
Delegator delegator = invoice.getDelegator();
List<GenericValue> locations = null;
// first try InvoiceContactMech to see if we can find the address needed
@@ -292,7 +296,7 @@ public class InvoiceWorker {
Debug.logError("Touble getting InvoiceContactMech entity list", module);
}
if (UtilValidate.isEmpty(locations)) {
if (UtilValidate.isEmpty(locations) && fetchPartyAddress) {
// if no locations found get it from the PartyAndContactMech using the from and to party on the invoice
String destinationPartyId = null;
Timestamp now = UtilDateTime.nowTimestamp();