Author: jaz
Date: Mon Apr 2 23:16:25 2007 New Revision: 525049 URL: http://svn.apache.org/viewvc?view=rev&rev=525049 Log: added new account type; REPLENISH_ACCOUNT; added ability to specify dynamic content in the name of the account (TYPE description of the feature) using flexible string expansion Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.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=525049&r1=525048&r2=525049 ============================================================================== --- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Mon Apr 2 23:16:25 2007 @@ -75,9 +75,10 @@ <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_AUTOMATIC" hasTable="N" 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"/> <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=""/> 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=525049&r1=525048&r2=525049 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Mon Apr 2 23:16:25 2007 @@ -28,6 +28,7 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.base.util.*; +import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.order.finaccount.FinAccountHelper; @@ -123,6 +124,39 @@ if (billToParty != null) { partyId = billToParty.getString("partyId"); } + + // some person data for expanding + GenericValue partyGroup = null; + GenericValue person = null; + GenericValue party = null; + + if (billToParty != null) { + try { + party = billToParty.getRelatedOne("Party"); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + if (party != null) { + String partyTypeId = party.getString("partyTypeId"); + if ("PARTY_GROUP".equals(partyTypeId)) { + partyGroup = billToParty; + } else if ("PERSON".equals(partyTypeId)) { + person = billToParty; + } + } + } + + // create the context for FSE + Map expContext = FastMap.newInstance(); + expContext.put("orderHeader", orderHeader); + expContext.put("orderItem", orderItem); + expContext.put("party", party); + expContext.put("person", person); + expContext.put("partyGroup", partyGroup); + + // expand the name field to dynamicly add information + FlexibleStringExpander exp = new FlexibleStringExpander(finAccountName); + finAccountName = exp.expandString(expContext); // price/amount/quantity to create initial deposit amount BigDecimal quantity = orderItem.getBigDecimal("quantity"); |
Free forum by Nabble | Edit this page |