You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/11/02 04:45:58 UTC

svn commit: r1196444 - in /ofbiz/trunk/applications: marketing/webapp/sfa/WEB-INF/controller.xml marketing/widget/sfa/forms/OpportunityForms.xml order/script/org/ofbiz/order/opportunity/OpportunityServices.xml

Author: hansbak
Date: Wed Nov  2 03:45:57 2011
New Revision: 1196444

URL: http://svn.apache.org/viewvc?rev=1196444&view=rev
Log:
on the opportunity find list change the edit button in a close button and set the close dat when not supplied, edit is available with clicking on the opportunity name/number

Modified:
    ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml
    ofbiz/trunk/applications/marketing/widget/sfa/forms/OpportunityForms.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml

Modified: ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml?rev=1196444&r1=1196443&r2=1196444&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml Wed Nov  2 03:45:57 2011
@@ -56,6 +56,12 @@ under the License.
         <response name="success" type="request" value="ViewSalesOpportunity"/>
         <response name="error" type="view" value="EditSalesOpportunity"/>
     </request-map>
+    <request-map uri="closeSalesOpportunity">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateSalesOpportunity"/>
+        <response name="success" type="request" value="FindSalesOpportunity"/>
+        <response name="error" type="view" value="FindSalesOpportunity"/>
+    </request-map>
 
     <!-- Account Entry Requests -->
     <request-map uri="FindAccounts">

Modified: ofbiz/trunk/applications/marketing/widget/sfa/forms/OpportunityForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/forms/OpportunityForms.xml?rev=1196444&r1=1196443&r2=1196444&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/forms/OpportunityForms.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/forms/OpportunityForms.xml Wed Nov  2 03:45:57 2011
@@ -55,6 +55,9 @@ under the License.
                 <field-map field-name="viewSize" from-field="viewSize"/>
             </service>
         </actions>
+        <row-actions>
+            <set field="isDateAfterNow" value="${groovy:org.ofbiz.base.util.UtilValidate.isDateAfterNow(estimatedCloseDate)}" type="Boolean"/>
+        </row-actions>
         <field name="salesOpportunityId"><hidden/></field>
         <field name="opportunityName" title="${uiLabelMap.SfaOpportunityName}">
             <hyperlink target="ViewSalesOpportunity" description="${opportunityName}[${salesOpportunityId}]">
@@ -65,9 +68,10 @@ under the License.
         <field name="nextStep"><display/></field>
         <field name="estimatedAmount" title="${uiLabelMap.SfaEstimatedAmount}"><display/></field>
         <field name="estimatedCloseDate" title="${uiLabelMap.SfaCloseDate}"><display/></field>
-        <field name="editButton" title="${uiLabelMap.CommonEdit}" widget-style="buttontext">
-            <hyperlink target="EditSalesOpportunity" description="${uiLabelMap.CommonEdit}">
+        <field name="editButton" title="${uiLabelMap.CommonClose}" use-when="${groovy: estimatedCloseDate == null || isDateAfterNow == true || opportunityStageId != &quot;SOSTG_CLOSED&quot;}" widget-style="buttontext">
+            <hyperlink target="closeSalesOpportunity" description="${uiLabelMap.CommonClose}">
                 <parameter param-name="salesOpportunityId"/>
+                <parameter param-name="opportunityStageId" value="SOSTG_CLOSED"/>
             </hyperlink>
         </field>
     </form>

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1196444&r1=1196443&r2=1196444&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml Wed Nov  2 03:45:57 2011
@@ -114,6 +114,14 @@ This file contains basic services for Sa
     </simple-method>
     <simple-method method-name="updateSalesOpportunity" short-description="Update an Sales opportunity">
         <entity-one entity-name="SalesOpportunity" value-field="lookedUpValue"/>
+        <if-compare field="parameters.opportunityStageId" operator="equals" value="SOSTG_CLOSED">
+            <if-empty field="parameters.estimatedCloseDate">
+                <now-timestamp field="nowTimestamp"/>
+                <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getDayStart" ret-field="parameters.estimatedCloseDate">
+                    <field field="nowTimestamp" type="java.sql.Timestamp"/>
+                </call-class-method>
+            </if-empty>
+        </if-compare>
         <set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
         <store-value value-field="lookedUpValue"/>
     </simple-method>