Skip to content
Snippets Groups Projects
Commit f27916ac authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge pull request #1968 from davecivicrm/CRM-13742

CRM-13742 conditional display of invite to create your own PCP after com...
parents 6b6d2f9a eea141c0
Branches
Tags
No related merge requests found
......@@ -508,7 +508,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
}
if ($this->_pcpId) {
if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) {
$this->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
$pcp_supporter_text = ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
// Only tell people that can also create a PCP if the contribution page has a non-empty value in the "Create Personal Campaign Page link" field.
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute');
if(!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!";
}
$this->assign('pcpSupporterText', $pcp_supporter_text);
}
$this->assign('pcp', TRUE);
$this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL,
......
......@@ -456,9 +456,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
$this->assign('bltID', $this->_bltID);
$isShowLocation = CRM_Utils_Array::value('is_show_location', $this->_values['event']);
$this->assign('isShowLocation', $isShowLocation);
if ($pcpId && $pcpSupporter = CRM_PCP_BAO_PCP::displayName($pcpId)) {
$this->assign('pcpSupporterText', ts('This event registration is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
}
//CRM-6907
$config->defaultCurrency = CRM_Utils_Array::value('currency', $this->_values['event'],
$config->defaultCurrency
......
......@@ -418,14 +418,23 @@ WHERE pcp.id = %1 AND cc.contribution_status_id =1 AND cc.is_test = 0";
$prms = array('id' => $pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($pcpId)) {
if ($pcpInfo['page_type'] == 'event') {
$page->assign('pcpSupporterText', ts('This event registration is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
$pcp_supporter_text = ts('This event registration is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'event');
if(!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!";
}
}
else {
$page->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
$pcp_supporter_text = ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'contribute');
if(!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!";
}
}
$page->assign('pcpSupporterText', $pcp_supporter_text);
}
$page->assign('pcp', TRUE);
......@@ -735,9 +744,10 @@ WHERE pcp.id = %1 AND cc.contribution_status_id =1 AND cc.is_test = 0";
static function getPcpBlockStatus($pageId, $component) {
$query = "
SELECT pb.link_text as linkText
FROM civicrm_contribution_page cp
LEFT JOIN civicrm_pcp_block pb ON ( cp.id = pb.entity_id AND pb.entity_table = %2 )
WHERE pb.is_active = 1 AND cp.id = %1";
FROM civicrm_pcp_block pb
WHERE pb.is_active = 1 AND
pb.entity_id = %1 AND
pb.entity_table = %2";
$entity_table = self::getPcpEntityTable($component);
......
......@@ -72,5 +72,5 @@
{ts}Personal Contribution Link{/ts}
{/htxt}
{htxt id="id-link_text"}
{ts}Text for the link inviting constituents to create a Personal Contribution Page. This link will appear on the Contribution Thank-you page as well as on each Personal Campaign Page.{/ts}
{ts}Text for the link inviting constituents to create a Personal Contribution Page. This link will appear on the Contribution Thank-you page as well as on each Personal Campaign Page. Leave blank if you do not want constituents to be prompted to create their own Personal Campaign Pages.{/ts}
{/htxt}
......@@ -72,5 +72,5 @@
{ts}Personal Contribution Link{/ts}
{/htxt}
{htxt id="id-link_text"}
{ts}Text for the link inviting constituents to create a Personal Contribution Page. This link will appear on the Contribution Thank-you page as well as on each Personal Campaign Page.{/ts}
{ts}Text for the link inviting constituents to create a Personal Contribution Page. This link will appear on the Contribution Thank-you page as well as on each Personal Campaign Page. Leave blank if you do not want constituents to be prompted to create their own Personal Campaign Pages.{/ts}
{/htxt}
......@@ -72,7 +72,7 @@
{ts}Link Text{/ts}
{/htxt}
{htxt id="id-link_text"}
{ts}Text for the link inviting constituents to create a Personal Campaign Page. This link will appear on the Event registration Thank-you page as well as on each Personal Campaign Page.{/ts}
{ts}Text for the link inviting constituents to create a Personal Campaign Page. This link will appear on the Event registration Thank-you page as well as on each Personal Campaign Page. Leave blank if you do not want constituents to be prompted to create their own Personal Campaign Pages.{/ts}
{/htxt}
{htxt id="id-target_entity_type-title"}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment