From d755faf26bcc9b2170450414addbcbf8944addad Mon Sep 17 00:00:00 2001 From: Civiware Solutions Date: Fri, 29 Jun 2018 02:58:54 +0530 Subject: [PATCH] added install code to create custom field --- batchexportperm.php | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/batchexportperm.php b/batchexportperm.php index a656f67..d863dbb 100644 --- a/batchexportperm.php +++ b/batchexportperm.php @@ -85,6 +85,46 @@ function batchexportperm_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { */ function batchexportperm_civicrm_managed(&$entities) { _batchexportperm_civix_civicrm_managed($entities); + $entities[] = [ + 'module' => 'org.agbu.batchexportperm', + 'name' => 'batchexportperm_batch_details', + 'entity' => 'CustomGroup', + 'params' => [ + 'version' => 3, + 'name' => 'batchexportperm_batch_details', + 'title' => 'Batch Details', + 'extends' => 'Contribution', + 'style' => 'Inline', + 'collapse_display' => TRUE, + 'is_active' => TRUE, + 'is_multiple' => FALSE, + 'collapse_adv_display' => FALSE, + 'is_reserved' => TRUE, + ], + ]; + $entities[] = [ + 'module' => 'org.agbu.batchexportperm', + 'name' => 'export_date', + 'entity' => 'CustomField', + 'params' => [ + 'version' => 3, + 'name' => 'export_date', + 'label' => 'Export Date', + 'data_type' => 'Date', + 'html_type' => 'Select Date', + 'is_required' => FALSE, + 'is_searchable' => FALSE, + 'is_search_range' => FALSE, + 'is_active' => TRUE, + 'is_view' => TRUE, + 'date_format' => 'mm/dd/yy', + 'text_length' => 255, + 'column_name' => 'export_date', + 'note_columns' => 150, + 'note_rows' => 4, + 'custom_group_id' => 'batchexportperm_batch_details', + ], + ]; } /** @@ -226,8 +266,8 @@ function _batchexportperm_civicrm_check_permission($contributionId, $errorType = function _batchexportperm_civicrm_allow_contribution_to_edit($contributionId) { $customFieldId = civicrm_api3('CustomField', 'getvalue', [ 'return' => "id", - 'custom_group_id' => "Batch_Details", - 'name' => "Export_Date", + 'custom_group_id' => "batchexportperm_batch_details", + 'name' => "export_date", ]); $exportDate = civicrm_api3('Contribution', 'getvalue', [ 'return' => "custom_{$customFieldId}",