Author: ashish
Date: Thu Jun 12 01:43:19 2008 New Revision: 667006 URL: http://svn.apache.org/viewvc?rev=667006&view=rev Log: Patch applied from JIRA issue https://issues.apache.org/jira/browse/OFBIZ-1794. Now the agreement will be applied for the Registered user in Ecommerce Section. Thanks Ratnesh Upadhyay & Ravindra Mandre for your patch. Special thanks to Rishi Solanki for helping and Jacopo for useful comments. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementForms.xml ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementTabBar.ftl ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml ofbiz/trunk/applications/accounting/widget/Menus.xml ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutshippingaddress.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl ofbiz/trunk/applications/party/entitydef/entitygroup.xml ofbiz/trunk/applications/party/entitydef/entitymodel.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Thu Jun 12 01:43:19 2008 @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- + 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 @@ -306,6 +307,9 @@ <value xml:lang="th">รหัสสัà¸à¸à¸²</value> <value xml:lang="zh">ååç¼å·</value> </property> + <property key="AccountingAgreementInformation"> + <value xml:lang="en">Agreement Information</value> + </property> <property key="AccountingAgreementIsNotSetForSupplierProducts"> <value xml:lang="en">Please set a supplier in Agreement.partyIdTo and a currency in the AgreementItem before editing the price list</value> <value xml:lang="th">à¸à¸£à¸¸à¸à¸²à¸à¸³à¸«à¸à¸à¸à¸¹à¹à¸à¸±à¸à¸«à¸²à¸ªà¸´à¹à¸à¸à¸à¸à¹à¸à¸ªà¸±à¸à¸à¸² à¸à¸¶à¸à¸à¸¥à¸¸à¹à¸¡à¸à¸¹à¹à¹à¸à¹à¹à¸¥à¸°à¹à¸à¸´à¸à¹à¸à¸ªà¸´à¹à¸à¸à¸à¸à¸à¸µà¹à¸à¸à¸¥à¸à¸à¹à¸à¸à¹à¸à¹à¹à¸à¸£à¸²à¸¢à¸à¸²à¸£à¸£à¸²à¸à¸² @@ -382,6 +386,9 @@ <value xml:lang="th">à¹à¸à¸£à¹à¸¡à¸à¸±à¸</value> <value xml:lang="zh">ä¿é</value> </property> + <property key="AccountingAgreementRoles"> + <value xml:lang="en">Agreement Roles</value> + </property> <property key="AccountingAgreementTermId"> <value xml:lang="ar">ر٠ز بÙد إتÙاÙ</value> <value xml:lang="en">Agreement Term Id</value> @@ -3888,6 +3895,9 @@ <value xml:lang="th">à¹à¸à¸´à¹à¸¡à¹à¸à¸£à¹à¸¡à¸à¸±à¸à¹à¸«à¸¡à¹</value> <value xml:lang="zh">æ°å»ºä¿é</value> </property> + <property key="AccountingNewAgreementRole"> + <value xml:lang="en">Create New Agreement Role</value> + </property> <property key="AccountingNewAgreementTerm"> <value xml:lang="ar">اضاÙØ© بÙد إتÙاÙÙØ©</value> <value xml:lang="en">Create Agreement Term</value> @@ -8098,6 +8108,9 @@ <value xml:lang="th">รายà¸à¸²à¸£à¸à¸±à¸à¸à¸µà¹à¸¢à¸à¸à¸£à¸°à¹à¸ à¸à¸à¸±à¹à¸§à¹à¸</value> <value xml:lang="zh">æ»è´¦è´¦æ·å表</value> </property> + <property key="OrderSelectAgreementRoles"> + <value xml:lang="en">Select order agreement Roles</value> + </property> <property key="Organization"> <value xml:lang="ar">اÙ٠ؤسسة</value> <value xml:lang="en">Organization</value> @@ -8110,6 +8123,9 @@ <value xml:lang="th">à¸à¸à¸à¹à¸à¸£</value> <value xml:lang="zh">å¢ä½</value> </property> + <property key="PageTitleAddAgreementRoles"> + <value xml:lang="en">Add Agreement Roles</value> + </property> <property key="PageTitleAddBillingAccountRoles"> <value xml:lang="en">Add Billing Account Roles</value> <value xml:lang="it">Aggiungi Ruoli Conto Fatturazione</value> @@ -8559,6 +8575,9 @@ <value xml:lang="th">หาสัà¸à¸à¸²</value> <value xml:lang="zh">æ¥æ¾åå</value> </property> + <property key="PageTitleFindAgreementRoles"> + <value xml:lang="en">Find Agreement Roles</value> + </property> <property key="PageTitleFindBillingAccount"> <value xml:lang="en">Find Billing Account(s)</value> <value xml:lang="es">Encontrar Cuenta(s) de Facturación</value> @@ -8703,6 +8722,9 @@ <value xml:lang="ru">СпиÑок акÑий ÑлеменÑа договоÑа</value> <value xml:lang="th">List Agreement Promo Appls</value> </property> + <property key="PageTitleListAgreementRoles"> + <value xml:lang="en">List Agreement Roles</value> + </property> <property key="PageTitleListAgreementTerms"> <value xml:lang="en">List Agreement Terms</value> <value xml:lang="es">Lista Términos de Acuerdos</value> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Thu Jun 12 01:43:19 2008 @@ -1761,6 +1761,25 @@ <response name="success" type="view" value="EditPaymentMethodType"/> <response name="error" type="view" value="EditPaymentMethodType"/> </request-map> + <request-map uri="EditAgreementRoles"> + <security https="true" auth="true"/> + <response name="success" type="view" value="EditAgreementRoles"/> + </request-map> + <request-map uri="createAgreementRole"> + <event type="service" invoke="createAgreementRole"/> + <response name="success" type="view" value="EditAgreementRoles"/> + <response name="error" type="view" value="EditAgreementRoles"/> + </request-map> + <request-map uri="updateAgreementRole"> + <event type="service" invoke="updateAgreementRole"/> + <response name="success" type="view" value="EditAgreementRoles"/> + <response name="error" type="view" value="EditAgreementRoles"/> + </request-map> + <request-map uri="deleteAgreementRole"> + <event type="service" invoke="deleteAgreementRole"/> + <response name="success" type="view" value="EditAgreementRoles"/> + <response name="error" type="view" value="EditAgreementRoles"/> + </request-map> <!-- ================ Entity Lookup Requests ================= --> <request-map uri="LookupProduct"><security auth="true" https="true"/><response name="success" type="view" value="LookupProduct"/></request-map> @@ -2056,6 +2075,9 @@ <!-- Payment Method Type --> <view-map name="EditPaymentMethodType" type="screen" page="component://accounting/widget/PaymentMethodTypeScreens.xml#EditPaymentMethodType"/> + + <!-- Agreements Views --> + <view-map name="EditAgreementRoles" type="screen" page="component://accounting/widget/AgreementScreens.xml#EditAgreementRoles"/> <!-- end of view mappings --> </site-conf> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementForms.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementForms.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementForms.xml Thu Jun 12 01:43:19 2008 @@ -79,8 +79,9 @@ <form name="EditAgreement" type="single" target="updateAgreement" title="" default-map-name="agreement" header-row-style="header-row" default-table-style="basic-table"> <alt-target use-when="agreement==null" target="createAgreement"/> - <auto-fields-entity entity-name="Agreement" default-field-type="edit"/> - <field name="agreementId" title="${uiLabelMap.AccountingAgreementId}"><display/></field> + <auto-fields-service service-name="updateAgreement" default-field-type="edit" map-name="agreement"/> + <field name="agreementId" use-when="agreementId!=null" tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field> + <field name="agreementId" use-when="agreement==null&&agreementId==null"><ignored/></field> <field name="productId" title="${uiLabelMap.AccountingProductId}"> <lookup target-form-name="LookupProduct"/> </field> @@ -502,4 +503,31 @@ <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deleteAgreementWorkEffortAppl?agreementId=${agreementId}&agreementItemSeqId=${agreementItemSeqId}&workEffortId=${workEffortId}"/> </field> </form> + <form name="ListAgreementRoles" list-name="agreementRoles" type="list" paginate-target="FindAgreementRoles" + odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> + <actions> + <entity-and entity-name="AgreementRole" use-cache="true" list-name="agreementRoles"> + <field-map field-name="agreementId" env-name="agreementId"/> + </entity-and> + </actions> + <auto-fields-entity entity-name="AgreementRole" default-field-type="display"/> + <field name="agreementId"><hidden/></field> + <field name="partyId" title="${uiLabelMap.PartyPartyId}"><display/></field> + <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}"><display/></field> + <field name="deleteLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext"> + <hyperlink target="deleteAgreementRole?agreementId=${agreementId}&partyId=${partyId}&roleTypeId=${roleTypeId}" description="${uiLabelMap.CommonRemove}" also-hidden="false"/> + </field> + </form> + <form name="AddAgreementRole" type="single" target="createAgreementRole" + header-row-style="header-row" default-table-style="basic-table"> + <auto-fields-entity entity-name="AgreementRole" default-field-type="edit"/> + <field name="agreementId"><hidden/></field> + <field name="partyId" title="${uiLabelMap.PartyPartyId}"><lookup target-form-name="LookupPartyName"/></field> + <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}"> + <drop-down allow-empty="true"> + <entity-options description="${description}" entity-name="RoleType" key-field-name="roleTypeId"/> + </drop-down> + </field> + <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> </forms> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementTabBar.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementTabBar.ftl?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementTabBar.ftl (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/agreement/AgreementTabBar.ftl Thu Jun 12 01:43:19 2008 @@ -24,6 +24,7 @@ <li<#if selected == "AgreementTerms"> class="selected"</#if>><a href="<@ofbizUrl>EditAgreementTerms?agreementId=${agreement.agreementId}</@ofbizUrl>">${uiLabelMap.AccountingAgreementTerms}</a></li> <li<#if selected == "AgreementItems"> class="selected"</#if>><a href="<@ofbizUrl>ListAgreementItems?agreementId=${agreement.agreementId}</@ofbizUrl>">${uiLabelMap.AccountingAgreementItems}</a></li> <li<#if selected == "AgreementWorkEffortAppls"> class="selected"</#if>><a href="<@ofbizUrl>EditAgreementWorkEffortAppls?agreementId=${agreement.agreementId}</@ofbizUrl>">${uiLabelMap.AccountingAgreementWorkEffortAppls}</a></li> + <li<#if selected == "AgreementRoles"> class="selected"</#if>><a href="<@ofbizUrl>EditAgreementRoles?agreementId=${agreement.agreementId}</@ofbizUrl>">${uiLabelMap.AccountingAgreementRoles}</a></li> </ul> <br class="clear"/> </div> Modified: ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/AgreementScreens.xml Thu Jun 12 01:43:19 2008 @@ -76,37 +76,23 @@ <if-service-permission service-name="acctgAgreementPermissionCheck" main-action="VIEW"/> </condition> <widgets> - <container style="screenlet"> - <container style="screenlet-title-bar"> - <container style="h3"> - <label text="${uiLabelMap.PageTitleFindAgreement}"/> - </container> - </container> - <container style="screenlet-body"> - <section> - <widgets> - <container style="button-bar"> - <link target="EditAgreement" text="${uiLabelMap.AccountingNewAgreement}" style="buttontext"/> - </container> - <include-form name="FindAgreements" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/> - </widgets> - </section> - </container> - </container> - <container style="screenlet"> - <container style="screenlet-title-bar"> - <container style="h3"> - <label text="${uiLabelMap.PageTitleListAgreement}"/> - </container> - </container> - <container style="screenlet-body"> - <section> - <widgets> - <include-form name="ListAgreements" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/> - </widgets> - </section> - </container> + <container style="button-bar"> + <link target="EditAgreement" text="${uiLabelMap.AccountingNewAgreement}" style="buttontext"/> </container> + <screenlet title="${uiLabelMap.PageTitleFindAgreement}"> + <section> + <widgets> + <include-form name="FindAgreements" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/> + </widgets> + </section> + </screenlet> + <screenlet title="${uiLabelMap.PageTitleListAgreement}"> + <section> + <widgets> + <include-form name="ListAgreements" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/> + </widgets> + </section> + </screenlet> </widgets> <fail-widgets> <label style="h3">${uiLabelMap.AcccountingViewPermissionError}</label> @@ -915,4 +901,29 @@ </widgets> </section> </screen> + <screen name="EditAgreementRoles"> + <section> + <actions> + <set field="titleProperty" value="PageTitleFindAgreementRoles"/> + <set field="headerItem" value="agreement"/> + <set field="tabButtonItem" value="AgreementRoles"/> + <set field="agreementId" from-field="parameters.agreementId"/> + <entity-one entity-name="Agreement" value-name="agreement" auto-field-map="true"/> + </actions> + <widgets> + <decorator-screen name="CommonAgreementDecorator" location="${parameters.agreementDecoratorLocation}"> + <decorator-section name="body"> + <screenlet id="add-agreement-roles" title="${uiLabelMap.PageTitleAddAgreementRoles}" collapsible="true"> + <section> + <widgets> + <include-form name="AddAgreementRole" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/> + </widgets> + </section> + </screenlet> + <include-form name="ListAgreementRoles" location="component://accounting/webapp/accounting/agreement/AgreementForms.xml"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/Menus.xml (original) +++ ofbiz/trunk/applications/accounting/widget/Menus.xml Thu Jun 12 01:43:19 2008 @@ -580,4 +580,10 @@ <link target="editInvoiceItemType"/> </menu-item> </menu> + <menu name="AgreementTabBar" menu-container-style="button-bar tab-bar" default-selected-style="selected"> + <menu-item name="createNewAgreement" title="${uiLabelMap.AccountingNewAgreement}"> + <link target="EditAgreement"/> + </menu-item> + </menu> + </menus> Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Thu Jun 12 01:43:19 2008 @@ -568,12 +568,19 @@ <security https="true" auth="true"/> <event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="setCheckOutPages"/> <response name="shippingaddress" type="view" value="checkoutshippingaddress"/> - <response name="shippingoptions" type="view" value="checkoutshippingoptions"/> + <response name="shippingoptions" type="request" value="setOrderCurrencyAgreementShipDates"/> <response name="payment" type="request" value="setPoNumber"/> <response name="confirm" type="request" value="calcShipping"/> <response name="success" type="view" value="checkoutshippingaddress"/> <response name="error" type="request" value="checkouterror"/> </request-map> + <request-map uri="setOrderCurrencyAgreementShipDates"> + <description>Handles setting the currency, agreement and shipment dates of an order.</description> + <security https="true" auth="true"/> + <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="setOrderCurrencyAgreementShipDates"/> + <response name="success" type="view" value="checkoutshippingoptions"/> + <response name="error" type="request" value="checkouterror"/> + </request-map> <request-map uri="setPoNumber"> <security direct-request="false"/> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="setPoNumber"/> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh Thu Jun 12 01:43:19 2008 @@ -22,18 +22,36 @@ import org.ofbiz.entity.util.*; import org.ofbiz.party.contact.*; import org.ofbiz.product.store.*; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; +import javolution.util.FastList; delegator = request.getAttribute("delegator"); cart = session.getAttribute("shoppingCart"); userLogin = session.getAttribute("userLogin"); party = userLogin.getRelatedOne("Party"); +partyId = party.getString("partyId"); productStoreId = ProductStoreWorker.getProductStoreId(request); +productStoreId = cart.getProductStoreId(); +if (UtilValidate.isNotEmpty(productStoreId)) { + productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); + payToPartyId = productStore.getString("payToPartyId"); +} + String shippingContactMechId = request.getParameter("shipping_contact_mech_id"); for (int shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); shipGroupIndex++) { supplierPartyId = cart.getSupplierPartyId(shipGroupIndex); context.put(shipGroupIndex+"_supplierPartyId",supplierPartyId); } +List exprs = FastList.newInstance(); +exprs.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, payToPartyId)); +exprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId)); +agreements = delegator.findList("Agreement", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, null, null, true); +agreements = EntityUtil.filterByDate(agreements); +context.put("agreements", agreements); context.put("shoppingCart", cart); context.put("userLogin", userLogin); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh Thu Jun 12 01:43:19 2008 @@ -28,6 +28,11 @@ import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.order.shoppingcart.product.ProductDisplayWorker; import org.ofbiz.order.shoppingcart.product.ProductPromoWorker; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; +import javolution.util.FastList; + // Get the Cart and Prepare Size shoppingCart = ShoppingCartEvents.getCartObject(request); @@ -44,19 +49,38 @@ payToPartyId = productStore.getString("payToPartyId"); partyId = shoppingCart.getOrderPartyId(); + List exprsAgreements = FastList.newInstance(); + List exprsAgreementRoles = FastList.newInstance(); // get applicable agreements for order entry if ("PURCHASE_ORDER".equals(shoppingCart.getOrderType())) { // the agreement for a PO is from customer to payToParty (ie, us) - agreements = delegator.findByAndCache("Agreement", UtilMisc.toMap("partyIdTo", partyId, "partyIdFrom", payToPartyId)); + exprsAgreements.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyId)); + exprsAgreements.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, payToPartyId)); + agreements = delegator.findList("Agreement", EntityCondition.makeCondition(exprsAgreements, EntityOperator.AND), null, null, null, true); + exprsAgreementRoles.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); + exprsAgreementRoles.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "SUPPLIER")); + agreementRoles = delegator.findList("AgreementRole", EntityCondition.makeCondition(exprsAgreementRoles, EntityOperator.AND), null, null, null, true); catalogCol = CatalogWorker.getAllCatalogIds(request); } else { // the agreement for a sales order is from us to the customer - agreements = delegator.findByAndCache("Agreement", UtilMisc.toMap("partyIdTo", payToPartyId, "partyIdFrom", partyId)); + exprsAgreements.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, payToPartyId)); + exprsAgreements.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId)); + agreements = delegator.findList("Agreement", EntityCondition.makeCondition(exprsAgreements, EntityOperator.AND), null, null, null, true); + exprsAgreementRoles.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); + exprsAgreementRoles.add(EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "CUSTOMER")); + agreementRoles = delegator.findList("AgreementRole", EntityCondition.makeCondition(exprsAgreementRoles, EntityOperator.AND), null, null, null, true); catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId); } + if (agreements != null && agreements.size() > 0) { + agreements = EntityUtil.filterByDate(agreements); context.put("agreements", agreements); } + if (UtilValidate.isNotEmpty(agreementRoles)) { + context.put("agreementRoles", agreementRoles); + } + + if (catalogCol != null && catalogCol.size() > 0) { currentCatalogId = (String) catalogCol.get(0); currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutshippingaddress.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutshippingaddress.ftl?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutshippingaddress.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutshippingaddress.ftl Thu Jun 12 01:43:19 2008 @@ -54,7 +54,6 @@ // --> </script> <#assign cart = shoppingCart?if_exists/> - <form method="post" name="checkoutInfoForm" style="margin:0;"> <input type="hidden" name="checkoutpage" value="shippingaddress"/> <div class="screenlet" style="height: 100%;"> @@ -98,7 +97,37 @@ <tr><td colspan="2"><hr/></td></tr> </#list> </#if> - </table> + </table> + <div class="tableheadtext"> ${uiLabelMap.AccountingAgreementInformation}</div> + <table> + <#if agreements?exists> + <#if agreements.size()!=1> + <tr> + <td> </td> + <td align='left' valign='top' nowrap> + <div class='tableheadtext'> + ${uiLabelMap.OrderSelectAgreement} + </div> + </td> + <td> </td> + <td valign='middle'> + <div class='tabletext' valign='top'> + <select name="agreementId" class="selectBox"> + <#list agreements as agreement> + <option value='${agreement.agreementId?if_exists}'>${agreement.agreementId} - ${agreement.description?if_exists}</option> + </#list> + </select> + </div> + </td> + </tr> + <#else> + <#list agreements as agreement> + <input type="radio" name="agreementId" value="${agreement.agreementId?if_exists}"<#if checkThisAddress> checked</#if>>${agreement.description?if_exists} will be used for this order. + </#list> + </#if> + </#if> + </table> + <br /> <#-- Party Tax Info --> <div class="tableheadtext"> ${uiLabelMap.PartyTaxIdentification}</div> ${screens.render("component://order/widget/ordermgr/OrderEntryOrderScreens.xml#customertaxinfo")} Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl Thu Jun 12 01:43:19 2008 @@ -52,9 +52,29 @@ </div> </td> </tr> - <#else><input type='hidden' name='hasAgreements' value='N'/> </#if> + <#if agreementRoles?exists> + <tr> + <td> </td> + <td align='right' valign='top' nowrap> + <div class='tableheadtext'> + ${uiLabelMap.OrderSelectAgreementRoles} + </div> + </td> + <td> </td> + <td valign='middle'> + <div class='tabletext' valign='top'> + <select name="agreementId" class="inputBox"> + <option value="">${uiLabelMap.CommonNone}</option> + <#list agreementRoles as agreementRole> + <option value='${agreementRole.agreementId?if_exists}' >${agreementRole.agreementId?if_exists} - ${agreementRole.roleTypeId?if_exists}</option> + </#list> + </select> + </div> + </td> + </tr> + </#if> <tr> <td> </td> Modified: ofbiz/trunk/applications/party/entitydef/entitygroup.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/entitydef/entitygroup.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/party/entitydef/entitygroup.xml (original) +++ ofbiz/trunk/applications/party/entitydef/entitygroup.xml Thu Jun 12 01:43:19 2008 @@ -48,7 +48,7 @@ <entity-group group="org.ofbiz" entity="AgreementItemAndProductAppl" /> <entity-group group="org.ofbiz" entity="AgreementItemAndPartyAppl" /> - + <entity-group group="org.ofbiz" entity="AgreementAndRole"/> <!-- ========================================================= --> <!-- org.ofbiz.party.communication --> <!-- ========================================================= --> Modified: ofbiz/trunk/applications/party/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/entitydef/entitymodel.xml?rev=667006&r1=667005&r2=667006&view=diff ============================================================================== --- ofbiz/trunk/applications/party/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/party/entitydef/entitymodel.xml Thu Jun 12 01:43:19 2008 @@ -485,7 +485,51 @@ <key-map field-name="agreementId"/> </view-link> </view-entity> - + <view-entity entity-name="AgreementAndRole" + package-name="org.ofbiz.party.agreement" + title="Agreement and AgreementRole View Entity"> + <member-entity entity-alias="AGR" entity-name="Agreement"/> + <member-entity entity-alias="AR" entity-name="AgreementRole"/> + <alias-all entity-alias="AGR"/> + <alias-all entity-alias="AR"/> + <view-link entity-alias="AGR" rel-entity-alias="AR"> + <key-map field-name="agreementId"/> + </view-link> + <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-nofk" rel-entity-name="PartyRole"> + <key-map field-name="partyId"/> + <key-map field-name="roleTypeId"/> + </relation> + <relation type="one-nofk" title="To" rel-entity-name="Party"> + <key-map field-name="partyIdTo" rel-field-name="partyId"/> + </relation> + <relation type="one-nofk" title="To" rel-entity-name="RoleType"> + <key-map field-name="roleTypeIdTo" rel-field-name="roleTypeId"/> + </relation> + <relation type="one-nofk" title="To" rel-entity-name="PartyRole"> + <key-map field-name="partyIdTo" rel-field-name="partyId"/> + <key-map field-name="roleTypeIdTo" rel-field-name="roleTypeId"/> + </relation> + <relation type="one-nofk" title="From" rel-entity-name="Party"> + <key-map field-name="partyIdFrom" rel-field-name="partyId"/> + </relation> + <relation type="one-nofk" title="From" rel-entity-name="RoleType"> + <key-map field-name="roleTypeIdFrom" rel-field-name="roleTypeId"/> + </relation> + <relation type="one-nofk" title="From" rel-entity-name="PartyRole"> + <key-map field-name="partyIdFrom" rel-field-name="partyId"/> + <key-map field-name="roleTypeIdFrom" rel-field-name="roleTypeId"/> + </relation> + <relation type="many" rel-entity-name="AgreementRole"> + <key-map field-name="agreementId"/> + </relation> + </view-entity> + <!-- ========================================================= --> <!-- org.ofbiz.party.communication --> <!-- ========================================================= --> |
Free forum by Nabble | Edit this page |