The changes to the code using EntityQuery shouldn't be necessary.  Could
you undo them or otherwise explain why it was needed?

Thanks
Scott

On Wed, Dec 17, 2014 at 2:45 AM, <jler...@apache.org> wrote:

> Author: jleroux
> Date: Tue Dec 16 13:45:54 2014
> New Revision: 1645950
>
> URL: http://svn.apache.org/r1645950
> Log:
> A patch from Leon for "correction to changeset r1626462  and r1626463  "
> https://issues.apache.org/jira/browse/OFBIZ-5869
>
> Uses now timestamp to replace "null" value.
>
> Modified:
>
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
>
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java
>
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
>
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy
>
> ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
>
> ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java
>
> Modified:
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1645950&r1=1645949&r2=1645950&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
> (original)
> +++
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
> Tue Dec 16 13:45:54 2014
> @@ -296,6 +296,7 @@ public class InvoiceWorker {
>          if (UtilValidate.isEmpty(locations))    {
>              // 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();
>              if
> (invoice.getString("invoiceTypeId").equals("SALES_INVOICE"))
>                  destinationPartyId = invoice.getString("partyId");
>              if
> (invoice.getString("invoiceTypeId").equals("PURCHASE_INVOICE"))
> @@ -303,8 +304,8 @@ public class InvoiceWorker {
>              try {
>                  locations =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                          .where("partyId", destinationPartyId,
> "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
> -                locations = EntityUtil.filterByDate(locations, null,
> "contactFromDate", "contactThruDate", true);
> -                locations = EntityUtil.filterByDate(locations, null,
> "purposeFromDate", "purposeThruDate", true);
> +                locations = EntityUtil.filterByDate(locations, now,
> "contactFromDate", "contactThruDate", true);
> +                locations = EntityUtil.filterByDate(locations, now,
> "purposeFromDate", "purposeThruDate", true);
>              } catch (GenericEntityException e) {
>                  Debug.logError("Trouble getting contact party purpose
> list", module);
>              }
> @@ -313,8 +314,8 @@ public class InvoiceWorker {
>                  try {
>                      locations =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                              .where("partyId", destinationPartyId,
> "contactMechPurposeTypeId", "GENERAL_LOCATION").queryList();
> -                    locations = EntityUtil.filterByDate(locations, null,
> "contactFromDate", "contactThruDate", true);
> -                    locations = EntityUtil.filterByDate(locations, null,
> "purposeFromDate", "purposeThruDate", true);
> +                    locations = EntityUtil.filterByDate(locations, now,
> "contactFromDate", "contactThruDate", true);
> +                    locations = EntityUtil.filterByDate(locations, now,
> "purposeFromDate", "purposeThruDate", true);
>                  } catch (GenericEntityException e) {
>                      Debug.logError("Trouble getting contact party purpose
> list", module);
>                  }
>
> Modified:
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java?rev=1645950&r1=1645949&r2=1645950&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java
> (original)
> +++
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java
> Tue Dec 16 13:45:54 2014
> @@ -216,8 +216,8 @@ public class PaymentMethodServices {
>              try {
>                  List<GenericValue> allPCWPs =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                          .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId",
> contactMechPurposeTypeId).queryList();
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "contactFromDate", "contactThruDate", true);
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "purposeFromDate", "purposeThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "contactFromDate", "contactThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "purposeFromDate", "purposeThruDate", true);
>                  tempVal = EntityUtil.getFirst(allPCWPs);
>              } catch (GenericEntityException e) {
>                  Debug.logWarning(e.getMessage(), module);
> @@ -391,8 +391,8 @@ public class PaymentMethodServices {
>              try {
>                  List<GenericValue> allPCWPs =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                          .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId",
> contactMechPurposeTypeId).queryList();
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "contactFromDate", "contactThruDate", true);
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "purposeFromDate", "purposeThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "contactFromDate", "contactThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "purposeFromDate", "purposeThruDate", true);
>
>                  tempVal = EntityUtil.getFirst(allPCWPs);
>              } catch (GenericEntityException e) {
> @@ -732,8 +732,8 @@ public class PaymentMethodServices {
>              try {
>                  List<GenericValue> allPCWPs =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                          .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId",
> contactMechPurposeTypeId).queryList();
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "contactFromDate", "contactThruDate", true);
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "purposeFromDate", "purposeThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "contactFromDate", "contactThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "purposeFromDate", "purposeThruDate", true);
>
>                  tempVal = EntityUtil.getFirst(allPCWPs);
>              } catch (GenericEntityException e) {
> @@ -861,8 +861,8 @@ public class PaymentMethodServices {
>              try {
>                  List<GenericValue> allPCWPs =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                          .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId",
> contactMechPurposeTypeId).queryList();
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "contactFromDate", "contactThruDate", true);
> -                allPCWPs = EntityUtil.filterByDate(allPCWPs, null,
> "purposeFromDate", "purposeThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "contactFromDate", "contactThruDate", true);
> +                allPCWPs = EntityUtil.filterByDate(allPCWPs, now,
> "purposeFromDate", "purposeThruDate", true);
>                  tempVal = EntityUtil.getFirst(allPCWPs);
>              } catch (GenericEntityException e) {
>                  Debug.logWarning(e.getMessage(), module);
>
> Modified:
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=1645950&r1=1645949&r2=1645950&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
> (original)
> +++
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
> Tue Dec 16 13:45:54 2014
> @@ -29,6 +29,7 @@ import javolution.util.FastList;
>  import javolution.util.FastMap;
>
>  import org.ofbiz.base.util.Debug;
> +import org.ofbiz.base.util.UtilDateTime;
>  import org.ofbiz.base.util.UtilFormatOut;
>  import org.ofbiz.base.util.UtilMisc;
>  import org.ofbiz.base.util.UtilNumber;
> @@ -161,7 +162,7 @@ public class PaymentWorker {
>          try {
>              purpose =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                      .where("partyId", partyId,
> "contactMechPurposeTypeId", "PAYMENT_LOCATION")
> -
> .orderBy("-purposeFromDate").filterByDate("contactFromDate",
> "contactThruDate", "purposeFromDate", "purposeThruDate")
> +
> .orderBy("-purposeFromDate").filterByDate(UtilDateTime.nowTimestamp(),
> "contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
>                      .queryFirst();
>          } catch (GenericEntityException e) {
>              Debug.logError(e, "Trouble getting PartyContactWithPurpose
> view entity list", module);
>
> Modified:
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=1645950&r1=1645949&r2=1645950&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy
> (original)
> +++
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy
> Tue Dec 16 13:45:54 2014
> @@ -144,8 +144,8 @@ context.companyName = companyName;
>
>  // the address
>  addresses = delegator.findByAnd("PartyContactWithPurpose", [partyId :
> partyId, contactMechPurposeTypeId : "GENERAL_LOCATION"], null, false);
> -addresses = EntityUtil.filterByDate(addresses, null, "contactFromDate",
> "contactThruDate", true);
> -addresses = EntityUtil.filterByDate(addresses, null, "purposeFromDate",
> "purposeThruDate", true);
> +addresses = EntityUtil.filterByDate(addresses, nowTimestamp,
> "contactFromDate", "contactThruDate", true);
> +addresses = EntityUtil.filterByDate(addresses, nowTimestamp,
> "purposeFromDate", "purposeThruDate", true);
>  address = null;
>  if (addresses) {
>      address = delegator.findOne("PostalAddress", [contactMechId :
> addresses[0].contactMechId], false);
> @@ -165,24 +165,24 @@ context.postalAddress = address;
>
>  //telephone
>  phones = delegator.findByAnd("PartyContactWithPurpose", [partyId :
> partyId, contactMechPurposeTypeId : "PRIMARY_PHONE"], null, false);
> -phones = EntityUtil.filterByDate(phones, null, "contactFromDate",
> "contactThruDate", true);
> -phones = EntityUtil.filterByDate(phones, null, "purposeFromDate",
> "purposeThruDate", true);
> +phones = EntityUtil.filterByDate(phones, nowTimestamp, "contactFromDate",
> "contactThruDate", true);
> +phones = EntityUtil.filterByDate(phones, nowTimestamp, "purposeFromDate",
> "purposeThruDate", true);
>  if (phones) {
>      context.phone = delegator.findOne("TelecomNumber", [contactMechId :
> phones[0].contactMechId], false);
>  }
>
>  // Fax
>  faxNumbers = delegator.findByAnd("PartyContactWithPurpose", [partyId :
> partyId, contactMechPurposeTypeId : "FAX_NUMBER"], null, false);
> -faxNumbers = EntityUtil.filterByDate(faxNumbers, null, "contactFromDate",
> "contactThruDate", true);
> -faxNumbers = EntityUtil.filterByDate(faxNumbers, null, "purposeFromDate",
> "purposeThruDate", true);
> +faxNumbers = EntityUtil.filterByDate(faxNumbers, nowTimestamp,
> "contactFromDate", "contactThruDate", true);
> +faxNumbers = EntityUtil.filterByDate(faxNumbers, nowTimestamp,
> "purposeFromDate", "purposeThruDate", true);
>  if (faxNumbers) {
>      context.fax = delegator.findOne("TelecomNumber", [contactMechId :
> faxNumbers[0].contactMechId], false);
>  }
>
>  //Email
>  emails = delegator.findByAnd("PartyContactWithPurpose", [partyId :
> partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false);
> -emails = EntityUtil.filterByDate(emails, null, "contactFromDate",
> "contactThruDate", true);
> -emails = EntityUtil.filterByDate(emails, null, "purposeFromDate",
> "purposeThruDate", true);
> +emails = EntityUtil.filterByDate(emails, nowTimestamp, "contactFromDate",
> "contactThruDate", true);
> +emails = EntityUtil.filterByDate(emails, nowTimestamp, "purposeFromDate",
> "purposeThruDate", true);
>  if (emails) {
>      context.email = delegator.findOne("ContactMech", [contactMechId :
> emails[0].contactMechId], false);
>  } else {    //get email address from party contact mech
> @@ -202,8 +202,8 @@ if (emails) {
>
>  // website
>  websiteUrls = delegator.findByAnd("PartyContactWithPurpose", [partyId :
> partyId, contactMechPurposeTypeId : "PRIMARY_WEB_URLs"], null, false);
> -websiteUrls = EntityUtil.filterByDate(websiteUrls, null,
> "contactFromDate", "contactThruDate", true);
> -websiteUrls = EntityUtil.filterByDate(websiteUrls, null,
> "purposeFromDate", "purposeThruDate", true);
> +websiteUrls = EntityUtil.filterByDate(websiteUrls, nowTimestamp,
> "contactFromDate", "contactThruDate", true);
> +websiteUrls = EntityUtil.filterByDate(websiteUrls, nowTimestamp,
> "purposeFromDate", "purposeThruDate", true);
>  if (websiteUrls) {
>      websiteUrl = EntityUtil.getFirst(websiteUrls);
>      context.website = delegator.findOne("ContactMech", [contactMechId :
> websiteUrl.contactMechId], false);
>
> Modified:
> ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java?rev=1645950&r1=1645949&r2=1645950&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
> (original)
> +++
> ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
> Tue Dec 16 13:45:54 2014
> @@ -821,7 +821,7 @@ public class ContactMechServices {
>          try {
>              tempVal =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                      .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)
> -                    .filterByDate("contactFromDate", "contactThruDate",
> "purposeFromDate", "purposeThruDate")
> +                    .filterByDate(UtilDateTime.nowTimestamp(),
> "contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
>                      .queryFirst();
>          } catch (GenericEntityException e) {
>              Debug.logWarning(e.getMessage(), module);
> @@ -881,7 +881,7 @@ public class ContactMechServices {
>          try {
>              tempVal =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                      .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)
> -                    .filterByDate("contactFromDate", "contactThruDate",
> "purposeFromDate", "purposeThruDate")
> +                    .filterByDate(UtilDateTime.nowTimestamp(),
> "contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
>                      .queryFirst();
>          } catch (GenericEntityException e) {
>              Debug.logWarning(e.getMessage(), module);
>
> Modified:
> ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java?rev=1645950&r1=1645949&r2=1645950&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java
> (original)
> +++
> ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java
> Tue Dec 16 13:45:54 2014
> @@ -29,6 +29,7 @@ import javolution.util.FastMap;
>
>  import org.ofbiz.base.util.Debug;
>  import org.ofbiz.base.util.GeneralException;
> +import org.ofbiz.base.util.UtilDateTime;
>  import org.ofbiz.base.util.UtilGenerics;
>  import org.ofbiz.base.util.UtilMisc;
>  import org.ofbiz.base.util.UtilValidate;
> @@ -559,7 +560,7 @@ public class GoogleCheckoutHelper {
>          // check to make sure the purpose doesn't already exist
>          List<GenericValue> values =
> EntityQuery.use(delegator).from("PartyContactWithPurpose")
>                  .where("partyId", partyId, "contactMechId",
> contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)
> -                .filterByDate("contactFromDate", "contactThruDate",
> "purposeFromDate", "purposeThruDate")
> +                .filterByDate(UtilDateTime.nowTimestamp(),
> "contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
>                  .queryList();
>
>          if (UtilValidate.isEmpty(values)) {
>
>
>

Reply via email to