The loopkup for a party is pretty easy, though easier (as with many things here...) using the form widget instead of an ftl file. In fact, we have a project-wide goal of converting all generic ftl screens like this to use the form widget. Of course, I wasn't involved in discussions around this and only read what has gone through the lists and the issue... was there a reason for using FTL instead of the Form Widget (Ean or Adrian)? -David [hidden email] wrote: > Author: adrianc > Date: Mon Sep 24 12:38:03 2007 > New Revision: 578930 > > URL: http://svn.apache.org/viewvc?rev=578930&view=rev > Log: > New feature - assign parties to products. Patch is from Ean Schuessler - OFBIZ-1177, plus some additional work from me. Still needs a party ID lookup screen. > > Added: > ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl > Modified: > ofbiz/trunk/applications/product/config/ProductUiLabels.properties > ofbiz/trunk/applications/product/entitydef/entitygroup.xml > ofbiz/trunk/applications/product/entitydef/entitymodel.xml > ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml > ofbiz/trunk/applications/product/servicedef/services.xml > ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml > ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl > ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml > ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml > > Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.properties > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/config/ProductUiLabels.properties (original) > +++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties Mon Sep 24 12:38:03 2007 > @@ -132,6 +132,7 @@ > PageTitleEditProductPromos=Edit Product Promos > PageTitleEditProductPromotionCode=Edit Product Promotion Code > PageTitleEditProductQuickAdmin=Edit Product Quick Admin > +PageTitleEditProductParties=Edit Product Parties > PageTitleEditProductStore=Edit Product Store > PageTitleEditProductStoreCatalogs=Edit Product Store Catalogs > PageTitleEditProductStoreEmailSetup=Edit Product Store Email Setup > @@ -329,6 +330,7 @@ > ProductAssetUsage=Rental > ProductAssignPicker=Assign Picker > ProductAssociatePartyToCategory=Associate Party to Category (enter Party ID, select Type, then enter optional From Date) > +ProductAssociatePartyToProduct=Associate Party to Product (enter Party ID, select Type, then enter optional From Date) > ProductAssociationNotFound=Association not found: Product Id=${productId?if_exists}, Product Id To=${productIdTo?if_exists}, Association Type Id=${productAssocTypeId?if_exists}, From Date=${fromDate?if_exists} > ProductAssociationType=Association Type > ProductAssociationTypeId=Association Type ID > @@ -434,7 +436,6 @@ > ProductCopyProductCategoryMembersToAnotherCategory=Copy Product Category Members to Another Category > ProductCostPrice=Cost Price > ProductCosts=Costs > -ProductCostPrice=Cost Price > ProductCouldNotFindFacilityWithId=Could Not Find Facility with ID > ProductCouldNotFindProduct=Could Not Find Product with ID > ProductCouldNotFindProductCategoryWithId=Could not Find Product Category with Id > > Modified: ofbiz/trunk/applications/product/entitydef/entitygroup.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitygroup.xml?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/entitydef/entitygroup.xml (original) > +++ ofbiz/trunk/applications/product/entitydef/entitygroup.xml Mon Sep 24 12:38:03 2007 > @@ -176,6 +176,7 @@ > <entity-group group="org.ofbiz" entity="ProductMaint" /> > <entity-group group="org.ofbiz" entity="ProductMaintType" /> > <entity-group group="org.ofbiz" entity="ProductReview" /> > + <entity-group group="org.ofbiz" entity="ProductRole" /> > <entity-group group="org.ofbiz" entity="ProductSearchConstraint" /> > <entity-group group="org.ofbiz" entity="ProductSearchResult" /> > <entity-group group="org.ofbiz" entity="ProductType" /> > @@ -336,5 +337,7 @@ > <entity-group group="org.ofbiz" entity="ShippingDocument" /> > <entity-group group="org.ofbiz" entity="PackedQtyVsOrderItemQuantity" /> > </entitygroup> > + > + > > > > Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) > +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Mon Sep 24 12:38:03 2007 > @@ -2190,6 +2190,33 @@ > <key-map field-name="parentTypeId" rel-field-name="productAssocTypeId"/> > </relation> > </entity> > + <entity entity-name="ProductRole" > + package-name="org.ofbiz.product.product" > + title="Product Role Entity"> > + <field name="productId" type="id-ne"></field> > + <field name="partyId" type="id-ne"></field> > + <field name="roleTypeId" type="id-ne"></field> > + <field name="fromDate" type="date-time"></field> > + <field name="thruDate" type="date-time"></field> > + <field name="comments" type="comment"></field> > + <prim-key field="productId"/> > + <prim-key field="partyId"/> > + <prim-key field="roleTypeId"/> > + <prim-key field="fromDate"/> > + <relation type="one-nofk" rel-entity-name="Party"> > + <key-map field-name="partyId"/> > + </relation> > + <relation type="one-nofk" rel-entity-name="RoleType"> > + <key-map field-name="roleTypeId"/> > + </relation> > + <relation type="one" fk-name="PROD_RLE_PTYRLE" rel-entity-name="PartyRole"> > + <key-map field-name="partyId"/> > + <key-map field-name="roleTypeId"/> > + </relation> > + <!-- <relation type="one" fk-name="PROD_RLE_CATEGORY" rel-entity-name="Product"> > + <key-map field-name="productCategoryId"/> > + </relation> --> > + </entity> > <entity entity-name="ProductAttribute" > package-name="org.ofbiz.product.product" > title="Product Attribute Entity"> > > 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=578930&r1=578929&r2=578930&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 Mon Sep 24 12:38:03 2007 > @@ -900,4 +900,49 @@ > <entity-one entity-name="ProductAttribute" value-name="lookedUpValue"/> > <remove-value value-name="lookedUpValue"/> > </simple-method> > + > + <!-- ================================================================ --> > + <!-- ProductRole Services --> > + <!-- ================================================================ --> > + > + <simple-method method-name="addPartyToProduct" short-description="Add Party to Product"> > + <set value="addPartyToProduct" field="callingMethodName"/> > + <set value="CREATE" field="checkAction"/> > + <call-simple-method method-name="checkProductRelatedPermission"/> > + <check-errors/> > + > + <make-value value-name="newEntity" entity-name="ProductRole"/> > + <set-pk-fields map-name="parameters" value-name="newEntity"/> > + <set-nonpk-fields map-name="parameters" value-name="newEntity"/> > + > + <if-empty field-name="newEntity.fromDate"> > + <now-timestamp-to-env env-name="newEntity.fromDate"/> > + </if-empty> > + > + <create-value value-name="newEntity"/> > + </simple-method> > + <simple-method method-name="updatePartyToProduct" short-description="Update Party to Product"> > + <set value="updatePartyToProduct" field="callingMethodName"/> > + <set value="UPDATE" field="checkAction"/> > + <call-simple-method method-name="checkProductRelatedPermission"/> > + <check-errors/> > + > + <make-value value-name="lookupPKMap" entity-name="ProductRole"/> > + <set-pk-fields map-name="parameters" value-name="lookupPKMap"/> > + <find-by-primary-key entity-name="ProductRole" map-name="lookupPKMap" value-name="lookedUpValue"/> > + <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/> > + <store-value value-name="lookedUpValue"/> > + </simple-method> > + <simple-method method-name="removePartyFromProduct" short-description="Remove Party From Product"> > + <set value="removePartyFromProduct" field="callingMethodName"/> > + <set value="DELETE" field="checkAction"/> > + <call-simple-method method-name="checkProductRelatedPermission"/> > + <check-errors/> > + > + <make-value value-name="lookupPKMap" entity-name="ProductRole"/> > + <set-pk-fields map-name="parameters" value-name="lookupPKMap"/> > + <find-by-primary-key entity-name="ProductRole" map-name="lookupPKMap" value-name="lookedUpValue"/> > + <remove-value value-name="lookedUpValue"/> > + </simple-method> > + > </simple-methods> > > Modified: ofbiz/trunk/applications/product/servicedef/services.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/servicedef/services.xml (original) > +++ ofbiz/trunk/applications/product/servicedef/services.xml Mon Sep 24 12:38:03 2007 > @@ -716,6 +716,35 @@ > <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/> > </service> > > + <service name="addPartyToProduct" engine="simple" > + location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="addPartyToProduct" auth="true"> > + <description>Add Party To Product</description> > + <attribute name="productId" type="String" mode="IN" optional="false"/> > + <attribute name="partyId" type="String" mode="IN" optional="false"/> > + <attribute name="roleTypeId" type="String" mode="IN" optional="false"/> > + <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> > + <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/> > + <attribute name="comments" type="String" mode="IN" optional="true"/> > + </service> > + <service name="updatePartyToProduct" engine="simple" > + location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updatePartyToProduct" auth="true"> > + <description>Update Party To Product</description> > + <attribute name="productId" type="String" mode="IN" optional="false"/> > + <attribute name="partyId" type="String" mode="IN" optional="false"/> > + <attribute name="roleTypeId" type="String" mode="IN" optional="false"/> > + <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/> > + <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/> > + <attribute name="comments" type="String" mode="IN" optional="true"/> > + </service> > + <service name="removePartyFromProduct" engine="simple" > + location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="removePartyFromProduct" auth="true"> > + <description>Remove Party From Product</description> > + <attribute name="productId" type="String" mode="IN" optional="false"/> > + <attribute name="partyId" type="String" mode="IN" optional="false"/> > + <attribute name="roleTypeId" type="String" mode="IN" optional="false"/> > + <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/> > + </service> > + > <service name="safeAddProductCategoryToCategory" engine="simple" > location="org/ofbiz/product/category/CategoryServices.xml" invoke="addProductCategoryToCategory" auth="true"> > <description>Safe Add ProductCategory To Category (requires fromDate)</description> > > Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original) > +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Mon Sep 24 12:38:03 2007 > @@ -512,8 +512,31 @@ > <request-map uri="ProductBarCode.pdf"> > <security https="true" auth="true"/> > <response name="success" type="view" value="ProductBarCode.pdf"/> > + </request-map> > + > + <!-- ================ Product Roles Requests ================= --> > + <request-map uri="EditProductParties"> > + <security https="true" auth="true"/> > + <response name="success" type="view" value="EditProductParties"/> > + </request-map> > + <request-map uri="addPartyToProduct"> > + <security https="true" auth="true"/> > + <event type="service" path="" invoke="addPartyToProduct"/> > + <response name="success" type="view" value="EditProductParties"/> > + <response name="error" type="view" value="EditProductParties"/> > + </request-map> > + <request-map uri="updatePartyToProduct"> > + <security https="true" auth="true"/> > + <event type="service" path="" invoke="updatePartyToProduct"/> > + <response name="success" type="view" value="EditProductParties"/> > + <response name="error" type="view" value="EditProductParties"/> > + </request-map> > + <request-map uri="removePartyFromProduct"> > + <security https="true" auth="true"/> > + <event type="service" path="" invoke="removePartyFromProduct"/> > + <response name="success" type="view" value="EditProductParties"/> > + <response name="error" type="view" value="EditProductParties"/> > </request-map> > - > > <!-- ================ Product Asset Usage (rental) Requests ================= --> > <request-map uri="EditProductAssetUsage"> > @@ -2505,6 +2528,7 @@ > <view-map name="EditProduct" type="screen" page="component://product/widget/catalog/ProductScreens.xml#EditProduct"/> > <view-map name="EditProductPrices" type="screen" page="component://product/widget/catalog/ProductScreens.xml#EditProductPrices"/> > <view-map name="EditProductAssetUsage" type="screen" page="component://product/widget/catalog/ProductScreens.xml#EditProductAssetUsage"/> > + <view-map name="EditProductParties" type="screen" page="component://product/widget/catalog/ProductScreens.xml#EditProductParties"/> > <view-map name="showFixedAssetProduct" type="screen" page="component://product/widget/catalog/ProductScreens.xml#showFixedAssetProduct"/> > <view-map name="newFixedAssetProduct" type="screen" page="component://product/widget/catalog/ProductScreens.xml#newFixedAssetProduct"/> > <view-map name="ProductBarCode.pdf" type="screenfop" page="component://product/widget/catalog/ProductScreens.xml#ProductBarCode.fo" content-type="application/pdf" encoding="none"/> > > Added: ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl?rev=578930&view=auto > ============================================================================== > --- ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl (added) > +++ ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl Mon Sep 24 12:38:03 2007 > @@ -0,0 +1,78 @@ > +<#-- > +Licensed to the Apache Software Foundation (ASF) under one > +or more contributor license agreements. See the NOTICE file > +distributed with this work for additional information > +regarding copyright ownership. The ASF licenses this file > +to you under the Apache License, Version 2.0 (the > +"License"); you may not use this file except in compliance > +with the License. You may obtain a copy of the License at > + > +http://www.apache.org/licenses/LICENSE-2.0 > + > +Unless required by applicable law or agreed to in writing, > +software distributed under the License is distributed on an > +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > +KIND, either express or implied. See the License for the > +specific language governing permissions and limitations > +under the License. > +--> > + > +<#if productId?exists && product?exists> > + <table class="basic-table" cellspacing="0"> > + <tr class="header-row"> > + <td>${uiLabelMap.PartyPartyId}</td> > + <td>${uiLabelMap.PartyRole}</td> > + <td>${uiLabelMap.CommonFromDateTime}</td> > + <td>${uiLabelMap.CommonThruDateTime}</td> > + <td> </td> > + </tr> > + <#assign line = 0> > + <#list productRoles as productRole> > + <#assign line = line + 1> > + <#assign curRoleType = productRole.getRelatedOneCache("RoleType")> > + <tr> > + <td><a href="/partymgr/control/viewprofile?party_id=${(productRole.partyId)?if_exists}" target="_blank" class="buttontext">${(productRole.partyId)?if_exists}</a></td> > + <td>${(curRoleType.get("description",locale))?if_exists}</td> > + <#assign hasntStarted = false> > + <#if (productRole.getTimestamp("fromDate"))?exists && Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().before(productRole.getTimestamp("fromDate"))> <#assign hasntStarted = true></#if> > + <td<#if hasntStarted> class="alert"</#if>>${(productRole.fromDate)?if_exists}</td> > + <td align="center"> > + <form method="post" action="<@ofbizUrl>updatePartyToProduct</@ofbizUrl>" name="lineForm${line}"> > + <#assign hasExpired = false> > + <#if (productRole.getTimestamp("thruDate"))?exists && (Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().after(productRole.getTimestamp("thruDate")))> <#assign hasExpired = true></#if> > + <input type="hidden" name="productId" value="${(productRole.productId)?if_exists}"> > + <input type="hidden" name="partyId" value="${(productRole.partyId)?if_exists}"> > + <input type="hidden" name="roleTypeId" value="${(productRole.roleTypeId)?if_exists}"> > + <input type="hidden" name="fromDate" value="${(productRole.getTimestamp("fromDate"))?if_exists}"> > + <input type="text" size="25" name="thruDate" value="${(productRole. getTimestamp("thruDate"))?if_exists}" class="inputBox" <#if hasExpired> style="color: red;"</#if>> > + <a href="javascript:call_cal(document.lineForm${line}.thruDate, '${(productRole.getTimestamp("thruDate"))?default(nowTimestamp?string)}');"><img src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" height="16" border="0" alt="Calendar"></a> > + <input type="submit" value="${uiLabelMap.CommonUpdate}"> > + </form> > + </td> > + <td align="center"> > + <a href="<@ofbizUrl>removePartyFromProduct?productId=${(productRole.productId)?if_exists}&partyId=${(productRole.partyId)?if_exists}&roleTypeId=${(productRole.roleTypeId)?if_exists}&fromDate=${Static["org.ofbiz.base.util.UtilFormatOut"].encodeQueryValue(productRole.getTimestamp("fromDate").toString())}</@ofbizUrl>" class="buttontext"> > + ${uiLabelMap.CommonDelete}</a> > + </td> > + </tr> > + </#list> > + </table> > + <br/> > + <h2>${uiLabelMap.ProductAssociatePartyToProduct}:</h2> > + <br/> > + <form method="post" action="<@ofbizUrl>addPartyToProduct</@ofbizUrl>" name="addNewForm"> > + <input type="hidden" name="productId" value="${productId}"> > + <input type="text" size="20" maxlength="20" name="partyId" value=""> > + <#-- TODO: Add PartyId lookup screen > + <a href="javascript:call_fieldlookup2(document.addNewForm.partyId,'LookupCustomerName');"> > + <img src='/images/fieldlookup.gif' width='15' height='14' border='0' alt='Click here For Field Lookup'/> > + </a> --> > + <select name="roleTypeId" size="1"> > + <#list roleTypes as roleType> > + <option value="${(roleType.roleTypeId)?if_exists}" <#if roleType.roleTypeId.equals("_NA_")> ${uiLabelMap.ProductSelected}</#if>>${(roleType.get("description",locale))?if_exists}</option> > + </#list> > + </select> > + <input type="text" size="25" name="fromDate"> > + <a href="javascript:call_cal(document.addNewForm.fromDate, '${nowTimestamp?string}');"><img src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" height="16" border="0" alt="Calendar"></a> > + <input type="submit" value="${uiLabelMap.CommonAdd}"> > + </form> > +</#if> > > Modified: ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl (original) > +++ ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl Mon Sep 24 12:38:03 2007 > @@ -55,6 +55,7 @@ > <#if product?exists && product.productTypeId?if_exists == "ASSET_USAGE"> > <a href="<@ofbizUrl>EditProductAssetUsage?productId=${productId}</@ofbizUrl>" class="${selectedClassMap.EditProductAssetUsage?default(unselectedClassName)}">${uiLabelMap.ProductAssetUsage}</a> > </#if> > - <a href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> > + <a href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> > + <a href="<@ofbizUrl>EditProductParties?productId=${productId}</@ofbizUrl>" class="${selectedClassMap.EditProductParties?default(unselectedClassName)}">${uiLabelMap.PartyParties}</a> > </div> > </#if> > > Modified: ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml (original) > +++ ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml Mon Sep 24 12:38:03 2007 > @@ -78,7 +78,7 @@ > </container> > > <!-- add Create Product and View Product (in ecommerce) links --> > - <container> > + <container style="button-bar"> > <link target="EditProduct" text="${uiLabelMap.ProductNewProduct}" style="buttontext"/> > <link target="CreateVirtualWithVariantsForm" text="${uiLabelMap.ProductNewVirtualProduct}" style="buttontext"/> > <link target="/ecommerce/control/product?product_id=${productId}" url-mode="inter-app" text="${uiLabelMap.ProductProductPage}" style="buttontext"/> > > Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=578930&r1=578929&r2=578930&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml (original) > +++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Mon Sep 24 12:38:03 2007 > @@ -974,4 +974,37 @@ > </section> > </screen> > > + <screen name="EditProductParties"> > + <section> > + <actions> > + <set field="titleProperty" value="PageTitleEditProductParties"/> > + <set field="headerItem" value="product"/> > + <set field="tabButtonItem" value="EditProductParties"/> > + <set field="labelTitleProperty" value="PartyParties"/> > + > + <set field="productId" from-field="parameters.productId"/> > + <entity-one entity-name="Product" value-name="product"/> > + > + <entity-condition entity-name="ProductRole" list-name="productRoles"> > + <condition-expr field-name="productId" env-name="productId"/> > + <order-by field-name="roleTypeId"/> > + <order-by field-name="partyId"/> > + </entity-condition> > + > + <entity-condition entity-name="RoleType" list-name="roleTypes"> > + <order-by field-name="description"/> > + </entity-condition> > + </actions> > + <widgets> > + <decorator-screen name="CommonProductDecorator" location="${parameters.mainDecoratorLocation}"> > + <decorator-section name="body"> > + <platform-specific> > + <html><html-template location="component://product/webapp/catalog/product/EditProductParties.ftl"/></html> > + </platform-specific> > + </decorator-section> > + </decorator-screen> > + </widgets> > + </section> > + </screen> > + > </screens> > > |
I agree that a form widget would have been simpler. I only had time to review and commit, not re-write.
David E Jones wrote: > > The loopkup for a party is pretty easy, though easier (as with many > things here...) using the form widget instead of an ftl file. > > In fact, we have a project-wide goal of converting all generic ftl > screens like this to use the form widget. > > Of course, I wasn't involved in discussions around this and only read > what has gone through the lists and the issue... was there a reason for > using FTL instead of the Form Widget (Ean or Adrian)? > > -David > > > [hidden email] wrote: > >> Author: adrianc >> Date: Mon Sep 24 12:38:03 2007 >> New Revision: 578930 >> >> URL: http://svn.apache.org/viewvc?rev=578930&view=rev >> Log: >> New feature - assign parties to products. Patch is from Ean Schuessler >> - OFBIZ-1177, plus some additional work from me. Still needs a party >> ID lookup screen. >> >> Added: >> >> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >> >> Modified: >> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >> ofbiz/trunk/applications/product/entitydef/entitygroup.xml >> ofbiz/trunk/applications/product/entitydef/entitymodel.xml >> >> ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml >> >> ofbiz/trunk/applications/product/servicedef/services.xml >> >> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >> >> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >> >> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >> >> Modified: >> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- ofbiz/trunk/applications/product/config/ProductUiLabels.properties >> (original) >> +++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties >> Mon Sep 24 12:38:03 2007 >> @@ -132,6 +132,7 @@ >> PageTitleEditProductPromos=Edit Product Promos >> PageTitleEditProductPromotionCode=Edit Product Promotion Code >> PageTitleEditProductQuickAdmin=Edit Product Quick Admin >> +PageTitleEditProductParties=Edit Product Parties >> PageTitleEditProductStore=Edit Product Store >> PageTitleEditProductStoreCatalogs=Edit Product Store Catalogs >> PageTitleEditProductStoreEmailSetup=Edit Product Store Email Setup >> @@ -329,6 +330,7 @@ >> ProductAssetUsage=Rental >> ProductAssignPicker=Assign Picker >> ProductAssociatePartyToCategory=Associate Party to Category (enter >> Party ID, select Type, then enter optional From Date) >> +ProductAssociatePartyToProduct=Associate Party to Product (enter >> Party ID, select Type, then enter optional From Date) >> ProductAssociationNotFound=Association not found: Product >> Id=${productId?if_exists}, Product Id To=${productIdTo?if_exists}, >> Association Type Id=${productAssocTypeId?if_exists}, From >> Date=${fromDate?if_exists} >> ProductAssociationType=Association Type >> ProductAssociationTypeId=Association Type ID >> @@ -434,7 +436,6 @@ >> ProductCopyProductCategoryMembersToAnotherCategory=Copy Product >> Category Members to Another Category >> ProductCostPrice=Cost Price >> ProductCosts=Costs >> -ProductCostPrice=Cost Price >> ProductCouldNotFindFacilityWithId=Could Not Find Facility with ID >> ProductCouldNotFindProduct=Could Not Find Product with ID >> ProductCouldNotFindProductCategoryWithId=Could not Find Product >> Category with Id >> >> Modified: ofbiz/trunk/applications/product/entitydef/entitygroup.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitygroup.xml?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- ofbiz/trunk/applications/product/entitydef/entitygroup.xml (original) >> +++ ofbiz/trunk/applications/product/entitydef/entitygroup.xml Mon Sep >> 24 12:38:03 2007 >> @@ -176,6 +176,7 @@ >> <entity-group group="org.ofbiz" entity="ProductMaint" /> >> <entity-group group="org.ofbiz" entity="ProductMaintType" /> >> <entity-group group="org.ofbiz" entity="ProductReview" /> >> + <entity-group group="org.ofbiz" entity="ProductRole" /> >> <entity-group group="org.ofbiz" entity="ProductSearchConstraint" /> >> <entity-group group="org.ofbiz" entity="ProductSearchResult" /> >> <entity-group group="org.ofbiz" entity="ProductType" /> >> @@ -336,5 +337,7 @@ >> <entity-group group="org.ofbiz" entity="ShippingDocument" /> >> <entity-group group="org.ofbiz" >> entity="PackedQtyVsOrderItemQuantity" /> >> </entitygroup> >> + >> + >> >> >> >> Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) >> +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Mon Sep >> 24 12:38:03 2007 >> @@ -2190,6 +2190,33 @@ >> <key-map field-name="parentTypeId" >> rel-field-name="productAssocTypeId"/> >> </relation> >> </entity> >> + <entity entity-name="ProductRole" >> + package-name="org.ofbiz.product.product" >> + title="Product Role Entity"> >> + <field name="productId" type="id-ne"></field> >> + <field name="partyId" type="id-ne"></field> >> + <field name="roleTypeId" type="id-ne"></field> >> + <field name="fromDate" type="date-time"></field> >> + <field name="thruDate" type="date-time"></field> >> + <field name="comments" type="comment"></field> >> + <prim-key field="productId"/> >> + <prim-key field="partyId"/> >> + <prim-key field="roleTypeId"/> >> + <prim-key field="fromDate"/> >> + <relation type="one-nofk" rel-entity-name="Party"> >> + <key-map field-name="partyId"/> >> + </relation> >> + <relation type="one-nofk" rel-entity-name="RoleType"> >> + <key-map field-name="roleTypeId"/> >> + </relation> >> + <relation type="one" fk-name="PROD_RLE_PTYRLE" >> rel-entity-name="PartyRole"> >> + <key-map field-name="partyId"/> >> + <key-map field-name="roleTypeId"/> >> + </relation> >> + <!-- <relation type="one" fk-name="PROD_RLE_CATEGORY" >> rel-entity-name="Product"> >> + <key-map field-name="productCategoryId"/> >> + </relation> --> >> + </entity> <entity entity-name="ProductAttribute" >> package-name="org.ofbiz.product.product" >> title="Product Attribute Entity"> >> >> 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=578930&r1=578929&r2=578930&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 >> Mon Sep 24 12:38:03 2007 >> @@ -900,4 +900,49 @@ >> <entity-one entity-name="ProductAttribute" >> value-name="lookedUpValue"/> >> <remove-value value-name="lookedUpValue"/> >> </simple-method> >> + + <!-- >> ================================================================ --> >> + <!-- ProductRole Services --> >> + <!-- >> ================================================================ --> >> + >> + <simple-method method-name="addPartyToProduct" >> short-description="Add Party to Product"> >> + <set value="addPartyToProduct" field="callingMethodName"/> >> + <set value="CREATE" field="checkAction"/> >> + <call-simple-method >> method-name="checkProductRelatedPermission"/> >> + <check-errors/> >> + >> + <make-value value-name="newEntity" entity-name="ProductRole"/> >> + <set-pk-fields map-name="parameters" value-name="newEntity"/> >> + <set-nonpk-fields map-name="parameters" value-name="newEntity"/> >> + >> + <if-empty field-name="newEntity.fromDate"> >> + <now-timestamp-to-env env-name="newEntity.fromDate"/> >> + </if-empty> >> + >> + <create-value value-name="newEntity"/> >> + </simple-method> >> + <simple-method method-name="updatePartyToProduct" >> short-description="Update Party to Product"> >> + <set value="updatePartyToProduct" field="callingMethodName"/> >> + <set value="UPDATE" field="checkAction"/> >> + <call-simple-method >> method-name="checkProductRelatedPermission"/> >> + <check-errors/> >> + >> + <make-value value-name="lookupPKMap" entity-name="ProductRole"/> >> + <set-pk-fields map-name="parameters" value-name="lookupPKMap"/> >> + <find-by-primary-key entity-name="ProductRole" >> map-name="lookupPKMap" value-name="lookedUpValue"/> >> + <set-nonpk-fields map-name="parameters" >> value-name="lookedUpValue"/> >> + <store-value value-name="lookedUpValue"/> >> + </simple-method> >> + <simple-method method-name="removePartyFromProduct" >> short-description="Remove Party From Product"> >> + <set value="removePartyFromProduct" field="callingMethodName"/> >> + <set value="DELETE" field="checkAction"/> >> + <call-simple-method >> method-name="checkProductRelatedPermission"/> >> + <check-errors/> >> + >> + <make-value value-name="lookupPKMap" entity-name="ProductRole"/> >> + <set-pk-fields map-name="parameters" value-name="lookupPKMap"/> >> + <find-by-primary-key entity-name="ProductRole" >> map-name="lookupPKMap" value-name="lookedUpValue"/> >> + <remove-value value-name="lookedUpValue"/> >> + </simple-method> >> + </simple-methods> >> >> Modified: ofbiz/trunk/applications/product/servicedef/services.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- ofbiz/trunk/applications/product/servicedef/services.xml (original) >> +++ ofbiz/trunk/applications/product/servicedef/services.xml Mon Sep >> 24 12:38:03 2007 >> @@ -716,6 +716,35 @@ >> <attribute name="fromDate" type="Timestamp" mode="IN" >> optional="false"/> >> </service> >> >> + <service name="addPartyToProduct" engine="simple" >> + >> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >> invoke="addPartyToProduct" auth="true"> >> + <description>Add Party To Product</description> >> + <attribute name="productId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="partyId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="roleTypeId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="fromDate" type="Timestamp" mode="IN" >> optional="true"/> >> + <attribute name="thruDate" type="Timestamp" mode="IN" >> optional="true"/> >> + <attribute name="comments" type="String" mode="IN" >> optional="true"/> >> + </service> >> + <service name="updatePartyToProduct" engine="simple" >> + >> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >> invoke="updatePartyToProduct" auth="true"> >> + <description>Update Party To Product</description> >> + <attribute name="productId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="partyId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="roleTypeId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="fromDate" type="Timestamp" mode="IN" >> optional="false"/> >> + <attribute name="thruDate" type="Timestamp" mode="IN" >> optional="true"/> >> + <attribute name="comments" type="String" mode="IN" >> optional="true"/> >> + </service> >> + <service name="removePartyFromProduct" engine="simple" >> + >> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >> invoke="removePartyFromProduct" auth="true"> >> + <description>Remove Party From Product</description> >> + <attribute name="productId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="partyId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="roleTypeId" type="String" mode="IN" >> optional="false"/> >> + <attribute name="fromDate" type="Timestamp" mode="IN" >> optional="false"/> >> + </service> >> + >> <service name="safeAddProductCategoryToCategory" engine="simple" >> >> location="org/ofbiz/product/category/CategoryServices.xml" >> invoke="addProductCategoryToCategory" auth="true"> >> <description>Safe Add ProductCategory To Category (requires >> fromDate)</description> >> >> Modified: >> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- >> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >> (original) >> +++ >> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >> Mon Sep 24 12:38:03 2007 >> @@ -512,8 +512,31 @@ >> <request-map uri="ProductBarCode.pdf"> >> <security https="true" auth="true"/> >> <response name="success" type="view" >> value="ProductBarCode.pdf"/> >> + </request-map> + >> + <!-- ================ Product Roles Requests ================= --> >> + <request-map uri="EditProductParties"> >> + <security https="true" auth="true"/> >> + <response name="success" type="view" >> value="EditProductParties"/> >> + </request-map> >> + <request-map uri="addPartyToProduct"> >> + <security https="true" auth="true"/> >> + <event type="service" path="" invoke="addPartyToProduct"/> >> + <response name="success" type="view" >> value="EditProductParties"/> >> + <response name="error" type="view" value="EditProductParties"/> >> + </request-map> >> + <request-map uri="updatePartyToProduct"> >> + <security https="true" auth="true"/> >> + <event type="service" path="" invoke="updatePartyToProduct"/> >> + <response name="success" type="view" >> value="EditProductParties"/> >> + <response name="error" type="view" value="EditProductParties"/> >> + </request-map> >> + <request-map uri="removePartyFromProduct"> >> + <security https="true" auth="true"/> >> + <event type="service" path="" invoke="removePartyFromProduct"/> >> + <response name="success" type="view" >> value="EditProductParties"/> >> + <response name="error" type="view" value="EditProductParties"/> >> </request-map> >> - >> <!-- ================ Product Asset Usage (rental) Requests >> ================= --> >> <request-map uri="EditProductAssetUsage"> >> @@ -2505,6 +2528,7 @@ >> <view-map name="EditProduct" type="screen" >> page="component://product/widget/catalog/ProductScreens.xml#EditProduct"/> >> >> <view-map name="EditProductPrices" type="screen" >> page="component://product/widget/catalog/ProductScreens.xml#EditProductPrices"/> >> >> <view-map name="EditProductAssetUsage" type="screen" >> page="component://product/widget/catalog/ProductScreens.xml#EditProductAssetUsage"/> >> >> + <view-map name="EditProductParties" type="screen" >> page="component://product/widget/catalog/ProductScreens.xml#EditProductParties"/> >> >> <view-map name="showFixedAssetProduct" type="screen" >> page="component://product/widget/catalog/ProductScreens.xml#showFixedAssetProduct"/> >> >> <view-map name="newFixedAssetProduct" type="screen" >> page="component://product/widget/catalog/ProductScreens.xml#newFixedAssetProduct"/> >> >> <view-map name="ProductBarCode.pdf" type="screenfop" >> page="component://product/widget/catalog/ProductScreens.xml#ProductBarCode.fo" >> content-type="application/pdf" encoding="none"/> >> >> Added: >> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >> >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl?rev=578930&view=auto >> >> ============================================================================== >> >> --- >> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >> (added) >> +++ >> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >> Mon Sep 24 12:38:03 2007 >> @@ -0,0 +1,78 @@ >> +<#-- >> +Licensed to the Apache Software Foundation (ASF) under one >> +or more contributor license agreements. See the NOTICE file >> +distributed with this work for additional information >> +regarding copyright ownership. The ASF licenses this file >> +to you under the Apache License, Version 2.0 (the >> +"License"); you may not use this file except in compliance >> +with the License. You may obtain a copy of the License at >> + >> +http://www.apache.org/licenses/LICENSE-2.0 >> + >> +Unless required by applicable law or agreed to in writing, >> +software distributed under the License is distributed on an >> +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> +KIND, either express or implied. See the License for the >> +specific language governing permissions and limitations >> +under the License. >> +--> >> + >> +<#if productId?exists && product?exists> + <table >> class="basic-table" cellspacing="0"> >> + <tr class="header-row"> >> + <td>${uiLabelMap.PartyPartyId}</td> >> + <td>${uiLabelMap.PartyRole}</td> >> + <td>${uiLabelMap.CommonFromDateTime}</td> >> + <td>${uiLabelMap.CommonThruDateTime}</td> >> + <td> </td> >> + </tr> >> + <#assign line = 0> >> + <#list productRoles as productRole> >> + <#assign line = line + 1> >> + <#assign curRoleType = productRole.getRelatedOneCache("RoleType")> >> + <tr> >> + <td><a >> href="/partymgr/control/viewprofile?party_id=${(productRole.partyId)?if_exists}" >> target="_blank" >> class="buttontext">${(productRole.partyId)?if_exists}</a></td> >> + <td>${(curRoleType.get("description",locale))?if_exists}</td> >> + <#assign hasntStarted = false> >> + <#if (productRole.getTimestamp("fromDate"))?exists && >> Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().before(productRole.getTimestamp("fromDate"))> >> <#assign hasntStarted = true></#if> >> + <td<#if hasntStarted> >> class="alert"</#if>>${(productRole.fromDate)?if_exists}</td> >> + <td align="center"> >> + <form method="post" >> action="<@ofbizUrl>updatePartyToProduct</@ofbizUrl>" >> name="lineForm${line}"> >> + <#assign hasExpired = false> >> + <#if (productRole.getTimestamp("thruDate"))?exists && >> (Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().after(productRole.getTimestamp("thruDate")))> >> <#assign hasExpired = true></#if> >> + <input type="hidden" name="productId" >> value="${(productRole.productId)?if_exists}"> >> + <input type="hidden" name="partyId" >> value="${(productRole.partyId)?if_exists}"> >> + <input type="hidden" name="roleTypeId" >> value="${(productRole.roleTypeId)?if_exists}"> >> + <input type="hidden" name="fromDate" >> value="${(productRole.getTimestamp("fromDate"))?if_exists}"> >> + <input type="text" size="25" name="thruDate" >> value="${(productRole. getTimestamp("thruDate"))?if_exists}" >> class="inputBox" <#if hasExpired> style="color: red;"</#if>> >> + <a >> href="javascript:call_cal(document.lineForm${line}.thruDate, >> '${(productRole.getTimestamp("thruDate"))?default(nowTimestamp?string)}');"><img >> src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" >> height="16" border="0" alt="Calendar"></a> >> + <input type="submit" value="${uiLabelMap.CommonUpdate}"> >> + </form> >> + </td> >> + <td align="center"> >> + <a >> href="<@ofbizUrl>removePartyFromProduct?productId=${(productRole.productId)?if_exists}&partyId=${(productRole.partyId)?if_exists}&roleTypeId=${(productRole.roleTypeId)?if_exists}&fromDate=${Static["org.ofbiz.base.util.UtilFormatOut"].encodeQueryValue(productRole.getTimestamp("fromDate").toString())}</@ofbizUrl>" >> class="buttontext"> >> + ${uiLabelMap.CommonDelete}</a> >> + </td> >> + </tr> >> + </#list> >> + </table> >> + <br/> >> + <h2>${uiLabelMap.ProductAssociatePartyToProduct}:</h2> >> + <br/> >> + <form method="post" >> action="<@ofbizUrl>addPartyToProduct</@ofbizUrl>" name="addNewForm"> >> + <input type="hidden" name="productId" value="${productId}"> >> + <input type="text" size="20" maxlength="20" name="partyId" value=""> >> + <#-- TODO: Add PartyId lookup screen >> + <a >> href="javascript:call_fieldlookup2(document.addNewForm.partyId,'LookupCustomerName');"> >> >> + <img src='/images/fieldlookup.gif' width='15' height='14' >> border='0' alt='Click here For Field Lookup'/> >> + </a> --> >> + <select name="roleTypeId" size="1"> >> + <#list roleTypes as roleType> >> + <option value="${(roleType.roleTypeId)?if_exists}" <#if >> roleType.roleTypeId.equals("_NA_")> >> ${uiLabelMap.ProductSelected}</#if>>${(roleType.get("description",locale))?if_exists}</option> >> >> + </#list> >> + </select> >> + <input type="text" size="25" name="fromDate"> >> + <a href="javascript:call_cal(document.addNewForm.fromDate, >> '${nowTimestamp?string}');"><img >> src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" >> height="16" border="0" alt="Calendar"></a> >> + <input type="submit" value="${uiLabelMap.CommonAdd}"> >> + </form> >> +</#if> >> >> Modified: >> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- >> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >> (original) >> +++ >> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >> Mon Sep 24 12:38:03 2007 >> @@ -55,6 +55,7 @@ >> <#if product?exists && product.productTypeId?if_exists == >> "ASSET_USAGE"> >> <a >> href="<@ofbizUrl>EditProductAssetUsage?productId=${productId}</@ofbizUrl>" >> class="${selectedClassMap.EditProductAssetUsage?default(unselectedClassName)}">${uiLabelMap.ProductAssetUsage}</a> >> >> </#if> >> - <a >> href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" >> class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> >> + <a >> href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" >> class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> >> >> + <a >> href="<@ofbizUrl>EditProductParties?productId=${productId}</@ofbizUrl>" >> class="${selectedClassMap.EditProductParties?default(unselectedClassName)}">${uiLabelMap.PartyParties}</a> >> >> </div> >> </#if> >> >> Modified: >> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- >> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >> (original) >> +++ >> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >> Mon Sep 24 12:38:03 2007 >> @@ -78,7 +78,7 @@ >> </container> >> >> <!-- add Create Product and >> View Product (in ecommerce) links --> >> - <container> >> + <container style="button-bar"> >> <link >> target="EditProduct" text="${uiLabelMap.ProductNewProduct}" >> style="buttontext"/> >> <link >> target="CreateVirtualWithVariantsForm" >> text="${uiLabelMap.ProductNewVirtualProduct}" style="buttontext"/> >> <link >> target="/ecommerce/control/product?product_id=${productId}" >> url-mode="inter-app" text="${uiLabelMap.ProductProductPage}" >> style="buttontext"/> >> >> Modified: >> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=578930&r1=578929&r2=578930&view=diff >> >> ============================================================================== >> >> --- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >> (original) >> +++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >> Mon Sep 24 12:38:03 2007 >> @@ -974,4 +974,37 @@ >> </section> >> </screen> >> + <screen name="EditProductParties"> >> + <section> >> + <actions> >> + <set field="titleProperty" >> value="PageTitleEditProductParties"/> >> + <set field="headerItem" value="product"/> >> + <set field="tabButtonItem" value="EditProductParties"/> >> + <set field="labelTitleProperty" value="PartyParties"/> >> + >> + <set field="productId" >> from-field="parameters.productId"/> >> + <entity-one entity-name="Product" value-name="product"/> >> + >> + <entity-condition entity-name="ProductRole" >> list-name="productRoles"> >> + <condition-expr field-name="productId" >> env-name="productId"/> >> + <order-by field-name="roleTypeId"/> >> + <order-by field-name="partyId"/> >> + </entity-condition> >> + >> + <entity-condition entity-name="RoleType" >> list-name="roleTypes"> >> + <order-by field-name="description"/> >> + </entity-condition> >> + </actions> >> + <widgets> >> + <decorator-screen name="CommonProductDecorator" >> location="${parameters.mainDecoratorLocation}"> >> + <decorator-section name="body"> >> + <platform-specific> >> + <html><html-template >> location="component://product/webapp/catalog/product/EditProductParties.ftl"/></html> >> >> + </platform-specific> >> + </decorator-section> >> + </decorator-screen> >> + </widgets> >> + </section> >> + </screen> >> + </screens> >> >> > |
That's fine, there is no expectation that you should rewrite it or anything like that. As part of your review though you can send back that sort of feedback, and if it delays inclusion it's not a problem. In fact that's how it should be, ie that's the point of reviews. At this point for me it would be tempting to reject a patch that doesn't follow best practices. I'm not saying that's what we should do, but it sure is tempting... -David Adrian Crum wrote: > I agree that a form widget would have been simpler. I only had time to > review and commit, not re-write. > > > David E Jones wrote: > >> >> The loopkup for a party is pretty easy, though easier (as with many >> things here...) using the form widget instead of an ftl file. >> >> In fact, we have a project-wide goal of converting all generic ftl >> screens like this to use the form widget. >> >> Of course, I wasn't involved in discussions around this and only read >> what has gone through the lists and the issue... was there a reason >> for using FTL instead of the Form Widget (Ean or Adrian)? >> >> -David >> >> >> [hidden email] wrote: >> >>> Author: adrianc >>> Date: Mon Sep 24 12:38:03 2007 >>> New Revision: 578930 >>> >>> URL: http://svn.apache.org/viewvc?rev=578930&view=rev >>> Log: >>> New feature - assign parties to products. Patch is from Ean >>> Schuessler - OFBIZ-1177, plus some additional work from me. Still >>> needs a party ID lookup screen. >>> >>> Added: >>> >>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>> >>> Modified: >>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>> ofbiz/trunk/applications/product/entitydef/entitygroup.xml >>> ofbiz/trunk/applications/product/entitydef/entitymodel.xml >>> >>> ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml >>> >>> ofbiz/trunk/applications/product/servicedef/services.xml >>> >>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>> >>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>> >>> >>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>> >>> Modified: >>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- >>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>> (original) >>> +++ >>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>> Mon Sep 24 12:38:03 2007 >>> @@ -132,6 +132,7 @@ >>> PageTitleEditProductPromos=Edit Product Promos >>> PageTitleEditProductPromotionCode=Edit Product Promotion Code >>> PageTitleEditProductQuickAdmin=Edit Product Quick Admin >>> +PageTitleEditProductParties=Edit Product Parties >>> PageTitleEditProductStore=Edit Product Store >>> PageTitleEditProductStoreCatalogs=Edit Product Store Catalogs >>> PageTitleEditProductStoreEmailSetup=Edit Product Store Email Setup >>> @@ -329,6 +330,7 @@ >>> ProductAssetUsage=Rental >>> ProductAssignPicker=Assign Picker >>> ProductAssociatePartyToCategory=Associate Party to Category (enter >>> Party ID, select Type, then enter optional From Date) >>> +ProductAssociatePartyToProduct=Associate Party to Product (enter >>> Party ID, select Type, then enter optional From Date) >>> ProductAssociationNotFound=Association not found: Product >>> Id=${productId?if_exists}, Product Id To=${productIdTo?if_exists}, >>> Association Type Id=${productAssocTypeId?if_exists}, From >>> Date=${fromDate?if_exists} >>> ProductAssociationType=Association Type >>> ProductAssociationTypeId=Association Type ID >>> @@ -434,7 +436,6 @@ >>> ProductCopyProductCategoryMembersToAnotherCategory=Copy Product >>> Category Members to Another Category >>> ProductCostPrice=Cost Price >>> ProductCosts=Costs >>> -ProductCostPrice=Cost Price >>> ProductCouldNotFindFacilityWithId=Could Not Find Facility with ID >>> ProductCouldNotFindProduct=Could Not Find Product with ID >>> ProductCouldNotFindProductCategoryWithId=Could not Find Product >>> Category with Id >>> >>> Modified: ofbiz/trunk/applications/product/entitydef/entitygroup.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitygroup.xml?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- ofbiz/trunk/applications/product/entitydef/entitygroup.xml >>> (original) >>> +++ ofbiz/trunk/applications/product/entitydef/entitygroup.xml Mon >>> Sep 24 12:38:03 2007 >>> @@ -176,6 +176,7 @@ >>> <entity-group group="org.ofbiz" entity="ProductMaint" /> >>> <entity-group group="org.ofbiz" entity="ProductMaintType" /> >>> <entity-group group="org.ofbiz" entity="ProductReview" /> >>> + <entity-group group="org.ofbiz" entity="ProductRole" /> >>> <entity-group group="org.ofbiz" entity="ProductSearchConstraint" /> >>> <entity-group group="org.ofbiz" entity="ProductSearchResult" /> >>> <entity-group group="org.ofbiz" entity="ProductType" /> >>> @@ -336,5 +337,7 @@ >>> <entity-group group="org.ofbiz" entity="ShippingDocument" /> >>> <entity-group group="org.ofbiz" >>> entity="PackedQtyVsOrderItemQuantity" /> >>> </entitygroup> >>> + >>> + >>> >>> >>> >>> Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml >>> (original) >>> +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Mon >>> Sep 24 12:38:03 2007 >>> @@ -2190,6 +2190,33 @@ >>> <key-map field-name="parentTypeId" >>> rel-field-name="productAssocTypeId"/> >>> </relation> >>> </entity> >>> + <entity entity-name="ProductRole" >>> + package-name="org.ofbiz.product.product" >>> + title="Product Role Entity"> >>> + <field name="productId" type="id-ne"></field> >>> + <field name="partyId" type="id-ne"></field> >>> + <field name="roleTypeId" type="id-ne"></field> >>> + <field name="fromDate" type="date-time"></field> >>> + <field name="thruDate" type="date-time"></field> >>> + <field name="comments" type="comment"></field> >>> + <prim-key field="productId"/> >>> + <prim-key field="partyId"/> >>> + <prim-key field="roleTypeId"/> >>> + <prim-key field="fromDate"/> >>> + <relation type="one-nofk" rel-entity-name="Party"> >>> + <key-map field-name="partyId"/> >>> + </relation> >>> + <relation type="one-nofk" rel-entity-name="RoleType"> >>> + <key-map field-name="roleTypeId"/> >>> + </relation> >>> + <relation type="one" fk-name="PROD_RLE_PTYRLE" >>> rel-entity-name="PartyRole"> >>> + <key-map field-name="partyId"/> >>> + <key-map field-name="roleTypeId"/> >>> + </relation> >>> + <!-- <relation type="one" fk-name="PROD_RLE_CATEGORY" >>> rel-entity-name="Product"> >>> + <key-map field-name="productCategoryId"/> >>> + </relation> --> >>> + </entity> <entity entity-name="ProductAttribute" >>> package-name="org.ofbiz.product.product" >>> title="Product Attribute Entity"> >>> >>> 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=578930&r1=578929&r2=578930&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 >>> Mon Sep 24 12:38:03 2007 >>> @@ -900,4 +900,49 @@ >>> <entity-one entity-name="ProductAttribute" >>> value-name="lookedUpValue"/> >>> <remove-value value-name="lookedUpValue"/> >>> </simple-method> >>> + + <!-- >>> ================================================================ --> >>> + <!-- ProductRole Services --> >>> + <!-- >>> ================================================================ --> >>> + >>> + <simple-method method-name="addPartyToProduct" >>> short-description="Add Party to Product"> >>> + <set value="addPartyToProduct" field="callingMethodName"/> >>> + <set value="CREATE" field="checkAction"/> >>> + <call-simple-method >>> method-name="checkProductRelatedPermission"/> >>> + <check-errors/> >>> + >>> + <make-value value-name="newEntity" entity-name="ProductRole"/> >>> + <set-pk-fields map-name="parameters" value-name="newEntity"/> >>> + <set-nonpk-fields map-name="parameters" >>> value-name="newEntity"/> >>> + >>> + <if-empty field-name="newEntity.fromDate"> >>> + <now-timestamp-to-env env-name="newEntity.fromDate"/> >>> + </if-empty> >>> + >>> + <create-value value-name="newEntity"/> >>> + </simple-method> >>> + <simple-method method-name="updatePartyToProduct" >>> short-description="Update Party to Product"> >>> + <set value="updatePartyToProduct" field="callingMethodName"/> >>> + <set value="UPDATE" field="checkAction"/> >>> + <call-simple-method >>> method-name="checkProductRelatedPermission"/> >>> + <check-errors/> >>> + >>> + <make-value value-name="lookupPKMap" >>> entity-name="ProductRole"/> >>> + <set-pk-fields map-name="parameters" value-name="lookupPKMap"/> >>> + <find-by-primary-key entity-name="ProductRole" >>> map-name="lookupPKMap" value-name="lookedUpValue"/> >>> + <set-nonpk-fields map-name="parameters" >>> value-name="lookedUpValue"/> >>> + <store-value value-name="lookedUpValue"/> >>> + </simple-method> >>> + <simple-method method-name="removePartyFromProduct" >>> short-description="Remove Party From Product"> >>> + <set value="removePartyFromProduct" field="callingMethodName"/> >>> + <set value="DELETE" field="checkAction"/> >>> + <call-simple-method >>> method-name="checkProductRelatedPermission"/> >>> + <check-errors/> >>> + >>> + <make-value value-name="lookupPKMap" >>> entity-name="ProductRole"/> >>> + <set-pk-fields map-name="parameters" value-name="lookupPKMap"/> >>> + <find-by-primary-key entity-name="ProductRole" >>> map-name="lookupPKMap" value-name="lookedUpValue"/> >>> + <remove-value value-name="lookedUpValue"/> >>> + </simple-method> >>> + </simple-methods> >>> >>> Modified: ofbiz/trunk/applications/product/servicedef/services.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- ofbiz/trunk/applications/product/servicedef/services.xml (original) >>> +++ ofbiz/trunk/applications/product/servicedef/services.xml Mon Sep >>> 24 12:38:03 2007 >>> @@ -716,6 +716,35 @@ >>> <attribute name="fromDate" type="Timestamp" mode="IN" >>> optional="false"/> >>> </service> >>> >>> + <service name="addPartyToProduct" engine="simple" >>> + >>> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >>> invoke="addPartyToProduct" auth="true"> >>> + <description>Add Party To Product</description> >>> + <attribute name="productId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="partyId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="roleTypeId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="fromDate" type="Timestamp" mode="IN" >>> optional="true"/> >>> + <attribute name="thruDate" type="Timestamp" mode="IN" >>> optional="true"/> >>> + <attribute name="comments" type="String" mode="IN" >>> optional="true"/> >>> + </service> >>> + <service name="updatePartyToProduct" engine="simple" >>> + >>> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >>> invoke="updatePartyToProduct" auth="true"> >>> + <description>Update Party To Product</description> >>> + <attribute name="productId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="partyId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="roleTypeId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="fromDate" type="Timestamp" mode="IN" >>> optional="false"/> >>> + <attribute name="thruDate" type="Timestamp" mode="IN" >>> optional="true"/> >>> + <attribute name="comments" type="String" mode="IN" >>> optional="true"/> >>> + </service> >>> + <service name="removePartyFromProduct" engine="simple" >>> + >>> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >>> invoke="removePartyFromProduct" auth="true"> >>> + <description>Remove Party From Product</description> >>> + <attribute name="productId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="partyId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="roleTypeId" type="String" mode="IN" >>> optional="false"/> >>> + <attribute name="fromDate" type="Timestamp" mode="IN" >>> optional="false"/> >>> + </service> >>> + >>> <service name="safeAddProductCategoryToCategory" engine="simple" >>> >>> location="org/ofbiz/product/category/CategoryServices.xml" >>> invoke="addProductCategoryToCategory" auth="true"> >>> <description>Safe Add ProductCategory To Category (requires >>> fromDate)</description> >>> >>> Modified: >>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- >>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>> (original) >>> +++ >>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>> Mon Sep 24 12:38:03 2007 >>> @@ -512,8 +512,31 @@ >>> <request-map uri="ProductBarCode.pdf"> >>> <security https="true" auth="true"/> >>> <response name="success" type="view" >>> value="ProductBarCode.pdf"/> >>> + </request-map> + >>> + <!-- ================ Product Roles Requests ================= --> >>> + <request-map uri="EditProductParties"> >>> + <security https="true" auth="true"/> >>> + <response name="success" type="view" >>> value="EditProductParties"/> >>> + </request-map> >>> + <request-map uri="addPartyToProduct"> >>> + <security https="true" auth="true"/> >>> + <event type="service" path="" invoke="addPartyToProduct"/> >>> + <response name="success" type="view" >>> value="EditProductParties"/> >>> + <response name="error" type="view" value="EditProductParties"/> >>> + </request-map> >>> + <request-map uri="updatePartyToProduct"> >>> + <security https="true" auth="true"/> >>> + <event type="service" path="" invoke="updatePartyToProduct"/> >>> + <response name="success" type="view" >>> value="EditProductParties"/> >>> + <response name="error" type="view" value="EditProductParties"/> >>> + </request-map> >>> + <request-map uri="removePartyFromProduct"> >>> + <security https="true" auth="true"/> >>> + <event type="service" path="" invoke="removePartyFromProduct"/> >>> + <response name="success" type="view" >>> value="EditProductParties"/> >>> + <response name="error" type="view" value="EditProductParties"/> >>> </request-map> >>> - <!-- ================ Product Asset Usage (rental) >>> Requests ================= --> >>> <request-map uri="EditProductAssetUsage"> >>> @@ -2505,6 +2528,7 @@ >>> <view-map name="EditProduct" type="screen" >>> page="component://product/widget/catalog/ProductScreens.xml#EditProduct"/> >>> >>> <view-map name="EditProductPrices" type="screen" >>> page="component://product/widget/catalog/ProductScreens.xml#EditProductPrices"/> >>> >>> <view-map name="EditProductAssetUsage" type="screen" >>> page="component://product/widget/catalog/ProductScreens.xml#EditProductAssetUsage"/> >>> >>> + <view-map name="EditProductParties" type="screen" >>> page="component://product/widget/catalog/ProductScreens.xml#EditProductParties"/> >>> >>> <view-map name="showFixedAssetProduct" type="screen" >>> page="component://product/widget/catalog/ProductScreens.xml#showFixedAssetProduct"/> >>> >>> <view-map name="newFixedAssetProduct" type="screen" >>> page="component://product/widget/catalog/ProductScreens.xml#newFixedAssetProduct"/> >>> >>> <view-map name="ProductBarCode.pdf" type="screenfop" >>> page="component://product/widget/catalog/ProductScreens.xml#ProductBarCode.fo" >>> content-type="application/pdf" encoding="none"/> >>> >>> Added: >>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>> >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl?rev=578930&view=auto >>> >>> ============================================================================== >>> >>> --- >>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>> (added) >>> +++ >>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>> Mon Sep 24 12:38:03 2007 >>> @@ -0,0 +1,78 @@ >>> +<#-- >>> +Licensed to the Apache Software Foundation (ASF) under one >>> +or more contributor license agreements. See the NOTICE file >>> +distributed with this work for additional information >>> +regarding copyright ownership. The ASF licenses this file >>> +to you under the Apache License, Version 2.0 (the >>> +"License"); you may not use this file except in compliance >>> +with the License. You may obtain a copy of the License at >>> + >>> +http://www.apache.org/licenses/LICENSE-2.0 >>> + >>> +Unless required by applicable law or agreed to in writing, >>> +software distributed under the License is distributed on an >>> +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >>> +KIND, either express or implied. See the License for the >>> +specific language governing permissions and limitations >>> +under the License. >>> +--> >>> + >>> +<#if productId?exists && product?exists> + <table >>> class="basic-table" cellspacing="0"> >>> + <tr class="header-row"> >>> + <td>${uiLabelMap.PartyPartyId}</td> >>> + <td>${uiLabelMap.PartyRole}</td> >>> + <td>${uiLabelMap.CommonFromDateTime}</td> >>> + <td>${uiLabelMap.CommonThruDateTime}</td> >>> + <td> </td> >>> + </tr> >>> + <#assign line = 0> >>> + <#list productRoles as productRole> >>> + <#assign line = line + 1> >>> + <#assign curRoleType = >>> productRole.getRelatedOneCache("RoleType")> >>> + <tr> >>> + <td><a >>> href="/partymgr/control/viewprofile?party_id=${(productRole.partyId)?if_exists}" >>> target="_blank" >>> class="buttontext">${(productRole.partyId)?if_exists}</a></td> >>> + <td>${(curRoleType.get("description",locale))?if_exists}</td> >>> + <#assign hasntStarted = false> >>> + <#if (productRole.getTimestamp("fromDate"))?exists && >>> Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().before(productRole.getTimestamp("fromDate"))> >>> <#assign hasntStarted = true></#if> >>> + <td<#if hasntStarted> >>> class="alert"</#if>>${(productRole.fromDate)?if_exists}</td> >>> + <td align="center"> >>> + <form method="post" >>> action="<@ofbizUrl>updatePartyToProduct</@ofbizUrl>" >>> name="lineForm${line}"> >>> + <#assign hasExpired = false> >>> + <#if (productRole.getTimestamp("thruDate"))?exists && >>> (Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().after(productRole.getTimestamp("thruDate")))> >>> <#assign hasExpired = true></#if> >>> + <input type="hidden" name="productId" >>> value="${(productRole.productId)?if_exists}"> >>> + <input type="hidden" name="partyId" >>> value="${(productRole.partyId)?if_exists}"> >>> + <input type="hidden" name="roleTypeId" >>> value="${(productRole.roleTypeId)?if_exists}"> >>> + <input type="hidden" name="fromDate" >>> value="${(productRole.getTimestamp("fromDate"))?if_exists}"> >>> + <input type="text" size="25" name="thruDate" >>> value="${(productRole. getTimestamp("thruDate"))?if_exists}" >>> class="inputBox" <#if hasExpired> style="color: red;"</#if>> >>> + <a >>> href="javascript:call_cal(document.lineForm${line}.thruDate, >>> '${(productRole.getTimestamp("thruDate"))?default(nowTimestamp?string)}');"><img >>> src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" >>> height="16" border="0" alt="Calendar"></a> >>> + <input type="submit" value="${uiLabelMap.CommonUpdate}"> >>> + </form> >>> + </td> >>> + <td align="center"> >>> + <a >>> href="<@ofbizUrl>removePartyFromProduct?productId=${(productRole.productId)?if_exists}&partyId=${(productRole.partyId)?if_exists}&roleTypeId=${(productRole.roleTypeId)?if_exists}&fromDate=${Static["org.ofbiz.base.util.UtilFormatOut"].encodeQueryValue(productRole.getTimestamp("fromDate").toString())}</@ofbizUrl>" >>> class="buttontext"> >>> + ${uiLabelMap.CommonDelete}</a> >>> + </td> >>> + </tr> >>> + </#list> >>> + </table> >>> + <br/> >>> + <h2>${uiLabelMap.ProductAssociatePartyToProduct}:</h2> >>> + <br/> >>> + <form method="post" >>> action="<@ofbizUrl>addPartyToProduct</@ofbizUrl>" name="addNewForm"> >>> + <input type="hidden" name="productId" value="${productId}"> >>> + <input type="text" size="20" maxlength="20" name="partyId" >>> value=""> >>> + <#-- TODO: Add PartyId lookup screen >>> + <a >>> href="javascript:call_fieldlookup2(document.addNewForm.partyId,'LookupCustomerName');"> >>> >>> + <img src='/images/fieldlookup.gif' width='15' height='14' >>> border='0' alt='Click here For Field Lookup'/> >>> + </a> --> >>> + <select name="roleTypeId" size="1"> >>> + <#list roleTypes as roleType> >>> + <option value="${(roleType.roleTypeId)?if_exists}" <#if >>> roleType.roleTypeId.equals("_NA_")> >>> ${uiLabelMap.ProductSelected}</#if>>${(roleType.get("description",locale))?if_exists}</option> >>> >>> + </#list> >>> + </select> >>> + <input type="text" size="25" name="fromDate"> >>> + <a href="javascript:call_cal(document.addNewForm.fromDate, >>> '${nowTimestamp?string}');"><img >>> src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" >>> height="16" border="0" alt="Calendar"></a> >>> + <input type="submit" value="${uiLabelMap.CommonAdd}"> >>> + </form> >>> +</#if> >>> >>> Modified: >>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>> >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- >>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>> (original) >>> +++ >>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>> Mon Sep 24 12:38:03 2007 >>> @@ -55,6 +55,7 @@ >>> <#if product?exists && product.productTypeId?if_exists == >>> "ASSET_USAGE"> >>> <a >>> href="<@ofbizUrl>EditProductAssetUsage?productId=${productId}</@ofbizUrl>" >>> class="${selectedClassMap.EditProductAssetUsage?default(unselectedClassName)}">${uiLabelMap.ProductAssetUsage}</a> >>> >>> </#if> >>> - <a >>> href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" >>> class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> >>> + <a >>> href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" >>> class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> >>> >>> + <a >>> href="<@ofbizUrl>EditProductParties?productId=${productId}</@ofbizUrl>" >>> class="${selectedClassMap.EditProductParties?default(unselectedClassName)}">${uiLabelMap.PartyParties}</a> >>> >>> </div> >>> </#if> >>> >>> Modified: >>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- >>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>> (original) >>> +++ >>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>> Mon Sep 24 12:38:03 2007 >>> @@ -78,7 +78,7 @@ >>> </container> >>> >>> <!-- add Create Product and >>> View Product (in ecommerce) links --> >>> - <container> >>> + <container style="button-bar"> >>> <link >>> target="EditProduct" text="${uiLabelMap.ProductNewProduct}" >>> style="buttontext"/> >>> <link >>> target="CreateVirtualWithVariantsForm" >>> text="${uiLabelMap.ProductNewVirtualProduct}" style="buttontext"/> >>> <link >>> target="/ecommerce/control/product?product_id=${productId}" >>> url-mode="inter-app" text="${uiLabelMap.ProductProductPage}" >>> style="buttontext"/> >>> >>> Modified: >>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=578930&r1=578929&r2=578930&view=diff >>> >>> ============================================================================== >>> >>> --- >>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>> (original) >>> +++ >>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>> Mon Sep 24 12:38:03 2007 >>> @@ -974,4 +974,37 @@ >>> </section> >>> </screen> >>> + <screen name="EditProductParties"> >>> + <section> >>> + <actions> >>> + <set field="titleProperty" >>> value="PageTitleEditProductParties"/> >>> + <set field="headerItem" value="product"/> >>> + <set field="tabButtonItem" value="EditProductParties"/> >>> + <set field="labelTitleProperty" value="PartyParties"/> >>> + >>> + <set field="productId" >>> from-field="parameters.productId"/> >>> + <entity-one entity-name="Product" >>> value-name="product"/> >>> + >>> + <entity-condition entity-name="ProductRole" >>> list-name="productRoles"> >>> + <condition-expr field-name="productId" >>> env-name="productId"/> >>> + <order-by field-name="roleTypeId"/> >>> + <order-by field-name="partyId"/> >>> + </entity-condition> >>> + >>> + <entity-condition entity-name="RoleType" >>> list-name="roleTypes"> >>> + <order-by field-name="description"/> >>> + </entity-condition> >>> + </actions> >>> + <widgets> >>> + <decorator-screen name="CommonProductDecorator" >>> location="${parameters.mainDecoratorLocation}"> >>> + <decorator-section name="body"> >>> + <platform-specific> >>> + <html><html-template >>> location="component://product/webapp/catalog/product/EditProductParties.ftl"/></html> >>> >>> + </platform-specific> >>> + </decorator-section> >>> + </decorator-screen> >>> + </widgets> >>> + </section> >>> + </screen> >>> + </screens> >>> >>> >> > |
David,
I understand what you're saying, and for the most part I agree. I have rejected patches in the past. I started to reject this one because it was untested and it required a lot of work to debug. In this particular case I committed myself to get Ean's patch included in the project because I believe it is a feature that has been sorely needed for a long time. The value I saw in Ean's patch was in the entities and services - I wasn't too concerned about the UI. If we were to "take a stand" and reject changes that don't strictly adhere to best practices, then there would be a lot of work left out of OFBiz (I see commits that don't follow best practices almost on a daily basis). I agree that it's tempting to go that route. Maybe once the developer/committer community gets large enough, we can afford to take a tougher stand. Right now we would be shooting ourselves in the foot in doing so. Bottom line is, I believe we're on the same page as far as patch quality is concerned. This particular case was a judgement call to get some groundwork laid. -Adrian David E Jones wrote: > > That's fine, there is no expectation that you should rewrite it or > anything like that. As part of your review though you can send back that > sort of feedback, and if it delays inclusion it's not a problem. In fact > that's how it should be, ie that's the point of reviews. > > At this point for me it would be tempting to reject a patch that doesn't > follow best practices. I'm not saying that's what we should do, but it > sure is tempting... > > -David > > > Adrian Crum wrote: > >> I agree that a form widget would have been simpler. I only had time to >> review and commit, not re-write. >> >> >> David E Jones wrote: >> >>> >>> The loopkup for a party is pretty easy, though easier (as with many >>> things here...) using the form widget instead of an ftl file. >>> >>> In fact, we have a project-wide goal of converting all generic ftl >>> screens like this to use the form widget. >>> >>> Of course, I wasn't involved in discussions around this and only read >>> what has gone through the lists and the issue... was there a reason >>> for using FTL instead of the Form Widget (Ean or Adrian)? >>> >>> -David >>> >>> >>> [hidden email] wrote: >>> >>>> Author: adrianc >>>> Date: Mon Sep 24 12:38:03 2007 >>>> New Revision: 578930 >>>> >>>> URL: http://svn.apache.org/viewvc?rev=578930&view=rev >>>> Log: >>>> New feature - assign parties to products. Patch is from Ean >>>> Schuessler - OFBIZ-1177, plus some additional work from me. Still >>>> needs a party ID lookup screen. >>>> >>>> Added: >>>> >>>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>>> >>>> Modified: >>>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>>> ofbiz/trunk/applications/product/entitydef/entitygroup.xml >>>> ofbiz/trunk/applications/product/entitydef/entitymodel.xml >>>> >>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml >>>> >>>> ofbiz/trunk/applications/product/servicedef/services.xml >>>> >>>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>>> >>>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>>> >>>> >>>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>>> >>>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>>> >>>> Modified: >>>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>>> (original) >>>> +++ >>>> ofbiz/trunk/applications/product/config/ProductUiLabels.properties >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -132,6 +132,7 @@ >>>> PageTitleEditProductPromos=Edit Product Promos >>>> PageTitleEditProductPromotionCode=Edit Product Promotion Code >>>> PageTitleEditProductQuickAdmin=Edit Product Quick Admin >>>> +PageTitleEditProductParties=Edit Product Parties >>>> PageTitleEditProductStore=Edit Product Store >>>> PageTitleEditProductStoreCatalogs=Edit Product Store Catalogs >>>> PageTitleEditProductStoreEmailSetup=Edit Product Store Email Setup >>>> @@ -329,6 +330,7 @@ >>>> ProductAssetUsage=Rental >>>> ProductAssignPicker=Assign Picker >>>> ProductAssociatePartyToCategory=Associate Party to Category (enter >>>> Party ID, select Type, then enter optional From Date) >>>> +ProductAssociatePartyToProduct=Associate Party to Product (enter >>>> Party ID, select Type, then enter optional From Date) >>>> ProductAssociationNotFound=Association not found: Product >>>> Id=${productId?if_exists}, Product Id To=${productIdTo?if_exists}, >>>> Association Type Id=${productAssocTypeId?if_exists}, From >>>> Date=${fromDate?if_exists} >>>> ProductAssociationType=Association Type >>>> ProductAssociationTypeId=Association Type ID >>>> @@ -434,7 +436,6 @@ >>>> ProductCopyProductCategoryMembersToAnotherCategory=Copy Product >>>> Category Members to Another Category >>>> ProductCostPrice=Cost Price >>>> ProductCosts=Costs >>>> -ProductCostPrice=Cost Price >>>> ProductCouldNotFindFacilityWithId=Could Not Find Facility with ID >>>> ProductCouldNotFindProduct=Could Not Find Product with ID >>>> ProductCouldNotFindProductCategoryWithId=Could not Find Product >>>> Category with Id >>>> >>>> Modified: ofbiz/trunk/applications/product/entitydef/entitygroup.xml >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitygroup.xml?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- ofbiz/trunk/applications/product/entitydef/entitygroup.xml >>>> (original) >>>> +++ ofbiz/trunk/applications/product/entitydef/entitygroup.xml Mon >>>> Sep 24 12:38:03 2007 >>>> @@ -176,6 +176,7 @@ >>>> <entity-group group="org.ofbiz" entity="ProductMaint" /> >>>> <entity-group group="org.ofbiz" entity="ProductMaintType" /> >>>> <entity-group group="org.ofbiz" entity="ProductReview" /> >>>> + <entity-group group="org.ofbiz" entity="ProductRole" /> >>>> <entity-group group="org.ofbiz" >>>> entity="ProductSearchConstraint" /> >>>> <entity-group group="org.ofbiz" entity="ProductSearchResult" /> >>>> <entity-group group="org.ofbiz" entity="ProductType" /> >>>> @@ -336,5 +337,7 @@ >>>> <entity-group group="org.ofbiz" entity="ShippingDocument" /> >>>> <entity-group group="org.ofbiz" >>>> entity="PackedQtyVsOrderItemQuantity" /> >>>> </entitygroup> >>>> + >>>> + >>>> >>>> >>>> >>>> Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml >>>> (original) >>>> +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Mon >>>> Sep 24 12:38:03 2007 >>>> @@ -2190,6 +2190,33 @@ >>>> <key-map field-name="parentTypeId" >>>> rel-field-name="productAssocTypeId"/> >>>> </relation> >>>> </entity> >>>> + <entity entity-name="ProductRole" >>>> + package-name="org.ofbiz.product.product" >>>> + title="Product Role Entity"> >>>> + <field name="productId" type="id-ne"></field> >>>> + <field name="partyId" type="id-ne"></field> >>>> + <field name="roleTypeId" type="id-ne"></field> >>>> + <field name="fromDate" type="date-time"></field> >>>> + <field name="thruDate" type="date-time"></field> >>>> + <field name="comments" type="comment"></field> >>>> + <prim-key field="productId"/> >>>> + <prim-key field="partyId"/> >>>> + <prim-key field="roleTypeId"/> >>>> + <prim-key field="fromDate"/> >>>> + <relation type="one-nofk" rel-entity-name="Party"> >>>> + <key-map field-name="partyId"/> >>>> + </relation> >>>> + <relation type="one-nofk" rel-entity-name="RoleType"> >>>> + <key-map field-name="roleTypeId"/> >>>> + </relation> >>>> + <relation type="one" fk-name="PROD_RLE_PTYRLE" >>>> rel-entity-name="PartyRole"> >>>> + <key-map field-name="partyId"/> >>>> + <key-map field-name="roleTypeId"/> >>>> + </relation> >>>> + <!-- <relation type="one" fk-name="PROD_RLE_CATEGORY" >>>> rel-entity-name="Product"> >>>> + <key-map field-name="productCategoryId"/> >>>> + </relation> --> >>>> + </entity> <entity entity-name="ProductAttribute" >>>> package-name="org.ofbiz.product.product" >>>> title="Product Attribute Entity"> >>>> >>>> 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=578930&r1=578929&r2=578930&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 >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -900,4 +900,49 @@ >>>> <entity-one entity-name="ProductAttribute" >>>> value-name="lookedUpValue"/> >>>> <remove-value value-name="lookedUpValue"/> >>>> </simple-method> >>>> + + <!-- >>>> ================================================================ --> >>>> + <!-- ProductRole Services --> >>>> + <!-- >>>> ================================================================ --> >>>> + >>>> + <simple-method method-name="addPartyToProduct" >>>> short-description="Add Party to Product"> >>>> + <set value="addPartyToProduct" field="callingMethodName"/> >>>> + <set value="CREATE" field="checkAction"/> >>>> + <call-simple-method >>>> method-name="checkProductRelatedPermission"/> >>>> + <check-errors/> >>>> + >>>> + <make-value value-name="newEntity" entity-name="ProductRole"/> >>>> + <set-pk-fields map-name="parameters" value-name="newEntity"/> >>>> + <set-nonpk-fields map-name="parameters" >>>> value-name="newEntity"/> >>>> + >>>> + <if-empty field-name="newEntity.fromDate"> >>>> + <now-timestamp-to-env env-name="newEntity.fromDate"/> >>>> + </if-empty> >>>> + >>>> + <create-value value-name="newEntity"/> >>>> + </simple-method> >>>> + <simple-method method-name="updatePartyToProduct" >>>> short-description="Update Party to Product"> >>>> + <set value="updatePartyToProduct" field="callingMethodName"/> >>>> + <set value="UPDATE" field="checkAction"/> >>>> + <call-simple-method >>>> method-name="checkProductRelatedPermission"/> >>>> + <check-errors/> >>>> + >>>> + <make-value value-name="lookupPKMap" >>>> entity-name="ProductRole"/> >>>> + <set-pk-fields map-name="parameters" >>>> value-name="lookupPKMap"/> >>>> + <find-by-primary-key entity-name="ProductRole" >>>> map-name="lookupPKMap" value-name="lookedUpValue"/> >>>> + <set-nonpk-fields map-name="parameters" >>>> value-name="lookedUpValue"/> >>>> + <store-value value-name="lookedUpValue"/> >>>> + </simple-method> >>>> + <simple-method method-name="removePartyFromProduct" >>>> short-description="Remove Party From Product"> >>>> + <set value="removePartyFromProduct" >>>> field="callingMethodName"/> >>>> + <set value="DELETE" field="checkAction"/> >>>> + <call-simple-method >>>> method-name="checkProductRelatedPermission"/> >>>> + <check-errors/> >>>> + >>>> + <make-value value-name="lookupPKMap" >>>> entity-name="ProductRole"/> >>>> + <set-pk-fields map-name="parameters" >>>> value-name="lookupPKMap"/> >>>> + <find-by-primary-key entity-name="ProductRole" >>>> map-name="lookupPKMap" value-name="lookedUpValue"/> >>>> + <remove-value value-name="lookedUpValue"/> >>>> + </simple-method> >>>> + </simple-methods> >>>> >>>> Modified: ofbiz/trunk/applications/product/servicedef/services.xml >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- ofbiz/trunk/applications/product/servicedef/services.xml (original) >>>> +++ ofbiz/trunk/applications/product/servicedef/services.xml Mon Sep >>>> 24 12:38:03 2007 >>>> @@ -716,6 +716,35 @@ >>>> <attribute name="fromDate" type="Timestamp" mode="IN" >>>> optional="false"/> >>>> </service> >>>> >>>> + <service name="addPartyToProduct" engine="simple" >>>> + >>>> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >>>> invoke="addPartyToProduct" auth="true"> >>>> + <description>Add Party To Product</description> >>>> + <attribute name="productId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="partyId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="roleTypeId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="fromDate" type="Timestamp" mode="IN" >>>> optional="true"/> >>>> + <attribute name="thruDate" type="Timestamp" mode="IN" >>>> optional="true"/> >>>> + <attribute name="comments" type="String" mode="IN" >>>> optional="true"/> >>>> + </service> >>>> + <service name="updatePartyToProduct" engine="simple" >>>> + >>>> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >>>> invoke="updatePartyToProduct" auth="true"> >>>> + <description>Update Party To Product</description> >>>> + <attribute name="productId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="partyId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="roleTypeId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="fromDate" type="Timestamp" mode="IN" >>>> optional="false"/> >>>> + <attribute name="thruDate" type="Timestamp" mode="IN" >>>> optional="true"/> >>>> + <attribute name="comments" type="String" mode="IN" >>>> optional="true"/> >>>> + </service> >>>> + <service name="removePartyFromProduct" engine="simple" >>>> + >>>> location="component://product/script/org/ofbiz/product/product/ProductServices.xml" >>>> invoke="removePartyFromProduct" auth="true"> >>>> + <description>Remove Party From Product</description> >>>> + <attribute name="productId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="partyId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="roleTypeId" type="String" mode="IN" >>>> optional="false"/> >>>> + <attribute name="fromDate" type="Timestamp" mode="IN" >>>> optional="false"/> >>>> + </service> >>>> + >>>> <service name="safeAddProductCategoryToCategory" engine="simple" >>>> >>>> location="org/ofbiz/product/category/CategoryServices.xml" >>>> invoke="addProductCategoryToCategory" auth="true"> >>>> <description>Safe Add ProductCategory To Category (requires >>>> fromDate)</description> >>>> >>>> Modified: >>>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>>> (original) >>>> +++ >>>> ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -512,8 +512,31 @@ >>>> <request-map uri="ProductBarCode.pdf"> >>>> <security https="true" auth="true"/> >>>> <response name="success" type="view" >>>> value="ProductBarCode.pdf"/> >>>> + </request-map> + >>>> + <!-- ================ Product Roles Requests ================= --> >>>> + <request-map uri="EditProductParties"> >>>> + <security https="true" auth="true"/> >>>> + <response name="success" type="view" >>>> value="EditProductParties"/> >>>> + </request-map> >>>> + <request-map uri="addPartyToProduct"> >>>> + <security https="true" auth="true"/> >>>> + <event type="service" path="" invoke="addPartyToProduct"/> >>>> + <response name="success" type="view" >>>> value="EditProductParties"/> >>>> + <response name="error" type="view" >>>> value="EditProductParties"/> >>>> + </request-map> >>>> + <request-map uri="updatePartyToProduct"> >>>> + <security https="true" auth="true"/> >>>> + <event type="service" path="" invoke="updatePartyToProduct"/> >>>> + <response name="success" type="view" >>>> value="EditProductParties"/> >>>> + <response name="error" type="view" >>>> value="EditProductParties"/> >>>> + </request-map> >>>> + <request-map uri="removePartyFromProduct"> >>>> + <security https="true" auth="true"/> >>>> + <event type="service" path="" >>>> invoke="removePartyFromProduct"/> >>>> + <response name="success" type="view" >>>> value="EditProductParties"/> >>>> + <response name="error" type="view" >>>> value="EditProductParties"/> >>>> </request-map> >>>> - <!-- ================ Product Asset Usage (rental) >>>> Requests ================= --> >>>> <request-map uri="EditProductAssetUsage"> >>>> @@ -2505,6 +2528,7 @@ >>>> <view-map name="EditProduct" type="screen" >>>> page="component://product/widget/catalog/ProductScreens.xml#EditProduct"/> >>>> >>>> <view-map name="EditProductPrices" type="screen" >>>> page="component://product/widget/catalog/ProductScreens.xml#EditProductPrices"/> >>>> >>>> <view-map name="EditProductAssetUsage" type="screen" >>>> page="component://product/widget/catalog/ProductScreens.xml#EditProductAssetUsage"/> >>>> >>>> + <view-map name="EditProductParties" type="screen" >>>> page="component://product/widget/catalog/ProductScreens.xml#EditProductParties"/> >>>> >>>> <view-map name="showFixedAssetProduct" type="screen" >>>> page="component://product/widget/catalog/ProductScreens.xml#showFixedAssetProduct"/> >>>> >>>> <view-map name="newFixedAssetProduct" type="screen" >>>> page="component://product/widget/catalog/ProductScreens.xml#newFixedAssetProduct"/> >>>> >>>> <view-map name="ProductBarCode.pdf" type="screenfop" >>>> page="component://product/widget/catalog/ProductScreens.xml#ProductBarCode.fo" >>>> content-type="application/pdf" encoding="none"/> >>>> >>>> Added: >>>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>>> >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl?rev=578930&view=auto >>>> >>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>>> (added) >>>> +++ >>>> ofbiz/trunk/applications/product/webapp/catalog/product/EditProductParties.ftl >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -0,0 +1,78 @@ >>>> +<#-- >>>> +Licensed to the Apache Software Foundation (ASF) under one >>>> +or more contributor license agreements. See the NOTICE file >>>> +distributed with this work for additional information >>>> +regarding copyright ownership. The ASF licenses this file >>>> +to you under the Apache License, Version 2.0 (the >>>> +"License"); you may not use this file except in compliance >>>> +with the License. You may obtain a copy of the License at >>>> + >>>> +http://www.apache.org/licenses/LICENSE-2.0 >>>> + >>>> +Unless required by applicable law or agreed to in writing, >>>> +software distributed under the License is distributed on an >>>> +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >>>> +KIND, either express or implied. See the License for the >>>> +specific language governing permissions and limitations >>>> +under the License. >>>> +--> >>>> + >>>> +<#if productId?exists && product?exists> + <table >>>> class="basic-table" cellspacing="0"> >>>> + <tr class="header-row"> >>>> + <td>${uiLabelMap.PartyPartyId}</td> >>>> + <td>${uiLabelMap.PartyRole}</td> >>>> + <td>${uiLabelMap.CommonFromDateTime}</td> >>>> + <td>${uiLabelMap.CommonThruDateTime}</td> >>>> + <td> </td> >>>> + </tr> >>>> + <#assign line = 0> >>>> + <#list productRoles as productRole> >>>> + <#assign line = line + 1> >>>> + <#assign curRoleType = >>>> productRole.getRelatedOneCache("RoleType")> >>>> + <tr> >>>> + <td><a >>>> href="/partymgr/control/viewprofile?party_id=${(productRole.partyId)?if_exists}" >>>> target="_blank" >>>> class="buttontext">${(productRole.partyId)?if_exists}</a></td> >>>> + <td>${(curRoleType.get("description",locale))?if_exists}</td> >>>> + <#assign hasntStarted = false> >>>> + <#if (productRole.getTimestamp("fromDate"))?exists && >>>> Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().before(productRole.getTimestamp("fromDate"))> >>>> <#assign hasntStarted = true></#if> >>>> + <td<#if hasntStarted> >>>> class="alert"</#if>>${(productRole.fromDate)?if_exists}</td> >>>> + <td align="center"> >>>> + <form method="post" >>>> action="<@ofbizUrl>updatePartyToProduct</@ofbizUrl>" >>>> name="lineForm${line}"> >>>> + <#assign hasExpired = false> >>>> + <#if (productRole.getTimestamp("thruDate"))?exists && >>>> (Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().after(productRole.getTimestamp("thruDate")))> >>>> <#assign hasExpired = true></#if> >>>> + <input type="hidden" name="productId" >>>> value="${(productRole.productId)?if_exists}"> >>>> + <input type="hidden" name="partyId" >>>> value="${(productRole.partyId)?if_exists}"> >>>> + <input type="hidden" name="roleTypeId" >>>> value="${(productRole.roleTypeId)?if_exists}"> >>>> + <input type="hidden" name="fromDate" >>>> value="${(productRole.getTimestamp("fromDate"))?if_exists}"> >>>> + <input type="text" size="25" name="thruDate" >>>> value="${(productRole. getTimestamp("thruDate"))?if_exists}" >>>> class="inputBox" <#if hasExpired> style="color: red;"</#if>> >>>> + <a >>>> href="javascript:call_cal(document.lineForm${line}.thruDate, >>>> '${(productRole.getTimestamp("thruDate"))?default(nowTimestamp?string)}');"><img >>>> src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" >>>> width="16" height="16" border="0" alt="Calendar"></a> >>>> + <input type="submit" value="${uiLabelMap.CommonUpdate}"> >>>> + </form> >>>> + </td> >>>> + <td align="center"> >>>> + <a >>>> href="<@ofbizUrl>removePartyFromProduct?productId=${(productRole.productId)?if_exists}&partyId=${(productRole.partyId)?if_exists}&roleTypeId=${(productRole.roleTypeId)?if_exists}&fromDate=${Static["org.ofbiz.base.util.UtilFormatOut"].encodeQueryValue(productRole.getTimestamp("fromDate").toString())}</@ofbizUrl>" >>>> class="buttontext"> >>>> + ${uiLabelMap.CommonDelete}</a> >>>> + </td> >>>> + </tr> >>>> + </#list> >>>> + </table> >>>> + <br/> >>>> + <h2>${uiLabelMap.ProductAssociatePartyToProduct}:</h2> >>>> + <br/> >>>> + <form method="post" >>>> action="<@ofbizUrl>addPartyToProduct</@ofbizUrl>" name="addNewForm"> >>>> + <input type="hidden" name="productId" value="${productId}"> >>>> + <input type="text" size="20" maxlength="20" name="partyId" >>>> value=""> >>>> + <#-- TODO: Add PartyId lookup screen >>>> + <a >>>> href="javascript:call_fieldlookup2(document.addNewForm.partyId,'LookupCustomerName');"> >>>> >>>> + <img src='/images/fieldlookup.gif' width='15' height='14' >>>> border='0' alt='Click here For Field Lookup'/> >>>> + </a> --> >>>> + <select name="roleTypeId" size="1"> >>>> + <#list roleTypes as roleType> >>>> + <option value="${(roleType.roleTypeId)?if_exists}" <#if >>>> roleType.roleTypeId.equals("_NA_")> >>>> ${uiLabelMap.ProductSelected}</#if>>${(roleType.get("description",locale))?if_exists}</option> >>>> >>>> + </#list> >>>> + </select> >>>> + <input type="text" size="25" name="fromDate"> >>>> + <a href="javascript:call_cal(document.addNewForm.fromDate, >>>> '${nowTimestamp?string}');"><img >>>> src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" >>>> width="16" height="16" border="0" alt="Calendar"></a> >>>> + <input type="submit" value="${uiLabelMap.CommonAdd}"> >>>> + </form> >>>> +</#if> >>>> >>>> Modified: >>>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>>> >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>>> (original) >>>> +++ >>>> ofbiz/trunk/applications/product/webapp/catalog/product/ProductTabBar.ftl >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -55,6 +55,7 @@ >>>> <#if product?exists && product.productTypeId?if_exists == >>>> "ASSET_USAGE"> >>>> <a >>>> href="<@ofbizUrl>EditProductAssetUsage?productId=${productId}</@ofbizUrl>" >>>> class="${selectedClassMap.EditProductAssetUsage?default(unselectedClassName)}">${uiLabelMap.ProductAssetUsage}</a> >>>> >>>> </#if> >>>> - <a >>>> href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" >>>> class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> >>>> + <a >>>> href="<@ofbizUrl>EditProductWorkEfforts?productId=${productId}</@ofbizUrl>" >>>> class="${selectedClassMap.EditProductWorkEfforts?default(unselectedClassName)}">${uiLabelMap.WorkEffortWorkEffort}</a> >>>> >>>> + <a >>>> href="<@ofbizUrl>EditProductParties?productId=${productId}</@ofbizUrl>" >>>> class="${selectedClassMap.EditProductParties?default(unselectedClassName)}">${uiLabelMap.PartyParties}</a> >>>> >>>> </div> >>>> </#if> >>>> >>>> Modified: >>>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>>> >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>>> (original) >>>> +++ >>>> ofbiz/trunk/applications/product/widget/catalog/CatalogCommonScreens.xml >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -78,7 +78,7 @@ >>>> </container> >>>> >>>> <!-- add Create Product and >>>> View Product (in ecommerce) links --> >>>> - <container> >>>> + <container style="button-bar"> >>>> <link >>>> target="EditProduct" text="${uiLabelMap.ProductNewProduct}" >>>> style="buttontext"/> >>>> <link >>>> target="CreateVirtualWithVariantsForm" >>>> text="${uiLabelMap.ProductNewVirtualProduct}" style="buttontext"/> >>>> <link >>>> target="/ecommerce/control/product?product_id=${productId}" >>>> url-mode="inter-app" text="${uiLabelMap.ProductProductPage}" >>>> style="buttontext"/> >>>> >>>> Modified: >>>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>>> URL: >>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=578930&r1=578929&r2=578930&view=diff >>>> >>>> ============================================================================== >>>> >>>> --- >>>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>>> (original) >>>> +++ >>>> ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml >>>> Mon Sep 24 12:38:03 2007 >>>> @@ -974,4 +974,37 @@ >>>> </section> >>>> </screen> >>>> + <screen name="EditProductParties"> >>>> + <section> >>>> + <actions> >>>> + <set field="titleProperty" >>>> value="PageTitleEditProductParties"/> >>>> + <set field="headerItem" value="product"/> >>>> + <set field="tabButtonItem" >>>> value="EditProductParties"/> >>>> + <set field="labelTitleProperty" value="PartyParties"/> >>>> + >>>> + <set field="productId" >>>> from-field="parameters.productId"/> >>>> + <entity-one entity-name="Product" >>>> value-name="product"/> >>>> + >>>> + <entity-condition entity-name="ProductRole" >>>> list-name="productRoles"> >>>> + <condition-expr field-name="productId" >>>> env-name="productId"/> >>>> + <order-by field-name="roleTypeId"/> >>>> + <order-by field-name="partyId"/> >>>> + </entity-condition> >>>> + >>>> + <entity-condition entity-name="RoleType" >>>> list-name="roleTypes"> >>>> + <order-by field-name="description"/> >>>> + </entity-condition> >>>> + </actions> >>>> + <widgets> >>>> + <decorator-screen name="CommonProductDecorator" >>>> location="${parameters.mainDecoratorLocation}"> >>>> + <decorator-section name="body"> >>>> + <platform-specific> >>>> + <html><html-template >>>> location="component://product/webapp/catalog/product/EditProductParties.ftl"/></html> >>>> >>>> + </platform-specific> >>>> + </decorator-section> >>>> + </decorator-screen> >>>> + </widgets> >>>> + </section> >>>> + </screen> >>>> + </screens> >>>> >>>> >>> >> > |
Adrian Crum wrote: > If we were to "take a stand" and reject changes that don't strictly > adhere to best practices, then there would be a lot of work left out of > OFBiz (I see commits that don't follow best practices almost on a daily > basis). I agree that it's tempting to go that route. Maybe once the > developer/committer community gets large enough, we can afford to take a > tougher stand. Right now we would be shooting ourselves in the foot in > doing so. I agree with everything else you wrote Adrian, but I don't think I agree with these last two sentences. I've been pretty hard on some of your stuff, and lots of other people's stuff, and the reason why is I think that feedback and a request to improve/correct is the best way to do two things: 1. help people understand best practices and the tools that are available, perhaps helping them move toward becoming a committer 2. improve the general quality of the project (in terms of utility and aesthetics) I don't think doing so will scare people away. The reactions I usually get are both good in a way: 1. an appreciation of the feedback and willingness or eagerness to take advantage of the ideas 2. a good brawl over the best way to do things that eventually leads to great improvement in the project, and probably someone who will stay involved in the project for a long time -David |
Agreed.
Men in the boxing ring are always preferred over those outside, IMHO. I think that strict standards and a clean project will attract a lot of good contributors. I've not heard of a college course that has strict entry requirements see a lack of applications; the converse is true. Jonathon David E Jones wrote: > > > Adrian Crum wrote: >> If we were to "take a stand" and reject changes that don't strictly >> adhere to best practices, then there would be a lot of work left out >> of OFBiz (I see commits that don't follow best practices almost on a >> daily basis). I agree that it's tempting to go that route. Maybe once >> the developer/committer community gets large enough, we can afford to >> take a tougher stand. Right now we would be shooting ourselves in the >> foot in doing so. > > I agree with everything else you wrote Adrian, but I don't think I agree > with these last two sentences. I've been pretty hard on some of your > stuff, and lots of other people's stuff, and the reason why is I think > that feedback and a request to improve/correct is the best way to do two > things: > > 1. help people understand best practices and the tools that are > available, perhaps helping them move toward becoming a committer > > 2. improve the general quality of the project (in terms of utility and > aesthetics) > > I don't think doing so will scare people away. The reactions I usually > get are both good in a way: > > 1. an appreciation of the feedback and willingness or eagerness to take > advantage of the ideas > > 2. a good brawl over the best way to do things that eventually leads to > great improvement in the project, and probably someone who will stay > involved in the project for a long time > > -David > > |
Administrator
|
Yes I can testify, I learned a lot from David's (and other) remarks ! This oblige you to think better, notably when it comes to use
existing tools and practices in OFBiz :o) On the other hand, there are more and more Jira issues pending and this begin to worry me a bit. I would not like that new comers think that their patches are neglicted. It seems that we (commiters) are more and more busy which indubitably is good for us but should not be bad for the project. Nevertheless, I know we try all to do our best everyday and I'm confident in the future... Jacques De : "Jonathon -- Improov" <[hidden email]> > Agreed. > > Men in the boxing ring are always preferred over those outside, IMHO. > > I think that strict standards and a clean project will attract a lot of good contributors. I've > not heard of a college course that has strict entry requirements see a lack of applications; the > converse is true. > > Jonathon > > David E Jones wrote: > > > > > > Adrian Crum wrote: > >> If we were to "take a stand" and reject changes that don't strictly > >> adhere to best practices, then there would be a lot of work left out > >> of OFBiz (I see commits that don't follow best practices almost on a > >> daily basis). I agree that it's tempting to go that route. Maybe once > >> the developer/committer community gets large enough, we can afford to > >> take a tougher stand. Right now we would be shooting ourselves in the > >> foot in doing so. > > > > I agree with everything else you wrote Adrian, but I don't think I agree > > with these last two sentences. I've been pretty hard on some of your > > stuff, and lots of other people's stuff, and the reason why is I think > > that feedback and a request to improve/correct is the best way to do two > > things: > > > > 1. help people understand best practices and the tools that are > > available, perhaps helping them move toward becoming a committer > > > > 2. improve the general quality of the project (in terms of utility and > > aesthetics) > > > > I don't think doing so will scare people away. The reactions I usually > > get are both good in a way: > > > > 1. an appreciation of the feedback and willingness or eagerness to take > > advantage of the ideas > > > > 2. a good brawl over the best way to do things that eventually leads to > > great improvement in the project, and probably someone who will stay > > involved in the project for a long time > > > > -David > > > > > |
Free forum by Nabble | Edit this page |