Author: jaz
Date: Sun Apr 22 08:12:08 2007 New Revision: 531196 URL: http://svn.apache.org/viewvc?view=rev&rev=531196 Log: updated FinAccounts added isRefundable flag; and replenishPaymentId to link a payment method to a finaccount for auto-replenish modes. The fulfillment service also sets this ID by default to the CC or EFT account used in the order which creates the finaccount Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?view=diff&rev=531196&r1=531195&r2=531196 ============================================================================== --- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Sun Apr 22 08:12:08 2007 @@ -74,12 +74,13 @@ <FinAccountTransType description="Withdraw" finAccountTransTypeId="WITHDRAWAL" hasTable="N" parentTypeId=""/> <FinAccountTransType description="Adjustment" finAccountTransTypeId="ADJUSTMENT" hasTable="N" parentTypeId=""/> - <FinAccountType description="Gift Certificate" finAccountTypeId="GIFTCERT_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" parentTypeId=""/> - <FinAccountType description="Deposit Account" finAccountTypeId="DEPOSIT_ACCOUNT" replenishEnumId="FARP_MANUAL" hasTable="N" parentTypeId=""/> - <FinAccountType description="Bank Account" finAccountTypeId="BANK_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" parentTypeId="DEPOSIT_ACCOUNT"/> - <FinAccountType description="Investment Account" finAccountTypeId="INVESTMENT_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" parentTypeId="DEPOSIT_ACCOUNT"/> - <FinAccountType description="Replenish Account" finAccountTypeId="REPLENISH_ACCOUNT" hasTable="N" replenishEnumId="FARP_AUTOMATIC" parentTypeId="DEPOSIT_ACCOUNT"/> - + <FinAccountType description="Gift Certificate" finAccountTypeId="GIFTCERT_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" isRefundable="N" parentTypeId=""/> + <FinAccountType description="Deposit Account" finAccountTypeId="DEPOSIT_ACCOUNT" replenishEnumId="FARP_MANUAL" hasTable="N" isRefundable="Y" parentTypeId=""/> + <FinAccountType description="Bank Account" finAccountTypeId="BANK_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" isRefundable="Y" parentTypeId="DEPOSIT_ACCOUNT"/> + <FinAccountType description="Investment Account" finAccountTypeId="INVESTMENT_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" isRefundable="Y" parentTypeId="DEPOSIT_ACCOUNT"/> + <FinAccountType description="Replenish Account" finAccountTypeId="REPLENISH_ACCOUNT" hasTable="N" replenishEnumId="FARP_AUTOMATIC" isRefundable="Y" parentTypeId="DEPOSIT_ACCOUNT"/> + <FinAccountType description="Service Credit Account" finAccountTypeId="SVCCRED_ACCOUNT" hasTable="N" replenishEnumId="FARP_MANUAL" isRefundable="N" parentTypeId=""/> + <FixedAssetType description="Equipment" fixedAssetTypeId="EQUIPMENT" hasTable="N" parentTypeId=""/> <FixedAssetType description="The fixed asset used in the operation-routing definition" fixedAssetTypeId="PRODUCTION_EQUIPMENT" hasTable="N" parentTypeId=""/> <FixedAssetType description="Group of machines, used for task and routing definition" fixedAssetTypeId="GROUP_EQUIPMENT" hasTable="N" parentTypeId=""/> Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?view=diff&rev=531196&r1=531195&r2=531196 ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Sun Apr 22 08:12:08 2007 @@ -338,7 +338,9 @@ <field name="postToGlAccountId" type="id"></field> <field name="fromDate" type="date-time"><description>Describes when account will be valid. If null, valid immediately.</description></field> <field name="thruDate" type="date-time"><description>Expiration date of the account. If null, will never expire.</description></field> - <field name="isFrozen" type="indicator"></field> + <field name="isFrozen" type="indicator"></field> + <field name="isRefundable" type="indicator"></field> + <field name="replenishPaymentId" type="id"></field> <field name="replenishLevel" type="currency-amount"></field> <field name="actualBalance" type="currency-amount"><description>Calculated as the sum of FinAccountTrans.amount</description></field> <field name="availableBalance" type="currency-amount"><description>Calculated as actualBalance minus sum of outstanding FinAccountAuth.amount</description></field> @@ -358,6 +360,9 @@ <relation type="one" fk-name="FINACCT_GLAC" title="PostTo" rel-entity-name="GlAccount"> <key-map field-name="postToGlAccountId" rel-field-name="glAccountId"/> </relation> + <relation type="one" fk-name="FINACCT_PAYMETH" title="Replenish" rel-entity-name="PaymentMethod"> + <key-map field-name="replenishPaymentId" rel-field-name="paymentMethodId"/> + </relation> <relation type="many" rel-entity-name="FinAccountTypeAttr"> <key-map field-name="finAccountTypeId"/> </relation> @@ -504,6 +509,7 @@ <field name="finAccountTypeId" type="id-ne"></field> <field name="parentTypeId" type="id-ne"></field> <field name="replenishEnumId" type="id-ne"></field> + <field name="isRefundable" type="indicator"></field> <field name="hasTable" type="indicator"></field> <field name="description" type="description"></field> <prim-key field="finAccountTypeId"/> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?view=diff&rev=531196&r1=531195&r2=531196 ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Sun Apr 22 08:12:08 2007 @@ -32,6 +32,26 @@ <set from-field="finAccountId" field="newEntity.finAccountId"/> </if-empty> + <!-- set the refundable flag from the type; if not set --> + <if-empty field-name="newEntity.isRefundable"> + <entity-one entity-name="FinAccountType" value-name="finAccountType"> + <field-map field-name="finAccountTypeId" env-name="parameters.finAccountTypeId"/> + </entity-one> + <if> + <condition> + <and> + <not> + <if-empty field-name="finAccountType.isRefundable"/> + </not> + <if-compare field-name="finAccountType.isRefundable" value="Y" operator="equals"/> + </and> + </condition> + <then> + <set field="newEntity.isRefundable" value="Y"/> + </then> + </if> + </if-empty> + <create-value value-name="newEntity"/> <field-to-result field-name="finAccountId" map-name="newEntity" result-name="finAccountId"/> </simple-method> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java?view=diff&rev=531196&r1=531195&r2=531196 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Sun Apr 22 08:12:08 2007 @@ -126,6 +126,20 @@ partyId = billToParty.getString("partyId"); } + // payment method info + List payPrefs = orh.getPaymentPreferences(); + String paymentMethodId = null; + if (payPrefs != null) { + Iterator i = payPrefs.iterator(); + while (i.hasNext()) { + // needs to be a CC or EFT account + GenericValue pref = (GenericValue) i.next(); + String type = pref.getString("paymentMethodTypeId"); + if ("CREDIT_CARD".equals(type) || "EFT_ACCOUNT".equals(type)) { + paymentMethodId = pref.getString("paymentMethodId"); + } + } + } // some person data for expanding GenericValue partyGroup = null; GenericValue person = null; @@ -179,6 +193,7 @@ // if we auto-replenish this type; set the level to the initial deposit if (replenishEnumId != null && "FARP_AUTOMATIC".equals(replenishEnumId)) { createCtx.put("replenishLevel", new Double(deposit.doubleValue())); + createCtx.put("replenishPaymentId", paymentMethodId); } Map createResp; |
Free forum by Nabble | Edit this page |