Details
-
Type: Sub-task
-
Status: Done/Fixed
-
Priority: Blocker
-
Resolution: Fixed/Completed
-
Affects Version/s: 1.0
-
Fix Version/s: 1.0
-
Labels:None
Description
Summary
========
Using Civix per the Extension Guide (http://wiki.civicrm.org/confluence/display/CRMDOC43/Create+a+Module+Extension) to create the skeletal extension and the installer which will instantiate required meta-data and a new table.
IMPORTANT: The bulk of this issue is creating the installation code for the extension. Please consider the possibility that a site admin might UNINSTALL and even REINSTALL the extension as you write and refine the installer code. Let's discuss whether what meta-data / data UNINSTALL should delete. For example .. should UNINSTALL delete any existing volunteer activities with their custom fields? Probably not IMO. If we agree, then most of the meta-data installed by the extension would NOT be removed, which means that the installer should check for existence of these artifacts and NOT try to re-create them if they exist.
Implementation
============
1. Create skeletal extension with civix generate:module
2. Create the metadata needed for Volunteer activities in your development site for the custom Activity fields defined here: http://wiki.civicrm.org/confluence/display/CRM/CiviVolunteer+dev+notes#CiviVolunteerdevnotes-VolunteerActivities
2.1 Add 'Volunteer' activity type to your dev site
2.2 Add 'CiviVolunteer' custom data set and the the custom fields listed on the wiki to your dev site (note down the custom group id). This includes creating the 'select values' for Volunteer Status (as listed on the wiki).
3. Use civix to create the Upgrader class and define the custom data group / fields to be created at install. (To make sure civix uses the right local dev site, run "civix config:get" or "civix civicrm:ping")
Follow the steps on the wiki at: http://wiki.civicrm.org/confluence/display/CRMDOC43/Create+a+Module+Extension#CreateaModuleExtension-Addcustomfields(CiviCRMv4.4+)
These commands will create xml/auto_install.xml as well as Upgrader.php. The volunteer_status option group and option values are part of this 'export' definition.
You can edit auto_install.xml and set <is_reserved>1</is_reserved> for the CustomGroup so the users can't delete it.
NOTE: this is new functionality which Tim created for 4.4 / CiviHR. Ping him if questions are not working as expected.
4. Add logic to Upgrader.php class file to instantiate the new Volunteer Needs table for the extension (civicrm_civivol_need) - table schema defined here:
http://wiki.civicrm.org/confluence/display/CRM/CiviVolunteer+dev+notes#CiviVolunteerdevnotes-VolunteerNeeds
(you can define a separate .mysql file to create the table - e.g. sql/auto_install.sql)
5. Add logic to Upgrader.php to instantiate additional option group and option value entries. Per Tim, you can choose between (a) calling OptionGroup API from hook_install or (b) calling SQL from hook_install.
5.1 Add 'Volunteer' to 'activity_type' option_group.
5.2 Add Volunteer Role (volunteer_role) option group and add some sample roles (option_value rows):
'Ticket-taker'
'Usher'
'Will Call'
6. Package the extension and test the installation. The expected meta-data (custom fields, option groups, option values, and new 'needs' table) should be created by installer.