Adding Fields to the Person Form - 3.1

From IHRIS Wiki

In this tutorial, we will look at adding a new fields to the person form to version 3.1 of iHRIS Manage. We will add two fields, one called "Favorite Color" which will be a drop-down list of values, and one will be "Favorite Animal" which will be a free-text field. There are many ways to skin my favorite animal, a cat. Likewise, there are many ways to add a field to a form. In order to better maintain the code and the customizations we are making, we will do so by creating a sub-module Demo_ManagePerson of the Demo site-module which contain the all of our changes. To look at a similar customization, look at [CSSC]'s customizations and in particular under modules/Person

Pre-Requisites

Please read over the following articles:


Directories

We will make our customizations to the iHRIS Manage Demo site. On unix you might be working under:

<Base Dir>
/var/lib/iHRIS
<Site Dir>
/var/lib/iHRIS/3.1/ihris-manages/sites/Demo

If you have installed Windows iHRIS Manage you will be working under the directories:

<Base Dir>
C:\Program Files\ihris-suite
<Site Dir>
C:\Program Files\ihris-suite\sites\ihris-manage

Creating a New Module

The looking a <SITE DIR>/iHRIS-Manage-Demo.xml we see that we can put sub-modules into the subdirectory modules of the site directory, which already exists. So lets do (on unix):

mkdir <SITE DIR>/modules/DemoPerson

which will contains our DemoPerson sub-module. Then save to the file:

<SITE DIR>/modules/DemoPerson/DemoPerson.xml

the following contents:

<?xml version="1.0"?>       
<!DOCTYPE I2CEConfiguration SYSTEM "I2CE_Configuration.dtd">
<I2CEConfiguration name='DemoPerson'>      
 <metadata>
   <displayName>Demo Person</displayName>   
   <category>Form</category>
   <description>Sets up the Demo Person form with extra fields for favorite animals and favorite color</description>
   <version>3.1.0</version> 
   <requirement name='Person'>
     <atLeast version='3.1.4'/>
     <lessThan version='3.2'/>
   </requirement>
   <priority>300</priority>  
 </metadata>
 <configurationGroup name='DemoPerson' path='/'>
 </configurationGroup>
</I2CEConfiguration>

This is (almost) the minimal amount of things we need to do create a new module. Right now, there is no functionality, but we have said that the module DemoPerson requires the module Person, which is incidentally a sub-module of ihris-common.

Adding the Fields to Magic Data

Customizing the Template Files

Enabling the Module