You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by by...@apache.org on 2007/09/27 18:55:18 UTC

svn commit: r580095 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java

Author: byersa
Date: Thu Sep 27 09:55:17 2007
New Revision: 580095

URL: http://svn.apache.org/viewvc?rev=580095&view=rev
Log:
Fixed another bug I added. Was building a fromDate if none was passed and that was the wrong behavior.

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java?rev=580095&r1=580094&r2=580095&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java Thu Sep 27 09:55:17 2007
@@ -65,6 +65,7 @@
         String contentId = request.getParameter("contentId");
         String rootContentId = request.getParameter("rootContentId");
         String mapKey = request.getParameter("mapKey");
+        String contentAssocTypeId = request.getParameter("contentAssocTypeId");
         String fromDateStr = request.getParameter("fromDate");
     	String dataResourceId = request.getParameter("dataResourceId");
         String contentRevisionSeqId = request.getParameter("contentRevisionSeqId");
@@ -89,21 +90,24 @@
             GenericDelegator delegator = (GenericDelegator)request.getAttribute("delegator");
             if (UtilValidate.isEmpty(dataResourceId)) {
                 if (UtilValidate.isEmpty(contentRevisionSeqId)) {
-                    if (UtilValidate.isEmpty(mapKey)) {
+                    if (UtilValidate.isEmpty(mapKey) && UtilValidate.isEmpty(contentAssocTypeId)) {
                         GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId));
                         dataResourceId = content.getString("dataResourceId");
                         Debug.logInfo("SCVH(0b)- dataResourceId:" + dataResourceId, module);
                     } else {
                         Timestamp fromDate = null;
-                        if (UtilValidate.isEmpty(fromDateStr)) {
-                            fromDateStr = UtilDateTime.nowAsString();
+                        if (UtilValidate.isNotEmpty(fromDateStr)) {
+                            try {
+                                fromDate = UtilDateTime.stringToTimeStamp(fromDateStr, null, locale);
+                            } catch (ParseException e) {
+                                fromDate = UtilDateTime.nowTimestamp();
+                            }
                         }
-                        try {
-                            fromDate = UtilDateTime.stringToTimeStamp(fromDateStr, null, locale);
-                        } catch (ParseException e) {
-                            fromDate = UtilDateTime.nowTimestamp();
+                        List assocList = null;
+                        if (UtilValidate.isNotEmpty(contentAssocTypeId)) {
+                            assocList = UtilMisc.toList(contentAssocTypeId);
                         }
-                        GenericValue content = ContentWorker.getSubContent(delegator, contentId, mapKey, null, null, null, fromDate);
+                        GenericValue content = ContentWorker.getSubContent(delegator, contentId, mapKey, null, null, assocList, fromDate);
                         dataResourceId = content.getString("dataResourceId");
                         Debug.logInfo("SCVH(0b)- dataResourceId:" + dataResourceId, module);
                     }