svn commit: r1859572 - in /ofbiz/ofbiz-framework/branches/release18.12: ./ applications/datamodel/entitydef/ applications/humanres/minilang/ applications/humanres/servicedef/ applications/humanres/webapp/humanres/WEB-INF/ applications/humanres/widget/ ...

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

svn commit: r1859572 - in /ofbiz/ofbiz-framework/branches/release18.12: ./ applications/datamodel/entitydef/ applications/humanres/minilang/ applications/humanres/servicedef/ applications/humanres/webapp/humanres/WEB-INF/ applications/humanres/widget/ ...

jleroux@apache.org
Author: jleroux
Date: Mon May 20 17:16:16 2019
New Revision: 1859572

URL: http://svn.apache.org/viewvc?rev=1859572&view=rev
Log:
"Applied fix from trunk for revision: 1859571"
------------------------------------------------------------------------
r1859571 | jleroux | 2019-05-20 19:14:43 +0200 (lun. 20 mai 2019) | 22 lignes

Fixed: field emplFromDate is forgot in PayHistory entity
(OFBIZ-11028)

Arpit Mor: steps to regenerate:
    Login to the URL: https://demo-trunk.ofbiz.apache.org/humanres/control/main
    Click on Employments
    Click on New Employments
    Click on Create
Actual: Error message is displayed.

Olivier Heintz: employment is associated with PayHistory, and there is a problem
in PayHistory entity definition in OFBiz,
In PayHistory, the field fromDate from Employment is confused with fromDate
about the current record.
A Employment can have multiple PayHistories and should have multiple
because PayHistory should show history of Pay  for a employment  !
It's necessary to have a field emplFromDate (to have the complete employment
primaryKey).
When modifying a PayRecord the current should be expire and a new one should
be created.

Thanks: Arpit Mor for report at OFBIZ-10969 and Olivier Heintz for the fix
------------------------------------------------------------------------

Modified:
    ofbiz/ofbiz-framework/branches/release18.12/   (props changed)
    ofbiz/ofbiz-framework/branches/release18.12/applications/datamodel/entitydef/humanres-entitymodel.xml
    ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/minilang/HumanResServices.xml
    ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/servicedef/services.xml
    ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/webapp/humanres/WEB-INF/controller.xml
    ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/EmploymentScreens.xml
    ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/HumanresMenus.xml
    ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/forms/EmploymentForms.xml

Propchange: ofbiz/ofbiz-framework/branches/release18.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 20 17:16:16 2019
@@ -10,4 +10,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1849931,1850015,1850023,1850530,1850647,1850685,1850694,1850711,1850914,1850918,1850921,1850948,1850953,1851006,1851013,1851068,1851074,1851130,1851158,1851200,1851224,1851247,1851254,1851315,1851319,1851350,1851353,1851433,1851500,1851805,1851885,1851998,1852503,1852587,1852818,1852882,1853070,1853109,1853691,1853745,1853750,1854306,1854457,1854683,1855078,1855083,1855287,1855371,1855403,1855488,1855492,1855497,1855501,1855898,1856212,1856405,1856455,1856459-1856460,1856484,1856598,1856610,1856613,1856617,1856667,1857088,1857099,1857152,1857154,1857173,1857180,1857213,1857392,1857617,1857692,1857813,1858035,1858092,1858180,1858250,1858256,1858275,1858319,1858347,1858432,1858444,1858483,1858523,1858539,1858965,1858980,1859033,1859055,1859087,1859255,1859263,1859268,1859543
+/ofbiz/ofbiz-framework/trunk:1849931,1850015,1850023,1850530,1850647,1850685,1850694,1850711,1850914,1850918,1850921,1850948,1850953,1851006,1851013,1851068,1851074,1851130,1851158,1851200,1851224,1851247,1851254,1851315,1851319,1851350,1851353,1851433,1851500,1851805,1851885,1851998,1852503,1852587,1852818,1852882,1853070,1853109,1853691,1853745,1853750,1854306,1854457,1854683,1855078,1855083,1855287,1855371,1855403,1855488,1855492,1855497,1855501,1855898,1856212,1856405,1856455,1856459-1856460,1856484,1856598,1856610,1856613,1856617,1856667,1857088,1857099,1857152,1857154,1857173,1857180,1857213,1857392,1857617,1857692,1857813,1858035,1858092,1858180,1858250,1858256,1858275,1858319,1858347,1858432,1858444,1858483,1858523,1858539,1858965,1858980,1859033,1859055,1859087,1859255,1859263,1859268,1859543,1859571

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/datamodel/entitydef/humanres-entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/datamodel/entitydef/humanres-entitymodel.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/datamodel/entitydef/humanres-entitymodel.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/datamodel/entitydef/humanres-entitymodel.xml Mon May 20 17:16:16 2019
@@ -526,6 +526,7 @@ under the License.
       <field name="roleTypeIdTo" type="id"></field>
       <field name="partyIdFrom" type="id"></field>
       <field name="partyIdTo" type="id"></field>
+      <field name="emplFromDate" type="date-time"></field>
       <field name="fromDate" type="date-time"></field>
       <field name="thruDate" type="date-time"></field>
       <field name="salaryStepSeqId" type="id"></field>
@@ -537,13 +538,14 @@ under the License.
       <prim-key field="roleTypeIdTo"/>
       <prim-key field="partyIdFrom"/>
       <prim-key field="partyIdTo"/>
+      <prim-key field="emplFromDate"/>
       <prim-key field="fromDate"/>
       <relation type="one" fk-name="PAY_HIST_EMPLMNT" rel-entity-name="Employment">
         <key-map field-name="roleTypeIdFrom"/>
         <key-map field-name="roleTypeIdTo"/>
         <key-map field-name="partyIdFrom"/>
         <key-map field-name="partyIdTo"/>
-        <key-map field-name="fromDate"/>
+        <key-map field-name="emplFromDate" rel-field-name="fromDate"/>
       </relation>
       <relation type="one" fk-name="PAY_HIST_PGRD" rel-entity-name="PayGrade">
         <key-map field-name="payGradeId"/>

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/minilang/HumanResServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/minilang/HumanResServices.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/minilang/HumanResServices.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/minilang/HumanResServices.xml Mon May 20 17:16:16 2019
@@ -22,7 +22,10 @@
         xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
 
     <!-- Employment Group -->
-    <simple-method method-name="createEmployment" short-description="Create Employment"><!--entity-auto-->
+    <simple-method method-name="createEmployment" short-description="Create Employment">
+        <set-service-fields service-name="ensurePartyRoleTo" to-map="partyRoleMap" map="parameters"/>
+        <call-service service-name="ensurePartyRoleTo" in-map-name="partyRoleMap"/>
+
         <make-value entity-name="Employment" value-field="newEntity"/>
         <set-pk-fields value-field="newEntity" map="parameters"/>
         <set-nonpk-fields map="parameters" value-field="newEntity"/>
@@ -32,10 +35,45 @@
         </if-empty>
         <create-value value-field="newEntity"/>
 
-        <set-service-fields service-name="createPayHistory" map="newEntity" to-map="createPayHistoryMap"/><!--create by seca-->
+        <set-service-fields service-name="createPayHistory" map="parameters" to-map="createPayHistoryMap"/>
+        <set field="createPayHistoryMap.emplFromDate" from="parameters.fromDate"/>
         <call-service service-name="createPayHistory" in-map-name="createPayHistoryMap"/>
     </simple-method>
 
+    <simple-method method-name="updatePayHistory" short-description="Update PayHistory, expire current record and create a new">
+        <entity-one entity-name="PayHistory" value-field="lookedOldValue"/>
+        <!-- check if amount or payGrade or salaryStepSeqId change, if Yes so expire current record -->
+        <if>
+          <condition>
+            <and>
+              <if-compare-field to-field="lookedOldValue.amount" operator="equals" field="parameters.amount"/>
+              <if-compare-field to-field="lookedOldValue.payGradeId" operator="equals" field="parameters.payGradeId"/>
+              <if-compare-field to-field="lookedOldValue.salaryStepSeqId" operator="equals" field="parameters.salaryStepSeqId"/>
+            </and>
+          </condition>
+          <then>
+            <!-- just update comment -->
+            <set field="lookedOldValue.comments" from-field="parameters.comments"/>
+            <store-value value-field="lookedOldValue"/>
+          </then>
+          <else>
+            <!-- expire old record and create a new one -->
+            <set-service-fields service-name="expirePayHistory" map="parameters" to-map="expirePayHistoryMap"/>
+            <call-service service-name="expirePayHistory" in-map-name="expirePayHistoryMap"/>
+            <set-service-fields service-name="createPayHistory" map="parameters" to-map="createPayHistoryMap"/>
+            <if-empty field="parameters.changeDate">
+                <now-timestamp field="nowTimeStamp"/>
+                <set field="createPayHistoryMap.fromDate" from-field="nowTimeStamp"/>
+            <else>
+                <set field="createPayHistoryMap.fromDate" from-field="parameters.changeDate"/>
+                </else>
+            </if-empty>
+            <call-service service-name="createPayHistory" in-map-name="createPayHistoryMap"/>
+          </else>
+        </if>
+        <field-to-result field="parameters.emplFromDate" result-name="fromDate"/>
+    </simple-method>
+
     <simple-method method-name="createEmplPositionReportingStruct" short-description="Create a Employee Position Reporting Structure">
         <make-value entity-name="EmplPositionReportingStruct" value-field="newEntity"/>
         <set-pk-fields map="parameters" value-field="newEntity"/>

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/servicedef/services.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/servicedef/services.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/servicedef/services.xml Mon May 20 17:16:16 2019
@@ -154,11 +154,18 @@ under the License.
     </service>
 
     <!-- Employment Group -->
-    <service name="createEmployment" engine="entity-auto" default-entity-name="Employment" invoke="create" auth="true">
-        <description>Create Employment</description>
+    <service name="createEmployment" engine="simple" default-entity-name="Employment"
+             location="component://humanres/minilang/HumanResServices.xml" invoke="createEmployment" auth="true">
+        <description>Create Employment and first record in PayHistory</description>
         <permission-service service-name="humanResManagerPermission" main-action="CREATE"/>
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
+        <!-- For PayHistory -->
+        <attribute name="amount" mode="IN" type="BigDecimal" optional="true"/>
+        <attribute name="payGradeId" mode="IN" type="String" optional="true"/>
+        <attribute name="salaryStepSeqId" mode="IN" type="String" optional="true"/>
+        <attribute name="periodTypeId" mode="IN" type="String" optional="true"/>
+        <attribute name="comments" mode="IN" type="String" optional="true"/>
         <override type="Timestamp" mode="IN" name="fromDate" optional="true"/>
     </service>
 
@@ -246,11 +253,14 @@ under the License.
         <override type="Timestamp" mode="IN" name="fromDate" optional="true"/>
     </service>
 
-    <service name="updatePayHistory" engine="entity-auto" default-entity-name="PayHistory" invoke="update" auth="true">
+    <service name="updatePayHistory" engine="simple" default-entity-name="PayHistory"
+             location="component://humanres/minilang/HumanResServices.xml" invoke="updatePayHistory" auth="true">
         <description>Update Pay History</description>
         <permission-service service-name="humanResManagerPermission" main-action="UPDATE"/>
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
+        <attribute name="changeDate" mode="IN" type="Timestamp" optional="true"/>
+        <attribute name="fromDate" mode="OUT" type="Timestamp"/>
     </service>
 
     <service name="deletePayHistory" engine="entity-auto" default-entity-name="PayHistory" invoke="delete" auth="true">

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/webapp/humanres/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/webapp/humanres/WEB-INF/controller.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/webapp/humanres/WEB-INF/controller.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/webapp/humanres/WEB-INF/controller.xml Mon May 20 17:16:16 2019
@@ -233,6 +233,10 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ListPayHistories"/>
     </request-map>
+    <request-map uri="EditPayHistory">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="EditPayHistory"/>
+    </request-map>
     <request-map uri="updatePayHistory">
         <security https="true" auth="true"/>
         <event type="service" invoke="updatePayHistory"/>
@@ -1146,6 +1150,7 @@ under the License.
     <view-map name="EditPartyBenefits" type="screen" page="component://humanres/widget/EmploymentScreens.xml#EditPartyBenefits"/>
     <view-map name="EditPayrollPreferences" type="screen" page="component://humanres/widget/EmploymentScreens.xml#EditPayrollPreferences"/>
     <view-map name="ListPayHistories" type="screen" page="component://humanres/widget/EmploymentScreens.xml#ListPayHistories"/>
+    <view-map name="EditPayHistory" type="screen" page="component://humanres/widget/EmploymentScreens.xml#EditPayHistory"/>
     <view-map name="EditSalarySteps" type="screen" page="component://humanres/widget/PayGradeScreens.xml#EditSalarySteps"/>
     <view-map name="EditUnemploymentClaims" type="screen" page="component://humanres/widget/EmploymentScreens.xml#EditUnemploymentClaims"/>
     <view-map name="EditAgreementEmploymentAppls" type="screen" page="component://humanres/widget/EmploymentScreens.xml#EditAgreementEmploymentAppls"/>

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/EmploymentScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/EmploymentScreens.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/EmploymentScreens.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/EmploymentScreens.xml Mon May 20 17:16:16 2019
@@ -113,6 +113,28 @@
             </widgets>
         </section>
     </screen>
+    <screen name="EditPayHistory">
+        <section>
+            <actions>
+                <set field="titleProperty" value="HumanResListPayHistories"/>
+                <set field="headerItem" value="Employment"/>
+                <set field="tabButtonItem" value="EditPayHistory"/>
+                <entity-one value-field="payHistory" entity-name="PayHistory"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonEmploymentDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="${uiLabelMap.HumanResListPayHistories}">
+                            <include-form name="ListPayHistories" location="component://humanres/widget/forms/EmploymentForms.xml"/>
+                        </screenlet>
+                        <screenlet title="${uiLabelMap.HumanResListPayHistories}">
+                            <include-form name="EditPayHistory" location="component://humanres/widget/forms/EmploymentForms.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
     <screen name="EditPartyBenefits">
         <section>
             <actions>

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/HumanresMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/HumanresMenus.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/HumanresMenus.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/HumanresMenus.xml Mon May 20 17:16:16 2019
@@ -36,13 +36,16 @@
     </menu>
     <menu name="EmploymentBar" default-menu-item-name="EditPartyBenefit" default-selected-style="selected"
         type="simple" menu-container-style="button-bar tab-bar" selected-menuitem-context-field-name="tabButtonItem">
+        <actions>
+            <set field="emplFromDate" from-field="parameters.emplFromDate" default-value="${parameters.fromDate}"/>
+        </actions>
         <menu-item name="EditEmployment" title="${uiLabelMap.HumanResEmployment}">
             <link target="EditEmployment" >
                 <parameter param-name="roleTypeIdFrom"/>
                 <parameter param-name="roleTypeIdTo"/>
                 <parameter param-name="partyIdFrom"/>
                 <parameter param-name="partyIdTo"/>
-                <parameter param-name="fromDate"/>
+                <parameter param-name="fromDate" from-field="emplFromDate"/>
             </link>
         </menu-item>
         <menu-item name="EditPartyBenefit" title="${uiLabelMap.HumanResEditPartyBenefit}">
@@ -51,7 +54,7 @@
                 <parameter param-name="roleTypeIdTo"/>
                 <parameter param-name="partyIdFrom"/>
                 <parameter param-name="partyIdTo"/>
-                <parameter param-name="fromDate"/>
+                <parameter param-name="fromDate" from-field="emplFromDate"/>
             </link>
         </menu-item>
         <menu-item name="EditPayrollPreference" title="${uiLabelMap.HumanResEditPayrollPreference}">
@@ -60,7 +63,7 @@
                 <parameter param-name="roleTypeIdTo"/>
                 <parameter param-name="partyIdFrom"/>
                 <parameter param-name="partyIdTo"/>
-                <parameter param-name="fromDate"/>
+                <parameter param-name="fromDate" from-field="emplFromDate"/>
             </link>
         </menu-item>
         <menu-item name="EditPayHistory" title="${uiLabelMap.HumanResEditPayHistory}">
@@ -69,7 +72,7 @@
                 <parameter param-name="roleTypeIdTo"/>
                 <parameter param-name="partyIdFrom"/>
                 <parameter param-name="partyIdTo"/>
-                <parameter param-name="fromDate"/>
+                <parameter param-name="fromDate" from-field="emplFromDate"/>
             </link>
         </menu-item>
         <menu-item name="EditUnemploymentClaims" title="${uiLabelMap.HumanResEditUnemploymentClaim}">
@@ -78,7 +81,7 @@
                 <parameter param-name="roleTypeIdTo"/>
                 <parameter param-name="partyIdFrom"/>
                 <parameter param-name="partyIdTo"/>
-                <parameter param-name="fromDate"/>
+                <parameter param-name="fromDate" from-field="emplFromDate"/>
             </link>
         </menu-item>
         <menu-item name="EditAgreementEmploymentAppls" title="${uiLabelMap.HumanResAgreementEmploymentAppl}">

Modified: ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/forms/EmploymentForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/forms/EmploymentForms.xml?rev=1859572&r1=1859571&r2=1859572&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/forms/EmploymentForms.xml (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/applications/humanres/widget/forms/EmploymentForms.xml Mon May 20 17:16:16 2019
@@ -112,7 +112,7 @@
     <form name="EditEmployment" type="single" target="updateEmployment" default-map-name="employment"
         header-row-style="header-row" default-table-style="basic-table">
         <alt-target use-when="employment==null" target="createEmployment"/>
-        <auto-fields-service service-name="createEmployment" default-field-type="hidden"/>
+<!--         <auto-fields-service service-name="createEmployment" default-field-type="hidden"/> -->
         <field name="roleTypeIdFrom"><hidden value="INTERNAL_ORGANIZATIO"/></field>
         <field name="roleTypeIdTo"><hidden value="EMPLOYEE"/></field>
         <field name="partyIdFrom" use-when="employment==null" title="${uiLabelMap.HumanResEmploymentPartyIdFrom}" required-field="true">
@@ -128,6 +128,19 @@
         <field name="fromDate" use-when="employment==null" title="${uiLabelMap.CommonFromDate}" required-field="true"><date-time default-value="${nowTimestamp}"/></field>
         <field name="fromDate" use-when="employment!=null" title="${uiLabelMap.CommonFromDate}"><display default-value="${nowTimestamp}"/></field>
         <field name="thruDate" use-when="employment!=null" title="${uiLabelMap.CommonThruDate}"><date-time/></field>
+        <!-- For PayHistory -->
+        <field name="amount"           use-when="employment==null" required-field="true"><text/></field>
+        <field name="comments"         use-when="employment==null"><text/></field>
+        <field name="payGradeId"       use-when="employment==null" title="${uiLabelMap.HumanResPayGradeID}"><lookup target-form-name="LookupPayGrade" size="20"/></field>
+        <field name="salaryStepSeqId"  use-when="employment==null" title="${uiLabelMap.HumanResSalaryStepSeqId}"><lookup target-form-name="LookupSalaryStep" size="20"/></field>
+        <field name="periodTypeId"     use-when="employment==null" title="${uiLabelMap.FormFieldTitle_periodTypeId}">
+            <drop-down allow-empty="false">
+                <entity-options key-field-name="periodTypeId" entity-name="PeriodType">
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <!-- End of For PayHistory -->
         <field name="terminationReasonId" use-when="employment!=null" title="${uiLabelMap.HumanResTerminationReasonId}">
             <drop-down allow-empty="true" no-current-selected-key="------">
                 <entity-options key-field-name="terminationReasonId" entity-name="TerminationReason">
@@ -148,44 +161,68 @@
     <form name="ListPayHistories" type="list" target="updatePayHistory" title="" paginate-target="findPayHistories"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <actions>
-            <entity-condition entity-name="PayHistory" filter-by-date="true">
+            <set field="emplFromDate" from-field="parameters.emplFromDate" default-value="${parameters.fromDate}"/>
+            <entity-condition entity-name="PayHistory">
                 <condition-list combine="and">
                     <condition-expr field-name="roleTypeIdFrom" operator="equals" from-field="parameters.roleTypeIdFrom"/>
                     <condition-expr field-name="roleTypeIdTo" operator="equals" from-field="parameters.roleTypeIdTo"/>
                     <condition-expr field-name="partyIdFrom" operator="equals" from-field="parameters.partyIdFrom"/>
                     <condition-expr field-name="partyIdTo" operator="equals" from-field="parameters.partyIdTo"/>
-                    <condition-expr field-name="fromDate" operator="equals" from-field="parameters.fromDate"/>
+                    <condition-expr field-name="emplFromDate" operator="equals" from-field="emplFromDate"/>
                 </condition-list>
+                <order-by field-name="fromDate"/>
             </entity-condition>
         </actions>
-        <auto-fields-service service-name="updatePayHistory"/>
-        <field name="roleTypeIdFrom"><hidden/></field>
-        <field name="roleTypeIdTo"><hidden/></field>
-        <field name="partyIdFrom"><hidden/></field>
-        <field name="partyIdTo"><hidden/></field>
-        <field name="fromDate"><display/></field>
-        <field name="amount"><hidden/></field>
-        <field name="comments"><hidden/></field>
-        <field name="salaryStepSeqId" title="${uiLabelMap.HumanResSalaryStepSeqId}"><lookup target-form-name="LookupSalaryStep" size="20"/></field>
-        <field name="payGradeId" title="${uiLabelMap.HumanResPayGradeID}"><lookup target-form-name="LookupPayGrade" size="20"/></field>
-        <field name="periodTypeId" title="${uiLabelMap.FormFieldTitle_periodTypeId}">
-            <drop-down allow-empty="false">
-                <entity-options key-field-name="periodTypeId" entity-name="PeriodType">
-                    <entity-order-by field-name="description"/>
-                </entity-options>
-            </drop-down>
+        <field name="editLink" title=" " widget-style="buttontext" use-when="${groovy:thruDate == null}">
+            <hyperlink description="${uiLabelMap.CommonEdit}" target="EditPayHistory">
+                <parameter param-name="roleTypeIdFrom"/>
+                <parameter param-name="roleTypeIdTo"/>
+                <parameter param-name="partyIdFrom"/>
+                <parameter param-name="partyIdTo"/>
+                <parameter param-name="emplFromDate"/>
+                <parameter param-name="fromDate"/>
+            </hyperlink>
         </field>
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
-        <field name="deleteLink" title=" " widget-style="buttontext">
+        <field name="fromDate" ><display/></field>
+        <field name="thruDate"><display/></field>
+        <field name="amount"><display/></field>
+        <field name="periodTypeId" title="${uiLabelMap.FormFieldTitle_periodTypeId}"><display-entity entity-name="PeriodType"/></field>
+        <field name="payGradeId" title="${uiLabelMap.HumanResPayGradeID}"><display/></field>
+        <field name="salaryStepSeqId" title="${uiLabelMap.HumanResSalaryStepSeqId}"><display/></field>
+        <field name="salaryStepSeqId" title="${uiLabelMap.HumanResSalaryStepSeqId}"><display/></field>
+        <field name="comments"><display/></field>
+        <field name="deleteLink" title=" " widget-style="buttontext" use-when="${groovy:thruDate == null}">
             <hyperlink description="${uiLabelMap.CommonDelete}" target="expirePayHistory">
                 <parameter param-name="roleTypeIdFrom"/>
                 <parameter param-name="roleTypeIdTo"/>
                 <parameter param-name="partyIdFrom"/>
                 <parameter param-name="partyIdTo"/>
+                <parameter param-name="emplFromDate"/>
                 <parameter param-name="fromDate"/>
             </hyperlink>
         </field>
     </form>
+    <form name="EditPayHistory" type="single" target="updatePayHistory" default-entity-name="PayHistory" default-map-name="payHistory">
+        <field name="roleTypeIdFrom" ><hidden/></field>
+        <field name="roleTypeIdTo"   ><hidden/></field>
+        <field name="partyIdFrom"    ><hidden/></field>
+        <field name="partyIdTo"      ><hidden/></field>
+        <field name="emplFromDate"   ><hidden/></field>
+        <field name="fromDate"><hidden/></field>
+        <field name="changeDate"><date-time/></field>
+        <field name="amount"><text/></field>
+        <field name="periodTypeId" title="${uiLabelMap.FormFieldTitle_periodTypeId}" position="2">
+            <drop-down allow-empty="false">
+                <entity-options key-field-name="periodTypeId" entity-name="PeriodType">
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="comments"><text size="75"/></field>
+        <field name="payGradeId" title="${uiLabelMap.HumanResPayGradeID}"><lookup target-form-name="LookupPayGrade" size="20" /></field>
+        <field name="salaryStepSeqId" title="${uiLabelMap.HumanResSalaryStepSeqId}" position="2"><lookup target-form-name="LookupSalaryStep" target-parameter="payGradeId" size="20"/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
+    </form>
     <form name="ListPartyBenefits" type="multi" target="updatePartyBenefit?benefitTypeId=${benefitTypeId}&amp;roleTypeIdFrom=${roleTypeIdFrom}&amp;roleTypeIdTo=${roleTypeIdTo}&amp;partyIdFrom=${partyIdFrom}&amp;partyIdTo=${partyIdTo}&amp;fromDate=${fromDate}" title="" paginate-target="findPartyBenefits"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
         <actions>