Author: jleroux
Date: Mon Nov 10 08:07:12 2014
New Revision: 1637805

URL: http://svn.apache.org/r1637805
Log:
Keeps in sync with OFBiz trunk HEAD

Added:
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/config/groovy.properties
      - copied unchanged from r1637804, 
ofbiz/trunk/framework/base/config/groovy.properties
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormRenderer.java
      - copied unchanged from r1637804, 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormRenderer.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/Paginator.java
      - copied unchanged from r1637804, 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/Paginator.java
Modified:
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/   (props changed)
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyServices.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/widget/partymgr/PartyMenus.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/config/ProductUiLabels.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/entitydef/entitymodel.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/SubscriptionForms.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/ServiceErrorUiLabels.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/serviceengine.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/servicedef/services_test_se.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/GroovyEventHandler.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/appserver/templates/tomcat6/server.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/tools/demo-backup/branch13.7-demo.patch

Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1636282-1637804

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
 Mon Nov 10 08:07:12 2014
@@ -145,7 +145,13 @@ This file contains basic services for Sa
             <if-not-empty field="parameters.accountPartyId">
                 <set field="roleMap.roleTypeId" value="ACCOUNT"/>
                 <set field="roleMap.partyId" 
from-field="parameters.accountPartyId"/>
-                <call-service service-name="createPartyRole" 
in-map-name="roleMap"/>
+                <entity-one value-field="partyRole" entity-name="PartyRole">
+                    <field-map field-name="roleTypeId" 
from-field="roleMap.roleTypeId"/>
+                    <field-map field-name="partyId" 
from-field="roleMap.partyId"/>
+                </entity-one>
+                <if-empty field="partyRole">
+                    <call-service service-name="createPartyRole" 
in-map-name="roleMap"/>
+                </if-empty>
             </if-not-empty>
             <set field="salesOpportunityRole.roleTypeId" value="ACCOUNT"/>
             <set field="salesOpportunityRole.salesOpportunityId" 
from-field="parameters.salesOpportunityId"/>
@@ -165,9 +171,15 @@ This file contains basic services for Sa
             </if-not-empty>
             <!-- Check party role for create Lead Role -->
             <if-not-empty field="parameters.leadPartyId">
-                <set field="roleMap.roleTypeId" value="LEAD"/>
-                <set field="roleMap.partyId" 
from-field="parameters.leadPartyId"/>
-                <call-service service-name="createPartyRole" 
in-map-name="roleMap"/>
+                <entity-one value-field="leadRole" entity-name="PartyRole">
+                    <field-map field-name="partyId" 
from-field="parameters.leadPartyId"/>
+                    <field-map field-name="roleTypeId" value="LEAD"/>
+                </entity-one>
+                <if-empty field="leadRole">
+                    <set field="roleMap.roleTypeId" value="LEAD"/>
+                    <set field="roleMap.partyId" 
from-field="parameters.leadPartyId"/>
+                    <call-service service-name="createPartyRole" 
in-map-name="roleMap"/>
+                </if-empty>
             </if-not-empty>
             <set field="salesOpportunityRole.roleTypeId" value="LEAD"/>
             <set field="salesOpportunityRole.salesOpportunityId" 
from-field="parameters.salesOpportunityId"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml
 Mon Nov 10 08:07:12 2014
@@ -88,8 +88,13 @@ under the License.
         <if-not-empty field="partyInvitationRoleAssocs">
             <set field="createPartyRoleCtx.partyId" 
from-field="parameters.partyId"/>
             <iterate list="partyInvitationRoleAssocs" 
entry="partyInvitationRoleAssoc">
-                <set field="createPartyRoleCtx.roleTypeId" 
from-field="partyInvitationRoleAssoc.roleTypeId"/>
-                <call-service service-name="createPartyRole" 
in-map-name="createPartyRoleCtx"/>
+                <entity-one value-field="partyRole" entity-name="PartyRole">
+                    <field-map field-name="roleTypeId" 
from-field="partyInvitationRoleAssoc.roleTypeId"/>
+                </entity-one>
+                <if-empty field="partyRole">
+                    <set field="createPartyRoleCtx.roleTypeId" 
from-field="partyInvitationRoleAssoc.roleTypeId"/>
+                    <call-service service-name="createPartyRole" 
in-map-name="createPartyRoleCtx"/>
+                </if-empty>
             </iterate>
         </if-not-empty>
         <set field="updatePartyInvitationCtx.partyInvitationId" 
from-field="parameters.partyInvitationId"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyServices.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/party/PartyServices.xml
 Mon Nov 10 08:07:12 2014
@@ -841,10 +841,22 @@ under the License.
     <simple-method method-name="createPartyRelationshipContactAccount" 
short-description="create a company/contact relationship and add the related 
roles">
         <set field="roleMap.partyId" from-field="parameters.accountPartyId"/>
         <set field="roleMap.roleTypeId" value="ACCOUNT"/>
-        <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+        <entity-one value-field="partyRole" entity-name="PartyRole">
+            <field-map field-name="partyId" from-field="roleMap.partyId"/>
+            <field-map field-name="roleTypeId" 
from-field="roleMap.roleTypeId"/>
+        </entity-one>
+        <if-empty field="partyRole">
+            <call-service service-name="createPartyRole" 
in-map-name="roleMap"/>
+        </if-empty>
         <set field="roleMap.partyId" from-field="parameters.contactPartyId"/>
         <set field="roleMap.roleTypeId" value="CONTACT"/>
-        <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+        <entity-one value-field="partyRole" entity-name="PartyRole">
+            <field-map field-name="partyId" from-field="roleMap.partyId"/>
+            <field-map field-name="roleTypeId" 
from-field="roleMap.roleTypeId"/>
+        </entity-one>
+        <if-empty field="partyRole">
+            <call-service service-name="createPartyRole" 
in-map-name="roleMap"/>
+        </if-empty>
         <set field="relMap.partyIdFrom" 
from-field="parameters.accountPartyId"/>
         <set field="relMap.roleTypeIdFrom" value="ACCOUNT"/>
         <set field="relMap.partyIdTo" from-field="parameters.contactPartyId"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
 Mon Nov 10 08:07:12 2014
@@ -885,7 +885,7 @@ public class ContactMechServices {
         if (tempVal != null) {
             Map<String, Object> deletePcmCtx = UtilMisc.toMap("contactMechId", 
context.get("contactMechId"));
             deletePcmCtx.put("contactMechPurposeTypeId", 
context.get("contactMechPurposeTypeId"));
-            deletePcmCtx.put("fromDate", tempVal.get("fromDate"));
+            deletePcmCtx.put("fromDate", tempVal.get("purposeFromDate"));
             deletePcmCtx.put("userLogin", context.get("userLogin"));
             deletePcmCtx.put("partyId", partyId);
             try {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/widget/partymgr/PartyMenus.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/widget/partymgr/PartyMenus.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/widget/partymgr/PartyMenus.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/widget/partymgr/PartyMenus.xml
 Mon Nov 10 08:07:12 2014
@@ -679,10 +679,14 @@
 
     <menu name="addRelContactAccounts">
         <menu-item name="add" title="${uiLabelMap.CommonCreateNew}">
-            <link 
target="${parameters._LAST_VIEW_NAME_}?portalPageId=${parameters.portalPageId}&amp;partyId=${parameters.partyId}&amp;editPartyRel=Y"/>
-        </menu-item>  
+            <link target="${parameters._LAST_VIEW_NAME_}">
+                <parameter param-name="partyId"/>
+                <parameter param-name="portalPageId"/>
+                <parameter param-name="editPartyRel" value="Y"/>
+            </link>
+        </menu-item>
     </menu>
-    
+
     <menu name="newPartyIdentification">
         <menu-item name="new" title="${uiLabelMap.CommonNew}">
             <link target="viewidentifications">

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/config/ProductUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/config/ProductUiLabels.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/config/ProductUiLabels.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/config/ProductUiLabels.xml
 Mon Nov 10 08:07:12 2014
@@ -96,7 +96,7 @@
     </property>
     <property key="FacilityCat">
         <value xml:lang="en">CAT</value>
-        <value xml:lang="en">Cat.</value>
+        <value xml:lang="nl">Cat.</value>
     </property>
     <property key="FacilityCompanyName">
         <value xml:lang="de">OFBiz: Einrichtungen Verwaltung</value>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/entitydef/entitymodel.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/entitydef/entitymodel.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/entitydef/entitymodel.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/entitydef/entitymodel.xml
 Mon Nov 10 08:07:12 2014
@@ -4462,7 +4462,7 @@ under the License.
         <field name="canclAutmExtTimeUomId" type="id"><description>Unit Of 
Measure used for the automatic extension of the 
subscription.</description></field>
         <field name="gracePeriodOnExpiry" type="numeric"><description>The time 
period (before the end of the thruDate) after which the automatic extension of 
the subscription will be executed.</description></field>
         <field name="gracePeriodOnExpiryUomId" type="id"><description>Unit Of 
Measure used for the automatic extension of the 
subscription.</description></field>
-        <field name="serviceNameOnExpiry" 
type="long-varchar"><description>Name of service which will run on subscription 
expiration.</description></field>
+        <field name="expirationCompletedDate" 
type="date-time"><description>The date when expiration 
completed.</description></field>
         <prim-key field="subscriptionId"/>
         <relation type="one" fk-name="SUBSC_SRESRC" 
rel-entity-name="SubscriptionResource">
             <key-map field-name="subscriptionResourceId"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
 Mon Nov 10 08:07:12 2014
@@ -315,6 +315,7 @@ public class SubscriptionServices {
         String gracePeriodOnExpiry = null;
         String gracePeriodOnExpiryUomId = null;
         String subscriptionId = null;
+        Timestamp expirationCompletedDate = null;
         
         try {
             EntityCondition cond1 = 
EntityCondition.makeCondition("automaticExtend", EntityOperator.EQUALS, "N");
@@ -325,57 +326,61 @@ public class SubscriptionServices {
             
             if (subscriptionList != null) {
                 for (GenericValue subscription : subscriptionList) {
-                    Calendar currentDate = Calendar.getInstance();
-                    currentDate.setTime(UtilDateTime.nowTimestamp());
-                    // check if the thruDate + grace period (if provided) is 
earlier than today's date
-                    Calendar endDateSubscription = Calendar.getInstance();
-                    int field = Calendar.MONTH;
-                    String subscriptionResourceId = 
subscription.getString("subscriptionResourceId");
-                    GenericValue subscriptionResource = null;
-                    subscriptionResource = 
EntityQuery.use(delegator).from("SubscriptionResource").where("subscriptionResourceId",
 subscriptionResourceId).queryOne();
-                    subscriptionId = subscription.getString("subscriptionId");
-                    gracePeriodOnExpiry = 
subscription.getString("gracePeriodOnExpiry");
-                    gracePeriodOnExpiryUomId = 
subscription.getString("gracePeriodOnExpiryUomId");
-                    String serviceNameOnExpiry = 
subscriptionResource.getString("serviceNameOnExpiry");
-                    
endDateSubscription.setTime(subscription.getTimestamp("thruDate"));
-                    
-                    if (gracePeriodOnExpiry != null && 
gracePeriodOnExpiryUomId != null) {
-                        if ("TF_day".equals(gracePeriodOnExpiryUomId)) {
-                            field = Calendar.DAY_OF_YEAR;
-                        } else if ("TF_wk".equals(gracePeriodOnExpiryUomId)) {
-                            field = Calendar.WEEK_OF_YEAR;
-                        } else if ("TF_mon".equals(gracePeriodOnExpiryUomId)) {
-                            field = Calendar.MONTH;
-                        } else if ("TF_yr".equals(gracePeriodOnExpiryUomId)) {
-                            field = Calendar.YEAR;
-                        } else {
-                            Debug.logWarning("Don't know anything about 
gracePeriodOnExpiryUomId [" + gracePeriodOnExpiryUomId + "], defaulting to 
month", module);
-                        }
-                        endDateSubscription.add(field, 
Integer.valueOf(gracePeriodOnExpiry).intValue());
-                    }
-                    
-                    if ((currentDate.after(endDateSubscription) || 
currentDate.equals(endDateSubscription)) && serviceNameOnExpiry != null) {
-                        if (userLogin != null) {
-                            expiryMap.put("userLogin", userLogin);
-                        }
-                        if (subscriptionId != null) {
-                            expiryMap.put("subscriptionId", subscriptionId);
-                        }
-                        result = dispatcher.runSync(serviceNameOnExpiry, 
expiryMap);
-                        if (ServiceUtil.isSuccess(result)) {
-                            Debug.logInfo("Subscription expired successfully 
for subscription ID:" + subscriptionId, module);
-                        } else if (ServiceUtil.isError(result)) {
-                            result = null;
-                            Debug.logError("Error expiring subscription while 
processing with subscriptionId: " + subscriptionId, module);
+                       expirationCompletedDate = 
subscription.getTimestamp("expirationCompletedDate");
+                       if (expirationCompletedDate == null) {
+                               Calendar currentDate = Calendar.getInstance();
+                        currentDate.setTime(UtilDateTime.nowTimestamp());
+                        // check if the thruDate + grace period (if provided) 
is earlier than today's date
+                        Calendar endDateSubscription = Calendar.getInstance();
+                        int field = Calendar.MONTH;
+                        String subscriptionResourceId = 
subscription.getString("subscriptionResourceId");
+                        GenericValue subscriptionResource = null;
+                        subscriptionResource = 
EntityQuery.use(delegator).from("SubscriptionResource").where("subscriptionResourceId",
 subscriptionResourceId).queryOne();
+                        subscriptionId = 
subscription.getString("subscriptionId");
+                        gracePeriodOnExpiry = 
subscription.getString("gracePeriodOnExpiry");
+                        gracePeriodOnExpiryUomId = 
subscription.getString("gracePeriodOnExpiryUomId");
+                        String serviceNameOnExpiry = 
subscriptionResource.getString("serviceNameOnExpiry");
+                        
endDateSubscription.setTime(subscription.getTimestamp("thruDate"));
+                        
+                        if (gracePeriodOnExpiry != null && 
gracePeriodOnExpiryUomId != null) {
+                            if ("TF_day".equals(gracePeriodOnExpiryUomId)) {
+                                field = Calendar.DAY_OF_YEAR;
+                            } else if 
("TF_wk".equals(gracePeriodOnExpiryUomId)) {
+                                field = Calendar.WEEK_OF_YEAR;
+                            } else if 
("TF_mon".equals(gracePeriodOnExpiryUomId)) {
+                                field = Calendar.MONTH;
+                            } else if 
("TF_yr".equals(gracePeriodOnExpiryUomId)) {
+                                field = Calendar.YEAR;
+                            } else {
+                                Debug.logWarning("Don't know anything about 
gracePeriodOnExpiryUomId [" + gracePeriodOnExpiryUomId + "], defaulting to 
month", module);
+                            }
+                            endDateSubscription.add(field, 
Integer.valueOf(gracePeriodOnExpiry).intValue());
                         }
+                        if ((currentDate.after(endDateSubscription) || 
currentDate.equals(endDateSubscription)) && serviceNameOnExpiry != null) {
+                            if (userLogin != null) {
+                                expiryMap.put("userLogin", userLogin);
+                            }
+                            if (subscriptionId != null) {
+                                expiryMap.put("subscriptionId", 
subscriptionId);
+                            }
+                            result = dispatcher.runSync(serviceNameOnExpiry, 
expiryMap);
+                            if (ServiceUtil.isSuccess(result)) {
+                                subscription.set("expirationCompletedDate", 
UtilDateTime.nowTimestamp());
+                                delegator.store(subscription);
+                                Debug.logInfo("Subscription expired 
successfully for subscription ID:" + subscriptionId, module);
+                            } else if (ServiceUtil.isError(result)) {
+                                result = null;
+                                Debug.logError("Error expiring subscription 
while processing with subscriptionId: " + subscriptionId, module);
+                            }
 
-                        if (result != null && subscriptionId != null) {
-                            Debug.logInfo("Service mentioned in 
serviceNameOnExpiry called with result: " + result.get("successMessage"), 
module);
-                        } else if (result == null && subscriptionId != null) {
-                            Debug.logError("Subscription couldn't be expired 
for subscriptionId: " + subscriptionId, module);
-                            return ServiceUtil.returnError("Subscription 
couldn't be expired for subscriptionId: " + subscriptionId);
+                            if (result != null && subscriptionId != null) {
+                                Debug.logInfo("Service mentioned in 
serviceNameOnExpiry called with result: " + result.get("successMessage"), 
module);
+                            } else if (result == null && subscriptionId != 
null) {
+                                Debug.logError("Subscription couldn't be 
expired for subscriptionId: " + subscriptionId, module);
+                                return ServiceUtil.returnError("Subscription 
couldn't be expired for subscriptionId: " + subscriptionId);
+                            }
                         }
-                    }
+                       }
                 }
             }
         } catch (GenericServiceException e) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/SubscriptionForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/SubscriptionForms.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/SubscriptionForms.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/SubscriptionForms.xml
 Mon Nov 10 08:07:12 2014
@@ -304,7 +304,6 @@ under the License.
                 </entity-options>
             </drop-down>
         </field>
-        <field name="serviceNameOnExpiry" ><ignored/></field>
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}" 
widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
 Mon Nov 10 08:07:12 2014
@@ -32,6 +32,7 @@ import java.util.Map;
 import javax.script.ScriptContext;
 
 import org.codehaus.groovy.control.CompilationFailedException;
+import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.runtime.InvokerHelper;
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.cache.UtilCache;
@@ -46,6 +47,18 @@ public class GroovyUtil {
 
     private static final UtilCache<String, Class<?>> parsedScripts = 
UtilCache.createUtilCache("script.GroovyLocationParsedCache", 0, 0, false);
 
+    private static final GroovyClassLoader groovyScriptClassLoader;
+    static {
+        GroovyClassLoader groovyClassLoader = null;
+        String scriptBaseClass = 
UtilProperties.getPropertyValue("groovy.properties", "scriptBaseClass");
+        if (!scriptBaseClass.isEmpty()) {
+            CompilerConfiguration conf = new CompilerConfiguration();
+            conf.setScriptBaseClass(scriptBaseClass);
+            groovyClassLoader = new 
GroovyClassLoader(GroovyUtil.class.getClassLoader(), conf);
+        }
+        groovyScriptClassLoader = groovyClassLoader;
+    }
+
     /**
      * Evaluate a Groovy condition or expression
      * @param expression The expression to evaluate
@@ -110,9 +123,6 @@ public class GroovyUtil {
     }
 
     public static Class<?> getScriptClassFromLocation(String location) throws 
GeneralException {
-        return getScriptClassFromLocation(location, null);
-    }
-    public static Class<?> getScriptClassFromLocation(String location, 
GroovyClassLoader groovyClassLoader) throws GeneralException {
         try {
             Class<?> scriptClass = parsedScripts.get(location);
             if (scriptClass == null) {
@@ -120,8 +130,8 @@ public class GroovyUtil {
                 if (scriptUrl == null) {
                     throw new GeneralException("Script not found at location 
[" + location + "]");
                 }
-                if (groovyClassLoader != null) {
-                    scriptClass = parseClass(scriptUrl.openStream(), location, 
groovyClassLoader);
+                if (groovyScriptClassLoader != null) {
+                    scriptClass = parseClass(scriptUrl.openStream(), location, 
groovyScriptClassLoader);
                 } else {
                     scriptClass = parseClass(scriptUrl.openStream(), location);
                 }
@@ -156,16 +166,8 @@ public class GroovyUtil {
         return new GroovyClassLoader().parseClass(text);
     }
 
-    public static Class<?> parseClass(String text, String location) {
-        return new GroovyClassLoader().parseClass(text, location);
-    }
-
     public static Object runScriptAtLocation(String location, String 
methodName, Map<String, Object> context) throws GeneralException {
-        return runScriptAtLocation(location, methodName, context, null);
-    }
-
-    public static Object runScriptAtLocation(String location, String 
methodName, Map<String, Object> context, GroovyClassLoader groovyClassLoader) 
throws GeneralException {
-        Script script = 
InvokerHelper.createScript(getScriptClassFromLocation(location, 
groovyClassLoader), getBinding(context));
+        Script script = 
InvokerHelper.createScript(getScriptClassFromLocation(location), 
getBinding(context));
         Object result = null;
         if (UtilValidate.isEmpty(methodName)) {
             result = script.run();
@@ -175,30 +177,5 @@ public class GroovyUtil {
         return result;
     }
 
-    public static Object runScriptFromClasspath(String script, 
Map<String,Object> context) throws GeneralException {
-        try {
-            Class<?> scriptClass = parsedScripts.get(script);
-            if (scriptClass == null) {
-                scriptClass = loadClass(script);
-                Class<?> cachedScriptClass = parsedScripts.putIfAbsent(script, 
scriptClass);
-                if (cachedScriptClass == null) { // putIfAbsent returns null 
if the class is added
-                    if (Debug.verboseOn()) {
-                        Debug.logVerbose("Cached Groovy script at: " + script, 
module);
-                    }
-                } else {
-                    // the newly parsed script is discarded and the one found 
in the cache (that has been created by a concurrent thread in the meantime) is 
used
-                    scriptClass = cachedScriptClass;
-                }
-            }
-            return InvokerHelper.createScript(scriptClass, 
getBinding(context)).run();
-        } catch (CompilationFailedException e) {
-            String errMsg = "Error loading Groovy script [" + script + "]: " + 
e.toString();
-            throw new GeneralException(errMsg, e);
-        } catch (ClassNotFoundException e) {
-            String errMsg = "Error loading Groovy script [" + script + "]: " + 
e.toString();
-            throw new GeneralException(errMsg, e);
-        }
-    }
-
     private GroovyUtil() {}
 }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java
 Mon Nov 10 08:07:12 2014
@@ -34,6 +34,7 @@ import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.InvalidPropertiesFormatException;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
@@ -798,7 +799,7 @@ public class UtilProperties implements S
         if (defaultCandidateLocales == null) {
             synchronized (UtilProperties.class) {
                 if (defaultCandidateLocales == null) {
-                    defaultCandidateLocales = new HashSet<Locale>();
+                    defaultCandidateLocales = new LinkedHashSet<Locale>();
                     
defaultCandidateLocales.addAll(localeToCandidateList(Locale.getDefault()));
                     
defaultCandidateLocales.addAll(localeToCandidateList(getFallbackLocale()));
                     defaultCandidateLocales.add(Locale.ROOT);
@@ -822,7 +823,7 @@ public class UtilProperties implements S
         if (Locale.ROOT.equals(locale)) {
             return UtilMisc.toList(locale);
         }
-        Set<Locale> localeSet = new HashSet<Locale>();
+        Set<Locale> localeSet = new LinkedHashSet<Locale>();
         localeSet.addAll(localeToCandidateList(locale));
         localeSet.addAll(getDefaultCandidateLocales());
         List<Locale> localeList = new ArrayList<Locale>(localeSet);

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml
 Mon Nov 10 08:07:12 2014
@@ -146,7 +146,8 @@ under the License.
             <property name="keystoreType" value="JKS"/>
             <property name="keyAlias" value="ofbiz"/>
             <property name="keyPass" value="changeit"/>
-            <property name="sslProtocol" value="TLS"/>
+            <property name="sslProtocol" value="TLSv1.2"/>
+            <property name="sslEnabledProtocols" value="TLSv1.2"/>
             <property name="ciphers" value=""/>
         </property>
     </container>
@@ -203,7 +204,8 @@ under the License.
             <property name="keystoreFile" 
value="framework/base/config/ofbizssl.jks"/>
             <property name="keystorePass" value="changeit"/>
             <property name="keystoreType" value="JKS"/>
-            <property name="sslProtocol" value="TLS"/>
+            <property name="sslProtocol" value="TLSv1.2"/>
+            <property name="sslEnabledProtocols" value="TLSv1.2"/>
             <property name="ciphers" value=""/>
         </property>
     </container>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
 Mon Nov 10 08:07:12 2014
@@ -1211,10 +1211,13 @@ public class EntityTestSuite extends Ent
         assertTrue("One big transaction was not faster than several small 
ones", totalTimeOneTransaction < totalTimeSeveralSmallTransactions);
     }
 
+/*
     public void testConverters() throws Exception {
         // Must use the default delegator because the deserialized 
GenericValue can't
         // find the randomized one.
         Delegator localDelegator = DelegatorFactory.getDelegator("default");
+        TransactionUtil.begin();
+        localDelegator.create("TestingType", "testingTypeId", "TEST-UPDATE-1", 
"description", "Testing Type #Update-1");
         GenericValue testValue = localDelegator.create("Testing", "testingId", 
"JSON_TEST", "testingTypeId", "TEST-UPDATE-1",
                 "description", "Testing JSON Converters", "testingSize", 
(long) 123, "testingDate",
                 new Timestamp(System.currentTimeMillis()));
@@ -1225,8 +1228,9 @@ public class EntityTestSuite extends Ent
                 null);
         assertNotNull("GenericValue converted from JSON not null", 
convertedValue);
         assertEquals("GenericValue converted from JSON equals original value", 
testValue, convertedValue);
-        testValue.remove();
+        TransactionUtil.rollback();
     }
+*/
 
     private final class TestObserver implements Observer {
         private Observable observable;

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
 Mon Nov 10 08:07:12 2014
@@ -349,8 +349,18 @@ public class EntityQuery {
      * @return this EntityQuery object, to enable chaining
      */
     public EntityQuery filterByDate(String... filterByFieldName) {
+        return this.filterByDate(null, filterByFieldName);
+    }
+
+    /** Specifies whether the query should return only values that are active 
during the specified moment using the specified from/thru field name pairs.
+     * 
+     * @param moment - Timestamp representing the moment in time that the 
values should be active during
+     * @param fromThruFieldName - String pairs representing the from/thru date 
field names e.g. "fromDate", "thruDate", "contactFromDate", "contactThruDate"
+     * @return this EntityQuery object, to enable chaining
+     */
+    public EntityQuery filterByDate(Timestamp moment, String... 
filterByFieldName) {
         this.filterByDate  = true;
-        this.filterByDateMoment = null;
+        this.filterByDateMoment = moment;
         if (filterByFieldName.length % 2 != 0) {
             throw new IllegalArgumentException("You must pass an even sized 
array to this method, each pair should represent a from date field name and a 
thru date field name");
         }
@@ -469,7 +479,7 @@ public class EntityQuery {
     private EntityCondition makeDateCondition() {
         List<EntityCondition> conditions = new ArrayList<EntityCondition>();
         if (UtilValidate.isEmpty(this.filterByFieldNames)) {
-            this.filterByDate("fromDate", "thruDate");
+            this.filterByDate(filterByDateMoment, "fromDate", "thruDate");
         }
 
         for (int i = 0; i < this.filterByFieldNames.size();) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/ServiceErrorUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/ServiceErrorUiLabels.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/ServiceErrorUiLabels.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/ServiceErrorUiLabels.xml
 Mon Nov 10 08:07:12 2014
@@ -272,11 +272,22 @@
         <value xml:lang="zh">缺少参数</value>
         <value xml:lang="zh_TW">缺少參數</value>
     </property>
+    <property key="ServiceValueFound">
+        <value xml:lang="en">Value found (with ids ${pkFields}), cannot create 
a new one</value>
+        <value xml:lang="fr">La valeur a été trouvée (avec les réfs. 
${pkFields}), une nouvelle ne peut donc pas être créée</value>
+        <value xml:lang="it">Valore troavato, non è possibile creare</value>
+    </property>
     <property key="ServiceValueNotFound">
         <value xml:lang="en">Value not found, cannot update</value>
+        <value xml:lang="fr">La valeur n'a pas été trouvée, elle ne peut 
donc pas être mise à jour</value>
         <value xml:lang="it">Valore non troavato, non è possibile 
aggiornare</value>
         <value 
xml:lang="ja">値が見つかりません。更新できません</value>
         <value xml:lang="zh">没有找到值,无法更新</value>
         <value xml:lang="zh_TW">沒有找到值,無法更新</value>
     </property>
+    <property key="ServiceValueNotFoundForRemove">
+        <value xml:lang="en">Value not found, cannot remove</value>
+        <value xml:lang="fr">La valeur n'a pas été trouvée, suppression 
impossible</value>
+        <value xml:lang="it">Valore non troavato, non è possibile 
sopprimere</value>
+    </property>
 </resource>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/serviceengine.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/serviceengine.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/serviceengine.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/config/serviceengine.xml
 Mon Nov 10 08:07:12 2014
@@ -47,9 +47,7 @@ under the License.
         <engine name="script" class="org.ofbiz.service.engine.ScriptEngine"/>
         <!-- Engines that can be replaced by the generic script engine -->
         <engine name="bsh" class="org.ofbiz.service.engine.BeanShellEngine"/>
-        <engine name="groovy" class="org.ofbiz.service.engine.GroovyEngine">
-            <parameter name="scriptBaseClass" 
value="org.ofbiz.service.engine.GroovyBaseScript"/>
-        </engine>
+        <engine name="groovy" class="org.ofbiz.service.engine.GroovyEngine"/>
         <engine name="jacl" class="org.ofbiz.service.engine.BSFEngine"/>
         <engine name="javascript" 
class="org.ofbiz.service.engine.ScriptEngine"/>
         <engine name="jpython" class="org.ofbiz.service.engine.BSFEngine"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/servicedef/services_test_se.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/servicedef/services_test_se.xml?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/servicedef/services_test_se.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/servicedef/services_test_se.xml
 Mon Nov 10 08:07:12 2014
@@ -80,7 +80,7 @@ under the License.
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <attribute name="testingId" mode="IN" type="String"/>
         <attribute name="testingNodeId" mode="IN" type="String"/>
-        <attribute name="fromDate" mode="OUT" type="String"/>
+        <attribute name="fromDate" mode="OUT" type="Timestamp"/>
     </service>
     <service name="testEntityAutoUpdateTesting" auth="false"
         engine="entity-auto" default-entity-name="Testing" invoke="update">

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
 Mon Nov 10 08:07:12 2014
@@ -20,6 +20,7 @@ package org.ofbiz.service.engine;
 
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.Locale;
 import java.util.Map;
 
@@ -88,11 +89,16 @@ public final class EntityAutoEngine exte
 
         try {
             boolean allPksInOnly = true;
+            LinkedList<String> pkFieldNameOutOnly = null;
             for (ModelField pkField: modelEntity.getPkFieldsUnmodifiable()) {
                 ModelParam pkParam = modelService.getParam(pkField.getName());
                 if (pkParam.isOut()) {
                     allPksInOnly = false;
                 }
+                if (pkParam.isOut() && !pkParam.isIn()) {
+                    if (pkFieldNameOutOnly == null) pkFieldNameOutOnly = new 
LinkedList();
+                    pkFieldNameOutOnly.add(pkField.getName());
+                }
             }
 
             if ("create".equals(modelService.invoke)) {
@@ -128,7 +134,6 @@ public final class EntityAutoEngine exte
                     }
                 }
 
-
                 if (isSinglePk && isSinglePkOut && !isSinglePkIn) {
                     /*
                      **** primary sequenced primary key ****
@@ -145,7 +150,6 @@ public final class EntityAutoEngine exte
 
                     String sequencedId = 
dctx.getDelegator().getNextSeqId(modelEntity.getEntityName());
                     newEntity.set(singlePkModeField.getName(), sequencedId);
-                    result.put(singlePkModelParam.name, sequencedId);
                 } else if (isSinglePk && isSinglePkOut && isSinglePkIn) {
                     /*
                      **** primary sequenced key with optional override passed 
in ****
@@ -181,7 +185,6 @@ public final class EntityAutoEngine exte
                         }
                     }
                     newEntity.set(singlePkModeField.getName(), pkValue);
-                    result.put(singlePkModelParam.name, pkValue);
                 } else if (isDoublePk && doublePkPrimaryInParam != null && 
doublePkSecondaryOutParam != null) {
                     /*
                      **** secondary sequenced primary key ****
@@ -199,7 +202,6 @@ public final class EntityAutoEngine exte
 
                     newEntity.setPKFields(parameters, true);
                     dctx.getDelegator().setNextSubSeqId(newEntity, 
doublePkSecondaryOutField.getName(), 5, 1);
-                    result.put(doublePkSecondaryOutParam.name, 
newEntity.get(doublePkSecondaryOutField.getName()));
                 } else if (allPksInOnly) {
                     /*
                      **** plain specified primary key ****
@@ -213,24 +215,46 @@ public final class EntityAutoEngine exte
                      *
                      */
                     newEntity.setPKFields(parameters, true);
+                    //with all pks present on parameters, check if the entity 
is not already exists.
+                    GenericValue lookedUpValue = 
PrimaryKeyFinder.runFind(modelEntity, parameters, dctx.getDelegator(), false, 
true, null, null);
+                    if (lookedUpValue != null) {
+                        return 
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"ServiceValueFound", UtilMisc.toMap("pkFields", 
newEntity.getPkShortValueString()), locale));
+                    }
                 } else {
-                    throw new GenericServiceException("In Service [" + 
modelService.name + "] which uses the entity-auto engine with the create invoke 
option: " +
-                            "could not find a valid combination of primary key 
settings to do a known create operation; options include: " +
-                            "1. a single OUT pk for primary auto-sequencing, " 
+
-                            "2. a single INOUT pk for primary auto-sequencing 
with optional override, " +
-                            "3. a 2-part pk with one part IN (existing primary 
pk) and one part OUT (the secdonary pk to sub-sequence, " +
-                            "4. all pk fields are IN for a manually specified 
primary key");
+                    /* We haven't all Pk and their are 3 or more, now check if 
isn't a associate entity with own sequence
+                    <set-pk-fields map="parameters" value-field="newEntity"/>
+                    <sequenced-id sequence-name="ExempleItemAssoc" 
field="newEntity.exempleItemAssocId"/>
+                    <create-value value-field="newEntity"/>
+                     */
+                    if (pkFieldNameOutOnly != null && 
pkFieldNameOutOnly.size() == 1) {
+                        newEntity.setPKFields(parameters, true);
+                        String pkFieldName = pkFieldNameOutOnly.getFirst();
+                        //if it's a fromDate, don't update it now, it's will 
be done next step
+                        if (! "fromDate".equals(pkFieldName)) { 
+                            String pkValue = 
dctx.getDelegator().getNextSeqId(modelEntity.getEntityName());
+                            newEntity.set(pkFieldName, pkValue);
+                        }
+                    } else {
+                        throw new GenericServiceException("In Service [" + 
modelService.name + "] which uses the entity-auto engine with the create invoke 
option: " +
+                                "could not find a valid combination of primary 
key settings to do a known create operation; options include: " +
+                                "1. a single OUT pk for primary 
auto-sequencing, " +
+                                "2. a single INOUT pk for primary 
auto-sequencing with optional override, " +
+                                "3. a 2-part pk with one part IN (existing 
primary pk) and one part OUT (the secondary pk to sub-sequence), " +
+                                "4. a N-part pk with N-1 part IN and one party 
OUT only (missing pk is a sub-sequence mainly for entity assoc), " +
+                                "5. all pk fields are IN for a manually 
specified primary key");
+                    }
                 }
 
                 // handle the case where there is a fromDate in the pk of the 
entity, and it is optional or undefined in the service def, populate 
automatically
                 ModelField fromDateField = modelEntity.getField("fromDate");
                 if (fromDateField != null && fromDateField.getIsPk()) {
                     ModelParam fromDateParam = 
modelService.getParam("fromDate");
-                    if (fromDateParam == null || (fromDateParam.isOptional() 
&& parameters.get("fromDate") == null)) {
+                    if (fromDateParam == null || parameters.get("fromDate") == 
null) {
                         newEntity.set("fromDate", UtilDateTime.nowTimestamp());
                     }
                 }
 
+                newEntity.setNonPKFields(parameters, true);
                 if (modelEntity.getField("createdDate") != null) {
                     newEntity.set("createdDate", UtilDateTime.nowTimestamp());
                     if (modelEntity.getField("createdByUserLogin") != null) {
@@ -246,8 +270,8 @@ public final class EntityAutoEngine exte
                         newEntity.set("lastModifiedDate", 
UtilDateTime.nowTimestamp());
                     }
                 }
-                newEntity.setNonPKFields(parameters, true);
                 newEntity.create();
+                result.putAll(modelService.makeValid(newEntity, "OUT"));
             } else if ("update".equals(modelService.invoke)) {
                 /*
                 <auto-attributes include="pk" mode="IN" optional="false"/>
@@ -313,9 +337,9 @@ public final class EntityAutoEngine exte
                         }
                     }
                 }
-
                 // NOTE: nothing here to maintain the status history, that 
should be done with a custom service called by SECA rule
 
+                lookedUpValue.setNonPKFields(parameters, true);
                 if (modelEntity.getField("lastModifiedDate") != null) {
                     lookedUpValue.set("lastModifiedDate", 
UtilDateTime.nowTimestamp());
                     if (modelEntity.getField("lastModifiedByUserLogin") != 
null) {
@@ -325,8 +349,6 @@ public final class EntityAutoEngine exte
                         }
                     }
                 }
-
-                lookedUpValue.setNonPKFields(parameters, true);
                 lookedUpValue.store();
             } else if ("delete".equals(modelService.invoke)) {
                 /*
@@ -344,6 +366,8 @@ public final class EntityAutoEngine exte
                 GenericValue lookedUpValue = 
PrimaryKeyFinder.runFind(modelEntity, parameters, dctx.getDelegator(), false, 
true, null, null);
                 if (lookedUpValue != null) {
                     lookedUpValue.remove();
+                } else {
+                    return 
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"ServiceValueNotFoundForRemove", locale));
                 }
             }
         } catch (GeneralException e) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
 Mon Nov 10 08:07:12 2014
@@ -19,7 +19,6 @@
 package org.ofbiz.service.engine;
 
 import static org.ofbiz.base.util.UtilGenerics.cast;
-import groovy.lang.GroovyClassLoader;
 import groovy.lang.Script;
 
 import java.util.Collections;
@@ -30,10 +29,7 @@ import java.util.Set;
 
 import javax.script.ScriptContext;
 
-import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.runtime.InvokerHelper;
-import org.ofbiz.base.config.GenericConfigException;
-import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.GroovyUtil;
 import org.ofbiz.base.util.ScriptHelper;
@@ -44,7 +40,6 @@ import org.ofbiz.service.GenericServiceE
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceDispatcher;
 import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.service.config.ServiceConfigUtil;
 
 /**
  * Groovy Script Service Engine
@@ -55,8 +50,6 @@ public final class GroovyEngine extends 
     protected static final Object[] EMPTY_ARGS = {};
     private static final Set<String> protectedKeys = createProtectedKeys();
 
-    GroovyClassLoader groovyClassLoader;
-
     private static Set<String> createProtectedKeys() {
         Set<String> newSet = new HashSet<String>();
         /* Commenting out for now because some scripts write to the parameters 
Map - which should not be allowed.
@@ -70,16 +63,6 @@ public final class GroovyEngine extends 
 
     public GroovyEngine(ServiceDispatcher dispatcher) {
         super(dispatcher);
-        try {
-            String scriptBaseClass = 
ServiceConfigUtil.getEngineParameter("groovy", "scriptBaseClass");
-            if (scriptBaseClass != null) {
-                CompilerConfiguration conf = new CompilerConfiguration();
-                conf.setScriptBaseClass(scriptBaseClass);
-                groovyClassLoader = new 
GroovyClassLoader(getClass().getClassLoader(), conf);
-            }
-        } catch (GenericConfigException gce) {
-            Debug.logWarning(gce, "Error retrieving the configuration for the 
groovy service engine: ", module);
-        }
     }
 
     /**
@@ -119,7 +102,7 @@ public final class GroovyEngine extends 
             if (scriptHelper != null) {
                 gContext.put(ScriptUtil.SCRIPT_HELPER_KEY, scriptHelper);
             }
-            Script script = 
InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService),
 groovyClassLoader), GroovyUtil.getBinding(gContext));
+            Script script = 
InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)),
 GroovyUtil.getBinding(gContext));
             Object resultObj = null;
             if (UtilValidate.isEmpty(modelService.invoke)) {
                 resultObj = script.run();

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
 Mon Nov 10 08:07:12 2014
@@ -104,11 +104,10 @@ public class ServiceEntityAutoTests exte
         testingNodeMember.remove();
 
         //test create auto sub-sequence
-        //test missing pk
+        //test missing pk fromDate
         Map<String, Object> testingNodeMemberPkMissingMap = 
UtilMisc.toMap("testingId", "TESTING_3", "testingNodeId", "NODE_1");
         results = 
dispatcher.runSync("testEntityAutoCreateTestingNodeMemberPkMissing", 
testingNodeMemberPkMissingMap, 10, true);
-        assertTrue(ServiceUtil.isError(results));
-        assertTrue(ServiceUtil.getErrorMessage(results).contains("1. a single 
OUT pk for primary auto-sequencing"));
+        assertTrue(ServiceUtil.isSuccess(results));
     }
 
     public void testEntityAutoUpdateEntity() throws Exception {
@@ -141,7 +140,7 @@ public class ServiceEntityAutoTests exte
         //test create with bad pk
         Map<String, Object> testingDeleteFailedMap = 
UtilMisc.toMap("testingId", "TESTING_5_FAILED");
         results = dispatcher.runSync("testEntityAutoRemoveTesting", 
testingDeleteFailedMap);
-        assertTrue(ServiceUtil.isSuccess(results));
-        //assertEquals(UtilProperties.getMessage("ServiceErrorUiLabels", 
"ServiceValueNotFound", Locale.ENGLISH), ServiceUtil.getErrorMessage(results));
+        assertTrue(ServiceUtil.isError(results));
+        assertEquals(UtilProperties.getMessage("ServiceErrorUiLabels", 
"ServiceValueNotFoundForRemove", Locale.ENGLISH), 
ServiceUtil.getErrorMessage(results));
     }
 }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/GroovyEventHandler.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/GroovyEventHandler.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/GroovyEventHandler.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/event/GroovyEventHandler.java
 Mon Nov 10 08:07:12 2014
@@ -18,7 +18,6 @@
  */
 package org.ofbiz.webapp.event;
 
-import groovy.lang.GroovyClassLoader;
 import groovy.lang.Script;
 
 import java.util.Collections;
@@ -33,9 +32,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.runtime.InvokerHelper;
-import org.ofbiz.base.config.GenericConfigException;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GroovyUtil;
 import org.ofbiz.base.util.ScriptHelper;
@@ -43,7 +40,6 @@ import org.ofbiz.base.util.ScriptUtil;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.service.config.ServiceConfigUtil;
 import org.ofbiz.webapp.control.ConfigXMLReader.Event;
 import org.ofbiz.webapp.control.ConfigXMLReader.RequestMap;
 
@@ -70,20 +66,7 @@ public class GroovyEventHandler implemen
         return Collections.unmodifiableSet(newSet);
     }
 
-    private GroovyClassLoader groovyClassLoader;
-
     public void init(ServletContext context) throws EventHandlerException {
-        try {
-            // TODO: the name of the script base class is currently retrieved 
from the Groovy service engine configuration
-            String scriptBaseClass = 
ServiceConfigUtil.getEngineParameter("groovy", "scriptBaseClass");
-            if (scriptBaseClass != null) {
-                CompilerConfiguration conf = new CompilerConfiguration();
-                conf.setScriptBaseClass(scriptBaseClass);
-                groovyClassLoader = new 
GroovyClassLoader(getClass().getClassLoader(), conf);
-            }
-        } catch (GenericConfigException gce) {
-            Debug.logWarning(gce, "Error retrieving the configuration for the 
groovy service engine: ", module);
-        }
     }
 
     public String invoke(Event event, RequestMap requestMap, 
HttpServletRequest request, HttpServletResponse response) throws 
EventHandlerException {
@@ -107,7 +90,7 @@ public class GroovyEventHandler implemen
                 if (scriptHelper != null) {
                     context.put(ScriptUtil.SCRIPT_HELPER_KEY, scriptHelper);
                 }
-                Script script = 
InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(event.path, 
groovyClassLoader), GroovyUtil.getBinding(context));
+                Script script = 
InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(event.path), 
GroovyUtil.getBinding(context));
                 if (UtilValidate.isEmpty(event.invoke)) {
                     result = script.run();
                 } else {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
 Mon Nov 10 08:07:12 2014
@@ -90,8 +90,7 @@ public class FormFactory {
             URL formFileUrl = servletContext.getResource(resourceName);
             Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, 
true);
             Element formElement = 
UtilXml.firstChildElement(formFileDoc.getDocumentElement(), "form", "name", 
formName);
-            modelForm = new ModelForm(formElement, delegator.getModelReader(), 
dispatcher.getDispatchContext());
-            modelForm.setFormLocation(resourceName);
+            modelForm = new ModelForm(formElement, resourceName, 
delegator.getModelReader(), dispatcher.getDispatchContext());
             modelForm = formWebappCache.putIfAbsentAndGet(cacheKey, modelForm);
         }
         if (modelForm == null) {
@@ -126,8 +125,7 @@ public class FormFactory {
     }
 
     public static ModelForm createModelForm(Element formElement, ModelReader 
entityModelReader, DispatchContext dispatchContext, String formLocation, String 
formName) {
-        ModelForm modelForm = new ModelForm(formElement, entityModelReader, 
dispatchContext);
-        modelForm.setFormLocation(formLocation);
+        ModelForm modelForm = new ModelForm(formElement, formLocation, 
entityModelReader, dispatchContext);
         return modelForm;
     }
 }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1637805&r1=1637804&r2=1637805&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
 Mon Nov 10 08:07:12 2014
@@ -558,7 +558,8 @@ public final class MacroFormRenderer imp
             }
         }
         String id = modelFormField.getCurrentContainerId(context);
-        String formName = 
modelFormField.getModelForm().getCurrentFormName(context);
+        ModelForm modelForm = modelFormField.getModelForm();
+        String formName = FormRenderer.getCurrentFormName(modelForm, context);
         String timeDropdown = dateTimeField.getInputMethod();
         String timeDropdownParamName = "";
         String classString = "";
@@ -1068,7 +1069,7 @@ public final class MacroFormRenderer imp
         String title = modelFormField.getTitle(context);
         String name = modelFormField.getParameterName(context);
         String buttonType = submitField.getButtonType();
-        String formName = modelForm.getCurrentFormName(context);
+        String formName = FormRenderer.getCurrentFormName(modelForm, context);
         String imgSrc = submitField.getImageLocation(context);
         String confirmation = submitField.getConfirmation(context);
         String className = "";
@@ -1079,7 +1080,7 @@ public final class MacroFormRenderer imp
                 alert = "true";
             }
         }
-        String formId = modelForm.getCurrentContainerId(context);
+        String formId = FormRenderer.getCurrentContainerId(modelForm, context);
         List<ModelForm.UpdateArea> updateAreas = 
modelForm.getOnSubmitUpdateAreas();
         // This is here for backwards compatibility. Use on-event-update-area
         // elements instead.
@@ -1090,7 +1091,7 @@ public final class MacroFormRenderer imp
             }
             updateAreas.add(new ModelForm.UpdateArea("submit", formId, 
backgroundSubmitRefreshTarget));
         }
-        boolean ajaxEnabled = (updateAreas != null || 
UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) && 
this.javaScriptEnabled;
+        boolean ajaxEnabled = (UtilValidate.isNotEmpty(updateAreas) || 
UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) && 
this.javaScriptEnabled;
         String ajaxUrl = "";
         if (ajaxEnabled) {
             ajaxUrl = createAjaxParamsFromUpdateAreas(updateAreas, "", 
context);
@@ -1297,14 +1298,14 @@ public final class MacroFormRenderer imp
         }
         String formType = modelForm.getType();
         String targetWindow = modelForm.getTargetWindow(context);
-        String containerId = modelForm.getCurrentContainerId(context);
+        String containerId = FormRenderer.getCurrentContainerId(modelForm, 
context);
         String containerStyle = modelForm.getContainerStyle();
         String autocomplete = "";
-        String name = modelForm.getCurrentFormName(context);
+        String name = FormRenderer.getCurrentFormName(modelForm, context);
         String viewIndexField = modelForm.getMultiPaginateIndexField(context);
         String viewSizeField = modelForm.getMultiPaginateSizeField(context);
-        int viewIndex = modelForm.getViewIndex(context);
-        int viewSize = modelForm.getViewSize(context);
+        int viewIndex = Paginator.getViewIndex(modelForm, context);
+        int viewSize = Paginator.getViewSize(modelForm, context);
         boolean useRowSubmit = modelForm.getUseRowSubmit();
         if (!modelForm.getClientAutocompleteFields()) {
             autocomplete = "off";
@@ -1341,8 +1342,8 @@ public final class MacroFormRenderer imp
 
     public void renderFormClose(Appendable writer, Map<String, Object> 
context, ModelForm modelForm) throws IOException {
         String focusFieldName = modelForm.getfocusFieldName();
-        String formName = modelForm.getCurrentFormName(context);
-        String containerId = modelForm.getCurrentContainerId(context);
+        String formName = FormRenderer.getCurrentFormName(modelForm, context);
+        String containerId = FormRenderer.getCurrentContainerId(modelForm, 
context);
         String hasRequiredField = "";
         for (ModelFormField formField : modelForm.getFieldList()) {
             if (formField.getRequiredField()) {
@@ -1903,7 +1904,8 @@ public final class MacroFormRenderer imp
         StringBuilder imgSrc = new StringBuilder();
         // add calendar pop-up button and seed data IF this is not a "time" 
type date-find
         if (!"time".equals(dateFindField.getType())) {
-            formName = 
modelFormField.getModelForm().getCurrentFormName(context);
+            ModelForm modelForm = modelFormField.getModelForm();
+            formName = FormRenderer.getCurrentFormName(modelForm, context);
             defaultDateTimeString = 
UtilHttp.encodeBlanks(modelFormField.getEntry(context, 
dateFindField.getDefaultDateTimeString(context)));
             this.appendContentUrl(imgSrc, "/images/cal.gif");
         }
@@ -2014,7 +2016,7 @@ public final class MacroFormRenderer imp
             updateAreas = new LinkedList<ModelForm.UpdateArea>();
             updateAreas.add(new ModelForm.UpdateArea("change", id, 
autoCompleterTarget));
         }
-        boolean ajaxEnabled = updateAreas != null && this.javaScriptEnabled;
+        boolean ajaxEnabled = UtilValidate.isNotEmpty(updateAreas) && 
this.javaScriptEnabled;
         String autocomplete = "";
         if (!lookupField.getClientAutocompleteField() || !ajaxEnabled) {
             autocomplete = "off";
@@ -2024,7 +2026,8 @@ public final class MacroFormRenderer imp
         boolean readonly = lookupField.readonly;
         // add lookup pop-up button
         String descriptionFieldName = lookupField.getDescriptionFieldName();
-        String formName = 
modelFormField.getModelForm().getCurrentFormName(context);
+        ModelForm modelForm = modelFormField.getModelForm();
+        String formName = FormRenderer.getCurrentFormName(modelForm, context);
         StringBuilder targetParameterIter = new StringBuilder();
         StringBuilder imgSrc = new StringBuilder();
         // FIXME: refactor using the StringUtils methods
@@ -2183,12 +2186,12 @@ public final class MacroFormRenderer imp
         int paginatorNumber = WidgetWorker.getPaginatorNumber(context);
         String viewIndexParam = modelForm.getMultiPaginateIndexField(context);
         String viewSizeParam = modelForm.getMultiPaginateSizeField(context);
-        int viewIndex = modelForm.getViewIndex(context);
-        int viewSize = modelForm.getViewSize(context);
-        int listSize = modelForm.getListSize(context);
-        int lowIndex = modelForm.getLowIndex(context);
-        int highIndex = modelForm.getHighIndex(context);
-        int actualPageSize = modelForm.getActualPageSize(context);
+        int viewIndex = Paginator.getViewIndex(modelForm, context);
+        int viewSize = Paginator.getViewSize(modelForm, context);
+        int listSize = Paginator.getListSize(context);
+        int lowIndex = Paginator.getLowIndex(context);
+        int highIndex = Paginator.getHighIndex(context);
+        int actualPageSize = Paginator.getActualPageSize(context);
         // needed for the "Page" and "rows" labels
         Map<String, String> uiLabelMap = 
UtilGenerics.checkMap(context.get("uiLabelMap"));
         String pageLabel = "";
@@ -2935,8 +2938,9 @@ public final class MacroFormRenderer imp
         int paginatorNumber = WidgetWorker.getPaginatorNumber(context);
         String viewIndexField = 
modelFormField.modelForm.getMultiPaginateIndexField(context);
         String viewSizeField = 
modelFormField.modelForm.getMultiPaginateSizeField(context);
-        int viewIndex = modelFormField.modelForm.getViewIndex(context);
-        int viewSize = modelFormField.modelForm.getViewSize(context);
+        ModelForm modelForm = modelFormField.modelForm;
+        int viewIndex = Paginator.getViewIndex(modelForm, context);
+        int viewSize = Paginator.getViewSize(modelForm, context);
         if (viewIndexField.equals("viewIndex" + "_" + paginatorNumber)) {
             viewIndexField = "VIEW_INDEX" + "_" + paginatorNumber;
         }


Reply via email to