You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2006/12/21 02:14:09 UTC
svn commit: r489239 - in /incubator/ofbiz/trunk/applications/accounting:
webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh
webapp/accounting/invoice/InvoiceForms.xml widget/InvoiceScreens.xml
Author: sichen
Date: Wed Dec 20 17:14:09 2006
New Revision: 489239
URL: http://svn.apache.org/viewvc?view=rev&rev=489239
Log:
Fixed invoice item type dropdown to be more flexible. Now it shows the item types for a given invoice type instead of using a non-extensible heuristic.
Added:
incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh
Modified:
incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml
incubator/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml
Added: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh?view=auto&rev=489239
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh (added)
+++ incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh Wed Dec 20 17:14:09 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.util.EntityUtil;
+
+invoice = context.get("invoice");
+if (invoice == null) return;
+
+map = delegator.findByAndCache("InvoiceItemTypeMap", UtilMisc.toMap("invoiceTypeId", invoice.get("invoiceTypeId")));
+invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", map);
+context.put("invoiceItemTypes", invoiceItemTypes);
Modified: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml?view=diff&rev=489239&r1=489238&r2=489239
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml Wed Dec 20 17:14:09 2006
@@ -248,32 +248,13 @@
<field name="invoiceId"><hidden/></field>
<field name="invoiceItemSeqId" widget-style="buttontext"><hyperlink target="listInvoiceItems?invoiceId=${invoiceId}&invoiceItemSeqId=${invoiceItemSeqId}" description="${invoiceItemSeqId}"/></field>
<field name="quantity"><text size="3"/></field>
- <field name="invoiceItemTypeId" use-when=""${invoice.invoiceTypeId}".equals("PURCHASE_INVOICE")">
+ <field name="invoiceItemTypeId">
<drop-down allow-empty="false">
- <entity-options description="${description}" entity-name="InvoiceItemType">
- <entity-constraint name="invoiceItemTypeId" operator="like" value="PINV_%"/>
- <entity-order-by field-name="description"/>
- </entity-options>
+ <list-options list-name="invoiceItemTypes" key-name="invoiceItemTypeId" description="${description}"/>
</drop-down>
</field>
<field name="productId"><lookup target-form-name="LookupProduct" size="20"/></field>
<field name="description"><text size="30"/></field>
- <field name="invoiceItemTypeId" use-when=""${invoice.invoiceTypeId}".equals("SALES_INVOICE")">
- <drop-down allow-empty="false">
- <entity-options description="${description}" entity-name="InvoiceItemType">
- <entity-constraint name="invoiceItemTypeId" operator="like" value="INV_%"/>
- <entity-order-by field-name="description"/>
- </entity-options>
- </drop-down>
- </field>
- <field name="invoiceItemTypeId" use-when=""${invoice.invoiceTypeId}".equals("COMMISSION_INVOICE")">
- <drop-down allow-empty="false">
- <entity-options description="${description}" entity-name="InvoiceItemType">
- <entity-constraint name="invoiceItemTypeId" operator="like" value="COMM_INV_%"/>
- <entity-order-by field-name="description"/>
- </entity-options>
- </drop-down>
- </field>
<!--field name="overrideGlAccountId"><text size="10"/></field-->
<field name="amount"><text size="7"/></field>
<field name="total" widget-area-style="tabletextright" widget-style="tabletext" use-when="uomId!=null"><display type="currency" currency="${uomId}"/></field> <!-- this should not look like something you can modify, hence "tabletext" -->
@@ -292,31 +273,12 @@
<alt-target use-when="invoiceItem==null" target="createInvoiceItem"/>
<field name="invoiceId"><hidden/></field>
<field position="1" name="invoiceItemSeqId"><text size="5"/></field>
- <field position="1" name="invoiceItemTypeId" use-when=""${invoice.invoiceTypeId}".equals("PURCHASE_INVOICE")">
+ <field position="1" name="invoiceItemTypeId">
<drop-down allow-empty="false">
- <entity-options description="${description}" entity-name="InvoiceItemType">
- <entity-constraint name="invoiceItemTypeId" operator="like" value="PINV_%"/>
- <entity-order-by field-name="description"/>
- </entity-options>
+ <list-options list-name="invoiceItemTypes" key-name="invoiceItemTypeId" description="${description}"/>
</drop-down>
</field>
<field position="1" name="description"><text size="80"/></field>
- <field position="1" name="invoiceItemTypeId" use-when=""${invoice.invoiceTypeId}".equals("SALES_INVOICE")">
- <drop-down allow-empty="false">
- <entity-options description="${description}" entity-name="InvoiceItemType">
- <entity-constraint name="invoiceItemTypeId" operator="like" value="INV_%"/>
- <entity-order-by field-name="description"/>
- </entity-options>
- </drop-down>
- </field>
- <field position="1" name="invoiceItemTypeId" use-when=""${invoice.invoiceTypeId}".equals("COMMISSION_INVOICE")">
- <drop-down allow-empty="false">
- <entity-options description="${description}" entity-name="InvoiceItemType">
- <entity-constraint name="invoiceItemTypeId" operator="like" value="COMM_INV_%"/>
- <entity-order-by field-name="description"/>
- </entity-options>
- </drop-down>
- </field>
<field position="1" name="overrideGlAccountId"><text/></field>
<field position="2" name="inventoryItemId"><text/></field>
<field position="1" name="productId">
Modified: incubator/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml?view=diff&rev=489239&r1=489238&r2=489239
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/widget/InvoiceScreens.xml Wed Dec 20 17:14:09 2006
@@ -235,6 +235,7 @@
<field-map field-name="invoiceId" env-name="parameters.invoiceId"/>
<order-by field-name="invoiceItemSeqId"/>
</entity-and>
+ <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh"/>
</actions>
<widgets>
<decorator-screen name="CommonInvoiceDecorator" location="${parameters.mainDecoratorLocation}">