[ 
https://issues.apache.org/jira/browse/OFBIZ-10248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Malin updated OFBIZ-10248:
----------------------------------
    Description: 
When you edit an invoice pdf, the different addresses are resolved by the 
InvoiceWorker with the method getInvoiceAddressByType.
{code:java}
public static GenericValue getInvoiceAddressByType(GenericValue invoice, String 
contactMechPurposeTypeId, boolean fetchPartyAddress) {{code}
This method check first on the InvoiceContactMech table and if no address 
found, check directly on the party with a filter date to now.
{code:java}
try {
locations = invoice.getRelated("InvoiceContactMech", 
UtilMisc.toMap("contactMechPurposeTypeId", contactMechPurposeTypeId), null, 
false);
} catch (GenericEntityException e) {
Debug.logError("Touble getting InvoiceContactMech entity list", module);
}

if (UtilValidate.isEmpty(locations) && fetchPartyAddress) {
// if no locations found get it from the PartyAndContactMech using the from and 
to party on the invoice
...
locations = EntityUtil.filterByDate(locations, now, "contactFromDate", 
"contactThruDate", true);

{code}
If you edit the invoice pdf one year after, addresses present on it can be 
change because the invoice date isn't use to resolve validate address related.

  was:
When you edit an invoice pdf, the different addresses are resolved by the 
InvoiceWorker with the method getInvoiceAddressByType.
{code:java}
public static GenericValue getInvoiceAddressByType(GenericValue invoice, String 
contactMechPurposeTypeId, boolean fetchPartyAddress) {{code}
This method check first on the InvoiceContactMech table and if no address 
found, check directly on the party with a filter date to now.
{code:java}
try {
locations = invoice.getRelated("InvoiceContactMech", 
UtilMisc.toMap("contactMechPurposeTypeId", contactMechPurposeTypeId), null, 
false);
} catch (GenericEntityException e) {
Debug.logError("Touble getting InvoiceContactMech entity list", module);
}

if (UtilValidate.isEmpty(locations) && fetchPartyAddress) {
// if no locations found get it from the PartyAndContactMech using the from and 
to party on the invoice
...
locations = EntityUtil.filterByDate(locations, date, "contactFromDate", 
"contactThruDate", true);

{code}
If you edit the invoice pdf one year after, addresses present on it can be 
change because the invoice date isn't use to resolve validate address related.


> Resolve address from InvoiceWorker not respect the invoice date 
> ----------------------------------------------------------------
>
>                 Key: OFBIZ-10248
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10248
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: Trunk
>            Reporter: Nicolas Malin
>            Priority: Major
>         Attachments: OFBIZ-10248.patch
>
>
> When you edit an invoice pdf, the different addresses are resolved by the 
> InvoiceWorker with the method getInvoiceAddressByType.
> {code:java}
> public static GenericValue getInvoiceAddressByType(GenericValue invoice, 
> String contactMechPurposeTypeId, boolean fetchPartyAddress) {{code}
> This method check first on the InvoiceContactMech table and if no address 
> found, check directly on the party with a filter date to now.
> {code:java}
> try {
> locations = invoice.getRelated("InvoiceContactMech", 
> UtilMisc.toMap("contactMechPurposeTypeId", contactMechPurposeTypeId), null, 
> false);
> } catch (GenericEntityException e) {
> Debug.logError("Touble getting InvoiceContactMech entity list", module);
> }
> if (UtilValidate.isEmpty(locations) && fetchPartyAddress) {
> // if no locations found get it from the PartyAndContactMech using the from 
> and to party on the invoice
> ...
> locations = EntityUtil.filterByDate(locations, now, "contactFromDate", 
> "contactThruDate", true);
> {code}
> If you edit the invoice pdf one year after, addresses present on it can be 
> change because the invoice date isn't use to resolve validate address related.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to