|
Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/data/AccountingTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/data/AccountingTypeData.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/data/AccountingTypeData.xml Tue Jun 19 21:36:11 2012 @@ -386,6 +386,9 @@ under the License. <GlAccountCategoryType glAccountCategoryTypeId="COST_CENTER" description="Cost Center Category"/> + <!-- Invoice content type--> + <InvoiceContentType invoiceContentTypeId="COMMENTS" description="comments" hasTable="N" parentTypeId=""/> + <!-- invoice item types tree for adjustments --> <InvoiceItemType description="Invoice Adjustment" hasTable="N" invoiceItemTypeId="INVOICE_ADJ" parentTypeId=""/> <InvoiceItemType description="Invoice Header Adjustment" hasTable="N" invoiceItemTypeId="INVOICE_HEAD_ADJ" parentTypeId="INVOICE_ADJ"/> Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/entitydef/entitymodel.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/entitydef/entitymodel.xml Tue Jun 19 21:36:11 2012 @@ -1209,6 +1209,40 @@ under the License. <key-map field-name="attrName"/> </relation> </entity> + <entity entity-name="InvoiceContent" + package-name="org.ofbiz.accounting.invoice" + title="Invoice Content Entity"> + <field name="invoiceId" type="id-ne"></field> + <field name="invoiceContentTypeId" type="id-ne"></field> + <field name="contentId" type="id-ne"></field> + <field name="fromDate" type="date-time"></field> + <field name="thruDate" type="date-time"></field> + <prim-key field="contentId"/> + <prim-key field="invoiceId"/> + <prim-key field="invoiceContentTypeId"/> + <prim-key field="fromDate"/> + <relation type="one" fk-name="INV_CNT_PROD" rel-entity-name="Invoice"> + <key-map field-name="invoiceId"/> + </relation> + <relation type="one" fk-name="INV_CNT_CNT" rel-entity-name="Content"> + <key-map field-name="contentId"/> + </relation> + <relation type="one" fk-name="INV_CNT_TYPE" rel-entity-name="InvoiceContentType"> + <key-map field-name="invoiceContentTypeId"/> + </relation> + </entity> + <entity entity-name="InvoiceContentType" + package-name="org.ofbiz.accounting.invoice" + title="Invoice Content Type Entity"> + <field name="invoiceContentTypeId" type="id-ne"></field> + <field name="parentTypeId" type="id"></field> + <field name="hasTable" type="indicator"></field> + <field name="description" type="description"></field> + <prim-key field="invoiceContentTypeId"/> + <relation type="one" fk-name="INVCT_TYP_PARENT" title="Parent" rel-entity-name="InvoiceContentType"> + <key-map field-name="parentTypeId" rel-field-name="invoiceContentTypeId"/> + </relation> + </entity> <entity entity-name="InvoiceContactMech" package-name="org.ofbiz.accounting.invoice" never-cache="true" @@ -1550,6 +1584,20 @@ under the License. <key-map field-name="invoiceTypeId"/> </relation> </entity> + <entity entity-name="InvoiceNote" + package-name="org.ofbiz.accounting.invoice" + title="Invoice Note Entity"> + <field name="invoiceId" type="id-ne"></field> + <field name="noteId" type="id-ne"></field> + <prim-key field="invoiceId"/> + <prim-key field="noteId"/> + <relation type="one" fk-name="INVOICE_NOTE_INV" rel-entity-name="Invoice"> + <key-map field-name="invoiceId"/> + </relation> + <relation type="one" fk-name="INVOICE_NOTE_NOTE" rel-entity-name="NoteData"> + <key-map field-name="noteId"/> + </relation> + </entity> <view-entity entity-name="InvoiceAndApplAndPayment" package-name="org.ofbiz.accounting.invoice" title="Invoice and related applications and payments"> <member-entity entity-alias="INV" entity-name="Invoice"/> @@ -1621,6 +1669,38 @@ under the License. <key-map field-name="productId"/> </view-link> </view-entity> + + <view-entity entity-name="InvoiceContentAndInfo" + package-name="org.ofbiz.accounting.invoice" + title="InvoiceContent Content and DataResource View Entity"> + <member-entity entity-alias="INVC" entity-name="InvoiceContent"/> + <member-entity entity-alias="CO" entity-name="Content"/> + <member-entity entity-alias="DR" entity-name="DataResource"/> + <alias-all entity-alias="INVC"/> + <alias-all entity-alias="CO"/> + <alias-all entity-alias="DR" prefix="dr"/> + <view-link entity-alias="INVC" rel-entity-alias="CO"> + <key-map field-name="contentId"/> + </view-link> + <view-link entity-alias="CO" rel-entity-alias="DR"> + <key-map field-name="dataResourceId"/> + </view-link> + <relation type="one-nofk" rel-entity-name="ElectronicText"> + <key-map field-name="dataResourceId"/> + </relation> + <relation type="one-nofk" rel-entity-name="ImageDataResource"> + <key-map field-name="dataResourceId"/> + </relation> + <relation type="one-nofk" rel-entity-name="OtherDataResource"> + <key-map field-name="dataResourceId"/> + </relation> + <relation type="many" rel-entity-name="ContentAssocDataResourceViewFrom"> + <key-map field-name="contentId" rel-field-name="contentIdStart"/> + </relation> + <relation type="many" rel-entity-name="ContentAssocDataResourceViewTo"> + <key-map field-name="contentId" rel-field-name="contentIdStart"/> + </relation> + </view-entity> <!-- ========================================================= --> <!-- org.ofbiz.accounting.ledger --> <!-- ========================================================= --> Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/ofbiz-component.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/ofbiz-component.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/ofbiz-component.xml Tue Jun 19 21:36:11 2012 @@ -39,7 +39,7 @@ under the License. <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingTypeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingHelpData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/UsTaxAccountGroups.xml"/> - <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingSecurityData.xml"/> + <entity-resource type="data" reader-name="security" loader="main" location="data/AccountingSecurityData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingPortletData.xml"/> <entity-resource type="data" reader-name="seed-initial" loader="main" location="data/PaymentGatewayConfData.xml"/> <entity-resource type="data" reader-name="seed-initial" loader="main" location="data/AccountingScheduledServiceData.xml"/> Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Tue Jun 19 21:36:11 2012 @@ -944,4 +944,57 @@ under the License. <field-to-result field="invoiceId" result-name="invoiceId"/> </if-compare> </simple-method> + + <!-- InvoiceContent --> + <simple-method method-name="createInvoiceContent" short-description="Create Content For Invoice"> + <make-value value-field="newEntity" entity-name="InvoiceContent"/> + <set-pk-fields map="parameters" value-field="newEntity"/> + <set-nonpk-fields map="parameters" value-field="newEntity"/> + + <if-empty field="newEntity.fromDate"> + <now-timestamp field="nowTimestamp"/> + <set field="newEntity.fromDate" from-field="nowTimestamp"/> + </if-empty> + + <create-value value-field="newEntity"/> + + <set-service-fields service-name="updateContent" map="parameters" to-map="updateContent"/> + <call-service service-name="updateContent" in-map-name="updateContent"/> + + <field-to-result field="newEntity.contentId" result-name="contentId"/> + <field-to-result field="newEntity.invoiceId" result-name="invoiceId"/> + <field-to-result field="newEntity.invoiceContentTypeId" result-name="invoiceContentTypeId"/> + </simple-method> + <simple-method method-name="updateInvoiceContent" short-description="Update Content For Invoice"> + <make-value value-field="lookupPKMap" entity-name="InvoiceContent"/> + <set-pk-fields map="parameters" value-field="lookupPKMap"/> + <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/> + <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> + <store-value value-field="lookedUpValue"/> + + <set-service-fields service-name="updateContent" map="parameters" to-map="updateContent"/> + <call-service service-name="updateContent" in-map-name="updateContent"/> + </simple-method> + <simple-method method-name="removeInvoiceContent" short-description="Remove Content From Invoice"> + <make-value value-field="lookupPKMap" entity-name="InvoiceContent"/> + <set-pk-fields map="parameters" value-field="lookupPKMap"/> + <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/> + <remove-value value-field="lookedUpValue"/> + </simple-method> + + <simple-method method-name="createSimpleTextContentForInvoice" short-description="Create Simple Text Content For Invoice"> + <set-service-fields service-name="createInvoiceContent" map="parameters" to-map="createInvoiceContentMap"/> + <set-service-fields service-name="createSimpleTextContent" map="parameters" to-map="createSimpleTextMap"/> + <call-service service-name="createSimpleTextContent" in-map-name="createSimpleTextMap"> + <result-to-field result-name="contentId" field="createInvoiceContentMap.contentId"/> + </call-service> + <call-service service-name="createInvoiceContent" in-map-name="createInvoiceContentMap"/> + </simple-method> + <simple-method method-name="updateSimpleTextContentForInvoice" short-description="Update Simple Text Content For Invoice"> + <set-service-fields service-name="updateInvoiceContent" map="parameters" to-map="updateInvoiceContent"/> + <call-service service-name="updateInvoiceContent" in-map-name="updateInvoiceContent"/> + <set-service-fields service-name="updateSimpleTextContent" map="parameters" to-map="updateSimpleText"/> + <call-service service-name="updateSimpleTextContent" in-map-name="updateSimpleText"/> + </simple-method> + </simple-methods> Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Tue Jun 19 21:36:11 2012 @@ -2860,11 +2860,6 @@ under the License. </entity-and> <if-not-empty field="glAccountCategories"> <iterate list="glAccountOrganizations" entry="glAccountOrganization"> - <clear-field field="glAcctgOrgAndCostCenterMap"/> - <get-related-one value-field="glAccountOrganization" relation-name="GlAccount" to-value-field="glAccount"/> - <set field="glAcctgOrgAndCostCenterMap.glAccountId" from-field="glAccount.glAccountId"/> - <set field="glAcctgOrgAndCostCenterMap.accountCode" from-field="glAccount.accountCode"/> - <set field="glAcctgOrgAndCostCenterMap.accountName" from-field="glAccount.accountName"/> <iterate list="glAccountCategories" entry="glAccountCategory"> <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers" filter-by-date="true"> <field-map field-name="glAccountId" from-field="glAccountOrganization.glAccountId"/> @@ -2872,12 +2867,15 @@ under the License. </entity-and> <if-not-empty field="glAccountCategoryMembers"> <first-from-list list="glAccountCategoryMembers" entry="glAccountCategoryMember"/> - <if-not-empty field="glAccountCategoryMember"> - <set field="glAcctgOrgAndCostCenterMap[glAccountCategory.glAccountCategoryId]" from-field="glAccountCategoryMember.amountPercentage" type="BigDecimal"/> - </if-not-empty> + <set field="glAcctgOrgAndCostCenterMap[glAccountCategory.glAccountCategoryId]" from-field="glAccountCategoryMember.amountPercentage" type="BigDecimal"/> + <get-related-one value-field="glAccountCategoryMember" relation-name="GlAccount" to-value-field="glAccount"/> + <set field="glAcctgOrgAndCostCenterMap.glAccountId" from-field="glAccount.glAccountId"/> + <set field="glAcctgOrgAndCostCenterMap.accountCode" from-field="glAccount.accountCode"/> + <set field="glAcctgOrgAndCostCenterMap.accountName" from-field="glAccount.accountName"/> </if-not-empty> </iterate> <field-to-list field="glAcctgOrgAndCostCenterMap" list="glAcctgAndAmountPercentageList"/> + <clear-field field="glAcctgOrgAndCostCenterMap"/> </iterate> <field-to-result field="glAccountCategories"/> </if-not-empty> Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/servicedef/services_invoice.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/servicedef/services_invoice.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/servicedef/services_invoice.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/servicedef/services_invoice.xml Tue Jun 19 21:36:11 2012 @@ -384,4 +384,46 @@ under the License. <attribute name="invoiceId" type="String" mode="OUT" optional="true"/> </service> + <!-- Invoice content services --> + <service name="createInvoiceContent" default-entity-name="InvoiceContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="createInvoiceContent" auth="true"> + <description>Add Content To Invoice</description> + <auto-attributes include="pk" mode="INOUT" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/> + <override name="fromDate" optional="true"/> + <!--<override name="contentId" optional="true" mode="INOUT"/>--> + </service> + <service name="updateInvoiceContent" default-entity-name="InvoiceContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="updateInvoiceContent" auth="true"> + <description>Update Content To Invoice</description> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/> + </service> + <service name="removeInvoiceContent" default-entity-name="InvoiceContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="removeInvoiceContent" auth="true"> + <description>Remove Content From Invoice</description> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + + <service name="createSimpleTextContentForInvoice" default-entity-name="InvoiceContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="createSimpleTextContentForInvoice" auth="true"> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/> + <attribute name="text" type="String" mode="IN" optional="false" allow-html="safe"/> + <override name="contentId" optional="true"/> + <override name="fromDate" optional="true"/> + </service> + <service name="updateSimpleTextContentForInvoice" default-entity-name="InvoiceContent" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="updateSimpleTextContentForInvoice" auth="true"> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes mode="IN" entity-name="Content" optional="true"/> + <attribute name="textDataResourceId" type="String" mode="IN" optional="true"/> + <attribute name="text" type="String" mode="IN" optional="true" allow-html="safe"/> + </service> + </services> Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Tue Jun 19 21:36:11 2012 @@ -355,7 +355,7 @@ public class FinAccountPaymentServices { // get the financial account GenericValue finAccount; try { - finAccount = finAccountAuth.getRelatedOne("FinAccount"); + finAccount = finAccountAuth.getRelatedOne("FinAccount", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -733,7 +733,7 @@ public class FinAccountPaymentServices { // look up the type -- determine auto-replenish is active GenericValue finAccountType; try { - finAccountType = finAccount.getRelatedOne("FinAccountType"); + finAccountType = finAccount.getRelatedOne("FinAccountType", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Tue Jun 19 21:36:11 2012 @@ -62,7 +62,7 @@ public class FinAccountProductServices { // the order header for store info GenericValue orderHeader; try { - orderHeader = orderItem.getRelatedOne("OrderHeader"); + orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem", module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, @@ -152,7 +152,7 @@ public class FinAccountProductServices { if (billToParty != null) { try { - party = billToParty.getRelatedOne("Party"); + party = billToParty.getRelatedOne("Party", false); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Tue Jun 19 21:36:11 2012 @@ -389,12 +389,12 @@ public class FinAccountServices { // make sure there is an order available to refund if (orderId != null && orderItemSeqId != null) { GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId",orderId), false); - GenericValue productStore = delegator.getRelatedOne("ProductStore", orderHeader); + GenericValue productStore = orderHeader.getRelatedOne("ProductStore", false); GenericValue orderItem = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), false); if (!"ITEM_CANCELLED".equals(orderItem.getString("statusId"))) { // make sure the item hasn't already been returned - List<GenericValue> returnItems = orderItem.getRelated("ReturnItem"); + List<GenericValue> returnItems = orderItem.getRelated("ReturnItem", null, null, false); if (UtilValidate.isEmpty(returnItems)) { BigDecimal txAmt = trans.getBigDecimal("amount"); BigDecimal refAmt = txAmt; @@ -449,7 +449,7 @@ public class FinAccountServices { // get the return item GenericValue returnItem = delegator.findOne("ReturnItem", UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId), false); - GenericValue response = returnItem.getRelatedOne("ReturnItemResponse"); + GenericValue response = returnItem.getRelatedOne("ReturnItemResponse", false); if (response == null) { throw new GeneralException("No return response found for: " + returnItem.getPrimaryKey()); } Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Tue Jun 19 21:36:11 2012 @@ -210,7 +210,7 @@ public class InvoiceServices { BigDecimal invoiceSubTotal = ZERO; BigDecimal invoiceQuantity = ZERO; - GenericValue billingAccount = orderHeader.getRelatedOne("BillingAccount"); + GenericValue billingAccount = orderHeader.getRelatedOne("BillingAccount", false); String billingAccountId = billingAccount != null ? billingAccount.getString("billingAccountId") : null; Timestamp invoiceDate = (Timestamp)context.get("eventDate"); @@ -251,7 +251,7 @@ public class InvoiceServices { } // order roles to invoice roles - List<GenericValue> orderRoles = orderHeader.getRelated("OrderRole"); + List<GenericValue> orderRoles = orderHeader.getRelated("OrderRole", null, null, false); Map<String, Object> createInvoiceRoleContext = FastMap.newInstance(); createInvoiceRoleContext.put("invoiceId", invoiceId); createInvoiceRoleContext.put("userLogin", userLogin); @@ -278,13 +278,13 @@ public class InvoiceServices { * jacopoc: billing account terms were already copied as order terms * when the order was created. // get the billing account terms - billingAccountTerms = billingAccount.getRelated("BillingAccountTerm"); + billingAccountTerms = billingAccount.getRelated("BillingAccountTerm", null, null, false); // set the invoice terms as defined for the billing account createInvoiceTerms(delegator, dispatcher, invoiceId, billingAccountTerms, userLogin, locale); */ // set the invoice bill_to_customer from the billing account - List<GenericValue> billToRoles = billingAccount.getRelated("BillingAccountRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER"), null); + List<GenericValue> billToRoles = billingAccount.getRelated("BillingAccountRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER"), null, false); for (GenericValue billToRole : billToRoles) { if (!(billToRole.getString("partyId").equals(billToCustomerPartyId))) { createInvoiceRoleContext = UtilMisc.toMap("invoiceId", invoiceId, "partyId", billToRole.get("partyId"), @@ -325,7 +325,7 @@ public class InvoiceServices { } // get a list of the payment method types - //DEJ20050705 doesn't appear to be used: List paymentPreferences = orderHeader.getRelated("OrderPaymentPreference"); + //DEJ20050705 doesn't appear to be used: List paymentPreferences = orderHeader.getRelated("OrderPaymentPreference", null, null, false); // create the bill-from (or pay-to) contact mech as the primary PAYMENT_LOCATION of the party from the store GenericValue payToAddress = null; @@ -333,8 +333,7 @@ public class InvoiceServices { // for purchase orders, the pay to address is the BILLING_LOCATION of the vendor GenericValue billFromVendor = orh.getPartyFromRole("BILL_FROM_VENDOR"); if (billFromVendor != null) { - List<GenericValue> billingContactMechs = billFromVendor.getRelatedOne("Party").getRelatedByAnd("PartyContactMechPurpose", - UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION")); + List<GenericValue> billingContactMechs = billFromVendor.getRelatedOne("Party", false).getRelated("PartyContactMechPurpose", UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION"), null, false); if (UtilValidate.isNotEmpty(billingContactMechs)) { payToAddress = EntityUtil.getFirst(billingContactMechs); } @@ -373,9 +372,9 @@ public class InvoiceServices { } if (orderItem == null && itemIssuance != null) { - orderItem = itemIssuance.getRelatedOne("OrderItem"); + orderItem = itemIssuance.getRelatedOne("OrderItem", false); } else if ((orderItem == null) && (shipmentReceipt != null)) { - orderItem = shipmentReceipt.getRelatedOne("OrderItem"); + orderItem = shipmentReceipt.getRelatedOne("OrderItem", false); } else if ((orderItem == null) && (itemIssuance == null) && (shipmentReceipt == null)) { Debug.logError("Cannot create invoice when orderItem, itemIssuance, and shipmentReceipt are all null", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -383,7 +382,7 @@ public class InvoiceServices { } GenericValue product = null; if (orderItem.get("productId") != null) { - product = orderItem.getRelatedOne("Product"); + product = orderItem.getRelatedOne("Product", false); } // get some quantities @@ -581,7 +580,7 @@ public class InvoiceServices { // represent an organization override for the payToPartyId if (UtilValidate.isNotEmpty(adj.getString("productPromoId"))) { try { - GenericValue productPromo = adj.getRelatedOne("ProductPromo"); + GenericValue productPromo = adj.getRelatedOne("ProductPromo", false); if (UtilValidate.isNotEmpty(productPromo.getString("overrideOrgPartyId"))) { createInvoiceItemAdjContext.put("overrideOrgPartyId", productPromo.getString("overrideOrgPartyId")); } @@ -757,7 +756,7 @@ public class InvoiceServices { List<GenericValue> orderPaymentPrefs = delegator.findList("OrderPaymentPreference", EntityCondition.makeCondition(paymentPrefConds, EntityOperator.AND), null, null, null, false); List<GenericValue> currentPayments = FastList.newInstance(); for (GenericValue paymentPref : orderPaymentPrefs) { - List<GenericValue> payments = paymentPref.getRelated("Payment"); + List<GenericValue> payments = paymentPref.getRelated("Payment", null, null, false); currentPayments.addAll(payments); } // apply these payments to the invoice if they have any remaining amount to apply @@ -1171,7 +1170,7 @@ public class InvoiceServices { GenericValue orderItemBilling = EntityUtil.getFirst(orderItemBillings); GenericValue invoice = null; try { - invoice = orderItemBilling.getRelatedOne("Invoice"); + invoice = orderItemBilling.getRelatedOne("Invoice", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1274,7 +1273,7 @@ public class InvoiceServices { Iterator<GenericValue> itemsIter = items.iterator(); while (itemsIter.hasNext()) { GenericValue item = itemsIter.next(); - GenericValue inventoryItem = item.getRelatedOne("InventoryItem"); + GenericValue inventoryItem = item.getRelatedOne("InventoryItem", false); GenericValue ownerPartyRole = delegator.findOne("PartyRole", UtilMisc.toMap("partyId", inventoryItem.getString("ownerPartyId"), "roleTypeId", "INTERNAL_ORGANIZATIO"), true); if (UtilValidate.isEmpty(ownerPartyRole)) { itemsIter.remove(); @@ -1294,7 +1293,7 @@ public class InvoiceServices { orderItemAssocs = delegator.findList("OrderItemAssoc", EntityCondition.makeCondition("toOrderId", EntityOperator.IN, purchaseOrderIds), null, null, null, false); // Get only the order items which are indirectly related to the purchase order - this limits the list to the drop ship group(s) - items = EntityUtil.getRelated("FromOrderItem", orderItemAssocs); + items = EntityUtil.getRelated("FromOrderItem", null, orderItemAssocs, false); } else { // If it's a purchase invoice being created, the order items for that purchase orders can be used directly @@ -1392,7 +1391,7 @@ public class InvoiceServices { List<GenericValue> billed = null; BigDecimal orderedQty = null; try { - orderItem = issue.getEntityName().equals("OrderItem") ? issue : issue.getRelatedOne("OrderItem"); + orderItem = issue.getEntityName().equals("OrderItem") ? issue : issue.getRelatedOne("OrderItem", false); // total ordered orderedQty = orderItem.getBigDecimal("quantity"); @@ -1401,7 +1400,7 @@ public class InvoiceServices { // Override the issueQty with the quantity from the purchase order item GenericValue orderItemAssoc = EntityUtil.getFirst(EntityUtil.filterByAnd(orderItemAssocs, UtilMisc.toMap("orderId", issue.getString("orderId"), "orderItemSeqId", issue.getString("orderItemSeqId")))); - GenericValue purchaseOrderItem = orderItemAssoc.getRelatedOne("ToOrderItem"); + GenericValue purchaseOrderItem = orderItemAssoc.getRelatedOne("ToOrderItem", false); orderItem.set("quantity", purchaseOrderItem.getBigDecimal("quantity")); issueQty = purchaseOrderItem.getBigDecimal("quantity"); } @@ -1551,7 +1550,7 @@ public class InvoiceServices { GenericValue payToParty = orh.getBillFromParty(); GenericValue destinationContactMech = null; try { - destinationContactMech = shipment.getRelatedOne("DestinationPostalAddress"); + destinationContactMech = shipment.getRelatedOne("DestinationPostalAddress", false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment " + shipmentId, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -1774,9 +1773,9 @@ public class InvoiceServices { // get the items of the shipment. They can come from ItemIssuance if the shipment were from a purchase return, ShipmentReceipt if it were from a sales return List<GenericValue> shippedItems = null; if (salesReturnFound) { - shippedItems = shipment.getRelated("ShipmentReceipt"); + shippedItems = shipment.getRelated("ShipmentReceipt", null, null, false); } else if (purchaseReturnFound) { - shippedItems = shipment.getRelated("ItemIssuance"); + shippedItems = shipment.getRelated("ItemIssuance", null, null, false); } if (shippedItems == null) { Debug.logInfo("No items issued for shipments", module); @@ -1912,14 +1911,14 @@ public class InvoiceServices { // we need the related return item and product GenericValue returnItem = null; if (shipmentReceiptFound) { - returnItem = item.getRelatedOneCache("ReturnItem"); + returnItem = item.getRelatedOne("ReturnItem", true); } else if (itemIssuanceFound) { - GenericValue shipmentItem = item.getRelatedOneCache("ShipmentItem"); - GenericValue returnItemShipment = EntityUtil.getFirst(shipmentItem.getRelated("ReturnItemShipment")); - returnItem = returnItemShipment.getRelatedOneCache("ReturnItem"); + GenericValue shipmentItem = item.getRelatedOne("ShipmentItem", true); + GenericValue returnItemShipment = EntityUtil.getFirst(shipmentItem.getRelated("ReturnItemShipment", null, null, false)); + returnItem = returnItemShipment.getRelatedOne("ReturnItem", true); } if (returnItem == null) continue; // Just to prevent NPE - GenericValue product = returnItem.getRelatedOneCache("Product"); + GenericValue product = returnItem.getRelatedOne("Product", true); // extract the return price as a big decimal for convenience BigDecimal returnPrice = returnItem.getBigDecimal("returnPrice"); @@ -1990,7 +1989,7 @@ public class InvoiceServices { promisedTotal = promisedTotal.add(promisedAmount).setScale(DECIMALS, ROUNDING); // for each adjustment related to this ReturnItem, create a separate invoice item - List<GenericValue> adjustments = returnItem.getRelatedCache("ReturnAdjustment"); + List<GenericValue> adjustments = returnItem.getRelated("ReturnAdjustment", null, null, true); for (GenericValue adjustment : adjustments) { if (adjustment.get("amount") == null) { @@ -2057,7 +2056,7 @@ public class InvoiceServices { } // loop through return-wide adjustments and create invoice items for each - List<GenericValue> adjustments = returnHeader.getRelatedByAndCache("ReturnAdjustment", UtilMisc.toMap("returnItemSeqId", "_NA_")); + List<GenericValue> adjustments = returnHeader.getRelated("ReturnAdjustment", UtilMisc.toMap("returnItemSeqId", "_NA_"), null, true); for (GenericValue adjustment : adjustments) { // determine invoice item type from the return item type @@ -3077,7 +3076,7 @@ public class InvoiceServices { // item, if available List<GenericValue> paymentApplications = null; try { - paymentApplications = currentInvoiceItem.getRelated("PaymentApplication"); + paymentApplications = currentInvoiceItem.getRelated("PaymentApplication", null, null, false); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); } @@ -3315,7 +3314,7 @@ public class InvoiceServices { GenericValue payment = delegator.findOne("Payment", UtilMisc.toMap("paymentId", paymentId), false); if (payment == null) throw new GenericServiceException("Payment with ID [" + paymentId + "] not found!"); - List<GenericValue> paymentApplications = payment.getRelated("PaymentApplication"); + List<GenericValue> paymentApplications = payment.getRelated("PaymentApplication", null, null, false); if (UtilValidate.isEmpty(paymentApplications)) return ServiceUtil.returnSuccess(); // TODO: this is inefficient -- instead use HashSet to construct a distinct Set of invoiceIds, then iterate over it and call checkInvoicePaymentAppls Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java Tue Jun 19 21:36:11 2012 @@ -163,7 +163,7 @@ public class InvoiceWorker { List<GenericValue> invoiceItems = null; try { - invoiceItems = invoice.getRelated("InvoiceItem"); + invoiceItems = invoice.getRelated("InvoiceItem", null, null, false); invoiceItems = EntityUtil.filterByAnd( invoiceItems, UtilMisc.toList( EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.NOT_IN, getTaxableInvoiceItemTypeIds(invoice.getDelegator())) @@ -190,7 +190,7 @@ public class InvoiceWorker { */ public static GenericValue getBillToParty(GenericValue invoice) { try { - GenericValue billToParty = invoice.getRelatedOne("Party"); + GenericValue billToParty = invoice.getRelatedOne("Party", false); if (billToParty != null) { return billToParty; } @@ -201,8 +201,7 @@ public class InvoiceWorker { // remaining code is the old method, which we leave here for compatibility purposes List<GenericValue> billToRoles = null; try { - billToRoles = invoice.getRelated("InvoiceRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER"), - UtilMisc.toList("-datetimePerformed")); + billToRoles = invoice.getRelated("InvoiceRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER"), UtilMisc.toList("-datetimePerformed"), false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceRole list", module); } @@ -211,7 +210,7 @@ public class InvoiceWorker { GenericValue role = EntityUtil.getFirst(billToRoles); GenericValue party = null; try { - party = role.getRelatedOne("Party"); + party = role.getRelatedOne("Party", false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting Party from InvoiceRole", module); } @@ -224,7 +223,7 @@ public class InvoiceWorker { /** Convenience method to obtain the bill from party for an invoice. Note that invoice.partyIdFrom is the bill from party. */ public static GenericValue getBillFromParty(GenericValue invoice) { try { - return invoice.getRelatedOne("FromParty"); + return invoice.getRelatedOne("FromParty", false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting FromParty from Invoice", module); } @@ -245,8 +244,7 @@ public class InvoiceWorker { // remaining code is the old method, which we leave here for compatibility purposes List<GenericValue> sendFromRoles = null; try { - sendFromRoles = invoice.getRelated("InvoiceRole", UtilMisc.toMap("roleTypeId", "BILL_FROM_VENDOR"), - UtilMisc.toList("-datetimePerformed")); + sendFromRoles = invoice.getRelated("InvoiceRole", UtilMisc.toMap("roleTypeId", "BILL_FROM_VENDOR"), UtilMisc.toList("-datetimePerformed"), false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceRole list", module); } @@ -255,7 +253,7 @@ public class InvoiceWorker { GenericValue role = EntityUtil.getFirst(sendFromRoles); GenericValue party = null; try { - party = role.getRelatedOne("Party"); + party = role.getRelatedOne("Party", false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting Party from InvoiceRole", module); } @@ -288,7 +286,7 @@ public class InvoiceWorker { List<GenericValue> locations = null; // first try InvoiceContactMech to see if we can find the address needed try { - locations = invoice.getRelated("InvoiceContactMech", UtilMisc.toMap("contactMechPurposeTypeId", contactMechPurposeTypeId), null); + locations = invoice.getRelated("InvoiceContactMech", UtilMisc.toMap("contactMechPurposeTypeId", contactMechPurposeTypeId), null, false); } catch (GenericEntityException e) { Debug.logError("Touble getting InvoiceContactMech entity list", module); } @@ -322,14 +320,14 @@ public class InvoiceWorker { GenericValue contactMech = null; if (UtilValidate.isNotEmpty(locations)) { try { - contactMech = locations.get(0).getRelatedOne("ContactMech"); + contactMech = locations.get(0).getRelatedOne("ContactMech", false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting Contact for contactMechId: " + locations.get(0).getString("contactMechId"), module); } if (contactMech != null && contactMech.getString("contactMechTypeId").equals("POSTAL_ADDRESS")) { try { - postalAddress = contactMech.getRelatedOne("PostalAddress"); + postalAddress = contactMech.getRelatedOne("PostalAddress", false); return postalAddress; } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting PostalAddress for contactMechId: " + contactMech.getString("contactMechId"), module); @@ -476,7 +474,7 @@ public class InvoiceWorker { BigDecimal invoiceItemApplied = ZERO; List<GenericValue> paymentApplications = null; try { - paymentApplications = invoiceItem.getRelated("PaymentApplication"); + paymentApplications = invoiceItem.getRelated("PaymentApplication", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting paymentApplicationlist", module); } @@ -514,16 +512,16 @@ public class InvoiceWorker { try { // check if the invoice is posted and get the conversion from there - List<GenericValue> acctgTransEntries = invoice.getRelated("AcctgTrans"); + List<GenericValue> acctgTransEntries = invoice.getRelated("AcctgTrans", null, null, false); if (UtilValidate.isNotEmpty(acctgTransEntries)) { - GenericValue acctgTransEntry = (acctgTransEntries.get(0)).getRelated("AcctgTransEntry").get(0); + GenericValue acctgTransEntry = (acctgTransEntries.get(0)).getRelated("AcctgTransEntry", null, null, false).get(0); conversionRate = acctgTransEntry.getBigDecimal("amount").divide(acctgTransEntry.getBigDecimal("origAmount"), new MathContext(100)).setScale(decimals,rounding); } // check if a payment is applied and use the currency conversion from there if (UtilValidate.isEmpty(conversionRate)) { - List<GenericValue> paymentAppls = invoice.getRelated("PaymentApplication"); + List<GenericValue> paymentAppls = invoice.getRelated("PaymentApplication", null, null, false); for (GenericValue paymentAppl : paymentAppls) { - GenericValue payment = paymentAppl.getRelatedOne("Payment"); + GenericValue payment = paymentAppl.getRelatedOne("Payment", false); if (UtilValidate.isNotEmpty(payment.getBigDecimal("actualCurrencyAmount"))) { if (UtilValidate.isEmpty(conversionRate)) { conversionRate = payment.getBigDecimal("amount").divide(payment.getBigDecimal("actualCurrencyAmount"),new MathContext(100)).setScale(decimals,rounding); @@ -581,7 +579,7 @@ public class InvoiceWorker { List<GenericValue> invoiceItems = null; if (UtilValidate.isNotEmpty(invoice)) { try { - invoiceItems = invoice.getRelated("InvoiceItem"); + invoiceItems = invoice.getRelated("InvoiceItem", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceItem list", module); } Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java Tue Jun 19 21:36:11 2012 @@ -85,7 +85,7 @@ public class BillingAccountWorker { if (billingAccountRoleList.size() > 0) { BigDecimal totalAvailable = BigDecimal.ZERO; for(GenericValue billingAccountRole : billingAccountRoleList) { - GenericValue billingAccountVO = billingAccountRole.getRelatedOne("BillingAccount"); + GenericValue billingAccountVO = billingAccountRole.getRelatedOne("BillingAccount", false); // skip accounts that have thruDate < nowTimestamp java.sql.Timestamp thruDate = billingAccountVO.getTimestamp("thruDate"); @@ -255,7 +255,7 @@ public class BillingAccountWorker { for (Iterator<GenericValue> pAi = paymentAppls.iterator(); pAi.hasNext();) { GenericValue paymentAppl = pAi.next(); BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied"); - GenericValue invoice = paymentAppl.getRelatedOne("Invoice"); + GenericValue invoice = paymentAppl.getRelatedOne("Invoice", false); if (invoice != null) { // make sure the invoice has not been canceled and it is not a "Customer return invoice" if (!"CUST_RTN_INVOICE".equals(invoice.getString("invoiceTypeId")) && !"INVOICE_CANCELLED".equals(invoice.getString("statusId"))) { Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java Tue Jun 19 21:36:11 2012 @@ -389,7 +389,7 @@ public class GiftCertificateServices { String finAccountAuthId = authTransaction.getString("referenceNum"); try { GenericValue finAccountAuth = delegator.findOne("FinAccountAuth", UtilMisc.toMap("finAccountAuthId", finAccountAuthId), false); - GenericValue giftCard = finAccountAuth.getRelatedOne("FinAccount"); + GenericValue giftCard = finAccountAuth.getRelatedOne("FinAccount", false); // make sure authorization has not expired Timestamp authExpiration = finAccountAuth.getTimestamp("thruDate"); if ((authExpiration != null) && (authExpiration.before(UtilDateTime.nowTimestamp()))) { @@ -634,7 +634,7 @@ public class GiftCertificateServices { // get the GiftCard VO GenericValue giftCard = null; try { - giftCard = paymentPref.getRelatedOne("GiftCard"); + giftCard = paymentPref.getRelatedOne("GiftCard", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get GiftCard from OrderPaymentPreference", module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, @@ -700,7 +700,7 @@ public class GiftCertificateServices { // the order header for store info GenericValue orderHeader = null; try { - orderHeader = orderItem.getRelatedOne("OrderHeader"); + orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem",module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, @@ -743,7 +743,7 @@ public class GiftCertificateServices { // the product entity needed for information GenericValue product = null; try { - product = orderItem.getRelatedOne("Product"); + product = orderItem.getRelatedOne("Product", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get Product from OrderItem", module); } @@ -789,7 +789,7 @@ public class GiftCertificateServices { // get the response answers List<GenericValue> responseAnswers = null; try { - responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer"); + responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, @@ -802,7 +802,7 @@ public class GiftCertificateServices { for(GenericValue answer : responseAnswers) { GenericValue question = null; try { - question = answer.getRelatedOne("SurveyQuestion"); + question = answer.getRelatedOne("SurveyQuestion", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, @@ -955,7 +955,7 @@ public class GiftCertificateServices { // the order header for store info GenericValue orderHeader = null; try { - orderHeader = orderItem.getRelatedOne("OrderHeader"); + orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem",module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, @@ -1025,7 +1025,7 @@ public class GiftCertificateServices { // get the response answers List<GenericValue> responseAnswers = null; try { - responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer"); + responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, @@ -1038,7 +1038,7 @@ public class GiftCertificateServices { for(GenericValue answer : responseAnswers) { GenericValue question = null; try { - question = answer.getRelatedOne("SurveyQuestion"); + question = answer.getRelatedOne("SurveyQuestion", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Tue Jun 19 21:36:11 2012 @@ -130,7 +130,7 @@ public class PaymentGatewayServices { try { orderPaymentPreference = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); - orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader"); + orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -217,7 +217,7 @@ public class PaymentGatewayServices { if (!needsNsfRetry) { // is this an auto-order? if (UtilValidate.isNotEmpty(orderHeader.getString("autoOrderShoppingListId"))) { - GenericValue productStore = orderHeader.getRelatedOne("ProductStore"); + GenericValue productStore = orderHeader.getRelatedOne("ProductStore", false); // according to the store should we try other cards? if ("Y".equals(productStore.getString("autoOrderCcTryOtherCards"))) { // get other credit cards for the bill to party @@ -306,7 +306,7 @@ public class PaymentGatewayServices { return results; } } catch (GeneralException e) { - Debug.logError(e, "Error processing payment authorization: " + e.toString(), module); + Debug.logError(e, "Error processing payment authorization", module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "AccountingPaymentCannotBeAuthorized", UtilMisc.toMap("errroString", e.toString()), locale)); @@ -390,7 +390,7 @@ public class PaymentGatewayServices { try { results = dispatcher.runSync("authOrderPaymentPreference", authContext); } catch (GenericServiceException se) { - Debug.logError(se, "Error in calling authOrderPaymentPreference from authOrderPayments: " + se.toString(), module); + Debug.logError(se, "Error in calling authOrderPaymentPreference from authOrderPayments", module); hadError += 1; messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + se.toString()); continue; @@ -495,7 +495,7 @@ public class PaymentGatewayServices { processContext.put("customerIpAddress", visit.getString("clientIpAddress")); } - GenericValue productStore = orderHeader.getRelatedOne("ProductStore"); + GenericValue productStore = orderHeader.getRelatedOne("ProductStore", false); processContext.put("userLogin", userLogin); processContext.put("orderId", orh.getOrderId()); @@ -634,7 +634,7 @@ public class PaymentGatewayServices { String payToPartyId = "Company"; // default value GenericValue productStore = null; try { - productStore = orderHeader.getRelatedOne("ProductStore"); + productStore = orderHeader.getRelatedOne("ProductStore", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get ProductStore from OrderHeader", module); return null; @@ -650,31 +650,31 @@ public class PaymentGatewayServices { private static String getBillingInformation(OrderReadHelper orh, GenericValue paymentPreference, Map<String, Object> toContext) throws GenericEntityException { // gather the payment related objects. String paymentMethodTypeId = paymentPreference.getString("paymentMethodTypeId"); - GenericValue paymentMethod = paymentPreference.getRelatedOne("PaymentMethod"); + GenericValue paymentMethod = paymentPreference.getRelatedOne("PaymentMethod", false); if (paymentMethod != null && "CREDIT_CARD".equals(paymentMethodTypeId)) { // type credit card - GenericValue creditCard = paymentMethod.getRelatedOne("CreditCard"); - GenericValue billingAddress = creditCard.getRelatedOne("PostalAddress"); + GenericValue creditCard = paymentMethod.getRelatedOne("CreditCard", false); + GenericValue billingAddress = creditCard.getRelatedOne("PostalAddress", false); toContext.put("creditCard", creditCard); toContext.put("billingAddress", billingAddress); } else if (paymentMethod != null && "EFT_ACCOUNT".equals(paymentMethodTypeId)) { // type eft - GenericValue eftAccount = paymentMethod.getRelatedOne("EftAccount"); - GenericValue billingAddress = eftAccount.getRelatedOne("PostalAddress"); + GenericValue eftAccount = paymentMethod.getRelatedOne("EftAccount", false); + GenericValue billingAddress = eftAccount.getRelatedOne("PostalAddress", false); toContext.put("eftAccount", eftAccount); toContext.put("billingAddress", billingAddress); } else if (paymentMethod != null && "GIFT_CARD".equals(paymentMethodTypeId)) { // type gift card - GenericValue giftCard = paymentMethod.getRelatedOne("GiftCard"); + GenericValue giftCard = paymentMethod.getRelatedOne("GiftCard", false); toContext.put("giftCard", giftCard); - GenericValue orderHeader = paymentPreference.getRelatedOne("OrderHeader"); - List<GenericValue> orderItems = orderHeader.getRelated("OrderItem"); + GenericValue orderHeader = paymentPreference.getRelatedOne("OrderHeader", false); + List<GenericValue> orderItems = orderHeader.getRelated("OrderItem", null, null, false); toContext.put("orderId", orderHeader.getString("orderId")); toContext.put("orderItems", orderItems); } else if ("FIN_ACCOUNT".equals(paymentMethodTypeId)) { toContext.put("finAccountId", paymentPreference.getString("finAccountId")); } else if ("EXT_PAYPAL".equals(paymentMethodTypeId)) { - GenericValue payPalPaymentMethod = paymentMethod.getRelatedOne("PayPalPaymentMethod"); + GenericValue payPalPaymentMethod = paymentMethod.getRelatedOne("PayPalPaymentMethod", false); toContext.put("payPalPaymentMethod", payPalPaymentMethod); } else { // add other payment types here; i.e. gift cards, etc. @@ -687,7 +687,7 @@ public class PaymentGatewayServices { GenericValue billToPersonOrGroup = orh.getBillToParty(); GenericValue billToEmail = null; - Collection<GenericValue> emails = ContactHelper.getContactMech(billToPersonOrGroup.getRelatedOne("Party"), "PRIMARY_EMAIL", "EMAIL_ADDRESS", false); + Collection<GenericValue> emails = ContactHelper.getContactMech(billToPersonOrGroup.getRelatedOne("Party", false), "PRIMARY_EMAIL", "EMAIL_ADDRESS", false); if (UtilValidate.isNotEmpty(emails)) { billToEmail = emails.iterator().next(); @@ -843,7 +843,7 @@ public class PaymentGatewayServices { // cancel any payment records List<GenericValue> paymentList = null; try { - paymentList = paymentPref.getRelated("Payment"); + paymentList = paymentPref.getRelated("Payment", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get Payment records from OrderPaymentPreference : " + paymentPref, module); } @@ -979,7 +979,7 @@ public class PaymentGatewayServices { Map<String, Object> resCtx = model.makeValid(releaseResult, ModelService.IN_PARAM); releaseResRes = dispatcher.runSync(model.name, resCtx); } catch (GenericServiceException e) { - Debug.logError(e, "Trouble processing the release results: " + e.getMessage(), module); + Debug.logError(e, "Trouble processing the release results", module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " + e.getMessage()); @@ -1048,7 +1048,7 @@ public class PaymentGatewayServices { // cancel any payment records List<GenericValue> paymentList = null; try { - paymentList = paymentPref.getRelated("Payment"); + paymentList = paymentPref.getRelated("Payment", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get Payment records from OrderPaymentPreference : " + paymentPref, module); } @@ -1105,7 +1105,7 @@ public class PaymentGatewayServices { // get the OrderItemBilling records for this invoice List<GenericValue> orderItemBillings = null; try { - orderItemBillings = invoice.getRelated("OrderItemBilling"); + orderItemBillings = invoice.getRelated("OrderItemBilling", null, null, false); } catch (GenericEntityException e) { Debug.logError("Trouble getting OrderItemBilling(s) from Invoice #" + invoiceId, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -1260,7 +1260,7 @@ public class PaymentGatewayServices { if (captureResult != null) { BigDecimal amountCaptured = (BigDecimal) captureResult.get("captureAmount"); - Debug.logInfo("Amount captured for order [" + orderId + "] from unapplied payments associated to billing account [" + billingAccountId + "] is: " + amountCaptured, module); + if (Debug.infoOn()) Debug.logInfo("Amount captured for order [" + orderId + "] from unapplied payments associated to billing account [" + billingAccountId + "] is: " + amountCaptured, module); amountCaptured = amountCaptured.setScale(decimals, rounding); @@ -1296,7 +1296,7 @@ public class PaymentGatewayServices { } catch (GenericServiceException e) { Debug.logWarning(e, "Problem processing the capture split payment", module); } - Debug.logInfo("Captured: " + amountThisCapture + " Remaining (re-auth): " + splitAmount, module); + if (Debug.infoOn()) Debug.logInfo("Captured: " + amountThisCapture + " Remaining (re-auth): " + splitAmount, module); } } else { Debug.logError("Payment not captured for order [" + orderId + "] from billing account [" + billingAccountId + "]", module); @@ -1392,7 +1392,7 @@ public class PaymentGatewayServices { } catch (GenericServiceException e) { Debug.logWarning(e, "Problem processing the capture split payment", module); } - Debug.logInfo("Captured: " + amountThisCapture + " Remaining (re-auth): " + splitAmount, module); + if (Debug.infoOn()) Debug.logInfo("Captured: " + amountThisCapture + " Remaining (re-auth): " + splitAmount, module); } } else { Debug.logError("Payment not captured", module); @@ -1547,7 +1547,7 @@ public class PaymentGatewayServices { GenericValue orderPaymentPreference = EntityUtil.getFirst(orderPaymentPreferences); // Check the productStore setting to see if we need to do this explicitly - GenericValue productStore = order.getRelatedOne("ProductStore"); + GenericValue productStore = order.getRelatedOne("ProductStore", false); if (productStore.getString("manualAuthIsCapture") == null || (! productStore.getString("manualAuthIsCapture").equalsIgnoreCase("Y"))) { String responseId = delegator.getNextSeqId("PaymentGatewayResponse"); GenericValue pgResponse = delegator.makeValue("PaymentGatewayResponse"); @@ -1606,7 +1606,7 @@ public class PaymentGatewayServices { break; } GenericValue paymentApplication = paymentApplicationsIt.next(); - GenericValue payment = paymentApplication.getRelatedOne("Payment"); + GenericValue payment = paymentApplication.getRelatedOne("Payment", false); if (payment.getString("paymentPreferenceId") != null) { // if the payment is reserved for a specific OrderPaymentPreference, // we don't use it. @@ -1712,7 +1712,7 @@ public class PaymentGatewayServices { // get the new auth transaction authTrans = getAuthTransaction(paymentPref); } catch (GeneralException e) { - Debug.logError(e, "Error re-authorizing payment: " + e.toString(), module); + Debug.logError(e, "Error re-authorizing payment", module); return ServiceUtil.returnError(UtilProperties.getMessage("AccountingUiLabels", "AccountingPaymentReauthorizingError", locale)); } } @@ -1749,7 +1749,7 @@ public class PaymentGatewayServices { captureContext.put("authTrans", authTrans); } - Debug.logInfo("Capture [" + serviceName + "] : " + captureContext, module); + if (Debug.infoOn()) Debug.logInfo("Capture [" + serviceName + "] : " + captureContext, module); try { String paymentMethodTypeId = paymentPref.getString("paymentMethodTypeId"); if (paymentMethodTypeId != null && "GIFT_CARD".equals(paymentMethodTypeId)) { @@ -1912,7 +1912,7 @@ public class PaymentGatewayServices { GenericValue paymentMethod = delegator.findOne("PaymentMethod", UtilMisc.toMap("paymentMethodId", paymentMethodId), false); GenericValue creditCard = null; if (paymentMethod != null && "CREDIT_CARD".equals(paymentMethod.getString("paymentMethodTypeId"))) { - creditCard = paymentMethod.getRelatedOne("CreditCard"); + creditCard = paymentMethod.getRelatedOne("CreditCard", false); } // create the PaymentGatewayResponse @@ -2026,7 +2026,7 @@ public class PaymentGatewayServices { } } } catch (GenericEntityException e) { - Debug.logError(e, "Error updating payment status information: " + e.toString(), module); + Debug.logError(e, "Error updating payment status information", module); return ServiceUtil.returnError(UtilProperties.getMessage("AccountingUiLabels", "AccountingPaymentStatusUpdatingError", UtilMisc.toMap("errorString", e.toString()), locale)); } @@ -2037,9 +2037,9 @@ public class PaymentGatewayServices { boolean needsNsfRetry = false; if (Boolean.TRUE.equals(processContext.get("resultNsf"))) { // only track this for auto-orders, since we will only not fail and re-try on those - GenericValue orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader"); + GenericValue orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader", false); if (UtilValidate.isNotEmpty(orderHeader.getString("autoOrderShoppingListId"))) { - GenericValue productStore = orderHeader.getRelatedOne("ProductStore"); + GenericValue productStore = orderHeader.getRelatedOne("ProductStore", false); if ("Y".equals(productStore.getString("autoOrderCcTryLaterNsf"))) { // one last condition: make sure there have been less than ProductStore.autoOrderCcTryLaterMax // PaymentGatewayResponse records with the same orderPaymentPreferenceId and paymentMethodId (just in case it has changed) @@ -2132,7 +2132,7 @@ public class PaymentGatewayServices { // lookup the order header OrderReadHelper orh = null; try { - GenericValue orderHeader = paymentPreference.getRelatedOne("OrderHeader"); + GenericValue orderHeader = paymentPreference.getRelatedOne("OrderHeader", false); if (orderHeader != null) orh = new OrderReadHelper(orderHeader); } catch (GenericEntityException e) { @@ -2417,7 +2417,7 @@ public class PaymentGatewayServices { GenericValue orderHeader = null; try { - orderHeader = paymentPref.getRelatedOne("OrderHeader"); + orderHeader = paymentPref.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get OrderHeader from OrderPaymentPreference", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -2792,7 +2792,7 @@ public class PaymentGatewayServices { GenericValue capTrans = null; try { List<String> order = UtilMisc.toList("-transactionDate"); - List<GenericValue> transactions = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, order); + List<GenericValue> transactions = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, order, false); List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, CAPTURE_SERVICE_TYPE)); List<GenericValue> capTransactions = EntityUtil.filterByAnd(transactions, exprs); capTrans = EntityUtil.getFirst(capTransactions); @@ -2822,7 +2822,7 @@ public class PaymentGatewayServices { List<GenericValue> authTransactions = null; try { List<String> order = UtilMisc.toList("-transactionDate"); - List<GenericValue> transactions = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, order); + List<GenericValue> transactions = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, order, false); List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, AUTH_SERVICE_TYPE), EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, REAUTH_SERVICE_TYPE)); authTransactions = EntityUtil.filterByOr(transactions, exprs); @@ -2853,7 +2853,7 @@ public class PaymentGatewayServices { GenericValue paymentMethod = null; try { - paymentMethod = orderPaymentPreference.getRelatedOne("PaymentMethod"); + paymentMethod = orderPaymentPreference.getRelatedOne("PaymentMethod", false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -2861,7 +2861,7 @@ public class PaymentGatewayServices { if (paymentMethod != null && paymentMethod.getString("paymentMethodTypeId").equals("CREDIT_CARD")) { GenericValue creditCard = null; try { - creditCard = paymentMethod.getRelatedOne("CreditCard"); + creditCard = paymentMethod.getRelatedOne("CreditCard", false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -3022,7 +3022,7 @@ public class PaymentGatewayServices { // get the billToParty object GenericValue billToParty; try { - billToParty = paymentMethod.getRelatedOne("Party"); + billToParty = paymentMethod.getRelatedOne("Party", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -3310,7 +3310,7 @@ public class PaymentGatewayServices { String paymentMethodId = (String) context.get("paymentMethodId"); GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - Debug.logInfo("Running verifyCreditCard [ " + paymentMethodId + "] for store: " + productStoreId, module); + if (Debug.infoOn()) Debug.logInfo("Running verifyCreditCard [ " + paymentMethodId + "] for store: " + productStoreId, module); GenericValue productStore = null; productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); @@ -3326,7 +3326,7 @@ public class PaymentGatewayServices { } else if (mode.equalsIgnoreCase("UPDATE")) { amount = UtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_update.auth"); } - Debug.logInfo("Running credit card verification [" + paymentMethodId + "] (" + amount + ") : " + productStorePaymentProperties + " : " + mode, module); + if (Debug.infoOn()) Debug.logInfo("Running credit card verification [" + paymentMethodId + "] (" + amount + ") : " + productStorePaymentProperties + " : " + mode, module); if (UtilValidate.isNotEmpty(amount)) { BigDecimal authAmount = new BigDecimal(amount); @@ -3685,7 +3685,7 @@ public class PaymentGatewayServices { cal.setTimeInMillis(txStamp.getTime()); cal.add(Calendar.MINUTE, 2); Timestamp twoMinAfter = new Timestamp(cal.getTimeInMillis()); - Debug.logInfo("Re-Auth Capture Test : Tx Date - " + txStamp + " : 2 Min - " + twoMinAfter + " : Now - " + nowStamp, module); + if (Debug.infoOn()) Debug.logInfo("Re-Auth Capture Test : Tx Date - " + txStamp + " : 2 Min - " + twoMinAfter + " : Now - " + nowStamp, module); if (nowStamp.after(twoMinAfter)) { result.put("captureResult", Boolean.FALSE); @@ -3748,7 +3748,7 @@ public class PaymentGatewayServices { List<GenericValue> returnItemResponses = FastList.newInstance(); try { - returnItemResponses = orderHeader.getRelated("ReplacementReturnItemResponse"); + returnItemResponses = orderHeader.getRelated("ReplacementReturnItemResponse", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); return replacementOrderFlag; Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java Tue Jun 19 21:36:11 2012 @@ -69,13 +69,13 @@ public class PaymentWorker { paymentMethodValueMaps.add(valueMap); valueMap.put("paymentMethod", paymentMethod); if ("CREDIT_CARD".equals(paymentMethod.getString("paymentMethodTypeId"))) { - GenericValue creditCard = paymentMethod.getRelatedOne("CreditCard"); + GenericValue creditCard = paymentMethod.getRelatedOne("CreditCard", false); if (creditCard != null) valueMap.put("creditCard", creditCard); } else if ("GIFT_CARD".equals(paymentMethod.getString("paymentMethodTypeId"))) { - GenericValue giftCard = paymentMethod.getRelatedOne("GiftCard"); + GenericValue giftCard = paymentMethod.getRelatedOne("GiftCard", false); if (giftCard != null) valueMap.put("giftCard", giftCard); } else if ("EFT_ACCOUNT".equals(paymentMethod.getString("paymentMethodTypeId"))) { - GenericValue eftAccount = paymentMethod.getRelatedOne("EftAccount"); + GenericValue eftAccount = paymentMethod.getRelatedOne("EftAccount", false); if (eftAccount != null) valueMap.put("eftAccount", eftAccount); } } @@ -239,9 +239,9 @@ public class PaymentWorker { paymentApplication = delegator.findOne("PaymentApplication", UtilMisc.toMap("paymentApplicationId", paymentApplicationId), false); appliedAmount = paymentApplication.getBigDecimal("amountApplied"); if (paymentApplication.get("paymentId") != null) { - GenericValue payment = paymentApplication.getRelatedOne("Payment"); + GenericValue payment = paymentApplication.getRelatedOne("Payment", false); if (paymentApplication.get("invoiceId") != null && payment.get("actualCurrencyAmount") != null && payment.get("actualCurrencyUomId") != null) { - GenericValue invoice = paymentApplication.getRelatedOne("Invoice"); + GenericValue invoice = paymentApplication.getRelatedOne("Invoice", false); if (payment.getString("actualCurrencyUomId").equals(invoice.getString("currencyUomId"))) { appliedAmount = appliedAmount.multiply(payment.getBigDecimal("amount")).divide(payment.getBigDecimal("actualCurrencyAmount"),new MathContext(100)); } @@ -283,7 +283,7 @@ public class PaymentWorker { BigDecimal amountApplied = paymentApplication.getBigDecimal("amountApplied"); // check currency invoice and if different convert amount applied for display if (actual.equals(Boolean.FALSE) && paymentApplication.get("invoiceId") != null && payment.get("actualCurrencyAmount") != null && payment.get("actualCurrencyUomId") != null) { - GenericValue invoice = paymentApplication.getRelatedOne("Invoice"); + GenericValue invoice = paymentApplication.getRelatedOne("Invoice", false); if (payment.getString("actualCurrencyUomId").equals(invoice.getString("currencyUomId"))) { amountApplied = amountApplied.multiply(payment.getBigDecimal("amount")).divide(payment.getBigDecimal("actualCurrencyAmount"),new MathContext(100)); } Modified: ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java Tue Jun 19 21:36:11 2012 @@ -107,7 +107,7 @@ public class AIMPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue creditCard = null; try { - creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference); + creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference, false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -155,7 +155,7 @@ public class AIMPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue creditCard = null; try { - creditCard = delegator.getRelatedOne("CreditCard", orderPaymentPreference); + creditCard = delegator.getRelatedOne("CreditCard", orderPaymentPreference, false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -499,13 +499,13 @@ public class AIMPaymentServices { // sometimes the ccAuthCapture interface is used, in which case the creditCard is passed directly GenericValue creditCard = (GenericValue) params.get("creditCard"); if (creditCard == null || ! (opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) { - creditCard = opp.getRelatedOne("CreditCard"); + creditCard = opp.getRelatedOne("CreditCard", false); } AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard"))); AIMRequest.put("x_Last_Name", UtilFormatOut.checkNull(creditCard.getString("lastNameOnCard"))); AIMRequest.put("x_Company", UtilFormatOut.checkNull(creditCard.getString("companyNameOnCard"))); if (UtilValidate.isNotEmpty(creditCard.getString("contactMechId"))) { - GenericValue address = creditCard.getRelatedOne("PostalAddress"); + GenericValue address = creditCard.getRelatedOne("PostalAddress", false); if (address != null) { AIMRequest.put("x_Address", UtilFormatOut.checkNull(address.getString("address1"))); AIMRequest.put("x_City", UtilFormatOut.checkNull(address.getString("city"))); |
| Free forum by Nabble | Edit this page |
