From: eileenmcnaughton Date: Wed, 16 Dec 2015 16:14:23 +0000 (+0000) Subject: CRM-17718 allow campaign id to be updated from contribution recur form X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7083dc2a075bb82f3a9f1a552d4120f5c2dfc1f1;p=civicrm-core.git CRM-17718 allow campaign id to be updated from contribution recur form --- diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index ca7c4009a4..a5e5add641 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -378,6 +378,7 @@ SELECT rec.id as recur_id, rec.is_test, rec.auto_renew, rec.currency, + rec.campaign_id, con.id as contribution_id, con.contribution_page_id, rec.contact_id, diff --git a/CRM/Contribute/Form/UpdateSubscription.php b/CRM/Contribute/Form/UpdateSubscription.php index 6d926ccf2d..1ade6eca22 100644 --- a/CRM/Contribute/Form/UpdateSubscription.php +++ b/CRM/Contribute/Form/UpdateSubscription.php @@ -132,6 +132,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form { $this->_defaults = array(); $this->_defaults['amount'] = $this->_subscriptionDetails->amount; $this->_defaults['installments'] = $this->_subscriptionDetails->installments; + $this->_defaults['campaign_id'] = $this->_subscriptionDetails->campaign_id; $this->_defaults['is_notify'] = 1; return $this->_defaults; @@ -157,6 +158,10 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form { $this->add('checkbox', 'is_notify', ts('Notify Contributor?')); } + if (CRM_Core_Permission::check('edit contributions')) { + $this->addEntityRef('campaign_id', 'Campaign', array('entity' => 'Campaign')); + } + $type = 'next'; if ($this->_selfService) { $type = 'submit'; diff --git a/templates/CRM/Contribute/Form/UpdateSubscription.tpl b/templates/CRM/Contribute/Form/UpdateSubscription.tpl index c43a9a2a98..35a7ec926b 100644 --- a/templates/CRM/Contribute/Form/UpdateSubscription.tpl +++ b/templates/CRM/Contribute/Form/UpdateSubscription.tpl @@ -39,6 +39,7 @@ {ts}Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.{/ts} {if !$self_service} {$form.is_notify.label}{$form.is_notify.html} + {$form.campaign_id.label}{$form.campaign_id.html} {/if} {* Currently changes to interval, unit and cycle day are not supported. *}