svn commit: r663069 - in /ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions: communication/ party/ visit/

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

svn commit: r663069 - in /ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions: communication/ party/ visit/

ashish-18
Author: ashish
Date: Wed Jun  4 05:32:09 2008
New Revision: 663069

URL: http://svn.apache.org/viewvc?rev=663069&view=rev
Log:
Improvement suggested by Scott on my previous commits on Party component.
Party of JIRA issue # 1801.

PS : Scott I like(understand) the power of Elvis Operator :-)

Modified:
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editShoppingList.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/findMatches.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewprofile.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.groovy

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy Wed Jun  4 05:32:09 2008
@@ -31,7 +31,7 @@
 partyIdTo = context.partyIdTo;
 
 if (parameters.communicationEventTypeId) {
-   if (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION")) {
+   if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) {
       userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom]);
       userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
       context.userEmailAddresses = userEmailAddresses;    

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy Wed Jun  4 05:32:09 2008
@@ -29,12 +29,12 @@
 context.party = party;
 
 // get the sort field
-sortField = parameters.sort ? parameters.sort : "entryDate";
+sortField = parameters.sort ?: "entryDate";
 context.previousSort = sortField;
 
 // previous sort field
 previousSort = parameters.previousSort;
-if (previousSort && previousSort.equals(sortField)) {
+if (previousSort?.equals(sortField)) {
     sortField = "-" + sortField;
 }
 

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy Wed Jun  4 05:32:09 2008
@@ -24,9 +24,8 @@
 if (parentCommEventId) {
     parentEvent = delegator.findByPrimaryKey("CommunicationEvent", [communicationEventId : parentCommEventId]);
     if (parentEvent) {
-        orgEventId = parentEvent.origCommEventId;
-        if (!orgEventId) orgEventId = parentCommEventId;
-
+        orgEventId = parentEvent.origCommEventId ?: parentCommEventId;
+        
         parameters.communicationEventTypeId = parentEvent.communicationEventTypeId;
         parameters.parentCommEventId = parentCommEventId;
         parameters.origCommEventId = orgEventId;

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editShoppingList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editShoppingList.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editShoppingList.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editShoppingList.groovy Wed Jun  4 05:32:09 2008
@@ -24,11 +24,10 @@
 prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
 webSiteId = CatalogWorker.getWebSiteId(request);
 
-currencyUomId = parameters.currencyUomId ? parameters.currencyUomId : UtilHttp.getCurrencyUom(request);
+currencyUomId = parameters.currencyUomId ?: UtilHttp.getCurrencyUom(request);
 context.currencyUomId = currencyUomId;
 
-partyId = parameters.partyId;
-if (!partyId) partyId = parameters.partyId;
+partyId = parameters.partyId ?:parameters.partyId;
 
 party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
 context.party = party;
@@ -37,9 +36,7 @@
     context.lookupGroup = party.getRelatedOne("PartyGroup");
 }
 
-shoppingListId = parameters.shoppingListId;
-if (!shoppingListId)
-    shoppingListId = request.getAttribute("shoppingListId");
+shoppingListId = parameters.shoppingListId ?: request.getAttribute("shoppingListId");
 
 //get the party for listid if it exists    
 if(!partyId && shoppingListId){
@@ -58,7 +55,7 @@
 context.shoppingListTypes = shoppingListTypes;
 
 // no passed shopping list id default to first list
-if (!shoppingListId || shoppingListId.length() == 0) {
+if (!shoppingListId) {
     firstList = EntityUtil.getFirst(shoppingLists);
     if (firstList) {
         shoppingListId = firstList.shoppingListId;
@@ -78,7 +75,7 @@
         if (shoppingListItems) {
             shoppingListItemDatas = new ArrayList(shoppingListItems.size());
             shoppingListItemDatas.each { shoppingListItem ->
-                shoppingListItemData = new HashMap();
+                shoppingListItemData = [:];
                 product = shoppingListItem.getRelatedOneCache("Product");
 
                 // DEJ20050704 not sure about calculating price here, will have some bogus data when not in a store webapp
@@ -113,7 +110,7 @@
         if (childShoppingLists) {
             childShoppingListDatas = new ArrayList(childShoppingLists.size());
             childShoppingListDatas.each { childShoppingList ->
-                childShoppingListData = new HashMap();
+                childShoppingListData = [:];
                 calcListPriceInMap = [shoppingListId : childShoppingList.shoppingListId , prodCatalogId : prodCatalogId , webSiteId : webSiteId, userLogin : userLogin];
                 childShoppingListData.childShoppingList = childShoppingList;
                 childShoppingListDatas.add(childShoppingListData);

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy Wed Jun  4 05:32:09 2008
@@ -40,7 +40,4 @@
     }
     context.cmNewPurposeTypeId = cmNewPurposeTypeId;
 }
-
-donePage = parameters.DONE_PAGE;
-if (!donePage || donePage.length() <= 0) donePage = "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
-context.donePage = donePage;
+context.donePage = parameters.DONE_PAGE ?:"viewprofile?party_id=" + partyId + "&partyId=" + partyId;;

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy Wed Jun  4 05:32:09 2008
@@ -20,10 +20,7 @@
 import org.ofbiz.accounting.payment.PaymentWorker;
 import org.ofbiz.party.contact.ContactMechWorker;
 
-partyId = parameters.partyId;
-if (!partyId) {
-    partyId = parameters.party_id;
-}
+partyId = parameters.partyId ?: parameters.party_id;
 context.partyId = partyId;
 
 // payment info
@@ -41,23 +38,18 @@
 tryEntity = paymentResults.tryEntity;
 
 creditCardData = paymentResults.creditCard;
-if (!tryEntity.booleanValue()) creditCardData = parameters;
-if (!creditCardData) creditCardData = new HashMap();
-if (creditCardData) context.creditCardData = creditCardData;
+if (!tryEntity) creditCardData = parameters;
+context.creditCardData = creditCardData ?:[:];
 
 giftCardData = paymentResults.giftCard;
-if (!tryEntity.booleanValue()) giftCardData = parameters;
-if (!giftCardData) giftCardData = new HashMap();
-if (giftCardData) context.giftCardData = giftCardData;
+if (!tryEntity) giftCardData = parameters;
+context.giftCardData = giftCardData ?: [:];
 
 eftAccountData = paymentResults.eftAccount;
-if (!tryEntity.booleanValue()) eftAccountData = parameters;
-if (!eftAccountData) eftAccountData = new HashMap();
-if (eftAccountData) context.eftAccountData = eftAccountData;
-
-donePage = parameters.DONE_PAGE;
-if (!donePage || donePage.length() <= 0) donePage = "viewprofile";
-context.donePage = donePage;
+if (!tryEntity) eftAccountData = parameters;
+context.eftAccountData = eftAccountData ?: [:];
+
+context.donePage = parameters.DONE_PAGE ?:"viewprofile";
 
 paymentMethodData = paymentResults.paymentMethod;
 if (!tryEntity.booleanValue()) paymentMethodData = parameters;

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/findMatches.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/findMatches.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/findMatches.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/findMatches.groovy Wed Jun  4 05:32:09 2008
@@ -23,29 +23,16 @@
 if (match) {
     context.match = match;
     
-    lastName = parameters.lastName;
-    if (!lastName) lastName = null;
-
-    firstName = parameters.firstName;
-    if (!firstName) firstName = null;
-
-    address1 = parameters.address1;
-    if (!address1) address1 = null;
-
-    address2 = parameters.address2;
-    if (!address2) address2 = null;
-
-    city = parameters.city;
-    if (!city) city = null;
-
-    state = parameters.stateProvinceGeoId;
-    if (!state) state = null;
+    lastName = parameters.lastName ?: null;
+    firstName = parameters.firstName ?: null;
+    address1 = parameters.address1 ?: null;
+    address2 = parameters.address2 ?: null;
+    city = parameters.city ?: null;
+    state = parameters.stateProvinceGeoId ?: null;
     if ("ANY".equals(state)) state = null;
+    postalCode = parameters.postalCode ?: null;
 
-    postalCode = parameters.postalCode;
-    if (!postalCode) postalCode = null;
-
-    if (state != null) {
+    if (state) {
         context.currentStateGeo = delegator.findByPrimaryKey("Geo", [geoId : state]);
     }
 

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy Wed Jun  4 05:32:09 2008
@@ -19,10 +19,6 @@
 
 import org.ofbiz.party.contact.ContactMechWorker;
 
-if (!partyId) {
-    partyId = parameters.partyId;
-}
-boolean showOld = "true".equals(parameters.SHOW_OLD);
-context.showOld = new Boolean(showOld);
-
+partyId = partyId ?: parameters.partyId;
+context.showOld = "true".equals(parameters.SHOW_OLD);
 context.contactMeches = ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, showOld);
\ No newline at end of file

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy Wed Jun  4 05:32:09 2008
@@ -19,9 +19,7 @@
 
 import org.ofbiz.entity.util.EntityUtil;
 
-if (!partyId) {
-    partyId = parameters.partyId;
-}
+partyId = partyId ?: parameters.partyId;
 
 savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList", [partyId : partyId,
         shoppingListTypeId : "SLT_SPEC_PURP" , listName : "auto-save"]));

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy Wed Jun  4 05:32:09 2008
@@ -19,9 +19,7 @@
 
 import org.ofbiz.base.util.*;
 
-if (!partyId) {
-    partyId = parameters.partyId;
-}
+partyId = partyId ?: parameters.partyId;
 
 if (partyId) {
     // get the system user

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy Wed Jun  4 05:32:09 2008
@@ -19,10 +19,6 @@
 
 import org.ofbiz.accounting.payment.PaymentWorker;
 
-if (!partyId) {
-    partyId = parameters.partyId;
-}
-boolean showOld = "true".equals(parameters.SHOW_OLD);
-context.showOld = new Boolean(showOld);
-
+partyId = partyId ?: parameters.partyId;
+context.showOld = "true".equals(parameters.SHOW_OLD);
 context.paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, showOld);
\ No newline at end of file

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewprofile.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewprofile.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewprofile.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewprofile.groovy Wed Jun  4 05:32:09 2008
@@ -19,14 +19,9 @@
 
 import org.ofbiz.base.util.UtilDateTime;
 
-partyId = parameters.partyId;
-if (!partyId)
-    partyId = parameters.party_id;
+partyId = parameters.partyId ?: parameters.party_id;
+userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
 
-userLoginId = parameters.userlogin_id;
-if (!userLoginId) {
-    userLoginId = parameters.userLoginId;
-}
 if (!partyId && userLoginId) {
     thisUserLogin = delegator.findByPrimaryKey("UserLogin", [userLoginId : userLoginId]);
     if (thisUserLogin) {
@@ -35,9 +30,7 @@
     }
 }
 
-boolean showOld = "true".equals(parameters.SHOW_OLD);
-context.showOld = new Boolean(showOld);
-
+context.showOld = "true".equals(parameters.SHOW_OLD);
 context.partyId = partyId;
 context.party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
 context.nowStr = UtilDateTime.nowTimestamp().toString();
\ No newline at end of file

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy Wed Jun  4 05:32:09 2008
@@ -22,9 +22,8 @@
 
 import javolution.util.FastList;
 
-partyId = parameters.party_id;
-if (!partyId) partyId = parameters.partyId;
-if (!partyId) partyId = (String) request.getAttribute("partyId");
+partyId = parameters.party_id ?:parameters.partyId;
+partyId = partyId ?:request.getAttribute("partyId");
 context.partyId = partyId;
 
 List roleTypeAndPartyExprs = FastList.newInstance();

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.groovy?rev=663069&r1=663068&r2=663069&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/visit/showvisits.groovy Wed Jun  4 05:32:09 2008
@@ -26,8 +26,7 @@
 partyId = parameters.partyId;
 context.partyId = partyId;
 
-showAll = parameters.showAll;
-if (!showAll) showAll = "false";
+showAll = parameters.showAll ?:"false";
 context.showAll = showAll;
 
 sort = parameters.sort;