Commit f7b32533 authored by colemanw's avatar colemanw

Use entityRef for campaigns on Survey & Petition forms

parent 8dbd6052
......@@ -190,9 +190,10 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form {
// script / instructions / description of petition purpose
$this->add('wysiwyg', 'instructions', ts('Introduction'), $attributes['instructions']);
// Campaign id
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('campaign_id', $this->_values));
$this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
$this->addEntityRef('campaign_id', ts('Campaign'), [
'entity' => 'campaign',
'create' => TRUE,
]);
$customContactProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Individual'));
// custom group id
......
......@@ -127,13 +127,13 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
$this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'title'), TRUE);
$surveyActivityTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType();
// Activity Type id
$this->addSelect('activity_type_id', array('option_url' => 'civicrm/admin/campaign/surveyType'), TRUE);
// Campaign id
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('campaign_id', $this->_values));
$this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
$this->addEntityRef('campaign_id', ts('Campaign'), [
'entity' => 'campaign',
'create' => TRUE,
]);
// script / instructions
$this->add('wysiwyg', 'instructions', ts('Instructions for interviewers'), array('rows' => 5, 'cols' => 40));
......
......@@ -39,7 +39,7 @@
</tr>
<tr class="crm-campaign-survey-main-form-block-campaign_id">
<td class="label">{$form.campaign_id.label}</td>
<td class="view-value">{$form.campaign_id.html} &nbsp; <span class="action-link crm-campaign-survey-new_campaign_link"><a href="{crmURL p='civicrm/campaign/add' q='reset=1'}" target="_blank" title="{ts}Opens New Campaign form in a separate window{/ts}">{ts}new campaign{/ts}</a></span>
<td class="view-value">{$form.campaign_id.html}
<div class="description">{ts}Select the campaign for which survey is created.{/ts}</div>
</td>
</tr>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment