svn commit: r570039 - in /ofbiz/trunk/applications: accounting/config/ accounting/data/ accounting/entitydef/ accounting/script/org/ofbiz/accounting/finaccount/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/finaccount/ accounting/widget/ e...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r570039 - in /ofbiz/trunk/applications: accounting/config/ accounting/data/ accounting/entitydef/ accounting/script/org/ofbiz/accounting/finaccount/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/finaccount/ accounting/widget/ e...

jonesde
Author: jonesde
Date: Mon Aug 27 01:42:11 2007
New Revision: 570039

URL: http://svn.apache.org/viewvc?rev=570039&view=rev
Log:
A bit of a change: removed isFrozen and inGoodStanding fields from FinAccount, replaced by the new statusId field and FinAccountStatus entity; added/changed supporting services; updated relevant UI and automated routines; should all be in place now

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels_ru.properties
    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/servicedef/services_finaccount.xml
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
    ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/FinAccountDetail.ftl
    ofbiz/trunk/applications/ecommerce/widget/CustomerScreens.xml
    ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/FinAccounts.ftl
    ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Mon Aug 27 01:42:11 2007
@@ -815,7 +815,6 @@
 FormFieldTitle_finAccountTypeId=Fin Account Type Id
 FormFieldTitle_ownerPartyId=Owner Party Id
 FormFieldTitle_postToGlAccountId=Post To Gl Account Id
-FormFieldTitle_isFrozen=Is Frozen
 FormFieldTitle_isRefundable=Is Refundable
 FormFieldTitle_replenishLevel=Replenish Level
 FormFieldTitle_replenishPaymentId=Replenish Payment Id

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels_it.properties Mon Aug 27 01:42:11 2007
@@ -780,7 +780,6 @@
 FormFieldTitle_finAccountTypeId=Tipo Conto Finanziario
 FormFieldTitle_ownerPartyId=Soggetto Proprietario
 FormFieldTitle_postToGlAccountId=Contabilizza su Conto Gl
-FormFieldTitle_isFrozen=E' Congelato
 FormFieldTitle_isRefundable=E' Rimborsabile
 FormFieldTitle_replenishLevel=Livello Rifornimento
 FormFieldTitle_replenishPaymentId=Pagamento Rifornimento

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels_ru.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels_ru.properties?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels_ru.properties (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels_ru.properties Mon Aug 27 01:42:11 2007
@@ -719,7 +719,6 @@
 FormFieldTitle_invoiceProcessing=\u041D\u0430\u0437\u043D\u0430\u0447\u0438\u0442\u044C \u043D\u0430 \u0432\u0441\u044E \u043D\u0430\u043A\u043B\u0430\u0434\u043D\u0443\u044E
 FormFieldTitle_invoiceSequenceEnumId=Invoice Sequence
 FormFieldTitle_invoiceTypeId=\u0422\u0438\u043F \u043D\u0430\u043A\u043B\u0430\u0434\u043D\u043E\u0439
-FormFieldTitle_isFrozen=\u0417\u0430\u043C\u043E\u0440\u043E\u0436\u0435\u043D
 FormFieldTitle_isPosted=\u041F\u0440\u043E\u0432\u0435\u0434\u0435\u043D\u043E
 FormFieldTitle_isRefundable=\u0412\u043E\u0437\u043C\u0435\u0449\u0430\u0435\u043C\u044B\u0439
 FormFieldTitle_isSummary=\u0420\u0435\u0437\u044E\u043C\u0435?

Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Mon Aug 27 01:42:11 2007
@@ -81,6 +81,22 @@
     <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=""/>
 
+    <StatusType description="Financial Account Status" hasTable="N" parentTypeId="" statusTypeId="FINACCT_STATUS"/>
+    <StatusItem description="Active" sequenceId="01" statusCode="ACTIVE" statusId="FNACT_ACTIVE" statusTypeId="FINACCT_STATUS"/>
+    <!-- This is set automatically by the auto-replenishment code to allow one transaction to bring the balance below zero and then if any other transactions are attempted during replenishment they will be rejected. Was inGoodStanding -->
+    <StatusItem description="Negative Pending Replenishment" sequenceId="02" statusCode="NEGPENDREPL" statusId="FNACT_NEGPENDREPL" statusTypeId="FINACCT_STATUS"/>
+    <!-- This is meant to be set manually by a company representative to freeze an account so further transactions are not allowed. Was isFrozen -->
+    <StatusItem description="Manually Frozen" sequenceId="03" statusCode="MANFROZEN" statusId="FNACT_MANFROZEN" statusTypeId="FINACCT_STATUS"/>
+    <StatusItem description="Cancelled" sequenceId="09" statusCode="CANCELLED" statusId="FNACT_CANCELLED" statusTypeId="FINACCT_STATUS"/>
+    <StatusValidChange condition="" statusId="FNACT_ACTIVE" statusIdTo="FNACT_NEGPENDREPL" transitionName="Set Negative Pending Replenishment"/>
+    <StatusValidChange condition="" statusId="FNACT_ACTIVE" statusIdTo="FNACT_MANFROZEN" transitionName="Set Manually Frozen"/>
+    <StatusValidChange condition="" statusId="FNACT_ACTIVE" statusIdTo="FNACT_CANCELLED" transitionName="Cancel"/>
+    <StatusValidChange condition="" statusId="FNACT_NEGPENDREPL" statusIdTo="FNACT_ACTIVE" transitionName="Re-activate"/>
+    <StatusValidChange condition="" statusId="FNACT_NEGPENDREPL" statusIdTo="FNACT_MANFROZEN" transitionName="Manually Freeze"/>
+    <StatusValidChange condition="" statusId="FNACT_NEGPENDREPL" statusIdTo="FNACT_CANCELLED" transitionName="Cancel"/>
+    <StatusValidChange condition="" statusId="FNACT_MANFROZEN" statusIdTo="FNACT_ACTIVE" transitionName="Re-activate"/>
+    <StatusValidChange condition="" statusId="FNACT_MANFROZEN" statusIdTo="FNACT_CANCELLED" transitionName="Cancel"/>
+    
     <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?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Mon Aug 27 01:42:11 2007
@@ -329,6 +329,7 @@
     <entity entity-name="FinAccount" package-name="org.ofbiz.accounting.finaccount" title="Financial Account Entity">
         <field name="finAccountId" type="id-ne"></field>
         <field name="finAccountTypeId" type="id"></field>
+        <field name="statusId" type="id"></field>
         <field name="finAccountName" type="name"></field>
         <field name="finAccountCode" type="long-varchar" encrypt="true"></field>
         <field name="finAccountPin" type="long-varchar" encrypt="true"></field>
@@ -338,13 +339,13 @@
         <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"><description>This is meant to be set manually by a company representative to freeze an account so further transactions are not allowed.</description></field>
-        <field name="inGoodStanding" type="indicator"><description>This is set automatically by the auto-replenishment code to allow one transaction to bring the balance below zero and then if any other transactions are attempted during replenishment they will be rejected.</description></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>
+        <field name="oldIsFrozen" col-name="IS_FROZEN" type="indicator"><description>DEPRECATED: This is meant to be set manually by a company representative to freeze an account so further transactions are not allowed.</description></field>
+        <field name="oldInGoodStanding" col-name="IN_GOOD_STANDING" type="indicator"><description>DEPRECATED: This is set automatically by the auto-replenishment code to allow one transaction to bring the balance below zero and then if any other transactions are attempted during replenishment they will be rejected.</description></field>
         <prim-key field="finAccountId"/>
         <relation type="one" fk-name="FINACCT_TYPE" rel-entity-name="FinAccountType">
             <key-map field-name="finAccountTypeId"/>
@@ -368,9 +369,7 @@
             <key-map field-name="finAccountTypeId"/>
         </relation>
     </entity>
-    <view-entity entity-name="FinAccountAndRole"
-                 package-name="org.ofbiz.accounting.finaccount"
-                 title="Financial Account and Role View Entity">
+    <view-entity entity-name="FinAccountAndRole" package-name="org.ofbiz.accounting.finaccount" title="Financial Account and Role View Entity">
       <member-entity entity-alias="FA" entity-name="FinAccount"/>
       <member-entity entity-alias="FR" entity-name="FinAccountRole"/>
       <alias-all entity-alias="FA"/>
@@ -382,7 +381,6 @@
         <key-map field-name="finAccountId"/>
       </view-link>
     </view-entity>
-
     <entity entity-name="FinAccountAttribute" package-name="org.ofbiz.accounting.finaccount" title="Financial Account Attribute Entity">
         <field name="finAccountId" type="id-ne"></field>
         <field name="attrName" type="id-long-ne"></field>
@@ -430,6 +428,21 @@
         <relation type="one" fk-name="FIN_ACT_RL_RTRL" rel-entity-name="PartyRole">
             <key-map field-name="partyId"/>
             <key-map field-name="roleTypeId"/>
+        </relation>
+    </entity>
+    <entity entity-name="FinAccountStatus" package-name="org.ofbiz.accounting.finaccount" title="Financial Account Status Entity">
+        <field name="finAccountId" type="id-ne"></field>
+        <field name="statusId" type="id"></field>
+        <field name="statusDate" type="date-time"></field>
+        <field name="statusEndDate" type="date-time"></field>
+        <prim-key field="finAccountId"/>
+        <prim-key field="statusId"/>
+        <prim-key field="statusDate"/>
+        <relation type="one" fk-name="FINACT_STTS_FNA" rel-entity-name="FinAccount">
+            <key-map field-name="finAccountId"/>
+        </relation>
+        <relation type="one" fk-name="FINACT_STTS_STI" rel-entity-name="StatusItem">
+            <key-map field-name="statusId"/>
         </relation>
     </entity>
     <entity entity-name="FinAccountTrans" package-name="org.ofbiz.accounting.finaccount" title="Financial Account Transaction Entity">

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?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Mon Aug 27 01:42:11 2007
@@ -61,11 +61,37 @@
 
         <create-value value-name="newEntity"/>
         <field-to-result field-name="finAccountId" map-name="newEntity" result-name="finAccountId"/>
+        
+        <set-service-fields service-name="createFinAccountStatus" map-name="newEntity" to-map-name="createFinAccountStatusMap"/>
+        <call-service service-name="createFinAccountStatus" in-map-name="createFinAccountStatusMap"/>
     </simple-method>
     <simple-method method-name="updateFinAccount" short-description="Update a Financial Account">
         <entity-one entity-name="FinAccount" value-name="lookedUpValue"/>
         <field-to-result field-name="lookedUpValue.replenishPaymentId" result-name="oldReplenishPaymentId"/>
         <field-to-result field-name="lookedUpValue.replenishLevel" result-name="oldReplenishLevel"/>
+
+        <!-- handle statusId change stuff; first put the current statusId in the oldStatusId result -->
+        <field-to-result field-name="lookedUpValue.statusId" result-name="oldStatusId"/>
+        <if-compare-field field-name="lookedUpValue.statusId" operator="not-equals" to-field-name="parameters.statusId">
+            <!-- if the record exists there should be a statusId, but just in case make it so it won't blow up -->
+            <if-not-empty field-name="lookedUpValue.statusId">
+                <!-- if statusId change is not in the StatusValidChange list, complain... -->
+                <entity-one entity-name="StatusValidChange" value-name="statusValidChange" auto-field-map="false">
+                    <field-map field-name="statusId" env-name="lookedUpValue.statusId"/>
+                    <field-map field-name="statusIdTo" env-name="parameters.statusId"/>
+                </entity-one>
+                <if-empty field-name="statusValidChange">
+                    <!-- no valid change record found? return an error... -->
+                    <add-error><fail-property resource="CommonUiLabels" property="CommonErrorNoStatusValidChange"/></add-error>
+                    <check-errors/>
+                </if-empty>
+            </if-not-empty>
+            
+            <!-- before we set the nonpk fields, if the statusId is different save a status history record -->
+            <set-service-fields service-name="createFinAccountStatus" map-name="parameters" to-map-name="createFinAccountStatusMap"/>
+            <call-service service-name="createFinAccountStatus" in-map-name="createFinAccountStatusMap"/>
+        </if-compare-field>
+
         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
         <store-value value-name="lookedUpValue"/>
         
@@ -76,6 +102,27 @@
     <simple-method method-name="deleteFinAccount" short-description="Delete a Financial Account">
         <entity-one value-name="finAccount" entity-name="FinAccount"/>
         <remove-value value-name="finAccount"/>
+    </simple-method>
+    
+    <simple-method method-name="createFinAccountStatus" short-description="Create FinAccountStatus">
+        <now-timestamp-to-env env-name="nowTimestamp"/>
+        
+        <!-- find the most recent status record and set the statusEndDate -->
+        <entity-and entity-name="FinAccountStatus" list-name="oldFinAccountStatusList">
+            <field-map field-name="finAccountId" env-name="parameters.finAccountId"/>
+            <order-by field-name="-statusDate"/>
+        </entity-and>
+        <first-from-list entry-name="oldFinAccountStatus" list-name="oldFinAccountStatusList"/>
+        <if-not-empty field-name="oldFinAccountStatus">
+            <set field="oldFinAccountStatus.statusEndDate" from-field="nowTimestamp"/>
+            <store-value value-name="oldFinAccountStatus"/>
+        </if-not-empty>
+        
+        <make-value entity-name="FinAccountStatus" value-name="newEntity"/>
+        <set-pk-fields map-name="parameters" value-name="newEntity"/>
+        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+        <set field="newEntity.statusDate" from-field="nowTimestamp"/>
+        <create-value value-name="newEntity"/>  
     </simple-method>
 
     <!-- FinAccountTrans Services -->    

Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Mon Aug 27 01:42:11 2007
@@ -42,6 +42,7 @@
             <exclude field-name="actualBalance"/>
             <exclude field-name="availableBalance"/>
         </auto-attributes>
+        <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
         <attribute name="oldReplenishPaymentId" type="String" mode="OUT" optional="true"/>
         <attribute name="oldReplenishLevel" type="Double" mode="OUT" optional="true"/>
         <attribute name="replenishPaymentId" type="String" mode="OUT" optional="true"/>
@@ -62,7 +63,16 @@
         <description>Update FinAccount.availableBalance based on a new FinAccountAuth; meant to be called as an EECA as it is for data maintenance</description>
         <attribute name="finAccountAuthId" type="String" mode="IN" optional="false"/>
     </service>
+    <service name="createFinAccountStatus" default-entity-name="FinAccountStatus" engine="simple"
+        location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createFinAccountStatus" auth="true">
+        <description>Create a FinAccountStatus</description>
+        <auto-attributes include="all" mode="IN" optional="false">
+            <exclude field-name="statusDate"/>
+            <exclude field-name="statusEndDate"/>
+        </auto-attributes>
+    </service>
     
+    <!-- Financial Account Transaction -->
     <service name="createFinAccountTrans" engine="simple" default-entity-name="FinAccountTrans"
             location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createFinAccountTrans">
         <description>Create a new Financial Account Transaction.  Will use current timestamp for entryDate and trasanctionDate if none is provided.</description>
@@ -174,11 +184,11 @@
         <attribute name="finAccountId" type="String" mode="IN" optional="false"/>
         <attribute name="availableBalance" type="Double" mode="OUT" optional="false"/>
         <attribute name="balance" type="Double" mode="OUT" optional="false"/>
-        <attribute name="isFrozen" type="Boolean" mode="OUT" optional="false"/>
+        <attribute name="statusId" type="String" mode="OUT" optional="false"/>
     </service>
     <service name="checkFinAccountStatus" engine="java"
             location="org.ofbiz.accounting.finaccount.FinAccountServices" invoke="checkFinAccountStatus" auth="true">
-        <description>Checks the status of the financial account; changes the isFrozen flag</description>
+        <description>Checks the status of the financial account; may set statusId to FNACT_MANFROZEN or FNACT_ACTIVE</description>
         <attribute name="finAccountAuthId" type="String" mode="IN" optional="true"/>
         <attribute name="finAccountId" type="String" mode="IN" optional="true"/>
     </service>

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Mon Aug 27 01:42:11 2007
@@ -117,6 +117,7 @@
 
         String finAccountTypeId = finAccount.getString("finAccountTypeId");
         finAccountId = finAccount.getString("finAccountId");
+        String statusId = finAccount.getString("statusId");
 
         try {
             // fin the store requires a pin number; validate the PIN with the code
@@ -167,36 +168,21 @@
                 return result;
             }
 
-            // check for account being in bad standing
-            String inGoodStanding = finAccount.getString("inGoodStanding");
-            if (inGoodStanding != null && "N".equals(inGoodStanding)) {
+            // check for account being in bad standing somehow
+            if ("FNACT_NEGPENDREPL".equals(statusId) || "FNACT_MANFROZEN".equals(statusId) || "FNACT_CANCELLED".equals(statusId)) {
                 // refresh the finaccount
                 finAccount.refresh();
-                inGoodStanding = finAccount.getString("inGoodStanding");
+                statusId = finAccount.getString("statusId");
 
-                if (inGoodStanding != null && "N".equals(inGoodStanding)) {
+                if ("FNACT_NEGPENDREPL".equals(statusId) || "FNACT_MANFROZEN".equals(statusId) || "FNACT_CANCELLED".equals(statusId)) {
                     Map result = ServiceUtil.returnSuccess();
-                    result.put("authMessage", "Account is currently not in good standing");
-                    result.put("authResult", Boolean.FALSE);
-                    result.put("processAmount", amount);
-                    result.put("authFlag", "0");
-                    result.put("authCode", "A");
-                    result.put("authRefNum", "0");
-                    Debug.logWarning("Unable to auth FinAccount: " + result, module);
-                    return result;
-                }
-            }
-
-            // check for account being frozen
-            String isFrozen = finAccount.getString("isFrozen");
-            if (isFrozen != null && "Y".equals(isFrozen)) {
-                // refresh the finaccount
-                finAccount.refresh();
-                isFrozen = finAccount.getString("isFrozen");
-
-                if (isFrozen != null && "Y".equals(isFrozen)) {
-                    Map result = ServiceUtil.returnSuccess();
-                    result.put("authMessage", "Account is currently frozen");
+                    if ("FNACT_NEGPENDREPL".equals(statusId)) {
+                        result.put("authMessage", "Account is currently negative and pending replenishment");
+                    } else if ("FNACT_MANFROZEN".equals(statusId)) {
+                        result.put("authMessage", "Account is currently frozen");
+                    } else if ("FNACT_CANCELLED".equals(statusId)) {
+                        result.put("authMessage", "Account has been cancelled");
+                    }
                     result.put("authResult", Boolean.FALSE);
                     result.put("processAmount", amount);
                     result.put("authFlag", "0");
@@ -678,6 +664,7 @@
             return ServiceUtil.returnError("Invalid financial account [" + finAccountId + "]");
         }
         String currency = finAccount.getString("currencyUomId");
+        String statusId = finAccount.getString("statusId");
 
         // look up the type -- determine auto-replenish is active
         GenericValue finAccountType;
@@ -740,13 +727,15 @@
             return ServiceUtil.returnSuccess();        
         }
 
-        // configure rollback service to set good standing flag
-        Map rollbackCtx = UtilMisc.toMap("userLogin", userLogin, "finAccountId", finAccountId, "inGoodStanding", "N");
-        try {
-            dispatcher.addRollbackService("updateFinAccount", rollbackCtx, true);
-        } catch (GenericServiceException e) {
-            Debug.logError(e, module);
-            return ServiceUtil.returnError(e.getMessage());
+        // configure rollback service to set status to Negative Pending Replenishment
+        if ("FNACT_NEGPENDREPL".equals(statusId)) {
+            Map rollbackCtx = UtilMisc.toMap("userLogin", userLogin, "finAccountId", finAccountId, "statusId", "FNACT_NEGPENDREPL");
+            try {
+                dispatcher.addRollbackService("updateFinAccount", rollbackCtx, true);
+            } catch (GenericServiceException e) {
+                Debug.logError(e, module);
+                return ServiceUtil.returnError(e.getMessage());
+            }
         }
 
         // the deposit is level - balance (500 - (-10) = 510 || 500 - (10) = 490)
@@ -822,14 +811,16 @@
         }
 
         // say we are in good standing again
-        try {
-            Map ufaResp = dispatcher.runSync("updateFinAccount", UtilMisc.toMap("finAccountId", finAccountId, "inGoodStanding", "Y", "userLogin", userLogin));
-            if (ServiceUtil.isError(ufaResp)) {
-                return ufaResp;
+        if ("FNACT_NEGPENDREPL".equals(statusId)) {
+            try {
+                Map ufaResp = dispatcher.runSync("updateFinAccount", UtilMisc.toMap("finAccountId", finAccountId, "statusId", "FNACT_ACTIVE", "userLogin", userLogin));
+                if (ServiceUtil.isError(ufaResp)) {
+                    return ufaResp;
+                }
+            } catch (GenericServiceException e) {
+                Debug.logError(e, module);
+                return ServiceUtil.returnError(e.getMessage());
             }
-        } catch (GenericServiceException e) {
-            Debug.logError(e, module);
-            return ServiceUtil.returnError(e.getMessage());
         }
         
         return ServiceUtil.returnSuccess();

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?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Mon Aug 27 01:42:11 2007
@@ -189,7 +189,7 @@
         createCtx.put("productStoreId", productStoreId);
         createCtx.put("ownerPartyId", partyId);
         createCtx.put("currencyUomId", currency);
-        createCtx.put("isFrozen", "N");
+        createCtx.put("statusId", "FNACT_ACTIVE");
         createCtx.put("userLogin", userLogin);
 
         // if we auto-replenish this type; set the level to the initial deposit

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Mon Aug 27 01:42:11 2007
@@ -264,13 +264,13 @@
             balance = FinAccountHelper.ZERO;
         }
 
-        Boolean isFrozen = Boolean.valueOf("Y".equals(finAccount.getString("isFrozen")));
-        Debug.log("FinAccount Balance [" + balance + "] Available [" + availableBalance + "] - Frozen: " + isFrozen, module);
+        String statusId = finAccount.getString("statusId");
+        Debug.log("FinAccount Balance [" + balance + "] Available [" + availableBalance + "] - Status: " + statusId, module);
 
         Map result = ServiceUtil.returnSuccess();
         result.put("availableBalance", new Double(availableBalance.doubleValue()));
         result.put("balance", new Double(balance.doubleValue()));
-        result.put("isFrozen", isFrozen);
+        result.put("statusId", statusId);
         return result;
     }
 
@@ -290,21 +290,21 @@
         }
 
         if (finAccount != null) {            
-            String frozen = finAccount.getString("isFrozen");
-            if (frozen == null) frozen = "N";
+            String statusId = finAccount.getString("statusId");
+            if (statusId == null) statusId = "FNACT_ACTIVE";
 
             BigDecimal balance = finAccount.getBigDecimal("actualBalance");
             if (balance == null) {
                 balance = FinAccountHelper.ZERO;
             }
 
-            Debug.log("Account #" + finAccountId + " Balance: " + balance + " Frozen: " + frozen, module);
+            Debug.logInfo("Account #" + finAccountId + " Balance: " + balance + " Status: " + statusId, module);
 
-            if ("N".equals(frozen) && balance.compareTo(FinAccountHelper.ZERO) < 1) {
-                finAccount.set("isFrozen", "Y");
+            if ("FNACT_ACTIVE".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) < 1) {
+                finAccount.set("statusId", "FNACT_MANFROZEN");
                 Debug.logInfo("Financial account [" + finAccountId + "] has passed its threshold [" + balance + "] (Frozen)", module);
-            } else if ("Y".equals(frozen) && balance.compareTo(FinAccountHelper.ZERO) > 0) {
-                finAccount.set("isFrozen", "N");
+            } else if ("FNACT_MANFROZEN".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) > 0) {
+                finAccount.set("statusId", "FNACT_ACTIVE");
                 Debug.logInfo("Financial account [" + finAccountId + "] has been made current [" + balance + "] (Un-Frozen)", module);
             }
             try {

Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Mon Aug 27 01:42:11 2007
@@ -81,8 +81,12 @@
         <field name="organizationPartyId"><lookup target-form-name="LookupPartyName"/></field>
         <field name="ownerPartyId"><lookup target-form-name="LookupPartyName"/></field>
         <field name="postToGlAccountId"><lookup target-form-name="LookupGlAccount"/></field>
-        <field name="isFrozen">
-            <drop-down no-current-selected-key="N"><option key="N" description="${uiLabelMap.CommonN}"/><option key="Y" description="${uiLabelMap.CommonY}"/></drop-down>
+        <field name="statusId">
+            <drop-down allow-empty="false">
+                <entity-options entity-name="StatusItem" description="${description}">
+                    <entity-constraint name="statusTypeId" value="FINACCT_STATUS"/>
+                </entity-options>
+            </drop-down>
         </field>
         <field name="isRefundable">
             <drop-down no-current-selected-key="Y"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down>

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/FinAccountDetail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/FinAccountDetail.ftl?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/FinAccountDetail.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/FinAccountDetail.ftl Mon Aug 27 01:42:11 2007
@@ -31,8 +31,8 @@
       <td><div class="tabletext">${ownedFinAccount.fromDate?if_exists}</div></td>
   </tr>
   <tr>
-      <td align="right"><div class="tableheadtext">Is Frozen:</div></td>
-      <td><div class="tabletext">${ownedFinAccount.isFrozen?default("N")}</div></td>
+      <td align="right"><div class="tableheadtext">Status:</div></td>
+      <td><div class="tabletext">${(finAccountStatusItem.description)?default("Active")}</div></td>
   </tr>
   <#if ownedFinAccount.replenishLevel?exists>
   <tr>

Modified: ofbiz/trunk/applications/ecommerce/widget/CustomerScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CustomerScreens.xml?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CustomerScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CustomerScreens.xml Mon Aug 27 01:42:11 2007
@@ -432,6 +432,9 @@
                                                 <condition-expr field-name="finAccountId" env-name="ownedFinAccount.finAccountId"/>
                                                 <order-by field-name="authorizationDate"/>
                                             </entity-condition>
+                                            <entity-one entity-name="StatusItem" value-name="finAccountStatusItem">
+                                                <field-map field-name="statusId" env-name="ownedFinAccount.statusId"/>
+                                            </entity-one>
                                             <entity-one entity-name="Uom" value-name="accountCurrencyUom" auto-field-map="false" use-cache="true">
                                                 <field-map field-name="uomId" env-name="ownedFinAccount.currencyUomId"/>
                                             </entity-one>

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/FinAccounts.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/FinAccounts.ftl?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/FinAccounts.ftl (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/FinAccounts.ftl Mon Aug 27 01:42:11 2007
@@ -27,7 +27,7 @@
     <p>
         <b>Currency:</b> ${(accountCurrencyUom.description)?if_exists} [${ownedFinAccount.currencyUomId?if_exists}]
         <b>Date Opened:</b> ${ownedFinAccount.fromDate?if_exists}
-        <b>Is Frozen:</b> ${ownedFinAccount.isFrozen?default('N')}
+        <b>Status:</b> ${(finAccountStatusItem.description)?default("Active")}
         <#if ownedFinAccount.replenishLevel?exists>
             <b>Replenish Level:</b> <@ofbizCurrency amount=ownedFinAccount.replenishLevel isoCode=ownedFinAccount.currencyUomId/>
         </#if>

Modified: ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml?rev=570039&r1=570038&r2=570039&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml Mon Aug 27 01:42:11 2007
@@ -208,6 +208,9 @@
                                             <entity-one entity-name="Uom" value-name="accountCurrencyUom" auto-field-map="false" use-cache="true">
                                                 <field-map field-name="uomId" env-name="ownedFinAccount.currencyUomId"/>
                                             </entity-one>
+                                            <entity-one entity-name="StatusItem" value-name="finAccountStatusItem">
+                                                <field-map field-name="statusId" env-name="ownedFinAccount.statusId"/>
+                                            </entity-one>
                                             <entity-one entity-name="FinAccountType" value-name="ownedFinAccountType" auto-field-map="false" use-cache="true">
                                                 <field-map field-name="finAccountTypeId" env-name="ownedFinAccount.finAccountTypeId"/>
                                             </entity-one>