Author: jacopoc
Date: Thu Jun 21 07:16:58 2007 New Revision: 549490 URL: http://svn.apache.org/viewvc?view=rev&rev=549490 Log: Added overrideOrgPartyId field to ProductPromo and InvoiceItem for associating a promotion with a Internal Organization Party. Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/trunk/applications/product/entitydef/entitymodel.xml ofbiz/trunk/applications/product/webapp/catalog/promo/PromoForms.xml Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?view=diff&rev=549490&r1=549489&r2=549490 ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Thu Jun 21 07:16:58 2007 @@ -1029,7 +1029,8 @@ <field name="invoiceId" type="id-ne"></field> <field name="invoiceItemSeqId" type="id-ne"></field> <field name="invoiceItemTypeId" type="id"></field> - <field name="overrideGlAccountId" type="id"><!-- used to specify the override or actual glAccountId used for the invoice, avoids problems if configuration changes after initial posting, etc --></field> + <field name="overrideGlAccountId" type="id"><description>used to specify the override or actual glAccountId used for the invoice, avoids problems if configuration changes after initial posting, etc </description></field> + <field name="overrideOrgPartyId" type="id"><description>Used to specify the organization override rather than using the payToPartyId</description></field> <field name="inventoryItemId" type="id"></field> <field name="productId" type="id"></field> <field name="productFeatureId" type="id"></field> @@ -1081,6 +1082,9 @@ </relation> <relation type="one" fk-name="INVOICE_ITM_TARP" rel-entity-name="TaxAuthorityRateProduct"> <key-map field-name="taxAuthorityRateSeqId"/> + </relation> + <relation type="one" fk-name="INVCE_ITM_OVRPTY" title="OverrideOrg" rel-entity-name="Party"> + <key-map field-name="overrideOrgPartyId" rel-field-name="partyId"/> </relation> </entity> <entity entity-name="InvoiceItemAttribute" Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?view=diff&rev=549490&r1=549489&r2=549490 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Thu Jun 21 07:16:58 2007 @@ -532,7 +532,7 @@ amount = amount.multiply(billingQuantity); amount = amount.setScale(decimals, rounding); } - if (amount.signum() != 0) { + if (amount.signum() != 0) { Map createInvoiceItemAdjContext = FastMap.newInstance(); createInvoiceItemAdjContext.put("invoiceId", invoiceId); createInvoiceItemAdjContext.put("invoiceItemSeqId", invoiceItemSeqId); @@ -556,7 +556,22 @@ if (!(adj.getString("orderAdjustmentTypeId").equals("SALES_TAX"))) { createInvoiceItemAdjContext.put("taxableFlag", product.get("taxable")); } - + + // If the OrderAdjustment is associated to a ProductPromo, + // and the field ProductPromo.overrideOrgPartyId is set, + // copy the value to InvoiceItem.overrideOrgPartyId: this + // represent an organization override for the payToPartyId + if (UtilValidate.isNotEmpty(adj.getString("productPromoId"))) { + try { + GenericValue productPromo = adj.getRelatedOne("ProductPromo"); + if (UtilValidate.isNotEmpty(productPromo.getString("overrideOrgPartyId"))) { + createInvoiceItemAdjContext.put("overrideOrgPartyId", productPromo.getString("overrideOrgPartyId")); + } + } catch (GenericEntityException e) { + Debug.logError(e, "Error looking up ProductPromo with id [" + adj.getString("productPromoId") + "]", module); + } + } + Map createInvoiceItemAdjResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemAdjContext); if (ServiceUtil.isError(createInvoiceItemAdjResult)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceItemFromOrder",locale), null, null, createInvoiceItemAdjResult); Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=549490&r1=549489&r2=549490 ============================================================================== --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Thu Jun 21 07:16:58 2007 @@ -2619,11 +2619,15 @@ <field name="useLimitPerCustomer" type="numeric"></field> <field name="useLimitPerPromotion" type="numeric"></field> <field name="billbackFactor" type="floating-point"></field> + <field name="overrideOrgPartyId" type="id"></field> <field name="createdDate" type="date-time"></field> <field name="createdByUserLogin" type="id-vlong"></field> <field name="lastModifiedDate" type="date-time"></field> <field name="lastModifiedByUserLogin" type="id-vlong"></field> <prim-key field="productPromoId"/> + <relation type="one" fk-name="PROD_PRMO_OPA" rel-entity-name="Party"> + <key-map field-name="overrideOrgPartyId" rel-field-name="partyId"/> + </relation> <relation type="one" fk-name="PROD_PRMO_CUL" title="CreatedBy" rel-entity-name="UserLogin"> <key-map field-name="createdByUserLogin" rel-field-name="userLoginId"/> </relation> Modified: ofbiz/trunk/applications/product/webapp/catalog/promo/PromoForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/promo/PromoForms.xml?view=diff&rev=549490&r1=549489&r2=549490 ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/promo/PromoForms.xml (original) +++ ofbiz/trunk/applications/product/webapp/catalog/promo/PromoForms.xml Thu Jun 21 07:16:58 2007 @@ -41,6 +41,7 @@ <field name="requireCode" title="${uiLabelMap.ProductPromotionReqCode}" widget-style="selectBox"> <drop-down allow-empty="false" no-current-selected-key="N"><option key="N" description="${uiLabelMap.CommonN}"/><option key="Y" description="${uiLabelMap.CommonY}"/></drop-down> </field> + <field name="overrideOrgPartyId"><lookup target-form-name="LookupPartyName"/></field> <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> |
Free forum by Nabble | Edit this page |