added install code to create custom field
This commit is contained in:
		@@ -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}",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user