Browse files

Merged from trunk up to r927237 in prep for merging into trunk

  • Loading branch information...
1 parent e367e44 commit 31d3ef2aecf7ce8ec9004acfc48dc4fc0069da77 @jonesde jonesde committed Mar 25, 2010
Showing with 313 additions and 447 deletions.
  1. +1 −0 applications/accounting/data/AccountingTypeData.xml
  2. +119 −68 applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
  3. +0 −108 applications/accounting/webapp/accounting/reports/InventoryValuationReport.fo.ftl
  4. +22 −29 applications/accounting/widget/ReportFinancialSummaryForms.xml
  5. +22 −47 applications/accounting/widget/ReportFinancialSummaryScreens.xml
  6. +5 −3 applications/content/script/org/ofbiz/content/survey/SurveyServices.xml
  7. +4 −0 applications/product/entitydef/entitymodel.xml
  8. +4 −1 applications/product/widget/facility/InventoryForms.xml
  9. +18 −10 framework/base/src/org/ofbiz/base/util/GroovyUtil.java
  10. +1 −3 framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
  11. +1 −0 framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
  12. +1 −0 framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
  13. +97 −167 framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
  14. +2 −0 framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
  15. +2 −0 framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
  16. +11 −4 framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
  17. +1 −3 framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
  18. +1 −2 framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
  19. +1 −2 framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java
View
1 applications/accounting/data/AccountingTypeData.xml
@@ -955,6 +955,7 @@ under the License.
<Enumeration description="LIFO" enumCode="LIFO" enumId="COGS_LIFO" sequenceId="01" enumTypeId="COGS_METHODS"/>
<Enumeration description="FIFO" enumCode="FIFO" enumId="COGS_FIFO" sequenceId="02" enumTypeId="COGS_METHODS"/>
<Enumeration description="Average Cost" enumCode="AVG_COST" enumId="COGS_AVG_COST" sequenceId="03" enumTypeId="COGS_METHODS"/>
+ <Enumeration description="Inventory Item Cost" enumCode="INV_COST" enumId="COGS_INV_COST" sequenceId="04" enumTypeId="COGS_METHODS"/>
<!-- inventory sequencing mode for accounting preferences -->
<EnumerationType description="Invoice Sequence Mode" enumTypeId="INVOICE_SEQMD" hasTable="N" parentTypeId=""/>
View
187 applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
@@ -1097,93 +1097,121 @@ under the License.
<field-map field-name="roleTypeId" value="BILL_TO_CUSTOMER"/>
</entity-and>
<first-from-list list="billToCustomers" entry="billToCustomer"/>
- <!-- TODO: handle serialized inventory -->
- <!--
- <set field="getProdAvgCostMap.inventoryItem" from-field="inventoryItem"/>
- <call-service service-name="getProductAverageCost" in-map-name="getProdAvgCostMap">
- <result-to-field result-name="unitCost"/>
- </call-service>
- <calculate field="origAmount" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
- <calcop operator="multiply">
- <calcop operator="get" field="itemIssuance.quantity"/>
- <calcop operator="get" field="unitCost"/>
- </calcop>
- </calculate>
- -->
<!-- prepare the double posting (D/C) entries (AcctgTransEntry) -->
<!-- Credit -->
+ <!-- TODO: handle serialized inventory -->
<set field="partyAccountingPreferencesCallMap.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
<call-service service-name="getPartyAccountingPreferences" in-map-name="partyAccountingPreferencesCallMap">
<result-to-field result-name="partyAccountingPreference" field="partyAcctgPreference"/>
</call-service>
- <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_FIFO" type="String">
- <set value="+datetimeReceived" field="orderByString"/>
- </if-compare>
- <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_LIFO" type="String">
- <set value="-datetimeReceived" field="orderByString"/>
- </if-compare>
- <if-empty field="orderByString">
- <add-error><fail-message message="COGS costing method is not supported: ${partyAcctgPreference.cogsMethodId}"/></add-error>
- <check-errors/>
- </if-empty>
- <entity-condition entity-name="InventoryItem" list="costInventoryItems">
- <condition-list combine="and">
- <condition-expr field-name="ownerPartyId" operator="equals" from-field="inventoryItem.ownerPartyId"/>
- <condition-expr field-name="facilityId" operator="equals" from-field="inventoryItem.facilityId"/>
- <condition-expr field-name="productId" operator="equals" from-field="inventoryItem.productId"/>
- <condition-expr field-name="accountingQuantityTotal" operator="greater" value="0.0"/>
- </condition-list>
- <order-by field-name="${orderByString}"/>
- </entity-condition>
- <set field="remainingQuantity" from-field="itemIssuance.quantity"/>
<set field="totalAmount" value="0.0" type="BigDecimal"/>
- <iterate list="costInventoryItems" entry="costInventoryItem">
- <if-compare field="remainingQuantity" operator="greater" value="0.0" type="BigDecimal">
- <if-compare-field field="remainingQuantity" operator="less-equals" to-field="costInventoryItem.accountingQuantityTotal" type="BigDecimal">
- <set field="costInventoryItemQuantity" from-field="remainingQuantity"/>
- <set field="remainingQuantity" value="0.0" type="BigDecimal"/>
+ <if>
+ <condition>
+ <or>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_INV_COST" type="String"/>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_AVG_COST" type="String"/>
+ </or>
+ </condition>
+ <then>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_AVG_COST" type="String">
+ <set field="getProdAvgCostMap.inventoryItem" from-field="inventoryItem"/>
+ <call-service service-name="getProductAverageCost" in-map-name="getProdAvgCostMap">
+ <result-to-field result-name="unitCost"/>
+ </call-service>
<else>
- <set field="costInventoryItemQuantity" from-field="costInventoryItem.accountingQuantityTotal"/>
- <set field="remainingQuantity" value="${remainingQuantity - costInventoryItem.accountingQuantityTotal}" type="BigDecimal"/>
+ <set field="unitCost" from-field="inventoryItem.unitCost"/>
</else>
- </if-compare-field>
- <!-- An inventory item detail record is created to keep track of the units (value) that we are going to add to the inventory account -->
- <set from-field="costInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
- <set value="${-1 * costInventoryItemQuantity}" field="createDetailMap.accountingQuantityDiff" type="BigDecimal"/>
- <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
-
- <calculate field="costInventoryItemAmount" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
- <calcop operator="multiply">
- <calcop operator="get" field="costInventoryItemQuantity"/>
- <calcop operator="get" field="costInventoryItem.unitCost"/>
- </calcop>
- </calculate>
+ </if-compare>
<calculate field="totalAmount" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
- <calcop operator="sum">
- <calcop operator="get" field="costInventoryItemAmount"/>
- <calcop operator="get" field="totalAmount"/>
+ <calcop operator="multiply">
+ <calcop operator="get" field="itemIssuance.quantity"/>
+ <calcop operator="get" field="unitCost"/>
</calcop>
</calculate>
<make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
<set field="creditEntry.debitCreditFlag" value="C"/>
<set field="creditEntry.glAccountTypeId" value="INVENTORY_ACCOUNT"/>
<set field="creditEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
<set field="creditEntry.productId" from-field="inventoryItem.productId"/>
- <set field="creditEntry.inventoryItemId" from-field="costInventoryItem.inventoryItemId"/>
- <set field="creditEntry.origAmount" from-field="costInventoryItemAmount"/>
+ <set field="creditEntry.inventoryItemId" from-field="inventoryItem.inventoryItemId"/>
+ <set field="creditEntry.origAmount" from-field="totalAmount"/>
<set field="creditEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/>
<if-not-empty field="billToCustomer">
<set field="creditEntry.partyId" from-field="billToCustomer.partyId"/>
<set field="creditEntry.roleTypeId" from-field="billToCustomer.roleTypeId"/>
</if-not-empty>
<set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/>
- <clear-field field="creditEntry"/>
- </if-compare>
- </iterate>
- <if-compare field="remainingQuantity" operator="greater" value="0.0" type="BigDecimal">
- <add-error><fail-message message="Could not find enough accounting inventory for product [${inventoryItem.productId}]; remaining quantity: ${remainingQuantity}"/></add-error>
- <check-errors/>
- </if-compare>
+ </then>
+ <else>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_FIFO" type="String">
+ <set value="+datetimeReceived" field="orderByString"/>
+ </if-compare>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_LIFO" type="String">
+ <set value="-datetimeReceived" field="orderByString"/>
+ </if-compare>
+ <if-empty field="orderByString">
+ <add-error><fail-message message="COGS costing method is not supported: ${partyAcctgPreference.cogsMethodId}"/></add-error>
+ <check-errors/>
+ </if-empty>
+ <entity-condition entity-name="InventoryItem" list="costInventoryItems">
+ <condition-list combine="and">
+ <condition-expr field-name="ownerPartyId" operator="equals" from-field="inventoryItem.ownerPartyId"/>
+ <condition-expr field-name="facilityId" operator="equals" from-field="inventoryItem.facilityId"/>
+ <condition-expr field-name="productId" operator="equals" from-field="inventoryItem.productId"/>
+ <condition-expr field-name="accountingQuantityTotal" operator="greater" value="0.0"/>
+ </condition-list>
+ <order-by field-name="${orderByString}"/>
+ </entity-condition>
+ <set field="remainingQuantity" from-field="itemIssuance.quantity"/>
+ <iterate list="costInventoryItems" entry="costInventoryItem">
+ <if-compare field="remainingQuantity" operator="greater" value="0.0" type="BigDecimal">
+ <if-compare-field field="remainingQuantity" operator="less-equals" to-field="costInventoryItem.accountingQuantityTotal" type="BigDecimal">
+ <set field="costInventoryItemQuantity" from-field="remainingQuantity"/>
+ <set field="remainingQuantity" value="0.0" type="BigDecimal"/>
+ <else>
+ <set field="costInventoryItemQuantity" from-field="costInventoryItem.accountingQuantityTotal"/>
+ <set field="remainingQuantity" value="${remainingQuantity - costInventoryItem.accountingQuantityTotal}" type="BigDecimal"/>
+ </else>
+ </if-compare-field>
+ <!-- An inventory item detail record is created to keep track of the units (value) that we are going to add to the inventory account -->
+ <set from-field="costInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
+ <set value="${-1 * costInventoryItemQuantity}" field="createDetailMap.accountingQuantityDiff" type="BigDecimal"/>
+ <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
+
+ <calculate field="costInventoryItemAmount" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
+ <calcop operator="multiply">
+ <calcop operator="get" field="costInventoryItemQuantity"/>
+ <calcop operator="get" field="costInventoryItem.unitCost"/>
+ </calcop>
+ </calculate>
+ <calculate field="totalAmount" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
+ <calcop operator="add">
+ <calcop operator="get" field="costInventoryItemAmount"/>
+ <calcop operator="get" field="totalAmount"/>
+ </calcop>
+ </calculate>
+ <make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
+ <set field="creditEntry.debitCreditFlag" value="C"/>
+ <set field="creditEntry.glAccountTypeId" value="INVENTORY_ACCOUNT"/>
+ <set field="creditEntry.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
+ <set field="creditEntry.productId" from-field="inventoryItem.productId"/>
+ <set field="creditEntry.inventoryItemId" from-field="costInventoryItem.inventoryItemId"/>
+ <set field="creditEntry.origAmount" from-field="costInventoryItemAmount"/>
+ <set field="creditEntry.origCurrencyUomId" from-field="inventoryItem.currencyUomId"/>
+ <if-not-empty field="billToCustomer">
+ <set field="creditEntry.partyId" from-field="billToCustomer.partyId"/>
+ <set field="creditEntry.roleTypeId" from-field="billToCustomer.roleTypeId"/>
+ </if-not-empty>
+ <set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/>
+ <clear-field field="creditEntry"/>
+ </if-compare>
+ </iterate>
+ <if-compare field="remainingQuantity" operator="greater" value="0.0" type="BigDecimal">
+ <add-error><fail-message message="Could not find enough accounting inventory for product [${inventoryItem.productId}]; remaining quantity: ${remainingQuantity}"/></add-error>
+ <check-errors/>
+ </if-compare>
+ </else>
+ </if>
<!-- Debit -->
<make-value entity-name="AcctgTransEntry" value-field="debitEntry"/>
<set field="debitEntry.debitCreditFlag" value="D"/>
@@ -1284,11 +1312,34 @@ under the License.
</else>
</if-not-empty>
<!-- TODO: handle serialized inventory -->
+ <set field="partyAccountingPreferencesCallMap.organizationPartyId" from-field="inventoryItem.ownerPartyId"/>
+ <call-service service-name="getPartyAccountingPreferences" in-map-name="partyAccountingPreferencesCallMap">
+ <result-to-field result-name="partyAccountingPreference" field="partyAcctgPreference"/>
+ </call-service>
<if-not-empty field="shipmentReceipt.returnId">
- <set field="getProdAvgCostMap.inventoryItem" from-field="inventoryItem"/>
- <call-service service-name="getProductAverageCost" in-map-name="getProdAvgCostMap">
- <result-to-field result-name="unitCost"/>
- </call-service>
+ <if>
+ <condition>
+ <or>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_INV_COST" type="String"/>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_AVG_COST" type="String"/>
+ </or>
+ </condition>
+ <then>
+ <if-compare field="partyAcctgPreference.cogsMethodId" operator="equals" value="COGS_AVG_COST" type="String">
+ <set field="getProdAvgCostMap.inventoryItem" from-field="inventoryItem"/>
+ <call-service service-name="getProductAverageCost" in-map-name="getProdAvgCostMap">
+ <result-to-field result-name="unitCost"/>
+ </call-service>
+ <else>
+ <set field="unitCost" from-field="inventoryItem.unitCost"/>
+ </else>
+ </if-compare>
+ </then>
+ <else>
+ <!-- LIFO and FIFO-->
+ <set field="unitCost" from-field="inventoryItem.unitCost"/>
+ </else>
+ </if>
<else>
<set field="unitCost" from-field="inventoryItem.unitCost"/>
</else>
View
108 applications/accounting/webapp/accounting/reports/InventoryValuationReport.fo.ftl
@@ -1,108 +0,0 @@
-<#--
-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.
--->
-<#escape x as x?xml>
- <fo:block font-size="14pt" font-weight="bold" text-align="center">${uiLabelMap.AccountingInventoryValuation}</fo:block>
- <fo:block font-size="10pt" text-align="left" font-weight="bold">
- <#if parameters.organizationPartyId?has_content>${uiLabelMap.Party} : ${parameters.organizationPartyId?if_exists}</#if>
- </fo:block>
- <fo:block font-size="10pt" text-align="left" font-weight="bold">
- <#if parameters.facilityId?has_content>
- <#assign facility = (delegator.findOne("Facility", {"facilityId" : parameters.facilityId}, false))?if_exists>
- <#if facility.facilityName?has_content>${uiLabelMap.Facility} : ${facility.facilityName?if_exists}</#if>
- </#if>
- </fo:block>
- <fo:block font-size="10pt" text-align="left" font-weight="bold">
- <#if parameters.productCategoryId?has_content>
- <#assign productCategory = (delegator.findOne("ProductCategory", {"productCategoryId" : parameters.productCategoryId}, false))?if_exists>
- <#if productCategory.categoryName?has_content>${uiLabelMap.ProductProductCategory} : ${productCategory.categoryName?if_exists}</#if>
- </#if>
- </fo:block>
- <fo:block font-size="10pt" text-align="left" font-weight="bold">
- <#if parameters.fromDate?has_content>
- ${uiLabelMap.CommonFromDate} : ${parameters.fromDate?if_exists}
- </#if>
- </fo:block>
- <fo:block font-size="10pt" text-align="left" font-weight="bold">
- <#if parameters.thruDate?has_content>
- ${uiLabelMap.CommonThruDate} : ${parameters.thruDate?if_exists}
- </#if>
- </fo:block>
- <#if inventoryValuationList?has_content>
- <fo:block><fo:leader/></fo:block>
- <fo:block space-after.optimum="10pt" font-size="10pt">
- <fo:table>
- <fo:table-column column-width="130pt"/>
- <fo:table-column column-width="130pt"/>
- <fo:table-column column-width="130pt"/>
- <fo:table-column column-width="130pt"/>
- <fo:table-header>
- <fo:table-row font-weight="bold">
- <fo:table-cell padding="2pt" background-color="#D4D0C8" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${uiLabelMap.ProductProduct}</fo:block>
- </fo:table-cell>
- <fo:table-cell padding="2pt" background-color="#D4D0C8" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${uiLabelMap.AccountingTotalQuantityOnHand}</fo:block>
- </fo:table-cell>
- <fo:table-cell padding="2pt" background-color="#D4D0C8" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${uiLabelMap.FormFieldTitle_unitCost}</fo:block>
- </fo:table-cell>
- <fo:table-cell padding="2pt" background-color="#D4D0C8" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${uiLabelMap.CommonTotalValue}</fo:block>
- </fo:table-cell>
- </fo:table-row>
- </fo:table-header>
- <fo:table-body>
- <#list inventoryValuationList as inventoryValuation>
- <#assign currencyUomId = inventoryValuation.currencyUomId?if_exists>
- <fo:table-row>
- <fo:table-cell padding="2pt" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${inventoryValuation.productId?if_exists}</fo:block>
- </fo:table-cell>
- <fo:table-cell padding="2pt" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${inventoryValuation.totalQuantityOnHand?if_exists}</fo:block>
- </fo:table-cell>
- <fo:table-cell padding="2pt" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">
- <#if currencyUomId != null>
- <@ofbizCurrency amount = inventoryValuation.productAverageCost?if_exists isoCode = currencyUomId/>
- </#if>
- </fo:block>
- </fo:table-cell>
- <fo:table-cell padding="2pt" border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">
- <#if currencyUomId != null>
- <@ofbizCurrency amount = inventoryValuation.totalInventoryCost?if_exists isoCode = currencyUomId/>
- </#if>
- </fo:block>
- </fo:table-cell>
- </fo:table-row>
- </#list>
- </fo:table-body>
- </fo:table>
- </fo:block>
- <#else>
- <fo:table-row>
- <fo:table-cell number-columns-spanned="2"/>
- <fo:table-cell padding="2pt">
- <fo:block>${uiLabelMap.AccountingNoRecordFound}</fo:block>
- </fo:table-cell>
- <fo:table-cell number-columns-spanned="2"/>
- </fo:table-row>
- </#if>
-</#escape>
View
51 applications/accounting/widget/ReportFinancialSummaryForms.xml
@@ -496,41 +496,34 @@ under the License.
<entity-order-by field-name="facilityId"/>
</entity-options>
</drop-down>
- </field>
- <field name="cogsMethodId" position="2">
- <drop-down allow-empty="false">
- <!--TODO for now Average Cost is being calculated-->
- <!--<entity-options entity-name="Enumeration" description="${description}" key-field-name="enumId">
- <entity-constraint name="enumTypeId" operator="equals" value="COGS_METHODS"/>
- <entity-order-by field-name="description"/>
- </entity-options>-->
- <option key="COGS_AVG_COST" description="${uiLabelMap.ProductAverageCost}"/>
- </drop-down>
</field>
- <field name="productId" position="1"><lookup target-form-name="LookupProduct"/></field>
- <field name="productCategoryId" position="2"><lookup target-form-name="LookupProductCategory"/></field>
- <field name="fromDate" position="1"><date-time/></field>
- <field name="thruDate" position="2"><date-time/></field>
+ <field name="productId"><lookup target-form-name="LookupProduct"/></field>
+ <field name="thruDate"><date-time default-value="${nowTimestamp}"/></field>
<field name="organizationPartyId"><hidden/></field>
<field name="showSearchResults"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
<field name="submitButton" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
- <form name="InventoryValuationList" extends="ListInventoryAverageCosts" extends-resource="component://product/widget/facility/FacilityForms.xml"
- odd-row-style="alternate-row" default-table-style="basic-table hover-bar" list-name="inventoryValuationList" paginate-target="InventoryValuation">
- <field name="productAverageCost" use-when="currencyUomId!=null"><display type="currency" currency="${currencyUomId}"/></field>
- <field name="productAverageCost" use-when="currencyUomId==null" title="${uiLabelMap.FormFieldTitle_unitCost}"><display description="${uiLabelMap.ProductDifferentCurrencies}"/></field>
- <field name="totalInventoryCost" use-when="currencyUomId!=null" title="${uiLabelMap.CommonTotalValue}"><display type="currency" currency="${currencyUomId}"/></field>
- <field name="totalInventoryCost" use-when="currencyUomId==null" title="${uiLabelMap.CommonTotalValue}"><display description="${uiLabelMap.ProductDifferentCurrencies}"/></field>
- </form>
-
- <form name="InventoryValuationCsv" type="list" list-name="inventoryValuationList" view-size="99999">
- <field name="productId" title="${uiLabelMap.AccountingProductId}"><display/></field>
- <field name="totalQuantityOnHand" title="${uiLabelMap.AccountingTotalQuantityOnHand}"><display/></field>
- <field name="productAverageCost" use-when="currencyUomId!=null" title="${uiLabelMap.FormFieldTitle_unitCost}" ><display type="currency" currency="${currencyUomId}"/></field>
- <field name="productAverageCost" use-when="currencyUomId==null" title="${uiLabelMap.FormFieldTitle_unitCost}" ><display description="${uiLabelMap.ProductDifferentCurrencies}"/></field>
- <field name="totalInventoryCost" use-when="currencyUomId!=null" title="${uiLabelMap.CommonTotalValue}" ><display type="currency" currency="${currencyUomId}"/></field>
- <field name="totalInventoryCost" use-when="currencyUomId==null" title="${uiLabelMap.CommonTotalValue}"><display description="${uiLabelMap.ProductDifferentCurrencies}"/></field>
+ <form name="InventoryValuationList" type="list" list-name="inventoryValuationList" odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+ <actions>
+ <entity-condition entity-name="InventoryItemDetailForSum" list="inventoryValuationList" use-cache="false">
+ <condition-list>
+ <condition-expr field-name="ownerPartyId" operator="equals" from-field="parameters.organizationPartyId"/>
+ <condition-expr field-name="accountingQuantityDiff" operator="not-equals" value="0.0"/>
+ <condition-expr field-name="effectiveDate" operator="less-equals" from-field="parameters.thruDate"/>
+ <condition-expr field-name="facilityId" operator="equals" from-field="parameters.facilityId" ignore-if-empty="true"/>
+ <condition-expr field-name="productId" operator="equals" from-field="parameters.productId" ignore-if-empty="true"/>
+ </condition-list>
+ <select-field field-name="productId"/>
+ <select-field field-name="unitCost"/>
+ <select-field field-name="currencyUomId"/>
+ <select-field field-name="accountingQuantitySum"/>
+ </entity-condition>
+ </actions>
+ <field name="productId"><display/></field>
+ <field name="unitCost" widget-style="tabletextright"><display currency="${currencyUomId}" type="currency"/></field>
+ <field name="accountingQuantitySum" widget-style="tabletextright"><display/></field>
+ <field name="value" widget-style="tabletextright"><display description="${accountingQuantitySum * unitCost}" currency="${currencyUomId}" type="currency"/></field>
</form>
<form name="TrialBalanceFinancialTimePeriodSelection" type="single" header-row-style="header-row" target="TrialBalance" default-table-style="basic-table">
View
69 applications/accounting/widget/ReportFinancialSummaryScreens.xml
@@ -1367,42 +1367,22 @@ under the License.
<condition>
<if-compare field="parameters.showSearchResults" operator="equals" value="Y"/>
</condition>
- <actions>
- <service service-name="getInventoryValuationList" result-map="inventoryValuation"/>
- <set field="inventoryValuationList" from-field="inventoryValuation.inventoryValuationList" type="List"/>
- </actions>
<widgets>
- <section>
- <condition>
- <not><if-empty field="inventoryValuationList"/></not>
- </condition>
- <widgets>
- <link text="${uiLabelMap.AccountingExportAsPdf}" style="button" target="InventoryValuation.pdf">
- <parameter param-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
- <parameter param-name="facilityId" from-field="parameters.facilityId"/>
- <parameter param-name="productId" from-field="parameters.productId"/>
- <parameter param-name="productCategoryId" from-field="parameters.productCategoryId"/>
- <parameter param-name="fromDate" from-field="parameters.fromDate"/>
- <parameter param-name="thruDate" from-field="parameters.thruDate"/>
- <parameter param-name="cogsMethodId" from-field="parameters.cogsMethodId"/>
- </link>
- <link text="${uiLabelMap.AccountingExportAsCsv}" style="button" target="InventoryValuation.csv">
- <parameter param-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
- <parameter param-name="facilityId" from-field="parameters.facilityId"/>
- <parameter param-name="productId" from-field="parameters.productId"/>
- <parameter param-name="productCategoryId" from-field="parameters.productCategoryId"/>
- <parameter param-name="fromDate" from-field="parameters.fromDate"/>
- <parameter param-name="thruDate" from-field="parameters.thruDate"/>
- <parameter param-name="cogsMethodId" from-field="parameters.cogsMethodId"/>
- </link>
- <screenlet title="${uiLabelMap.AccountingInventoryValuationList}">
- <include-form name="InventoryValuationList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
- </screenlet>
- </widgets>
- <fail-widgets>
- <label style="h3">${uiLabelMap.AccountingNoRecordFound}</label>
- </fail-widgets>
- </section>
+ <link text="${uiLabelMap.AccountingExportAsPdf}" style="button" target="InventoryValuation.pdf">
+ <parameter param-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
+ <parameter param-name="facilityId" from-field="parameters.facilityId"/>
+ <parameter param-name="productId" from-field="parameters.productId"/>
+ <parameter param-name="thruDate" from-field="parameters.thruDate"/>
+ </link>
+ <link text="${uiLabelMap.AccountingExportAsCsv}" style="button" target="InventoryValuation.csv">
+ <parameter param-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
+ <parameter param-name="facilityId" from-field="parameters.facilityId"/>
+ <parameter param-name="productId" from-field="parameters.productId"/>
+ <parameter param-name="thruDate" from-field="parameters.thruDate"/>
+ </link>
+ <screenlet title="${uiLabelMap.AccountingInventoryValuationList}">
+ <include-form name="InventoryValuationList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+ </screenlet>
</widgets>
</section>
</decorator-section>
@@ -1418,18 +1398,15 @@ under the License.
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
- <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
- <service service-name="getInventoryValuationList" result-map="inventoryValuation"/>
- <set field="inventoryValuationList" from-field="inventoryValuation.inventoryValuationList" type="List"/>
+ <set field="viewSize" value="99999"/>
</actions>
<widgets>
<decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
- <platform-specific>
- <xsl-fo>
- <html-template location="component://accounting/webapp/accounting/reports/InventoryValuationReport.fo.ftl"/>
- </xsl-fo>
- </platform-specific>
+ <container>
+ <label style="h1" text="${uiLabelMap.AccountingInventoryValuation}"/>
+ <include-form name="InventoryValuationList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+ </container>
</decorator-section>
</decorator-screen>
</widgets>
@@ -1441,13 +1418,11 @@ under the License.
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
- <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
- <service service-name="getInventoryValuationList" result-map="inventoryValuation"/>
- <set field="inventoryValuationList" from-field="inventoryValuation.inventoryValuationList" type="List"/>
+ <set field="viewSize" value="99999"/>
</actions>
<widgets>
<container>
- <include-form name="InventoryValuationCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+ <include-form name="InventoryValuationList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
</container>
</widgets>
</section>
View
8 applications/content/script/org/ofbiz/content/survey/SurveyServices.xml
@@ -433,8 +433,10 @@
<field-map field-name="surveyId" from-field="survey.surveyId"/>
</entity-and>
<if-not-empty field="existingResponses">
- <add-error><fail-message message="You have already responded to this survey; multiple responses are not allowed"/></add-error>
- <check-errors/>
+ <if-compare field="survey.allowUpdate" operator="not-equals" value="Y">
+ <add-error><fail-message message="You have already responded to this survey; multiple responses are not allowed"/></add-error>
+ <check-errors/>
+ </if-compare>
</if-not-empty>
</if-not-empty>
</if-compare>
@@ -475,7 +477,7 @@
<!-- create/update the response -->
<if-compare field="survey.allowUpdate" operator="equals" value="Y">
<if-not-empty field="parameters.surveyResponseId">
- <entity-one entity-name="SurveyResponse" value-field="lookupRespMap"/>
+ <entity-one entity-name="SurveyResponse" value-field="surveyResponse"/>
</if-not-empty>
</if-compare>
View
4 applications/product/entitydef/entitymodel.xml
@@ -2050,9 +2050,13 @@ under the License.
<alias entity-alias="II" name="inventoryItemTypeId" group-by="true"></alias>
<alias entity-alias="II" name="facilityId" group-by="true"></alias>
<alias entity-alias="II" name="productId" group-by="true"></alias>
+ <alias entity-alias="II" name="unitCost" group-by="true"></alias>
+ <alias entity-alias="II" name="currencyUomId" group-by="true"></alias>
<alias entity-alias="IID" name="effectiveDate"><description>For query only, not in fields to select.</description></alias>
<alias entity-alias="IID" name="orderId"><description>For query only, not in fields to select.</description></alias>
+ <alias entity-alias="II" name="ownerPartyId"><description>For query only, not in fields to select.</description></alias>
<alias entity-alias="IID" name="quantityOnHandDiff"><description>For query only, not in fields to select.</description></alias>
+ <alias entity-alias="IID" name="accountingQuantityDiff"><description>For query only, not in fields to select.</description></alias>
<view-link entity-alias="II" rel-entity-alias="IID">
<key-map field-name="inventoryItemId"/>
</view-link>
View
5 applications/product/widget/facility/InventoryForms.xml
@@ -109,8 +109,11 @@ under the License.
</field>
<field name="unitCost"><text/></field>
+ <field name="accountingQuantityTotal">
+ <display/>
+ </field>
<field name="totals" title="${uiLabelMap.ProductAvailablePromiseQuantityHand}">
- <display description="${inventoryItem.availableToPromiseTotal} / ${inventoryItem.quantityOnHandTotal}"/>
+ <display description="${inventoryItem.availableToPromiseTotal} / ${inventoryItem.quantityOnHandTotal}"/>
</field>
<field use-when="inventoryItem!=null" name="submit" title="${uiLabelMap.CommonUpdate}">
View
28 framework/base/src/org/ofbiz/base/util/GroovyUtil.java
@@ -28,6 +28,8 @@
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyShell;
+import javolution.util.FastMap;
+
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.runtime.InvokerHelper;
import org.ofbiz.base.location.FlexibleLocation;
@@ -60,19 +62,25 @@ public static Class parseClass(InputStream in, String location) throws IOExcepti
return new GroovyClassLoader().parseClass(UtilIO.readString(in), location);
}
+ /** Returns a <code>Binding</code> instance initialized with the
+ * variables contained in <code>context</code>. If <code>context</code>
+ * is <code>null</code>, an empty <code>Binding</code> is returned.
+ * <p>The <code>context Map</code> is added to the <code>Binding</code>
+ * as a variable called "context" so that variables can be passed
+ * back to the caller. Any variables that are created in the script
+ * are lost when the script ends unless they are copied to the
+ * "context" <code>Map</code>.</p>
+ *
+ * @param context A <code>Map</code> containing initial variables
+ * @return A <code>Binding</code> instance
+ */
public static Binding getBinding(Map<String, ? extends Object> context) {
- Binding binding = new Binding();
+ Map<String, Object> vars = FastMap.newInstance();
if (context != null) {
- Set<String> keySet = context.keySet();
- for (Object key : keySet) {
- binding.setVariable((String) key, context.get(key));
- }
-
- // include the context itself in for easier access in the scripts
- binding.setVariable("context", context);
+ vars.putAll(context);
+ vars.put("context", context);
}
-
- return binding;
+ return new Binding(vars);
}
/**
View
4 framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
@@ -19,7 +19,6 @@
package org.ofbiz.birt.container;
import java.io.File;
-import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
@@ -42,7 +41,6 @@
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
-import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.service.GenericDispatcher;
import org.ofbiz.service.LocalDispatcher;
@@ -163,7 +161,7 @@ public String getContainerConfigName() {
return "birt-container";
}
- public static IReportEngine getReportEngine() throws GenericEntityException, SQLException {
+ public static IReportEngine getReportEngine() {
return engine;
}
View
1 framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
@@ -37,6 +37,7 @@ public BirtViewerAttributeBean(HttpServletRequest request) {
super(request);
}
+ @Override
protected void __init( HttpServletRequest request ) throws Exception
{
String reportParam = DataUtil.trimString( ParameterAccessor.getParameter( request, ParameterAccessor.PARAM_REPORT ));
View
1 framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
@@ -34,6 +34,7 @@ public OFBizBirtContext(HttpServletRequest request,
super(request, response);
}
+ @Override
protected void __init() {
this.bean = (ViewerAttributeBean) request
.getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
View
264 framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
@@ -63,40 +63,38 @@ public OFBizBirtViewerReportService(ServletContext servletContext) {
super(servletContext);
}
- public String runReport(IViewerReportDesignHandle design,
- String outputDocName, InputOptions runOptions, Map parameters,
+ @Override
+ public String runReport(IViewerReportDesignHandle design, String outputDocName, InputOptions runOptions, Map parameters,
Map displayTexts, List<Exception> errorList) throws ReportServiceException {
- if ( design == null || design.getDesignObject( ) == null )
- throw new ReportServiceException( BirtResources.getMessage( ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN ) );
+ if (design == null || design.getDesignObject( ) == null) {
+ throw new ReportServiceException(BirtResources.getMessage(ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN));
+ }
IReportRunnable runnable;
- HttpServletRequest request = (HttpServletRequest) runOptions.getOption( InputOptions.OPT_REQUEST );
- Locale locale = (Locale) runOptions.getOption( InputOptions.OPT_LOCALE );
- TimeZone timeZone = (TimeZone) runOptions.getOption( InputOptions.OPT_TIMEZONE );
+ HttpServletRequest request = (HttpServletRequest) runOptions.getOption(InputOptions.OPT_REQUEST);
+ Locale locale = (Locale) runOptions.getOption(InputOptions.OPT_LOCALE);
+ TimeZone timeZone = (TimeZone) runOptions.getOption(InputOptions.OPT_TIMEZONE);
- ViewerAttributeBean attrBean = (ViewerAttributeBean) request.getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
+ ViewerAttributeBean attrBean = (ViewerAttributeBean) request.getAttribute(IBirtConstants.ATTRIBUTE_BEAN);
// Set parameters
- Map parsedParams = attrBean.getParameters( );
- if ( parameters != null )
- {
- parsedParams.putAll( parameters );
+ Map parsedParams = attrBean.getParameters();
+ if (parameters != null) {
+ parsedParams.putAll(parameters);
}
// Set display Text of select parameters
- Map displayTextMap = attrBean.getDisplayTexts( );
- if ( displayTexts != null )
- {
- displayTextMap.putAll( displayTexts );
+ Map displayTextMap = attrBean.getDisplayTexts();
+ if (displayTexts != null) {
+ displayTextMap.putAll(displayTexts);
}
- runnable = (IReportRunnable) design.getDesignObject( );
- try
- {
+ runnable = (IReportRunnable) design.getDesignObject();
+ try {
// get maxRows
Integer maxRows = null;
- if ( ParameterAccessor.isReportParameterExist( request,
- ParameterAccessor.PARAM_MAXROWS ) )
- maxRows = Integer.valueOf( ParameterAccessor.getMaxRows( request ) );
+ if (ParameterAccessor.isReportParameterExist(request, ParameterAccessor.PARAM_MAXROWS)) {
+ maxRows = Integer.valueOf(ParameterAccessor.getMaxRows(request));
+ }
try {
// put all app context from Birt Container to Report Engine Service
@@ -110,29 +108,15 @@ public String runReport(IViewerReportDesignHandle design,
} catch (Exception e) {
Debug.logError(e, module);
}
- List<Exception> errors = this.runReport( request,
- runnable,
- outputDocName,
- locale,
- timeZone,
- parsedParams,
- displayTextMap,
- maxRows );
- if ( errors != null && !errors.isEmpty( ) )
- {
- errorList.addAll( errors );
+ List<Exception> errors = this.runReport(request, runnable, outputDocName, locale, timeZone, parsedParams, displayTextMap, maxRows);
+ if (errors != null && !errors.isEmpty()) {
+ errorList.addAll(errors);
}
- }
- catch ( RemoteException e )
- {
- if ( e.getCause( ) instanceof ReportServiceException )
- {
- throw (ReportServiceException) e.getCause( );
- }
- else
- {
- throw new ReportServiceException( e.getLocalizedMessage( ),
- e.getCause( ) );
+ } catch ( RemoteException e ) {
+ if (e.getCause() instanceof ReportServiceException) {
+ throw (ReportServiceException) e.getCause();
+ } else {
+ throw new ReportServiceException(e.getLocalizedMessage(), e.getCause());
}
}
return outputDocName;
@@ -153,83 +137,75 @@ public String runReport(IViewerReportDesignHandle design,
* @return list of exceptions which occured during the run or null
* @throws RemoteException
*/
- public List<Exception> runReport( HttpServletRequest request,
+ public List<Exception> runReport(HttpServletRequest request,
IReportRunnable runnable, String documentName, Locale locale,
- TimeZone timeZone, Map parameters, Map displayTexts, Integer maxRows )
- throws RemoteException
- {
+ TimeZone timeZone, Map parameters, Map displayTexts, Integer maxRows)
+ throws RemoteException {
assert runnable != null;
- // Preapre the run report task.
+ // Prepare the run report task.
IRunTask runTask = null;
try {
- runTask = BirtContainer.getReportEngine().createRunTask( runnable );
+ runTask = BirtContainer.getReportEngine().createRunTask(runnable);
} catch (Exception e) {
throwDummyException(e);
}
- runTask.setLocale( locale );
+ runTask.setLocale(locale);
- com.ibm.icu.util.TimeZone tz = BirtUtility.toICUTimeZone( timeZone );
- if ( tz != null )
- {
- runTask.setTimeZone( tz );
+ com.ibm.icu.util.TimeZone tz = BirtUtility.toICUTimeZone(timeZone);
+ if (tz != null) {
+ runTask.setTimeZone(tz);
}
- runTask.setParameterValues( parameters );
+ runTask.setParameterValues(parameters);
// set MaxRows settings
- if ( maxRows != null )
- runTask.setMaxRowsPerQuery( maxRows.intValue( ) );
+ if (maxRows != null) {
+ runTask.setMaxRowsPerQuery(maxRows.intValue());
+ }
// add task into session
- BirtUtility.addTask( request, runTask );
+ BirtUtility.addTask(request, runTask);
// Set display Text for select parameters
- if ( displayTexts != null )
+ if (displayTexts != null)
{
- Iterator keys = displayTexts.keySet( ).iterator( );
- while ( keys.hasNext( ) )
- {
- String paramName = DataUtil.getString( keys.next( ) );
- String displayText = DataUtil.getString( displayTexts
- .get( paramName ) );
- runTask.setParameterDisplayText( paramName, displayText );
+ Iterator keys = displayTexts.keySet().iterator();
+ while (keys.hasNext()) {
+ String paramName = DataUtil.getString(keys.next());
+ String displayText = DataUtil.getString(displayTexts.get(paramName));
+ runTask.setParameterDisplayText(paramName, displayText);
}
}
// set app context
- Map context = BirtUtility.getAppContext( request );
- runTask.setAppContext( context );
+ Map context = BirtUtility.getAppContext(request);
+ runTask.setAppContext(context);
// Run report.
- try
- {
- runTask.run( documentName );
- }
- catch ( BirtException e )
- {
+ try {
+ runTask.run(documentName);
+ } catch (BirtException e) {
// clear document file
- File doc = new File( documentName );
- if ( doc != null )
- doc.delete( );
-
- throwDummyException( e );
- }
- finally
- {
+ File doc = new File(documentName);
+ if (doc != null) {
+ doc.delete();
+ }
+ throwDummyException(e);
+ } finally {
// Remove task from http session
- BirtUtility.removeTask( request );
+ BirtUtility.removeTask(request);
// Append errors
- if ( ParameterAccessor.isDesigner( ) )
- BirtUtility.error( request, runTask.getErrors( ) );
+ if (ParameterAccessor.isDesigner()) {
+ BirtUtility.error(request, runTask.getErrors());
+ }
- runTask.close( );
+ runTask.close();
// check for non-fatal errors
- List<Exception> errors = UtilGenerics.cast(runTask.getErrors( ));
- if ( !errors.isEmpty( ) )
- {
+ List<Exception> errors = UtilGenerics.cast(runTask.getErrors());
+ if (!errors.isEmpty()) {
return errors;
}
}
@@ -241,32 +217,31 @@ public String runReport(IViewerReportDesignHandle design,
* java.lang.String, org.eclipse.birt.report.service.api.InputOptions,
* java.util.Map, java.io.OutputStream, java.util.List, java.util.Map)
*/
- public void runAndRenderReport( IViewerReportDesignHandle design,
+ @Override
+ public void runAndRenderReport(IViewerReportDesignHandle design,
String outputDocName, InputOptions options, Map parameters,
- OutputStream out, List activeIds, Map displayTexts )
- throws ReportServiceException
- {
- if ( design == null || design.getDesignObject( ) == null )
- throw new ReportServiceException( BirtResources.getMessage( ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN ) );
+ OutputStream out, List activeIds, Map displayTexts) throws ReportServiceException {
- HttpServletRequest request = (HttpServletRequest) options.getOption( InputOptions.OPT_REQUEST );
+ if (design == null || design.getDesignObject() == null) {
+ throw new ReportServiceException(BirtResources.getMessage(ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN));
+ }
- try
- {
- ViewerAttributeBean attrBean = (ViewerAttributeBean) request.getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
- String reportTitle = ParameterAccessor.htmlDecode( attrBean.getReportTitle( ) );
- IReportRunnable runnable = (IReportRunnable) design.getDesignObject( );
+ HttpServletRequest request = (HttpServletRequest) options.getOption(InputOptions.OPT_REQUEST);
+
+ try {
+ ViewerAttributeBean attrBean = (ViewerAttributeBean) request.getAttribute(IBirtConstants.ATTRIBUTE_BEAN);
+ String reportTitle = ParameterAccessor.htmlDecode(attrBean.getReportTitle());
+ IReportRunnable runnable = (IReportRunnable) design.getDesignObject();
// get maxRows
Integer maxRows = null;
- if ( ParameterAccessor.isReportParameterExist( request,
- ParameterAccessor.PARAM_MAXROWS ) )
- maxRows = Integer.valueOf( ParameterAccessor.getMaxRows( request ) );
+ if (ParameterAccessor.isReportParameterExist(request, ParameterAccessor.PARAM_MAXROWS)) {
+ maxRows = Integer.valueOf(ParameterAccessor.getMaxRows(request));
+ }
try {
// put all app context from Birt Container to Report Engine Service
- ReportEngineService.getInstance().getEngineConfig().getAppContext().putAll(
- BirtContainer.getReportEngine().getConfig().getAppContext());
+ ReportEngineService.getInstance().getEngineConfig().getAppContext().putAll(BirtContainer.getReportEngine().getConfig().getAppContext());
/*
--- DISABLE JDBC FEATURE
Connection connection = getConnection();
@@ -275,84 +250,39 @@ public void runAndRenderReport( IViewerReportDesignHandle design,
} catch (Exception e) {
Debug.logError(e, module);
}
- ReportEngineService.getInstance( ).runAndRenderReport( runnable,
- out,
- options,
- parameters,
- null,
- null,
- null,
- displayTexts,
- reportTitle,
- maxRows );
- }
- catch ( RemoteException e )
- {
- throwReportServiceException( e );
- }
- }
-
- /**
- * get connection
- */
- private Connection getConnection() {
- Connection connection = null;
- try {
- String delegatorGroupHelperName = BirtContainer.getDelegatorGroupHelperName();
- Delegator delegator = BirtContainer.getDelegator();
- Debug.logInfo("Get the JDBC connection from group helper's name:" + delegatorGroupHelperName, module);
- String helperName = delegator.getGroupHelperName(delegatorGroupHelperName); // gets the helper (localderby, localmysql, localpostgres, etc.) for your entity group org.ofbiz
- connection = ConnectionFactory.getConnection(helperName);
- } catch (GenericEntityException e) {
- Debug.logError(e, module);
- } catch (SQLException e) {
- Debug.logError(e, module);
+ ReportEngineService.getInstance().runAndRenderReport(runnable, out, options, parameters, null, null, null, displayTexts, reportTitle, maxRows);
+ } catch (RemoteException e) {
+ throwReportServiceException(e);
}
- return connection;
}
/**
* @param e
* @throws DummyRemoteException
*/
- private void throwDummyException( Exception e )
- throws DummyRemoteException
- {
- if ( e instanceof ReportServiceException )
- {
+ private void throwDummyException(Exception e) throws DummyRemoteException {
+ if (e instanceof ReportServiceException) {
throw new DummyRemoteException(e);
- }
- else
- {
- throw new DummyRemoteException( new ReportServiceException( e
- .getLocalizedMessage( ), e ) );
+ } else {
+ throw new DummyRemoteException(new ReportServiceException(e.getLocalizedMessage(), e));
}
}
/**
* Temporary method for extracting the exception from the
* DummyRemoteException and throwing it.
*/
- private void throwReportServiceException( RemoteException e )
- throws ReportServiceException
- {
+ private void throwReportServiceException(RemoteException e) throws ReportServiceException {
Throwable wrappedException = e;
- if ( e instanceof ReportEngineService.DummyRemoteException )
- {
- wrappedException = e.getCause( );
+ if (e instanceof ReportEngineService.DummyRemoteException) {
+ wrappedException = e.getCause();
}
- if ( wrappedException instanceof ReportServiceException )
- {
+ if (wrappedException instanceof ReportServiceException) {
throw (ReportServiceException) wrappedException;
- }
- else if ( wrappedException != null )
- {
- throw new ReportServiceException( wrappedException.getLocalizedMessage( ),
- wrappedException );
- }
- else
- {
- throw new ReportServiceException( e.getLocalizedMessage( ), e );
+ } else if (wrappedException != null) {
+ throw new ReportServiceException(wrappedException.getLocalizedMessage(), wrappedException);
+ } else {
+ throw new ReportServiceException(e.getLocalizedMessage(), e);
}
}
}
View
2 framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
@@ -35,6 +35,7 @@
public final static String module = BirtEngineServlet.class.getName();
+ @Override
protected void __init( ServletConfig config )
{
BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
@@ -47,6 +48,7 @@ protected void __init( ServletConfig config )
requester.setJSPRootPath( "/webcontent/birt" );
}
+ @Override
protected IContext __getContext( HttpServletRequest request,
HttpServletResponse response ) throws BirtException
{
View
2 framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
@@ -36,6 +36,7 @@
public final static String module = BirtViewerServlet.class.getName();
+ @Override
protected void __init(ServletConfig config) {
BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
.getServletContext( ) ) );
@@ -51,6 +52,7 @@ protected void __init(ServletConfig config) {
run.setJSPRootPath( "/webcontent/birt" );
}
+ @Override
protected IContext __getContext( HttpServletRequest request,
HttpServletResponse response ) throws BirtException
{
View
15 framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
@@ -18,14 +18,16 @@
*******************************************************************************/
package org.ofbiz.service.engine;
+import static org.ofbiz.base.util.UtilGenerics.cast;
+import groovy.lang.Script;
+
import java.util.Map;
+import javolution.util.FastMap;
+
import org.codehaus.groovy.runtime.InvokerHelper;
-import groovy.lang.Binding;
-import groovy.lang.Script;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.GroovyUtil;
-import static org.ofbiz.base.util.UtilGenerics.cast;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
@@ -63,9 +65,14 @@ public void runSyncIgnore(String localName, ModelService modelService, Map<Strin
if (UtilValidate.isEmpty(modelService.location)) {
throw new GenericServiceException("Cannot run Groovy service with empty location");
}
+ Map<String, Object> params = FastMap.newInstance();
+ params.putAll(context);
+ context.put("parameters", params);
context.put("dctx", dispatcher.getLocalContext(localName));
+ context.put("dispatcher", dispatcher);
+ context.put("delegator", dispatcher.getDelegator());
try {
- Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), new Binding(context));
+ Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(context));
Object resultObj = null;
if (UtilValidate.isEmpty(modelService.invoke)) {
resultObj = script.run();
View
4 framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
@@ -31,8 +31,6 @@
import javolution.util.FastList;
import javolution.util.FastMap;
-import groovy.lang.Binding;
-
import org.codehaus.groovy.runtime.InvokerHelper;
import org.ofbiz.base.util.BshUtil;
import org.ofbiz.base.util.Debug;
@@ -294,7 +292,7 @@ public void runAction(Map<String, Object> context) {
}
} else if (location.endsWith(".groovy")) {
try {
- groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), new Binding(context));
+ groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
if (UtilValidate.isEmpty(method)) {
script.run();
} else {
View
3 framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
@@ -31,7 +31,6 @@
import javolution.util.FastList;
import javolution.util.FastMap;
-import groovy.lang.Binding;
import org.codehaus.groovy.runtime.InvokerHelper;
import org.ofbiz.base.util.BshUtil;
@@ -351,7 +350,7 @@ public void runAction(Map<String, Object> context) {
}
} else if (location.endsWith(".groovy")) {
try {
- groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), new Binding(context));
+ groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
if (UtilValidate.isEmpty(method)) {
script.run();
} else {
View
3 framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java
@@ -33,7 +33,6 @@
import javolution.util.FastList;
import javolution.util.FastMap;
-import groovy.lang.Binding;
import org.codehaus.groovy.runtime.InvokerHelper;
import org.ofbiz.base.util.BshUtil;
@@ -417,7 +416,7 @@ public void runAction(Map<String, Object> context) throws GeneralException {
}
} else if (location.endsWith(".groovy")) {
try {
- groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), new Binding(context));
+ groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
if (UtilValidate.isEmpty(method)) {
script.run();
} else {

0 comments on commit 31d3ef2

Please sign in to comment.