Author: ashish
Date: Tue Oct 13 10:32:49 2009 New Revision: 824675 URL: http://svn.apache.org/viewvc?rev=824675&view=rev Log: Applied patch from jira issue OFBIZ-3033 - Improvement in Product Review implementation. 1) Make createProductReview service definition more generic, so that it can take all nopk fields as IN parameters. 2) Change field value in "productreview.ftl" because field "postedAnonymous" is not a boolean type in ProductReview entity. 3) Make the service implementation more generic so that, it can be used for unregistered users also. 4) Put checks on pendingReviews.ftl to handle case of anonymous user. Thanks Awdesh for the contribution. Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml ofbiz/trunk/applications/product/servicedef/services.xml ofbiz/trunk/applications/product/webapp/catalog/reviews/pendingReviews.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productreview.ftl Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml?rev=824675&r1=824674&r2=824675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml Tue Oct 13 10:32:49 2009 @@ -525,7 +525,7 @@ <remove-value value-field="lookedUpValue"/> </simple-method> - <simple-method method-name="createProductReview" short-description="Create a ProductReview"> + <simple-method method-name="createProductReview" short-description="Create a ProductReview" login-required="false"> <make-value value-field="newEntity" entity-name="ProductReview"/> <set-nonpk-fields map="parameters" value-field="newEntity"/> <set from-field="userLogin.userLoginId" field="newEntity.userLoginId"/> @@ -574,7 +574,7 @@ <set from-field="lookedUpValue.productId" field="productId"/> <call-simple-method method-name="updateProductWithReviewRatingAvg"/> </simple-method> - <simple-method method-name="updateProductWithReviewRatingAvg" short-description="Update Product with new Review Rating Avg"> + <simple-method method-name="updateProductWithReviewRatingAvg" short-description="Update Product with new Review Rating Avg" login-required="false"> <!-- this method is meant to be called in-line and depends in a productId parameter --> <call-class-method class-name="org.ofbiz.product.product.ProductWorker" method-name="getAverageProductRating" ret-field="averageCustomerRating"> <field field="delegator" type="org.ofbiz.entity.Delegator"/> Modified: ofbiz/trunk/applications/product/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=824675&r1=824674&r2=824675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services.xml Tue Oct 13 10:32:49 2009 @@ -188,12 +188,11 @@ <service name="createProductReview" engine="simple" location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductReview" auth="true"> <description>Create a product review entity</description> - <attribute name="productStoreId" type="String" mode="IN" optional="false"/> - <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="postedAnonymous" type="Boolean" mode="IN" optional="true"/> - <attribute name="productRating" type="BigDecimal" mode="IN" optional="false"/> - <attribute name="productReview" type="String" mode="IN" optional="true"/> + <auto-attributes entity-name="ProductReview" mode="IN" include="nonpk" optional="true"/> <attribute name="productReviewId" type="String" mode="OUT" optional="false"/> + <override name="productStoreId" optional="false"/> + <override name="productId" optional="false"/> + <override name="productRating" optional="false"/> </service> <service name="updateProductReview" engine="simple" default-entity-name="ProductReview" location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductReview" auth="true"> Modified: ofbiz/trunk/applications/product/webapp/catalog/reviews/pendingReviews.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/reviews/pendingReviews.ftl?rev=824675&r1=824674&r2=824675&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/reviews/pendingReviews.ftl (original) +++ ofbiz/trunk/applications/product/webapp/catalog/reviews/pendingReviews.ftl Tue Oct 13 10:32:49 2009 @@ -56,6 +56,7 @@ <#assign rowCount = 0> <#assign rowClass = "2"> <#list pendingReviews as review> + <#if review.userLoginId?has_content> <#assign postedUserLogin = review.getRelatedOne("UserLogin")> <#assign party = postedUserLogin.getRelatedOne("Party")> <#assign partyTypeId = party.get("partyTypeId")> @@ -64,16 +65,19 @@ <#else> <#assign postedPerson = postedUserLogin.getRelatedOne("PartyGroup")> </#if> + </#if> <tr id="review_tableRow_${rowCount}" valign="middle"<#if rowClass == "1"> class="alternate-row"</#if>> <td> <input type="hidden" name="productReviewId_o_${rowCount}" value="${review.productReviewId}"> ${review.postedDateTime?if_exists} </td> + <#if postedPerson?has_content> <#if postedPerson.firstName?has_content && postedPerson.lastName?has_content> <td>${postedPerson.firstName} ${postedPerson.lastName}</td> <#else> <td>${postedPerson.groupName}</td> </#if> + </#if> <td> <select name='postedAnonymous_o_${rowCount}'> <option>${review.postedAnonymous?default("N")}</option> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productreview.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productreview.ftl?rev=824675&r1=824674&r2=824675&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productreview.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productreview.ftl Tue Oct 13 10:32:49 2009 @@ -51,11 +51,11 @@ <span><label for="yes">${uiLabelMap.EcommercePostAnonymous}:</label></span> <span> <label for="yes">${uiLabelMap.CommonYes}</label> - <input type="radio" id="yes" name="postedAnonymous" value="true" /> + <input type="radio" id="yes" name="postedAnonymous" value="Y" /> </span> <span> <label for="no">${uiLabelMap.CommonNo}</label> - <input type="radio" id="no" name="postedAnonymous" value="false" checked="checked" /> + <input type="radio" id="no" name="postedAnonymous" value="N" checked="checked" /> </span> </div> <div> |
Free forum by Nabble | Edit this page |