This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 109c496e65 Improved: Manage marital status type history for person 
(OFBIZ-13329)
109c496e65 is described below

commit 109c496e65ae175495679e0e3f45d3d78470c0a9
Author: Nicolas Malin <[email protected]>
AuthorDate: Tue Dec 23 16:38:07 2025 +0100

    Improved: Manage marital status type history for person (OFBIZ-13329)
    
    on the framework we can add a marital status to a person through 
enumeration on entity Person.
    
    But we can't manage the history of change. After scan the data model book, 
we proposed to improve party model entity with two new entities :
    
        MaritalStatus : to stock the history of marital status change
        MaritalStatusType : like Len Silverton suggest on his book to isolate 
these types.
    
    We move the current field maritalStatusEnumId to deprecated and introduce a 
migration service to move field maritalStatusEnumId to maritalStatusTypeId
    
    Thanks to Charles Steltzlen for this improvement
---
 applications/datamodel/DATAMODEL_CHANGES.adoc      | 21 +++++
 applications/datamodel/data/seed/PartySeedData.xml | 11 ++-
 .../datamodel/entitydef/party-entitymodel.xml      | 48 +++++++++++-
 applications/party/config/PartyEntityLabels.xml    | 90 ++++++++++++++++++++++
 applications/party/config/PartyUiLabels.xml        | 30 ++++++++
 .../party/minilang/party/PartyMapProcs.xml         |  2 +-
 applications/party/servicedef/secas.xml            |  8 ++
 applications/party/servicedef/services.xml         | 53 +++++++++++++
 .../ofbiz/party/party/PartyServicesScript.groovy   | 37 +++++++++
 .../party/webapp/partymgr/WEB-INF/controller.xml   | 28 +++++++
 applications/party/widget/partymgr/PartyForms.xml  | 61 +++++++++++++--
 applications/party/widget/partymgr/PartyMenus.xml  |  5 ++
 .../party/widget/partymgr/PartyScreens.xml         | 41 ++++++++++
 13 files changed, 421 insertions(+), 14 deletions(-)

diff --git a/applications/datamodel/DATAMODEL_CHANGES.adoc 
b/applications/datamodel/DATAMODEL_CHANGES.adoc
index 190df6b2ef..fda0f6759b 100644
--- a/applications/datamodel/DATAMODEL_CHANGES.adoc
+++ b/applications/datamodel/DATAMODEL_CHANGES.adoc
@@ -28,6 +28,27 @@ The following file contains information about the data model 
changes in the Apac
 
 == Changes with OFBiz Trunk (Upcoming Branch)
 
+=== Entity Changes
+*Added new entities*
+. MaritalStatus
+. MaritalStatusType
+
+=== Field Changes
+[cols="<,^,^,^,>",options="header",]
+|=======================================================
+|Entity                 |Field   |Action |IsPK |Revision
+| Person | maritalStatusTypeId | Added | No | TODO
+
+|=======================================================
+
+=== Migration Scripts
+1.  Migration service *migratePersonMaritalStatusType* is implemented to 
migrate the
+    *oldMaritalStatusEnumId* field to *maritalStatusTypeId* on entity 
*Person*. +
+    (More detail at 
https://issues.apache.org/jira/browse/OFBIZ-13329[OFBIZ-13329])
+
+
+== Changes with OFBiz 24
+
 === Entity Changes
 *Added new entities*
 
diff --git a/applications/datamodel/data/seed/PartySeedData.xml 
b/applications/datamodel/data/seed/PartySeedData.xml
index 16edce8fe3..7255edd7ea 100644
--- a/applications/datamodel/data/seed/PartySeedData.xml
+++ b/applications/datamodel/data/seed/PartySeedData.xml
@@ -135,10 +135,6 @@ under the License.
     <Enumeration description="Student" enumCode="STUDENT" 
enumId="EMPS_STUDENT" sequenceId="06" enumTypeId="EMPLOY_STTS"/>
     <Enumeration description="Unemployed" enumCode="UNEMP" enumId="EMPS_UNEMP" 
sequenceId="07" enumTypeId="EMPLOY_STTS"/>
 
-    <EnumerationType enumTypeId="MARITAL_STATUS" description="Marital Status"/>
-    <Enumeration description="Single" enumId="SINGLE" sequenceId="01" 
enumTypeId="MARITAL_STATUS"/>
-    <Enumeration description="Married" enumId="MARRIED" sequenceId="02" 
enumTypeId="MARITAL_STATUS"/>
-
     <EnumerationType description="Residence Status" 
enumTypeId="PTY_RESID_STTS" hasTable="N"/>
     <Enumeration description="Own Home" enumCode="OWN" enumId="PRESS_OWN" 
sequenceId="01" enumTypeId="PTY_RESID_STTS"/>
     <Enumeration description="Private Tenant" enumCode="PVT_TENANT" 
enumId="PRESS_PVT_TENANT" sequenceId="02" enumTypeId="PTY_RESID_STTS"/>
@@ -157,6 +153,13 @@ under the License.
     <Enumeration description="Unsubscribe Contact List Verify" 
enumCode="UNSUB_CONT_VERIFY_EMAIL" enumId="UNSUB_CONT_LIST_VERI" 
sequenceId="03" enumTypeId="PARTY_EMAIL"/>
     <Enumeration description="Contact List E-mail Template" 
enumCode="CONT_EMAIL_TEMPLATE" enumId="CONT_EMAIL_TEMPLATE" sequenceId="04" 
enumTypeId="PARTY_EMAIL"/>
 
+    <!-- marital status -->
+    <MaritalStatusType description="Divorced" maritalStatusTypeId="DIVORCED" 
hasTable="N"/>
+    <MaritalStatusType description="Married" maritalStatusTypeId="MARRIED" 
hasTable="N"/>
+    <MaritalStatusType description="Separated" maritalStatusTypeId="SEPARATED" 
hasTable="N"/>
+    <MaritalStatusType description="Single" maritalStatusTypeId="SINGLE" 
hasTable="N"/>
+    <MaritalStatusType description="Widowed" maritalStatusTypeId="WIDOWED" 
hasTable="N"/>
+
     <!-- the groups which are the main roles on he party listing -->
     <RoleType description="Main Role" hasTable="N" roleTypeId="MAIN_ROLE"/>
 
diff --git a/applications/datamodel/entitydef/party-entitymodel.xml 
b/applications/datamodel/entitydef/party-entitymodel.xml
index 187062d1ec..bad43eeaf1 100644
--- a/applications/datamodel/entitydef/party-entitymodel.xml
+++ b/applications/datamodel/entitydef/party-entitymodel.xml
@@ -35,6 +35,7 @@ under the License.
   <!--  - org.apache.ofbiz.party.contact -->
   <!--  - org.apache.ofbiz.party.need -->
   <!--  - org.apache.ofbiz.party.party -->
+  <!--  - org.apache.ofbiz.party.person -->
   <!-- ========================================================= -->
 
 
@@ -2818,7 +2819,10 @@ under the License.
       <field name="height" type="floating-point"></field>
       <field name="weight" type="floating-point"></field>
       <field name="mothersMaidenName" type="long-varchar" 
encrypt="true"></field>
-      <field name="maritalStatusEnumId" type="id"/>
+      <field name="oldMaritalStatusEnumId" type="id" 
col-name="marital_satus_enum_id">
+        <description>DEPRECATED use maritalStatusTypeId instead</description>
+      </field>
+      <field name="maritalStatusTypeId" type="id"/>
       <field name="socialSecurityNumber" type="long-varchar" 
encrypt="true"></field>
       <field name="passportNumber" type="long-varchar" encrypt="true"></field>
       <field name="passportExpireDate" type="date"></field>
@@ -2841,8 +2845,8 @@ under the License.
       <relation type="one" fk-name="PERSON_RESS_ENUM" title="ResidenceStatus" 
rel-entity-name="Enumeration">
         <key-map field-name="residenceStatusEnumId" rel-field-name="enumId"/>
       </relation>
-      <relation type="one" fk-name="PERSON_MARITAL" title="MaritalStatus" 
rel-entity-name="Enumeration">
-        <key-map field-name="maritalStatusEnumId" rel-field-name="enumId"/>
+      <relation type="one" fk-name="PERSON_MAR_TYPE" 
rel-entity-name="MaritalStatusType">
+        <key-map field-name="maritalStatusTypeId"/>
       </relation>
       <index name="FIRST_NAME_IDX">
         <index-field name="firstName"/>
@@ -3076,5 +3080,41 @@ under the License.
             <key-map field-name="partyClassificationTypeId"/>
         </view-link>
     </view-entity>
-    
+
+  <!-- ========================================================= -->
+  <!-- org.apache.ofbiz.party.person -->
+  <!-- ========================================================= -->
+
+    <entity entity-name="MaritalStatus"
+            package-name="org.apache.ofbiz.party.person"
+            title="Person Marital Status">
+        <description>Marital Status.</description>
+        <field name="partyId" type="id"/>
+        <field name="maritalStatusTypeId" type="id"/>
+        <field name="fromDate" type="date-time"/>
+        <field name="thruDate" type="date-time"/>
+        <prim-key field="partyId"/>
+        <prim-key field="maritalStatusTypeId"/>
+        <prim-key field="fromDate"/>
+        <relation type="one" fk-name="MARITAL_PTY" rel-entity-name="Party">
+            <key-map field-name="partyId"/>
+        </relation>
+        <relation type="one" fk-name="MARITAL_TYPE" 
rel-entity-name="MaritalStatusType">
+            <key-map field-name="maritalStatusTypeId"/>
+        </relation>
+    </entity>
+    <entity entity-name="MaritalStatusType"
+            package-name="org.apache.ofbiz.party.person"
+            default-resource-name="PartyEntityLabels"
+            title="Person Marital Status Type">
+        <description>Marital Status Type.</description>
+        <field name="maritalStatusTypeId" type="id"/>
+        <field name="parentTypeId" type="id"/>
+        <field name="hasTable" type="indicator"/>
+        <field name="description" type="description"/>
+        <prim-key field="maritalStatusTypeId"/>
+        <relation type="one" fk-name="MARITAL_TYPE_PAR" title="Parent" 
rel-entity-name="MaritalStatusType">
+            <key-map field-name="parentTypeId" 
rel-field-name="maritalStatusTypeId"/>
+        </relation>
+    </entity>
 </entitymodel>
diff --git a/applications/party/config/PartyEntityLabels.xml 
b/applications/party/config/PartyEntityLabels.xml
index 7f264aa3f0..dbcf760763 100644
--- a/applications/party/config/PartyEntityLabels.xml
+++ b/applications/party/config/PartyEntityLabels.xml
@@ -1180,6 +1180,96 @@
         <value xml:lang="zh">网站网址</value>
         <value xml:lang="zh-TW">網站網址</value>
     </property>
+    <property key="MaritalStatusType.description.DIVORCED">
+        <value xml:lang="ar">مطلق</value>
+        <value xml:lang="de">Geschieden</value>
+        <value xml:lang="en">Divorced</value>
+        <value xml:lang="es">Divorciado/a</value>
+        <value xml:lang="fr">Divorcé(e)</value>
+        <value xml:lang="hi-IN">तलाकशुदा</value>
+        <value xml:lang="it">Divorziato/a</value>
+        <value xml:lang="ja">離婚</value>
+        <value xml:lang="nl">Gescheiden</value>
+        <value xml:lang="pt-BR">Divorciado</value>
+        <value xml:lang="ro">Divortat/a</value>
+        <value xml:lang="ru">Разведен</value>
+        <value xml:lang="th">หย่าร้าง</value>
+        <value xml:lang="vi">Li dị</value>
+        <value xml:lang="zh">离异</value>
+        <value xml:lang="zh-TW">離婚</value>
+    </property>
+    <property key="MaritalStatusType.description.MARRIED">
+        <value xml:lang="ar">متزوج</value>
+        <value xml:lang="de">Verheiratet</value>
+        <value xml:lang="en">Married</value>
+        <value xml:lang="es">Casado/a</value>
+        <value xml:lang="fr">Marié(e)</value>
+        <value xml:lang="hi-IN">विवाहित</value>
+        <value xml:lang="it">Sposato/a</value>
+        <value xml:lang="ja">既婚</value>
+        <value xml:lang="nl">Gehuwd</value>
+        <value xml:lang="pt-BR">Casado</value>
+        <value xml:lang="ro">Casatorit/a</value>
+        <value xml:lang="ru">В браке</value>
+        <value xml:lang="th">แต่งงาน</value>
+        <value xml:lang="vi">Lập gia đình</value>
+        <value xml:lang="zh">已婚</value>
+        <value xml:lang="zh-TW">已婚</value>
+    </property>
+    <property key="MaritalStatusType.description.SEPARATED">
+        <value xml:lang="ar">منفصل</value>
+        <value xml:lang="de">Getrennt</value>
+        <value xml:lang="en">Separated</value>
+        <value xml:lang="es">Separado/a</value>
+        <value xml:lang="fr">Séparé(e)</value>
+        <value xml:lang="hi-IN">अलग</value>
+        <value xml:lang="it">Separato/a</value>
+        <value xml:lang="ja">別居</value>
+        <value xml:lang="nl">Gescheiden</value>
+        <value xml:lang="pt-BR">Separado</value>
+        <value xml:lang="ro">Separat/a</value>
+        <value xml:lang="ru">Раздельно</value>
+        <value xml:lang="th">แยกทาง</value>
+        <value xml:lang="vi">Ly thân</value>
+        <value xml:lang="zh">分居</value>
+        <value xml:lang="zh-TW">分居</value>
+    </property>
+    <property key="MaritalStatusType.description.SINGLE">
+        <value xml:lang="ar">أعزب</value>
+        <value xml:lang="de">Ledig</value>
+        <value xml:lang="en">Single</value>
+        <value xml:lang="es">Soltero/a</value>
+        <value xml:lang="fr">Célibataire</value>
+        <value xml:lang="hi-IN">एकल</value>
+        <value xml:lang="it">Singolo/a</value>
+        <value xml:lang="ja">独身</value>
+        <value xml:lang="nl">Ongehuwd</value>
+        <value xml:lang="pt-BR">Solteiro</value>
+        <value xml:lang="ro">Single</value>
+        <value xml:lang="ru">Холост</value>
+        <value xml:lang="th">โสด</value>
+        <value xml:lang="vi">Độc thân</value>
+        <value xml:lang="zh">单身</value>
+        <value xml:lang="zh-TW">單身</value>
+    </property>
+    <property key="MaritalStatusType.description.WIDOWED">
+        <value xml:lang="ar">أرمل</value>
+        <value xml:lang="de">Verwitwed</value>
+        <value xml:lang="en">Widowed</value>
+        <value xml:lang="es">Viudo/a</value>
+        <value xml:lang="fr">Veuf(ve)</value>
+        <value xml:lang="hi-IN">विधवा</value>
+        <value xml:lang="it">Vedovo/a</value>
+        <value xml:lang="ja">死別</value>
+        <value xml:lang="nl">Weduwe/weduwnaar</value>
+        <value xml:lang="pt-BR">Viúvo</value>
+        <value xml:lang="ro">Vaduv/a</value>
+        <value xml:lang="ru">Вдовец(вдова)</value>
+        <value xml:lang="th">เป็นม่าย</value>
+        <value xml:lang="vi">Góa</value>
+        <value xml:lang="zh">丧偶</value>
+        <value xml:lang="zh-TW">喪偶</value>
+    </property>
     <property key="PartyClassificationGroup.description.ASSEMBLY">
         <value xml:lang="cs">Sestavení</value>
         <value xml:lang="de">Montage</value>
diff --git a/applications/party/config/PartyUiLabels.xml 
b/applications/party/config/PartyUiLabels.xml
index 16236fcae3..ce52529108 100644
--- a/applications/party/config/PartyUiLabels.xml
+++ b/applications/party/config/PartyUiLabels.xml
@@ -771,6 +771,24 @@
         <value xml:lang="zh">婚姻状况</value>
         <value xml:lang="zh-TW">婚姻狀況</value>
     </property>
+    <property key="FormFieldTitle_maritalStatusTypeId">
+        <value xml:lang="ar">الحالة الإجتماعية</value>
+        <value xml:lang="de">Zivilstand</value>
+        <value xml:lang="en">Marital Status</value>
+        <value xml:lang="es">Estado civil</value>
+        <value xml:lang="fr">Statut marital</value>
+        <value xml:lang="hi-IN">वैवाहिक स्थिति</value>
+        <value xml:lang="it">Stato Civile</value>
+        <value xml:lang="ja">婚姻状況</value>
+        <value xml:lang="nl">Burgerlijke status</value>
+        <value xml:lang="pt-BR">Estado civil</value>
+        <value xml:lang="ro">Stat Civil</value>
+        <value xml:lang="ru">Семейное состояние</value>
+        <value xml:lang="th">สถานภาพ</value>
+        <value xml:lang="vi">Trạng thái hôn nhân</value>
+        <value xml:lang="zh">婚姻状况</value>
+        <value xml:lang="zh-TW">婚姻狀況</value>
+    </property>
     <property key="FormFieldTitle_marketingCampaignId">
         <value xml:lang="ar">دليل حملة التسويق</value>
         <value xml:lang="de">Marketingkampagne ID</value>
@@ -2732,6 +2750,10 @@
         <value xml:lang="zh">登录用户列表</value>
         <value xml:lang="zh-TW">登入使用者清單</value>
     </property>
+    <property key="PageTitleListMaritalStatus">
+        <value xml:lang="en">List Marital Status</value>
+        <value xml:lang="fr">Liste des situations familiale</value>
+    </property>
     <property key="PageTitleListPartyIdentifications">
         <value xml:lang="ar">سرد أرقام الهويات</value>
         <value xml:lang="de">Liste der Identifikationsnummern</value>
@@ -3225,6 +3247,14 @@
         <value xml:lang="zh">新地址</value>
         <value xml:lang="zh-TW">新的位址</value>
     </property>
+    <property key="PartyAddNewMaritalStatus">
+        <value xml:lang="en">New Marital Status</value>
+        <value xml:lang="fr">Ajouter une situation familiale</value>
+    </property>
+    <property key="PartyAddNewMaritalStatusType">
+        <value xml:lang="en">New Marital Status Type</value>
+        <value xml:lang="fr">Ajouter un type de situation familiale</value>
+    </property>
     <property key="PartyAddNewPersonalInformation">
         <value xml:lang="ar">أضافة معلومات شخصية جديدة</value>
         <value xml:lang="cs">Přidat nová osobní data</value>
diff --git a/applications/party/minilang/party/PartyMapProcs.xml 
b/applications/party/minilang/party/PartyMapProcs.xml
index 6ddb8355dd..814360035b 100644
--- a/applications/party/minilang/party/PartyMapProcs.xml
+++ b/applications/party/minilang/party/PartyMapProcs.xml
@@ -39,7 +39,7 @@ under the License.
     <process field="height"><convert type="Double"><fail-property 
resource="PartyUiLabels" 
property="PartyHeightNotValidNumber"/></convert></process>
     <process field="weight"><convert type="Double"><fail-property 
resource="PartyUiLabels" 
property="PartyWeightNotValidNumber"/></convert></process>
     <process field="mothersMaidenName"><copy/></process>
-    <process field="maritalStatusEnumId"><copy/></process>
+    <process field="maritalStatusTypeId"><copy/></process>
     <process field="socialSecurityNumber"><copy/></process>
     <process field="passportNumber"><copy/></process>
     <process field="passportExpireDate"><convert type="Date"><fail-property 
resource="PartyUiLabels" 
property="PartyPassportExpireDateNotValidDate"/></convert></process>
diff --git a/applications/party/servicedef/secas.xml 
b/applications/party/servicedef/secas.xml
index 2873ef4fbe..7bf39adcf3 100644
--- a/applications/party/servicedef/secas.xml
+++ b/applications/party/servicedef/secas.xml
@@ -23,6 +23,10 @@ under the License.
     <eca service="createPerson" event="commit">
         <action service="ensureNaPartyRole" mode="sync"/>
     </eca>
+    <eca service="createPerson" event="commit">
+        <condition field-name="maritalStatusTypeId" operator="is-not-empty"/>
+        <action service="createMaritalStatus" mode="sync"/>
+    </eca>
     <eca service="createProductStoreRole" event="invoke">
         <action service="ensurePartyRole" mode="sync" run-as-user="system"/>
     </eca>
@@ -36,6 +40,10 @@ under the License.
     <eca service="updatePerson" event="invoke">
         <action service="savePartyNameChange" mode="sync"/>
     </eca>
+    <eca service="updatePerson" event="invoke">
+        <condition field-name="maritalStatusTypeId" operator="is-not-empty"/>
+        <action service="saveMaritalStatusChange" mode="sync"/>
+    </eca>
     <eca service="updatePartyGroup" event="invoke">
         <action service="savePartyNameChange" mode="sync"/>
     </eca>
diff --git a/applications/party/servicedef/services.xml 
b/applications/party/servicedef/services.xml
index c3e6fc6ef7..70a0362229 100644
--- a/applications/party/servicedef/services.xml
+++ b/applications/party/servicedef/services.xml
@@ -1622,4 +1622,57 @@ under the License.
         <description>Delete a CommunicationEventPrpTyp</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+
+    <!-- Marital Status and Type services -->
+    <service name="createMaritalStatus" engine="entity-auto" 
default-entity-name="MaritalStatus" invoke="create" auth="true">
+        <description>create Party MaritalStatus entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="CREATE"/>
+        <auto-attributes mode="IN" include="pk"/>
+        <auto-attributes mode="IN" optional="true" include="nonpk"/>
+        <override name="fromDate" optional="true"/>
+    </service>
+    <service name="updateMaritalStatus" engine="entity-auto" 
default-entity-name="MaritalStatus" invoke="update" auth="true">
+        <description>update Party MaritalStatus entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="UPDATE"/>
+        <auto-attributes mode="IN" include="pk"/>
+        <auto-attributes mode="IN" optional="true" include="nonpk"/>
+    </service>
+    <service name="expireMaritalStatus" engine="entity-auto" 
default-entity-name="MaritalStatus" invoke="expire" auth="true">
+        <description>expire Party MaritalStatus entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="UPDATE"/>
+        <auto-attributes mode="IN" include="pk"/>
+    </service>
+    <service name="deleteMaritalStatus" engine="entity-auto" 
default-entity-name="MaritalStatus" invoke="delete" auth="true">
+        <description>delete Party MaritalStatus entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="DELETE"/>
+        <auto-attributes mode="IN" include="pk"/>
+    </service>
+    <service name="saveMaritalStatusChange" engine="groovy" auth="true"
+        
location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy"
 invoke="saveMaritalStatusChange">
+        <description>Save Marital Status Change</description>
+        <attribute name="partyId" type="String" mode="IN"/>
+        <attribute name="maritalStatusTypeId" type="String" mode="IN"/>
+    </service>
+    <service name="migratePersonMaritalStatusType" engine="groovy" auth="true"
+        
location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy"
 invoke="migratePersonMaritalStatusType">
+        <description>For each person move value present on 
oldMaritalStatusEnumId to maritalStatusTypeId</description>
+    </service>
+
+    <service name="createMaritalStatusType" engine="entity-auto" 
default-entity-name="MaritalStatusType" invoke="create">
+        <description>create MaritalStatusType entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="CREATE"/>
+        <auto-attributes mode="IN" include="pk"/>
+        <auto-attributes mode="IN" optional="true" include="nonpk"/>
+    </service>
+    <service name="updateMaritalStatusType" engine="entity-auto" 
default-entity-name="MaritalStatusType" invoke="update">
+        <description>update MaritalStatusType entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="UPDATE"/>
+        <auto-attributes mode="IN" include="pk"/>
+        <auto-attributes mode="IN" optional="true" include="nonpk"/>
+    </service>
+    <service name="deleteMaritalStatusType" engine="entity-auto" 
default-entity-name="MaritalStatusType" invoke="delete">
+        <description>delete MaritalStatusType entity</description>
+        <permission-service service-name="partyBasePermissionCheck" 
main-action="DELETE"/>
+        <auto-attributes mode="IN" include="pk"/>
+    </service>
 </services>
diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
index b086fbb25a..513fe57b18 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
@@ -19,6 +19,7 @@
 package org.apache.ofbiz.party.party
 
 import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityConditionBuilder
 import org.apache.ofbiz.entity.condition.EntityJoinOperator
 import org.apache.ofbiz.entity.condition.EntityOperator
 import org.apache.ofbiz.entity.util.EntityUtil
@@ -961,3 +962,39 @@ Map getChildRoleTypesInline (List roleTypeIdListName) {
     resultMap.childRoleTypeIdList = newRoleTypeIdList
     return resultMap
 }
+
+/**
+  * Save Marital Status Change
+  */
+Map saveMaritalStatusChange() {
+    GenericValue person = from('Person').where(parameters).queryOne()
+    if (person && person.maritalStatusTypeId != 
parameters.maritalStatusTypeId) {
+        Timestamp now = UtilDateTime.nowTimestamp()
+        run service: 'createMaritalStatus', with: [*: parameters,
+                                                   fromDate: now]
+        if (person.maritalStatusTypeId) {
+            delegator.storeByCondition('MaritalStatus', [thruDate: now],
+                    new EntityConditionBuilder().AND {
+                        EQUALS(partyId: person.partyId)
+                        EQUALS(maritalStatusTypeId: person.maritalStatusTypeId)
+                        EQUALS(thruDate: null)
+                    })
+        }
+    }
+    return success()
+}
+
+/**
+  * Migrate MaritalStatus from Enum to MaritalStatusType
+  */
+Map migratePersonMaritalStatusType() {
+    from('Person')
+            .where(new 
EntityConditionBuilder().NOT_EQUAL(oldMaritalStatusEnumId: null))
+            .queryList()
+            .each {
+                it.maritalStatusTypeId = it.oldMaritalStatusEnumId
+                it.oldMaritalStatusEnumId = null
+                it.store()
+            }
+    return success()
+}
diff --git a/applications/party/webapp/partymgr/WEB-INF/controller.xml 
b/applications/party/webapp/partymgr/WEB-INF/controller.xml
index 4db95a1d4d..1e0b31448c 100644
--- a/applications/party/webapp/partymgr/WEB-INF/controller.xml
+++ b/applications/party/webapp/partymgr/WEB-INF/controller.xml
@@ -1350,6 +1350,32 @@ under the License.
         <response name="error" type="view" value="ViewProductStoreRoles"/>
     </request-map>
 
+    <request-map uri="createMaritalStatus">
+        <security/>
+        <event type="service" invoke="createMaritalStatus"/>
+        <response name="success" type="view" value="ViewMaritalStatus"/>
+        <response name="error" type="view" value="ViewMaritalStatus"/>
+    </request-map>
+    <request-map uri="deleteMaritalStatus">
+        <security/>
+        <event type="service" path="" invoke="deleteMaritalStatus"/>
+        <response name="success" type="view" value="ViewMaritalStatus"/>
+        <response name="error" type="view" value="ViewMaritalStatus"/>
+    </request-map>
+    <request-map uri="updateMaritalStatus">
+        <security/>
+        <event type="service" invoke="updateMaritalStatus"/>
+        <response name="success" type="view" value="ViewMaritalStatus"/>
+        <response name="error" type="view" value="ViewMaritalStatus"/>
+    </request-map>
+    <request-map uri="createMaritalStatusType">
+        <security/>
+        <event type="service" path="" invoke="createMaritalStatusType"/>
+        <response name="success" type="view" value="ViewMaritalStatus"/>
+        <response name="error" type="view" value="ViewMaritalStatus"/>
+    </request-map>
+    <request-map uri="EditMaritalStatus"><security/><response name="success" 
type="view" value="ViewMaritalStatus"/></request-map>
+
     <!--  external communication event; mark as read using 1px image request 
-->
     <request-map uri="ceimages" track-serverhit="false" track-visit="false">
         <security https="false" auth="true"/>
@@ -1549,6 +1575,8 @@ under the License.
 
     <view-map name="ViewProductStoreRoles" type="screen" 
page="component://party/widget/partymgr/PartyScreens.xml#ViewProductStoreRoles"/>
 
+    <view-map name="ViewMaritalStatus" type="screen" 
page="component://party/widget/partymgr/PartyScreens.xml#ListPartyMaritalStatus"/>
+
     <!-- Billing Account-->
     <view-map name="EditBillingAccount" type="screen" 
page="component://party/widget/partymgr/PaymentMethodScreens.xml#EditBillingAccount"/>
 
diff --git a/applications/party/widget/partymgr/PartyForms.xml 
b/applications/party/widget/partymgr/PartyForms.xml
index c6e0c34862..8dd4c586a8 100644
--- a/applications/party/widget/partymgr/PartyForms.xml
+++ b/applications/party/widget/partymgr/PartyForms.xml
@@ -196,6 +196,7 @@ under the License.
         focus-field-name="salutation" header-row-style="header-row" 
default-table-style="basic-table">
         <alt-target use-when="personInfo==null" target="createPerson"/>
         <auto-fields-service service-name="updatePerson"/>
+        <field name="oldMaritalStatusEnumId"><ignored/></field>
         <field use-when="personInfo!=null" name="partyId" 
title="${uiLabelMap.PartyPartyId}"><display/></field>
         <field use-when="personInfo==null&amp;&amp;partyId==null" 
name="partyId" title="${uiLabelMap.PartyPartyId}" 
tooltip="${uiLabelMap.CommonIdGeneratedIfEmpty}"><text/></field>
         <field use-when="personInfo==null&amp;&amp;partyId!=null" 
name="partyId" title="${uiLabelMap.PartyPartyId}" 
tooltip="${uiLabelMap.CommonCannotBeFound}: [${partyId}]"><display 
also-hidden="false"/></field>
@@ -207,12 +208,9 @@ under the License.
                 <option key="F" description="${uiLabelMap.CommonFemale}"/>
             </drop-down>
         </field>
-        <field name="maritalStatusEnumId">
+        <field name="maritalStatusTypeId">
             <drop-down allow-empty="true">
-                <entity-options entity-name="Enumeration" 
key-field-name="enumId" description="${description} [${enumCode}]">
-                    <entity-constraint name="enumTypeId" 
value="MARITAL_STATUS"/>
-                    <entity-order-by field-name="sequenceId"/>
-                </entity-options>
+                <entity-options entity-name="MaritalStatusType"/>
             </drop-down>
         </field>
         <field name="employmentStatusEnumId">
@@ -1398,6 +1396,59 @@ under the License.
         </field>
     </grid>
 
+    <grid name="ListPartyMaritalStatus" list-name="listIt" 
target="updateMaritalStatus">
+        <actions>
+            <entity-and entity-name="MaritalStatus">
+                <field-map field-name="partyId" from-field="partyId"/>
+            </entity-and>
+        </actions>
+        <field name="partyId"><hidden/></field>
+        <field name="maritalStatusTypeId">
+            <display-entity entity-name="MaritalStatusType"/>
+        </field>
+        <field name="fromDate"><display type="date"/></field>
+        <field name="thruDate"><date-time/></field>
+        <field name="delete" title=" ">
+            <hyperlink description="${uiLabelMap.CommonDelete}" 
target="deleteMaritalStatus">
+                <parameter param-name="partyId"/>
+                <parameter param-name="maritalStatusTypeId"/>
+                <parameter param-name="fromDate"/>
+            </hyperlink>
+        </field>
+        <field name="submitButton"><submit/></field>
+    </grid>
+
+    <form name="EditPartyMaritalStatus" type="single" 
target="createMaritalStatus"
+          default-table-style="basic-table" 
focus-field-name="maritalStatusTypeId">
+        <field name="partyId"><hidden/></field>
+        <field name="maritalStatusTypeId" 
title="${uiLabelMap.FormFieldTitle_maritalStatus}" required-field="true">
+            <drop-down>
+                <entity-options entity-name="MaritalStatusType">
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="fromDate" required-field="true"><date-time/></field>
+        <field name="thruDate"><date-time/></field>
+        <field name="submit" title="${uiLabelMap.CommonCreate}" 
use-when="partyIdentityDoc == null"><submit /></field>
+    </form>
+
+    <form name="AddMaritalStatusType" type="single" 
target="createMaritalStatusType"
+          header-row-style="header-row" default-table-style="basic-table">
+        <auto-fields-service service-name="createMaritalStatusType"/>
+        <field name="partyId"><hidden/></field>
+        <field name="hasTable"><hidden/></field>
+        <field name="maritalStatusTypeId" 
title="${uiLabelMap.FormFieldTitle_maritalStatus}" 
required-field="true"><text/></field>
+        <field name="parentTypeId">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="MaritalStatusType" 
key-field-name="maritalStatusTypeId">
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" 
title="${uiLabelMap.CommonCreate}"><submit/></field>
+    </form>
+
     <form name="ExportParty" type="single" target="ExportPartyCsv.csv" 
title="" >
         <field name="partyId" tooltip="blank for all"><lookup 
target-form-name="LookupPartyName"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit 
button-type="button"/></field>
diff --git a/applications/party/widget/partymgr/PartyMenus.xml 
b/applications/party/widget/partymgr/PartyMenus.xml
index ac344b27b3..4f3ec9e391 100644
--- a/applications/party/widget/partymgr/PartyMenus.xml
+++ b/applications/party/widget/partymgr/PartyMenus.xml
@@ -192,6 +192,11 @@
                 <parameter param-name="partyId"/>
             </link>
         </menu-item>
+        <menu-item name="ViewMaritalStatus" 
title="${uiLabelMap.PartyMaritalStatus}">
+            <link target="EditMaritalStatus">
+                <parameter param-name="partyId"/>
+            </link>
+        </menu-item>
     </menu>
     <menu name="ProfileSubTabBar" menu-container-style="button-bar 
button-style-2">
         <menu-item name="createNew" 
title="${uiLabelMap.AccountingBillingAccount}" >
diff --git a/applications/party/widget/partymgr/PartyScreens.xml 
b/applications/party/widget/partymgr/PartyScreens.xml
index 8546efc621..152ece2a1e 100644
--- a/applications/party/widget/partymgr/PartyScreens.xml
+++ b/applications/party/widget/partymgr/PartyScreens.xml
@@ -1323,6 +1323,47 @@ under the License.
         </section>
     </screen>
 
+    <!-- Marital Status Screen -->
+    <screen name="ListPartyMaritalStatus">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleListMaritalStatus"/>
+                <set field="headerItem" value="find"/>
+                <set field="tabButtonItem" value="ViewMaritalStatus"/>
+                <set field="labelTitleProperty" value="MaritalStatus"/>
+                <set field="partyId" from-field="parameters.partyId"/>
+                <entity-one entity-name="Party" value-field="party" 
use-cache="true"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonPartyDecorator" 
location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="${uiLabelMap.PartyMaritalStatus}">
+                            <include-grid name="ListPartyMaritalStatus" 
location="component://party/widget/partymgr/PartyForms.xml"/>
+                        </screenlet>
+                        <container style="lefthalf">
+                            <section>
+                                <condition>
+                                    <if-has-permission permission="PARTYMGR" 
action="_CREATE"/>
+                                </condition>
+                                <widgets>
+                                    <screenlet 
title="${uiLabelMap.PartyAddNewMaritalStatusType}">
+                                        <include-form 
name="AddMaritalStatusType" 
location="component://party/widget/partymgr/PartyForms.xml"/>
+                                    </screenlet>
+                                </widgets>
+                            </section>
+                        </container>
+                        <container style="righthalf">
+                            <screenlet 
title="${uiLabelMap.PartyAddNewMaritalStatus}">
+                                <include-form name="EditPartyMaritalStatus" 
location="component://party/widget/partymgr/PartyForms.xml"/>
+                            </screenlet>
+                        </container>
+                        <container style="clear"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="ViewProductStoreRoles">
         <section>
             <actions>


Reply via email to