svn commit: r673842 - in /ofbiz/trunk: applications/accounting/config/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/fixedasset/ applications/accounting/servicedef/ applications/accounting/webapp/accounting/WEB-...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r673842 - in /ofbiz/trunk: applications/accounting/config/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/fixedasset/ applications/accounting/servicedef/ applications/accounting/webapp/accounting/WEB-...

adrianc
Author: adrianc
Date: Thu Jul  3 15:10:55 2008
New Revision: 673842

URL: http://svn.apache.org/viewvc?rev=673842&view=rev
Log:
Fixed Asset Meter refactor, based on the patch in https://issues.apache.org/jira/browse/OFBIZ-1851.

This commit replaces the FixedAssetMaintMeter entity with a more generic FixedAssetMeter entity. There is a service available to migrate data in existing installations - migrateFixedAssetMaintMeter. The original FixedAssetMaintMeter behavior has been maintained - nothing changes from the user's perspective.

Meter readings will trigger the creation of a fixed asset maintenance if the fixed asset has been set up with product maintenances.

Many thanks to David Jones and Anil Patel for their help with this.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml
    ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
    ofbiz/trunk/applications/accounting/widget/Menus.xml
    ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Thu Jul  3 15:10:55 2008
@@ -169,8 +169,8 @@
         <value xml:lang="th">แก้ไขการบำรุงรักษาทรัพย์สินไม่หมุนเวียน</value>
         <value xml:lang="zh">编辑固定资产维修保养</value>
     </property>
-    <property key="AccountingAddFixedAssetMaintMeter">
-        <value xml:lang="en">Add Fixed Asset Maintenance Meter</value>
+    <property key="AccountingAddFixedAssetMeter">
+        <value xml:lang="en">Add Fixed Asset Meter Reading</value>
         <value xml:lang="fr">Ajouter une mesure de la maintenance d'immobilisation</value>
         <value xml:lang="it">Aggiorna Manutenzione Cespite Contatori</value>
         <value xml:lang="th">Add Fixed Asset Maintenance Meter</value>
@@ -2350,7 +2350,7 @@
         <value xml:lang="ru">Если вместе с Обслуживанием продукта указан Шаблон обслуживанияe, поле будет устанавливаться/сбрасываться автоматически</value>
         <value xml:lang="th">ถ้าการบำรุงรักษาเทมเพลตเป็นพิเศษด้วยการบำรุงรักษาสินค้า นี่จะกำหนดอัตโนมัติ</value>
     </property>
-    <property key="AccountingFixedAssetMaintMeterValue">
+    <property key="AccountingFixedAssetMeterValue">
         <value xml:lang="ar">قيمة المقياس</value>
         <value xml:lang="en">Meter Value</value>
         <value xml:lang="es">Valor de Contador</value>
@@ -2361,9 +2361,9 @@
         <value xml:lang="th">ค่ามิเตอร์</value>
         <value xml:lang="zh">仪表数值</value>
     </property>
-    <property key="AccountingFixedAssetMaintMeters">
+    <property key="AccountingFixedAssetMeters">
         <value xml:lang="ar">قراءات المقاييس</value>
-        <value xml:lang="en">Meters Readings</value>
+        <value xml:lang="en">Meter Readings</value>
         <value xml:lang="es">Lecturas de contador</value>
         <value xml:lang="fr">Lectures au compteur</value>
         <value xml:lang="it">Lettura Contatore</value>
@@ -2393,7 +2393,7 @@
     </property>
     <property key="AccountingFixedAssetMaintType">
         <value xml:lang="ar">نوع الصيانة</value>
-        <value xml:lang="en">Maintenace Type</value>
+        <value xml:lang="en">Maintenance Type</value>
         <value xml:lang="es">Tipo de mantenimiento</value>
         <value xml:lang="fr">Type de maintenance</value>
         <value xml:lang="it">Tipo Manutenzione</value>
@@ -8373,8 +8373,8 @@
         <value xml:lang="th">แก้ไขการแยกแยะกลุ่มทรัพย์สินไม่หมุนเวียน</value>
         <value xml:lang="zh">编辑固定资产标识</value>
     </property>
-    <property key="PageTitleEditFixedAssetMaintMeters">
-        <value xml:lang="en">Edit Fixed Asset Maint Meters</value>
+    <property key="PageTitleEditFixedAssetMeters">
+        <value xml:lang="en">Fixed Asset Meter Readings</value>
         <value xml:lang="it">Aggiorna Manutenzione Cespite Contatori</value>
         <value xml:lang="th">Edit Fixed Asset Maint Meters</value>
     </property>
@@ -8786,7 +8786,7 @@
         <value xml:lang="it">Lista Identificazione Cespiti</value>
         <value xml:lang="th">รายการแยกแยะทรัพย์สินไม่หมุนเวียน</value>
     </property>
-    <property key="PageTitleListFixedAssetMaintMeters">
+    <property key="PageTitleListFixedAssetMeters">
         <value xml:lang="en">List Fixed Asset Maint Meters</value>
         <value xml:lang="it">Lista Manutenzioni Cespiti Contatori</value>
         <value xml:lang="th">List Fixed Asset Maint Meters</value>

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Thu Jul  3 15:10:55 2008
@@ -770,7 +770,7 @@
     </entity>
     <entity entity-name="FixedAssetMaintMeter"
         package-name="org.ofbiz.accounting.fixedasset"
-        title="Fixed Asset Maintenance Entity">
+        title="Deprecated - use FixedAssetMeter">
         <field name="fixedAssetId" type="id-ne"></field>
         <field name="maintHistSeqId" type="id-ne"></field>
         <field name="productMeterTypeId" type="id-ne"></field>
@@ -786,6 +786,27 @@
             <key-map field-name="productMeterTypeId"/>
         </relation>
     </entity>
+    <entity entity-name="FixedAssetMeter"
+        package-name="org.ofbiz.accounting.fixedasset"
+        title="Fixed Asset Meter Entity">
+        <field name="fixedAssetId" type="id-ne"></field>
+        <field name="productMeterTypeId" type="id-ne"></field>
+        <field name="readingDate" type="date-time"></field>
+        <field name="meterValue" type="floating-point"></field>
+        <field name="readingReasonEnumId" type="id"></field>
+        <field name="maintHistSeqId" type="id"></field>
+        <field name="workEffortId" type="id"></field>
+        <prim-key field="fixedAssetId"/>
+        <prim-key field="productMeterTypeId"/>
+        <prim-key field="readingDate"/>
+        <relation type="one" fk-name="FXDASTMNMT_FAMNT" rel-entity-name="FixedAssetMaint">
+            <key-map field-name="fixedAssetId"/>
+            <key-map field-name="maintHistSeqId"/>
+        </relation>
+        <relation type="one" fk-name="FXDASTMNMT_PMTYP" rel-entity-name="ProductMeterType">
+            <key-map field-name="productMeterTypeId"/>
+        </relation>
+    </entity>
     <entity entity-name="FixedAssetProduct"
             package-name="org.ofbiz.accounting.fixedasset"
             title="Fixed Asset Product Representation Entity">

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml Thu Jul  3 15:10:55 2008
@@ -249,22 +249,100 @@
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
 
-    <!--  create/update/delete FixedAssetMaintMeter -->
-    <simple-method method-name="createFixedAssetMaintMeter" short-description="create a FixedAssetMaintMeter">
-        <make-value entity-name="FixedAssetMaintMeter" value-name="newEntity"/>
+    <!--  create/update/delete FixedAssetMeter -->
+    <simple-method method-name="createFixedAssetMeter" short-description="Create a Fixed Asset Meter Reading">
+        <make-value entity-name="FixedAssetMeter" value-name="newEntity"/>
         <set-pk-fields map-name="parameters" value-name="newEntity"/>
         <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
         <create-value value-name="newEntity"/>  
+        <check-errors/>
+        <set field="meterValue" from-field="newEntity"/>
+        <call-simple-method method-name="createMaintsFromMeterReading"/>
     </simple-method>  
-    <simple-method method-name="updateFixedAssetMaintMeter" short-description="Update an existing FixedAsset Maintenance Meter Reading">
-        <entity-one entity-name="FixedAssetMaintMeter" value-name="lookedUpValue"/>
+    <simple-method method-name="updateFixedAssetMeter" short-description="Update a Fixed Asset Meter Reading">
+        <entity-one entity-name="FixedAssetMeter" value-name="lookedUpValue"/>
         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
         <store-value value-name="lookedUpValue"/>
+        <check-errors/>
+        <set field="meterValue" from-field="lookedUpValue"/>
+        <call-simple-method method-name="createMaintsFromMeterReading"/>
     </simple-method>
-    <simple-method method-name="deleteFixedAssetMaintMeter" short-description="Delete FixedAsset Maintenance Meter">
-        <entity-one entity-name="FixedAssetMaintMeter" value-name="lookedUpValue"/>
+    <simple-method method-name="deleteFixedAssetMeter" short-description="Delete a Fixed Asset Meter Reading">
+        <entity-one entity-name="FixedAssetMeter" value-name="lookedUpValue"/>
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
+    <simple-method method-name="createMaintsFromMeterReading" short-description="Create Fixed Asset Maintenances From A Meter Reading">
+        <if-not-empty field="meterValue.maintHistSeqId">
+            <return/>
+        </if-not-empty>
+        <entity-one entity-name="FixedAsset" value-name="fixedAssetValue"/>
+        <if-empty field="fixedAssetValue.instanceOfProductId">
+            <return/>
+        </if-empty>
+        <entity-and list-name="productMaintList" entity-name="ProductMaint">
+            <field-map field-name="productId" env-name="fixedAssetValue.instanceOfProductId"/>
+            <field-map field-name="intervalMeterTypeId" env-name="meterValue.productMeterTypeId"/>
+        </entity-and>
+        <iterate list-name="productMaintList" entry-name="productMaintValue">
+            <set field="repeatCount" from-field="productMaintValue.repeatCount" default-value="0" type="Long"/>
+            <entity-condition list-name="maintList" entity-name="FixedAssetMaint">
+                <condition-list combine="and">
+                    <condition-expr field-name="fixedAssetId" operator="equals" env-name="fixedAssetValue.fixedAssetId"/>
+                    <condition-expr field-name="productMaintTypeId" operator="equals" env-name="productMaintValue.productMaintTypeId"/>
+                    <condition-expr field-name="intervalMeterTypeId" operator="equals" env-name="productMaintValue.intervalMeterTypeId"/>
+                    <condition-expr field-name="statusId" operator="not-equals" value="FAM_CANCELLED"/>
+                </condition-list>
+            </entity-condition>
+            <set field="listSize" value="0" type="Long"/>
+            <if-not-empty field="maintList">
+                <set field="listSize" value="${bsh:maintList.size();}" type="Long"/>
+            </if-not-empty>
+            <set field="maxIntervalQty" value="0" type="Double"/>
+            <iterate list-name="maintList" entry-name="maintValue">
+                <if-compare-field field="maintValue.intervalQuantity" operator="greater" to-field="maxIntervalQty" type="Double">
+                    <set field="maxIntervalQty" from-field="maintValue.intervalQuantity" type="Double"/>
+                </if-compare-field>
+            </iterate>
+            <set field="nextIntervalQty" value="${bsh:maxIntervalQty + productMaintValue.getDouble(&quot;intervalQuantity&quot;);}" type="Double"/>
+            <if-compare-field field="nextIntervalQty" operator="less-equals" to-field="meterValue.meterValue" type="Double">
+                <set field="maintDue" value="false"/>
+                <if-compare field="repeatCount" operator="greater" value="0" type="Long">
+                    <if-compare-field field="listSize" operator="less" to-field="repeatCount" type="Long">
+                        <set field="maintDue" value="true"/>
+                    </if-compare-field>
+                    <else>
+                        <set field="maintDue" value="true"/>
+                    </else>
+                </if-compare>
+                <if-compare field="maintDue" operator="equals" value="true">
+                    <set-service-fields service-name="createFixedAssetMaint" to-map-name="createMaintCxt" map-name="productMaintValue"/>
+                    <set field="createMaintCxt.fixedAssetId" from-field="fixedAssetValue.fixedAssetId"/>
+                    <set field="createMaintCxt.intervalQuantity" from-field="meterValue.meterValue"/>
+                    <set field="createMaintCxt.statusId" value="FAM_CREATED"/>
+                    <call-service service-name="createFixedAssetMaint" in-map-name="createMaintCxt"/>
+                    <check-errors/>
+                </if-compare>
+            </if-compare-field>
+        </iterate>
+    </simple-method>
+    <simple-method method-name="migrateFixedAssetMaintMeter" short-description="Copy FixedAssetMaintMeter To FixedAssetMeter">
+        <entity-condition list-name="maintMeterList" entity-name="FixedAssetMaintMeter"/>
+        <iterate list-name="maintMeterList" entry-name="maintMeter">
+            <make-value value-name="newEntity" entity-name="FixedAssetMeter"/>
+            <set-pk-fields map-name="maintMeter" value-name="newEntity"/>
+            <set-nonpk-fields map-name="maintMeter" value-name="newEntity"/>
+            <set field="newEntity.readingDate" from-field="maintMeter.createdStamp"/>
+            <entity-one entity-name="FixedAssetMeter" value-name="lookedUpValue" auto-field-map="false">
+                <field-map field-name="fixedAssetId" env-name="newEntity.fixedAssetId"/>
+                <field-map field-name="productMeterTypeId" env-name="newEntity.productMeterTypeId"/>
+                <field-map field-name="readingDate" env-name="newEntity.readingDate"/>
+            </entity-one>
+            <if-empty field="lookedUpValue">
+                <create-value value-name="newEntity"/>
+                <check-errors/>
+            </if-empty>
+        </iterate>
+    </simple-method>
     
     <!--  create/update/delete FixedAssetMaintOrder -->
     <simple-method method-name="createFixedAssetMaintOrder" short-description="Create a FixedAsset Maintenance Order">

Modified: ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml Thu Jul  3 15:10:55 2008
@@ -166,26 +166,31 @@
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
     <!-- FixedAsset Maintenance Meter Create/Update/Delete-->
-    <service name="createFixedAssetMaintMeter" default-entity-name="FixedAssetMaintMeter" engine="simple"
-                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetMaintMeter" auth="true">
+    <service name="createFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="simple"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetMeter" auth="true">
         <description>Create a Fixed Asset Maintenance Meter</description>
         <permission-service service-name="fixedAssetPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="updateFixedAssetMaintMeter" default-entity-name="FixedAssetMaintMeter" engine="simple"
-                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="updateFixedAssetMaintMeter" auth="true">
+    <service name="updateFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="simple"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="updateFixedAssetMeter" auth="true">
         <description>Update a Fixed Asset Maintenance Meter</description>
         <permission-service service-name="fixedAssetPermissionCheck" main-action="UPDATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="deleteFixedAssetMaintMeter" default-entity-name="FixedAssetMaintMeter" engine="simple"
-                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="deleteFixedAssetMaintMeter" auth="true">
+    <service name="deleteFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="simple"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="deleteFixedAssetMeter" auth="true">
         <description>Remove a Fixed Asset Maintenance Meter</description>
         <permission-service service-name="fixedAssetPermissionCheck" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="migrateFixedAssetMaintMeter" engine="simple"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="migrateFixedAssetMaintMeter" auth="true">
+        <description>Copy the FixedAssetMaintMeter entity to FixedAssetMeter. FixedAssetMeter.readingDate will be replaced with FixedAssetMaintMeter.createdStamp.</description>
+        <permission-service service-name="fixedAssetPermissionCheck" main-action="CREATE"/>
+    </service>
     <!-- FixedAsset Maintenance Order Create/Update/Delete-->
     <service name="createFixedAssetMaintOrder" default-entity-name="FixedAssetMaintOrder" engine="simple"
                 location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetMaintOrder" auth="true">
@@ -261,4 +266,4 @@
         <attribute name="assetDepreciationTillDate" type="List" mode="OUT" optional="false"/>
         <attribute name="assetNBVAfterDepreciation" type="List" mode="OUT" optional="false"/>
     </service>
-</services>
\ No newline at end of file
+</services>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Thu Jul  3 15:10:55 2008
@@ -819,28 +819,28 @@
         <response name="error" type="view" value="EditFixedAssetRegistrations"/>
     </request-map>
     <!-- FixedAssetMaintenance Meter -->
-    <request-map uri="EditFixedAssetMaintMeters">
+    <request-map uri="EditFixedAssetMeters">
         <security https="true" auth="true"/>
-        <response name="success" type="view" value="EditFixedAssetMaintMeters"/>
-        <response name="error" type="view" value="EditFixedAssetMaintMeters"/>
+        <response name="success" type="view" value="EditFixedAssetMeters"/>
+        <response name="error" type="view" value="EditFixedAssetMeters"/>
     </request-map>
-    <request-map uri="createFixedAssetMaintMeter">
+    <request-map uri="createFixedAssetMeter">
         <security https="true" auth="true"/>
-        <event type="service" path="" invoke="createFixedAssetMaintMeter"/>
-        <response name="success" type="view" value="EditFixedAssetMaintMeters"/>
-        <response name="error" type="view" value="EditFixedAssetMaintMeters"/>
+        <event type="service" path="" invoke="createFixedAssetMeter"/>
+        <response name="success" type="view" value="EditFixedAssetMeters"/>
+        <response name="error" type="view" value="EditFixedAssetMeters"/>
     </request-map>
-    <request-map uri="updateFixedAssetMaintMeter">
+    <request-map uri="updateFixedAssetMeter">
         <security https="true" auth="true"/>
-        <event type="service" path="" invoke="updateFixedAssetMaintMeter"/>
-        <response name="success" type="view" value="EditFixedAssetMaintMeters"/>
-        <response name="error" type="view" value="EditFixedAssetMaintMeters"/>
+        <event type="service" path="" invoke="updateFixedAssetMeter"/>
+        <response name="success" type="view" value="EditFixedAssetMeters"/>
+        <response name="error" type="view" value="EditFixedAssetMeters"/>
     </request-map>
-    <request-map uri="deleteFixedAssetMaintMeter">
+    <request-map uri="deleteFixedAssetMeter">
         <security https="true" auth="true"/>
-        <event type="service" path="" invoke="deleteFixedAssetMaintMeter"/>
-        <response name="success" type="view" value="EditFixedAssetMaintMeters"/>
-        <response name="error" type="view" value="EditFixedAssetMaintMeters"/>
+        <event type="service" path="" invoke="deleteFixedAssetMeter"/>
+        <response name="success" type="view" value="EditFixedAssetMeters"/>
+        <response name="error" type="view" value="EditFixedAssetMeters"/>
     </request-map>
     <!-- FixedAssetMaintenance -->
     <request-map uri="ListFixedAssetMaints">
@@ -1959,7 +1959,7 @@
     <view-map name="EditFixedAssetRegistrations" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetRegistrations"/>
     <view-map name="EditFixedAssetMaint" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMaint"/>
     <view-map name="ListFixedAssetMaints" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#ListFixedAssetMaints"/>
-    <view-map name="EditFixedAssetMaintMeters" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMaintMeters"/>
+    <view-map name="EditFixedAssetMeters" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMeters"/>
     <view-map name="EditFixedAssetMaintOrders" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMaintOrders"/>
     <view-map name="FixedAssetDay" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#CalendarDay"/>
     <view-map name="FixedAssetWeek" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#CalendarWeek"/>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/FixedAssetForms.xml Thu Jul  3 15:10:55 2008
@@ -369,37 +369,41 @@
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 
-    <!-- List all fixed asset Maintenance Meter  -->
-    <form name="ListFixedAssetMaintMeters" type="list"  list-name="fixedAssetMaintMeters" target="updateFixedAssetMaintMeter"
+    <!-- List all fixed asset meter readings -->
+    <form name="ListFixedAssetMeters" type="list" list-name="listIt" target="updateFixedAssetMeter" paginate-target="EditFixedAssetMeters"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
         <actions>
-            <entity-condition entity-name="FixedAssetMaintMeter">
-                <condition-list combine="and">
-                    <condition-expr field-name="fixedAssetId" env-name="fixedAssetId"/>
-                    <condition-expr field-name="maintHistSeqId" env-name="maintHistSeqId"/>
-                </condition-list>
-            </entity-condition>
+            <set field="findParams.fixedAssetId" from-field="parameters.fixedAssetId"/>
+            <set field="findParams.maintHistSeqId" from-field="parameters.maintHistSeqId" default-value=""/>
+            <service service-name="performFind" result-map-name="result" result-map-list-name="listIt">
+                <field-map field-name="inputFields" env-name="findParams"/>
+                <field-map field-name="entityName" value="FixedAssetMeter"/>
+                <field-map field-name="orderBy" value="-readingDate"/>
+            </service>
         </actions>
-        <auto-fields-service service-name="updateFixedAssetMaintMeter"/>
         <field name="fixedAssetId"><hidden/></field>
-        <field name="maintHistSeqId"><hidden/></field>
-        <field name="productMeterTypeId">            
-            <drop-down allow-empty="true">
-                <entity-options description="${description}" entity-name="ProductMeterType" key-field-name="productMeterTypeId">
-                    <entity-order-by field-name="productMeterTypeId"/>
-                </entity-options>
-            </drop-down>
+        <field name="productMeterTypeId">
+            <display-entity entity-name="ProductMeterType" key-field-name="productMeterTypeId" description="${description}"/>
+        </field>
+        <field name="readingDate"><display/></field>
+        <field name="meterValue" title="${uiLabelMap.AccountingFixedAssetMeterValue}"><text/></field>
+        <field name="maintHistSeqId" title="${uiLabelMap.AccountingFixedAssetMaint}">
+            <hyperlink target="EditFixedAssetMaint?fixedAssetId=${fixedAssetId}&amp;maintHistSeqId=${maintHistSeqId}"
+                description="${maintHistSeqId}" also-hidden="false"/>
         </field>
-        <field name="meterValue" title="${uiLabelMap.AccountingFixedAssetMaintMeterValue}"><text size="20" /></field>
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+        <field name="deleteLink" title="${uiLabelMap.CommonRemove}" widget-style="buttontext">
+            <hyperlink target="deleteFixedAssetMeter?fixedAssetId=${fixedAssetId}&amp;productMeterTypeId=${productMeterTypeId}&amp;readingDate=${readingDate}&amp;maintHistSeqId=${maintHistSeqId}"
+                description="${uiLabelMap.CommonRemove}" also-hidden="false"/>
+        </field>
     </form>
-    <!-- create a fixed asset MaintMeter-->
-    <form name="AddFixedAssetMaintMeter" type="single" target="createFixedAssetMaintMeter" title=""
+    <!-- create a fixed asset meter reading -->
+    <form name="AddFixedAssetMeter" type="single" target="createFixedAssetMeter" title=""
         header-row-style="header-row" default-table-style="basic-table">
-        <auto-fields-service service-name="createFixedAssetMaintMeter" />
+        <auto-fields-service service-name="createFixedAssetMeter" />
         <field name="fixedAssetId"><hidden/></field>
-        <field name="maintHistSeqId"><hidden/></field>
+        <field name="maintHistSeqId" use-when="maintHistSeqId != null"><hidden/></field>
+        <field name="maintHistSeqId" use-when="maintHistSeqId == null"><ignored/></field>
         <field name="productMeterTypeId" >
             <drop-down allow-empty="true">
                 <entity-options description="${description}" entity-name="ProductMeterType" key-field-name="productMeterTypeId">
@@ -407,7 +411,7 @@
                 </entity-options>
             </drop-down>
         </field>
-        <field name="meterValue" title="${uiLabelMap.AccountingFixedAssetMaintMeterValue}"><text size="20" /></field>
+        <field name="meterValue" title="${uiLabelMap.AccountingFixedAssetMeterValue}"><text size="20" /></field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
     <!-- List all fixed asset Maintenance Order  -->

Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Thu Jul  3 15:10:55 2008
@@ -384,7 +384,12 @@
                 <decorator-screen name="CommonFixedAssetMaintDecorator" location="${parameters.fixedAssetMaintDecoratorLocation}">
                     <decorator-section name="body">
                         <section>
-                            <condition><not><if-empty field-name="maintHistSeqId"/></not></condition>
+                            <condition>
+                                <and>
+                                    <not><if-empty field-name="maintHistSeqId"/></not>
+                                    <if-service-permission service-name="fixedAssetPermissionCheck" main-action="CREATE"/>
+                                </and>
+                            </condition>
                             <widgets>
                                 <container style="button-bar"><link target="EditFixedAssetMaint?fixedAssetId=${fixedAssetId}" text="${uiLabelMap.AccountingNewFixedAssetMaint}" style="buttontext"/></container>
                             </widgets>
@@ -395,13 +400,13 @@
             </widgets>
         </section>
     </screen>
-    <!-- Fixed Asset MaintMeter -->
-    <screen name="EditFixedAssetMaintMeters">
+    <!-- Fixed Asset Meter -->
+    <screen name="EditFixedAssetMeters">
         <section>
             <actions>
-                <set field="titleProperty" value="PageTitleEditFixedAssetMaintMeters"/>
-                <set field="tabButtonItem" value="ListFixedAssetMaints"/>                
-                <set field="tabButtonItemFixedAssetMaint" value="EditFixedAssetMaintMeters"/>
+                <set field="titleProperty" value="PageTitleEditFixedAssetMeters"/>
+                <set field="tabButtonItem" value="EditFixedAssetMeters"/>                
+                <set field="tabButtonItemFixedAssetMaint" value="EditFixedAssetMeters"/>
                 <set field="labelTitleProperty" value="PageTitleEditFixedAssetMaintenance"/>
                 <set field="fixedAssetId" from-field="parameters.fixedAssetId"/>
                 <set field="maintHistSeqId" from-field="parameters.maintHistSeqId"/>
@@ -411,10 +416,10 @@
             <widgets>
                 <decorator-screen name="CommonFixedAssetMaintDecorator" location="${parameters.fixedAssetMaintDecoratorLocation}">
                     <decorator-section name="body">
-                        <screenlet id="add-fixedasset-maint-meter" title="${uiLabelMap.AccountingAddFixedAssetMaintMeter}" collapsible="true">
-                            <include-form name="AddFixedAssetMaintMeter" location="component://accounting/webapp/accounting/fixedasset/FixedAssetForms.xml"/>
+                        <screenlet id="add-fixedasset-meter" title="${uiLabelMap.AccountingAddFixedAssetMeter}" collapsible="true">
+                            <include-form name="AddFixedAssetMeter" location="component://accounting/webapp/accounting/fixedasset/FixedAssetForms.xml"/>
                         </screenlet>
-                        <include-form name="ListFixedAssetMaintMeters" location="component://accounting/webapp/accounting/fixedasset/FixedAssetForms.xml"/>
+                        <include-form name="ListFixedAssetMeters" location="component://accounting/webapp/accounting/fixedasset/FixedAssetForms.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/Menus.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/Menus.xml Thu Jul  3 15:10:55 2008
@@ -364,8 +364,8 @@
         <menu-item name="EditFixedAssetMaint" title="${uiLabelMap.AccountingFixedAssetMaint}">
             <link target="EditFixedAssetMaint?fixedAssetId=${fixedAssetMaint.fixedAssetId}&amp;maintHistSeqId=${fixedAssetMaint.maintHistSeqId}"/>
         </menu-item>
-        <menu-item name="EditFixedAssetMaintMeters" title="${uiLabelMap.AccountingFixedAssetMaintMeters}">
-            <link target="EditFixedAssetMaintMeters?fixedAssetId=${fixedAssetMaint.fixedAssetId}&amp;maintHistSeqId=${fixedAssetMaint.maintHistSeqId}"/>
+        <menu-item name="EditFixedAssetMeters" title="${uiLabelMap.AccountingFixedAssetMeters}">
+            <link target="EditFixedAssetMeters?fixedAssetId=${fixedAssetId}&amp;maintHistSeqId=${maintHistSeqId}&amp;productMeterTypeId=${fixedAssetMaint.intervalMeterTypeId}"/>
         </menu-item>
         <menu-item name="EditFixedAssetMaintOrders" title="${uiLabelMap.AccountingFixedAssetMaintOrders}">
             <link target="EditFixedAssetMaintOrders?fixedAssetId=${fixedAssetMaint.fixedAssetId}&amp;maintHistSeqId=${fixedAssetMaint.maintHistSeqId}"/>
@@ -395,6 +395,9 @@
         <menu-item name="EditFixedAssetRegistrations" title="${uiLabelMap.AccountingFixedAssetRegistrations}">
             <link target="EditFixedAssetRegistrations?fixedAssetId=${fixedAssetId}"/>
         </menu-item>
+        <menu-item name="EditFixedAssetMeters" title="${uiLabelMap.AccountingFixedAssetMeters}">
+            <link target="EditFixedAssetMeters?fixedAssetId=${fixedAssetId}"/>
+        </menu-item>
         <menu-item name="ListFixedAssetMaints" title="${uiLabelMap.AccountingFixedAssetMaints}">
             <link target="ListFixedAssetMaints?fixedAssetId=${fixedAssetId}"/>
         </menu-item>

Modified: ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml?rev=673842&r1=673841&r2=673842&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/script/org/ofbiz/assetmaint/FixedAssetMaintEvents.xml Thu Jul  3 15:10:55 2008
@@ -50,7 +50,6 @@
         <find-by-primary-key entity-name="ProductMaintType" map-name="maintTypeLookup" value-name="maintType"/>
         <set field="updateWorkEffortCtx.description" from-field="maintType.description"/>
         <call-service service-name="updateWorkEffort" in-map-name="updateWorkEffortCtx"/>
-        <check-errors/>
     </simple-method>
 
     <simple-method method-name="assignFixedAssetPartiesToMaintenance" login-required="true"