Author: jonesde
Date: Thu Mar 25 00:20:58 2010 New Revision: 927238 URL: http://svn.apache.org/viewvc?rev=927238&view=rev Log: Merged from trunk up to r927237 in prep for merging into trunk Removed: ofbiz/branches/multitenant20100310/applications/accounting/webapp/accounting/reports/InventoryValuationReport.fo.ftl Modified: ofbiz/branches/multitenant20100310/ (props changed) ofbiz/branches/multitenant20100310/applications/accounting/data/AccountingTypeData.xml ofbiz/branches/multitenant20100310/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryForms.xml ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryScreens.xml ofbiz/branches/multitenant20100310/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml ofbiz/branches/multitenant20100310/applications/product/entitydef/entitymodel.xml ofbiz/branches/multitenant20100310/applications/product/widget/facility/InventoryForms.xml ofbiz/branches/multitenant20100310/framework/base/src/org/ofbiz/base/util/GroovyUtil.java ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java ofbiz/branches/multitenant20100310/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy (props changed) ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy (props changed) ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy (props changed) Propchange: ofbiz/branches/multitenant20100310/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 00:20:58 2010 @@ -1,2 +1,2 @@ /ofbiz/branches/addbirt:831210-885099,885686-886087 -/ofbiz/trunk:921280-926954 +/ofbiz/trunk:921280-927237 Modified: ofbiz/branches/multitenant20100310/applications/accounting/data/AccountingTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/accounting/data/AccountingTypeData.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/branches/multitenant20100310/applications/accounting/data/AccountingTypeData.xml Thu Mar 25 00:20:58 2010 @@ -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=""/> Modified: ofbiz/branches/multitenant20100310/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original) +++ ofbiz/branches/multitenant20100310/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Thu Mar 25 00:20:58 2010 @@ -1097,71 +1097,35 @@ 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"/> @@ -1169,21 +1133,85 @@ under the License. <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> Modified: ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryForms.xml (original) +++ ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryForms.xml Thu Mar 25 00:20:58 2010 @@ -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"> Modified: ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original) +++ ofbiz/branches/multitenant20100310/applications/accounting/widget/ReportFinancialSummaryScreens.xml Thu Mar 25 00:20:58 2010 @@ -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> Modified: ofbiz/branches/multitenant20100310/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml (original) +++ ofbiz/branches/multitenant20100310/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml Thu Mar 25 00:20:58 2010 @@ -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> Modified: ofbiz/branches/multitenant20100310/applications/product/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/product/entitydef/entitymodel.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/product/entitydef/entitymodel.xml (original) +++ ofbiz/branches/multitenant20100310/applications/product/entitydef/entitymodel.xml Thu Mar 25 00:20:58 2010 @@ -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> Modified: ofbiz/branches/multitenant20100310/applications/product/widget/facility/InventoryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/applications/product/widget/facility/InventoryForms.xml?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/applications/product/widget/facility/InventoryForms.xml (original) +++ ofbiz/branches/multitenant20100310/applications/product/widget/facility/InventoryForms.xml Thu Mar 25 00:20:58 2010 @@ -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}"> Modified: ofbiz/branches/multitenant20100310/framework/base/src/org/ofbiz/base/util/GroovyUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original) +++ ofbiz/branches/multitenant20100310/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Thu Mar 25 00:20:58 2010 @@ -28,6 +28,8 @@ import groovy.lang.Binding; 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 class GroovyUtil { 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); } /** Modified: ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java (original) +++ ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java Thu Mar 25 00:20:58 2010 @@ -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.UtilGenerics; 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 class BirtContainer implements Co return "birt-container"; } - public static IReportEngine getReportEngine() throws GenericEntityException, SQLException { + public static IReportEngine getReportEngine() { return engine; } Modified: ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java (original) +++ ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java Thu Mar 25 00:20:58 2010 @@ -37,6 +37,7 @@ public class BirtViewerAttributeBean ext super(request); } + @Override protected void __init( HttpServletRequest request ) throws Exception { String reportParam = DataUtil.trimString( ParameterAccessor.getParameter( request, ParameterAccessor.PARAM_REPORT )); Modified: ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java (original) +++ ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java Thu Mar 25 00:20:58 2010 @@ -34,6 +34,7 @@ public class OFBizBirtContext extends Bi super(request, response); } + @Override protected void __init() { this.bean = (ViewerAttributeBean) request .getAttribute( IBirtConstants.ATTRIBUTE_BEAN ); Modified: ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java (original) +++ ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java Thu Mar 25 00:20:58 2010 @@ -63,40 +63,38 @@ public class OFBizBirtViewerReportServic 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 class OFBizBirtViewerReportServic } 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 ); - } - } - catch ( RemoteException e ) - { - if ( e.getCause( ) instanceof ReportServiceException ) - { - throw (ReportServiceException) e.getCause( ); - } - else - { - throw new ReportServiceException( e.getLocalizedMessage( ), - e.getCause( ) ); + 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()); } } return outputDocName; @@ -153,83 +137,75 @@ public class OFBizBirtViewerReportServic * @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 class OFBizBirtViewerReportServic * 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 { + + if (design == null || design.getDesignObject() == null) { + throw new ReportServiceException(BirtResources.getMessage(ResourceConstants.GENERAL_EXCEPTION_NO_REPORT_DESIGN)); + } - HttpServletRequest request = (HttpServletRequest) options.getOption( InputOptions.OPT_REQUEST ); + 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( ); + 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,57 +250,21 @@ public class OFBizBirtViewerReportServic } 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 ); + 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); - } - 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)); } } @@ -333,26 +272,17 @@ public class OFBizBirtViewerReportServic * 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); } } } Modified: ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java (original) +++ ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java Thu Mar 25 00:20:58 2010 @@ -35,6 +35,7 @@ public class BirtEngineServlet extends o public final static String module = BirtEngineServlet.class.getName(); + @Override protected void __init( ServletConfig config ) { BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config @@ -47,6 +48,7 @@ public class BirtEngineServlet extends o requester.setJSPRootPath( "/webcontent/birt" ); } + @Override protected IContext __getContext( HttpServletRequest request, HttpServletResponse response ) throws BirtException { Modified: ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java (original) +++ ofbiz/branches/multitenant20100310/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java Thu Mar 25 00:20:58 2010 @@ -36,6 +36,7 @@ public class BirtViewerServlet extends V public final static String module = BirtViewerServlet.class.getName(); + @Override protected void __init(ServletConfig config) { BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config .getServletContext( ) ) ); @@ -51,6 +52,7 @@ public class BirtViewerServlet extends V run.setJSPRootPath( "/webcontent/birt" ); } + @Override protected IContext __getContext( HttpServletRequest request, HttpServletResponse response ) throws BirtException { Modified: ofbiz/branches/multitenant20100310/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java (original) +++ ofbiz/branches/multitenant20100310/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java Thu Mar 25 00:20:58 2010 @@ -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 final class GroovyEngine extends 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(); Modified: ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java (original) +++ ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java Thu Mar 25 00:20:58 2010 @@ -31,8 +31,6 @@ import java.util.regex.PatternSyntaxExce 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 abstract class ModelFormAction { } } 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 { Modified: ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java (original) +++ ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java Thu Mar 25 00:20:58 2010 @@ -31,7 +31,6 @@ import javax.servlet.http.HttpSession; 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 abstract class ModelMenuAction { } } 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 { Modified: ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java URL: http://svn.apache.org/viewvc/ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java?rev=927238&r1=927237&r2=927238&view=diff ============================================================================== --- ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java (original) +++ ofbiz/branches/multitenant20100310/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java Thu Mar 25 00:20:58 2010 @@ -33,7 +33,6 @@ import javax.servlet.http.HttpSession; 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 abstract class ModelScreenAction } } 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 { Propchange: ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 00:20:58 2010 @@ -1,2 +1,2 @@ /incubator/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:418499-490456 -/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:921280-926954 +/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy:921280-927237 Propchange: ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 00:20:58 2010 @@ -1,2 +1,2 @@ /incubator/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:418499-490456 -/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:921280-926954 +/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy:921280-927237 Propchange: ofbiz/branches/multitenant20100310/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 25 00:20:58 2010 @@ -1,2 +1,2 @@ /incubator/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:418499-490456 -/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:921280-926954 +/ofbiz/trunk/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy:921280-927237 |
Free forum by Nabble | Edit this page |