Added install code, navigation menu and DAO file

This commit is contained in:
2018-08-11 17:03:32 +05:30
parent 5595bf48c9
commit 29abfc684d
9 changed files with 835 additions and 8 deletions

View File

@ -46,6 +46,9 @@ function annualgrantbudgets_civicrm_postInstall() {
*/
function annualgrantbudgets_civicrm_uninstall() {
_annualgrantbudgets_civix_civicrm_uninstall();
CRM_Core_DAO::executeQuery("
DROP TABLE IF EXISTS civicrm_grant_budget;
");
}
/**
@ -85,6 +88,44 @@ function annualgrantbudgets_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL)
*/
function annualgrantbudgets_civicrm_managed(&$entities) {
_annualgrantbudgets_civix_civicrm_managed($entities);
$entities[] = [
'module' => 'org.agbu.annualgrantbudgets',
'name' => 'grant_scholarship',
'entity' => 'CustomGroup',
'params' => [
'version' => 3,
'name' => 'grant_scholarship',
'title' => ts('Grant Scholarship'),
'extends' => 'FinancialType',
'style' => 'Inline',
'collapse_display' => TRUE,
'is_active' => TRUE,
'is_multiple' => FALSE,
'collapse_adv_display' => FALSE,
'is_reserved' => TRUE,
],
];
$entities[] = [
'module' => 'org.agbu.annualgrantbudgets',
'name' => 'is_grant_scholarship',
'entity' => 'CustomField',
'params' => [
'version' => 3,
'name' => 'is_grant_scholarship',
'label' => ts('Scholarship?'),
'data_type' => 'Boolean',
'html_type' => 'Radio',
'is_required' => FALSE,
'is_searchable' => FALSE,
'is_search_range' => FALSE,
'default_value' => FALSE,
'is_active' => TRUE,
'is_view' => TRUE,
'text_length' => 255,
'column_name' => 'is_grant_scholarship',
'custom_group_id' => 'grant_scholarship',
],
];
}
/**
@ -132,4 +173,27 @@ function annualgrantbudgets_civicrm_alterSettingsFolders(&$metaDataFolders = NUL
*/
function annualgrantbudgets_civicrm_entityTypes(&$entityTypes) {
_annualgrantbudgets_civix_civicrm_entityTypes($entityTypes);
$entityTypes[] = [
'name' => 'GrantBudget',
'class' => 'CRM_Grant_DAO_GrantBudget',
'table' => 'civicrm_grant_budget',
];
}
/**
* Implements hook_civicrm_navigationMenu().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_navigationMenu
*
*/
function annualgrantbudgets_civicrm_navigationMenu(&$menu) {
_annualgrantbudgets_civix_insert_navigation_menu($menu, 'Administer/CiviGrant', [
'label' => ts('Grant Budget', ['domain' => 'org.agbu.annualgrantbudgets']),
'name' => 'grant_annual_budget',
'url' => CRM_Utils_System::url('civicrm/grant/annual/budgets', 'reset=1&action=browse', TRUE),
'active' => 1,
'permission_operator' => 'OR',
'permission' => 'access CiviGrant,administer CiviCRM',
]);
_annualgrantbudgets_civix_navigationMenu($menu);
}