Details
Description
In HR-1.0 and HR-1.1, there were three leave types defined in an OptionGroup:
- Annual
- Public
- Sick
In HR-1.2, there are many leave types defined with HRAbsenceType, eg
- Sick
- Vacation
- Maternity
- Paternity
- TOIL
- Other
T1. In hrabsence, move the installation logic out of CRM/HRAbsence/HRAbsence.mgd.php and into CRM_HRAbsence_Upgrader::install()
T2. In CRM_HRAbsence_Upgrader::install(), check to see if there's a pre-existing table ("civicrm_hrjob_leave") and pre-existing OptionGroup ("hrjob_leave_type") for the absence-types. If there is one, then skip creation of the default HRAbsenceTypes. Instead, convert each OptionValue to an HRAbsenceType, and update the data in civicrm_hrjob_leave.leave_type.
T3. In hrjob, change the XML schema for HRJobLeave.leave_type. It's currently a pseudo-constant which references an option-group. It should be a reference to civicrm_absence_type. (For an example of referencing a table, see https://github.com/civicrm/civicrm-core/blob/4.4/xml/schema/Core/Email.xml#L34 )
=> Changing this should have the effect of changing how the UI lists out leave-types. For example, when viewing the "Jobs" tab, you can use the Firebug console to inspect CRM.FieldOptions.HRJobLeave.leave_type.
=> If you encounter issues with changing pseudo-constants, contact colemanw.
T4. In hrjob, change the installation process so that it does not create the OptionGroup (hrjob_leave_type) on new installations.
T5. Test upgrades from HR-1.1 to HR-1.2. You will probably want to install hrabsence before running the other DB upgrades. Modify doc/UPGRADE.md accordingly.
T6. Test new-installation process.