3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2013
37 * This class contains Contribution Page related functions.
39 class CRM_Contribute_BAO_ContributionPage
extends CRM_Contribute_DAO_ContributionPage
{
42 * takes an associative array and creates a contribution page object
44 * @param array $params (reference ) an assoc array of name/value pairs
46 * @return object CRM_Contribute_DAO_ContributionPage object
50 public static function &create(&$params) {
51 $financialTypeId = NULL;
52 if (!empty($params['id']) && !CRM_Price_BAO_PriceSet
::getFor('civicrm_contribution_page', $params['id'], NULL, 1)) {
53 $financialTypeId = CRM_Core_DAO
::getFieldValue('CRM_Contribute_DAO_ContributionPage', $params['id'], 'financial_type_id');
55 $dao = new CRM_Contribute_DAO_ContributionPage();
56 $dao->copyValues($params);
58 if ($financialTypeId && !empty($params['financial_type_id']) && $financialTypeId != $params['financial_type_id']) {
59 CRM_Price_BAO_PriceFieldValue
::updateFinancialType($params['id'], 'civicrm_contribution_page', $params['financial_type_id']);
65 * update the is_active flag in the db
67 * @param int $id id of the database record
68 * @param boolean $is_active value we want to set the is_active field
70 * @return Object DAO object on success, null otherwise
73 static function setIsActive($id, $is_active) {
74 return CRM_Core_DAO
::setFieldValue('CRM_Contribute_DAO_ContributionPage', $id, 'is_active', $is_active);
77 static function setValues($id, &$values) {
82 CRM_Core_DAO
::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $values);
84 // get the profile ids
85 $ufJoinParams = array(
86 'module' => 'CiviContribute',
87 'entity_table' => 'civicrm_contribution_page',
90 list($values['custom_pre_id'], $customPostIds) = CRM_Core_BAO_UFJoin
::getUFGroupIds($ufJoinParams);
92 if (!empty($customPostIds)) {
93 $values['custom_post_id'] = $customPostIds[0];
96 $values['custom_post_id'] = '';
98 // // add an accounting code also
99 // if ($values ['financial_type_id']) {
100 // $values ['accountingCode'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $values ['financial_type_id'], 'accounting_code' );
105 * Function to send the emails
107 * @param int $contactID contact id
108 * @param array $values associated array of fields
109 * @param boolean $isTest if in test mode
110 * @param boolean $returnMessageText return the message text instead of sending the mail
116 static function sendMail($contactID, &$values, $isTest = FALSE, $returnMessageText = FALSE, $fieldTypes = NULL) {
117 $gIds = $params = array();
119 if (isset($values['custom_pre_id'])) {
120 $preProfileType = CRM_Core_BAO_UFField
::getProfileType($values['custom_pre_id']);
121 if ($preProfileType == 'Membership' && !empty($values['membership_id'])) {
122 $params['custom_pre_id'] = array(
126 $values['membership_id'],
132 elseif ($preProfileType == 'Contribution' && !empty($values['contribution_id'])) {
133 $params['custom_pre_id'] = array(
137 $values['contribution_id'],
144 $gIds['custom_pre_id'] = $values['custom_pre_id'];
147 if (isset($values['custom_post_id'])) {
148 $postProfileType = CRM_Core_BAO_UFField
::getProfileType($values['custom_post_id']);
149 if ($postProfileType == 'Membership' && !empty($values['membership_id'])) {
150 $params['custom_post_id'] = array(
154 $values['membership_id'],
160 elseif ($postProfileType == 'Contribution' && !empty($values['contribution_id'])) {
161 $params['custom_post_id'] = array(
165 $values['contribution_id'],
172 $gIds['custom_post_id'] = $values['custom_post_id'];
175 if (!empty($values['is_for_organization'])) {
176 if (!empty($values['membership_id'])) {
177 $params['onbehalf_profile'] = array(
181 $values['membership_id'],
187 elseif (!empty($values['contribution_id'])) {
188 $params['onbehalf_profile'] = array(
192 $values['contribution_id'],
200 //check whether it is a test drive
201 if ($isTest && !empty($params['custom_pre_id'])) {
202 $params['custom_pre_id'][] = array(
211 if ($isTest && !empty($params['custom_post_id'])) {
212 $params['custom_post_id'][] = array(
221 if (!$returnMessageText && !empty($gIds)) {
222 //send notification email if field values are set (CRM-1941)
223 foreach ($gIds as $key => $gId) {
225 $email = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
227 $val = CRM_Core_BAO_UFGroup
::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array
::value($key, $params), true );
228 CRM_Core_BAO_UFGroup
::commonSendMail($contactID, $val);
234 if (!empty($values['is_email_receipt']) ||
!empty($values['onbehalf_dupe_alert']) ||
237 $template = CRM_Core_Smarty
::singleton();
239 // get the billing location type
240 if (!array_key_exists('related_contact', $values)) {
241 $locationTypes = CRM_Core_PseudoConstant
::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
242 $billingLocationTypeId = array_search('Billing', $locationTypes);
245 // presence of related contact implies onbehalf of org case,
246 // where location type is set to default.
247 $locType = CRM_Core_BAO_LocationType
::getDefault();
248 $billingLocationTypeId = $locType->id
;
251 if (!array_key_exists('related_contact', $values)) {
252 list($displayName, $email) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($contactID, FALSE, $billingLocationTypeId);
254 // get primary location email if no email exist( for billing location).
256 list($displayName, $email) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($contactID);
258 if (empty($displayName)) {
259 list($displayName, $email) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($contactID);
262 //for display profile need to get individual contact id,
263 //hence get it from related_contact if on behalf of org true CRM-3767
264 //CRM-5001 Contribution/Membership:: On Behalf of Organization,
265 //If profile GROUP contain the Individual type then consider the
266 //profile is of Individual ( including the custom data of membership/contribution )
267 //IF Individual type not present in profile then it is consider as Organization data.
268 $userID = $contactID;
269 if ($preID = CRM_Utils_Array
::value('custom_pre_id', $values)) {
270 if (!empty($values['related_contact'])) {
271 $preProfileTypes = CRM_Core_BAO_UFGroup
::profileGroups($preID);
272 if (in_array('Individual', $preProfileTypes) ||
in_array('Contact', $postProfileTypes)) {
273 //Take Individual contact ID
274 $userID = CRM_Utils_Array
::value('related_contact', $values);
277 self
::buildCustomDisplay($preID, 'customPre', $userID, $template, $params['custom_pre_id']);
279 $userID = $contactID;
280 if ($postID = CRM_Utils_Array
::value('custom_post_id', $values)) {
281 if (!empty($values['related_contact'])) {
282 $postProfileTypes = CRM_Core_BAO_UFGroup
::profileGroups($postID);
283 if (in_array('Individual', $postProfileTypes) ||
in_array('Contact', $postProfileTypes)) {
284 //Take Individual contact ID
285 $userID = CRM_Utils_Array
::value('related_contact', $values);
288 self
::buildCustomDisplay($postID, 'customPost', $userID, $template, $params['custom_post_id']);
290 if (isset($values['honor'])) {
291 $honorValues = $values['honor'];
292 CRM_Contribute_BAO_ContributionSoft
::formatHonoreeProfileFields(
294 $honorValues['honor_profile_values'],
295 $honorValues['honor_profile_id'],
296 $honorValues['honor_id']
300 $title = isset($values['title']) ?
$values['title'] : CRM_Contribute_PseudoConstant
::contributionPage($values['contribution_page_id']);
302 // set email in the template here
305 'receiptFromEmail' => CRM_Utils_Array
::value('receipt_from_email', $values),
306 'contactID' => $contactID,
307 'displayName' => $displayName,
308 'contributionID' => CRM_Utils_Array
::value('contribution_id', $values),
309 'contributionOtherID' => CRM_Utils_Array
::value('contribution_other_id', $values),
310 'membershipID' => CRM_Utils_Array
::value('membership_id', $values),
312 'lineItem' => CRM_Utils_Array
::value('lineItem', $values),
314 'priceSetID' => CRM_Utils_Array
::value('priceSetID', $values),
316 'isShare' => CRM_Utils_Array
::value('is_share', $values),
319 if ($contributionTypeId = CRM_Utils_Array
::value('financial_type_id', $values)) {
320 $tplParams['contributionTypeId'] = $contributionTypeId;
321 $tplParams['contributionTypeName'] = CRM_Core_DAO
::getFieldValue('CRM_Financial_DAO_FinancialType',
322 $contributionTypeId);
325 if ($contributionPageId = CRM_Utils_Array
::value('id', $values)) {
326 $tplParams['contributionPageId'] = $contributionPageId;
329 // address required during receipt processing (pdf and email receipt)
330 if ($displayAddress = CRM_Utils_Array
::value('address', $values)) {
331 $tplParams['address'] = $displayAddress;
335 $originalCCReceipt = CRM_Utils_Array
::value('cc_receipt', $values);
337 // cc to related contacts of contributor OR the one who
338 // signs up. Is used for cases like - on behalf of
339 // contribution / signup ..etc
340 if (array_key_exists('related_contact', $values)) {
341 list($ccDisplayName, $ccEmail) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($values['related_contact']);
342 $ccMailId = "{$ccDisplayName} <{$ccEmail}>";
344 $values['cc_receipt'] = !empty($values['cc_receipt']) ?
($values['cc_receipt'] . ',' . $ccMailId) : $ccMailId;
346 // reset primary-email in the template
347 $tplParams['email'] = $ccEmail;
349 $tplParams['onBehalfName'] = $displayName;
350 $tplParams['onBehalfEmail'] = $email;
352 $ufJoinParams = array(
353 'module' => 'onBehalf',
354 'entity_table' => 'civicrm_contribution_page',
355 'entity_id' => $values['id'],
357 $OnBehalfProfile = CRM_Core_BAO_UFJoin
::getUFGroupIds($ufJoinParams);
358 $profileId = $OnBehalfProfile[0];
359 $userID = $contactID;
360 self
::buildCustomDisplay($profileId, 'onBehalfProfile', $userID, $template, $params['onbehalf_profile'], $fieldTypes);
363 // use either the contribution or membership receipt, based on whether it’s a membership-related contrib or not
364 $sendTemplateParams = array(
365 'groupName' => $tplParams['membershipID'] ?
'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
366 'valueName' => $tplParams['membershipID'] ?
'membership_online_receipt' : 'contribution_online_receipt',
367 'contactId' => $contactID,
368 'tplParams' => $tplParams,
370 'PDFFilename' => 'receipt.pdf',
373 if ($returnMessageText) {
374 list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate
::sendTemplate($sendTemplateParams);
376 'subject' => $subject,
378 'to' => $displayName,
383 if ($values['is_email_receipt']) {
384 $sendTemplateParams['from'] = CRM_Utils_Array
::value('receipt_from_name', $values) . ' <' . $values['receipt_from_email'] . '>';
385 $sendTemplateParams['toName'] = $displayName;
386 $sendTemplateParams['toEmail'] = $email;
387 $sendTemplateParams['cc'] = CRM_Utils_Array
::value('cc_receipt', $values);
388 $sendTemplateParams['bcc'] = CRM_Utils_Array
::value('bcc_receipt', $values);
389 list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate
::sendTemplate($sendTemplateParams);
392 // send duplicate alert, if dupe match found during on-behalf-of processing.
393 if (!empty($values['onbehalf_dupe_alert'])) {
394 $sendTemplateParams['groupName'] = 'msg_tpl_workflow_contribution';
395 $sendTemplateParams['valueName'] = 'contribution_dupalert';
396 $sendTemplateParams['from'] = ts('Automatically Generated') . " <{$values['receipt_from_email']}>";
397 $sendTemplateParams['toName'] = CRM_Utils_Array
::value('receipt_from_name', $values);
398 $sendTemplateParams['toEmail'] = CRM_Utils_Array
::value('receipt_from_email', $values);
399 $sendTemplateParams['tplParams']['onBehalfID'] = $contactID;
400 $sendTemplateParams['tplParams']['receiptMessage'] = $message;
402 // fix cc and reset back to original, CRM-6976
403 $sendTemplateParams['cc'] = $originalCCReceipt;
405 CRM_Core_BAO_MessageTemplate
::sendTemplate($sendTemplateParams);
411 * Construct the message to be sent by the send function
414 function composeMessage($tplParams, $contactID, $isTest) {
415 $sendTemplateParams = array(
416 'groupName' => $tplParams['membershipID'] ?
'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
417 'valueName' => $tplParams['membershipID'] ?
'membership_online_receipt' : 'contribution_online_receipt',
418 'contactId' => $contactID,
419 'tplParams' => $tplParams,
421 'PDFFilename' => 'receipt.pdf',
423 if ($returnMessageText) {
424 list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate
::sendTemplate($sendTemplateParams);
426 'subject' => $subject,
428 'to' => $displayName,
435 * Function to send the emails for Recurring Contribution Notication
437 * @param string $type txnType
438 * @param int $contactID contact id for contributor
439 * @param int $pageID contribution page id
440 * @param object $recur object of recurring contribution table
441 * @param object $autoRenewMembership is it a auto renew membership.
447 static function recurringNotify($type, $contactID, $pageID, $recur, $autoRenewMembership = FALSE) {
450 CRM_Core_DAO
::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', $pageID, $value, array(
454 'receipt_from_email',
460 $isEmailReceipt = CRM_Utils_Array
::value('is_email_receipt', $value[$pageID]);
461 $isOfflineRecur = FALSE;
462 if (!$pageID && $recur->id
) {
463 $isOfflineRecur = TRUE;
465 if ($isEmailReceipt ||
$isOfflineRecur) {
467 $receiptFrom = '"' . CRM_Utils_Array
::value('receipt_from_name', $value[$pageID]) . '" <' . $value[$pageID]['receipt_from_email'] . '>';
469 $receiptFromName = $value[$pageID]['receipt_from_name'];
470 $receiptFromEmail = $value[$pageID]['receipt_from_email'];
473 $domainValues = CRM_Core_BAO_Domain
::getNameAndEmail();
474 $receiptFrom = "$domainValues[0] <$domainValues[1]>";
475 $receiptFromName = $domainValues[0];
476 $receiptFromEmail = $domainValues[1];
479 list($displayName, $email) = CRM_Contact_BAO_Contact_Location
::getEmailDetails($contactID, FALSE);
480 $templatesParams = array(
481 'groupName' => 'msg_tpl_workflow_contribution',
482 'valueName' => 'contribution_recurring_notify',
483 'contactId' => $contactID,
484 'tplParams' => array(
485 'recur_frequency_interval' => $recur->frequency_interval
,
486 'recur_frequency_unit' => $recur->frequency_unit
,
487 'recur_installments' => $recur->installments
,
488 'recur_start_date' => $recur->start_date
,
489 'recur_end_date' => $recur->end_date
,
490 'recur_amount' => $recur->amount
,
491 'recur_txnType' => $type,
492 'displayName' => $displayName,
493 'receipt_from_name' => $receiptFromName,
494 'receipt_from_email' => $receiptFromEmail,
495 'auto_renew_membership' => $autoRenewMembership,
497 'from' => $receiptFrom,
498 'toName' => $displayName,
503 $templatesParams['cc'] = CRM_Utils_Array
::value('cc_receipt', $value[$pageID]);
504 $templatesParams['bcc'] = CRM_Utils_Array
::value('bcc_receipt', $value[$pageID]);
507 // in some cases its just recurringNotify() thats called for the first time and these urls don't get set.
508 // like in PaypalPro, & therefore we set it here additionally.
509 $template = CRM_Core_Smarty
::singleton();
510 $paymentProcessor = CRM_Financial_BAO_PaymentProcessor
::getProcessorForEntity($recur->id
, 'recur', 'obj');
511 $url = $paymentProcessor->subscriptionURL($recur->id
, 'recur');
512 $template->assign('cancelSubscriptionUrl', $url);
514 $url = $paymentProcessor->subscriptionURL($recur->id
, 'recur', 'billing');
515 $template->assign('updateSubscriptionBillingUrl', $url);
517 $url = $paymentProcessor->subscriptionURL($recur->id
, 'recur', 'update');
518 $template->assign('updateSubscriptionUrl', $url);
521 list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate
::sendTemplate($templatesParams);
524 CRM_Core_Error
::debug_log_message('Success: mail sent for recurring notification.');
527 CRM_Core_Error
::debug_log_message('Failure: mail not sent for recurring notification.');
533 * Function to add the custom fields for contribution page (ie profile)
535 * @param int $gid uf group id
536 * @param string $name
537 * @param int $cid contact id
538 * @param array $params params to build component whereclause
544 public static function buildCustomDisplay($gid, $name, $cid, &$template, &$params, $fieldTypes = NULL) {
546 if (CRM_Core_BAO_UFGroup
::filterUFGroups($gid, $cid)) {
549 $fields = CRM_Core_BAO_UFGroup
::getFields($gid, FALSE, CRM_Core_Action
::VIEW
, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission
::CREATE
, NULL);
550 foreach ($fields as $k => $v) {
552 $groupTitle = $v["groupTitle"];
554 // suppress all file fields from display and formatting fields
556 CRM_Utils_Array
::value('data_type', $v, '') == 'File' ||
557 CRM_Utils_Array
::value('name', $v, '') == 'image_URL' ||
558 CRM_Utils_Array
::value('field_type', $v) == 'Formatting'
563 if (!empty($fieldTypes) && (!in_array($v['field_type'], $fieldTypes))) {
569 $template->assign($name . "_grouptitle", $groupTitle);
572 CRM_Core_BAO_UFGroup
::getValues($cid, $fields, $values, FALSE, $params);
574 if (count($values)) {
575 $template->assign($name, $values);
582 * This function is to make a copy of a contribution page, including
583 * all the blocks in the page
585 * @param int $id the contribution page id to copy
587 * @return the copy object
591 static function copy($id) {
594 'title' => ts('Copy of') . ' ',
597 $copy = &CRM_Core_DAO
::copyGeneric('CRM_Contribute_DAO_ContributionPage', array(
599 ), NULL, $fieldsFix);
601 //copying all the blocks pertaining to the contribution page
602 $copyPledgeBlock = &CRM_Core_DAO
::copyGeneric('CRM_Pledge_DAO_PledgeBlock', array(
604 'entity_table' => 'civicrm_contribution_page',
606 'entity_id' => $copy->id
,
609 $copyMembershipBlock = &CRM_Core_DAO
::copyGeneric('CRM_Member_DAO_MembershipBlock', array(
611 'entity_table' => 'civicrm_contribution_page',
613 'entity_id' => $copy->id
,
616 $copyUFJoin = &CRM_Core_DAO
::copyGeneric('CRM_Core_DAO_UFJoin', array(
618 'entity_table' => 'civicrm_contribution_page',
620 'entity_id' => $copy->id
,
623 $copyWidget = &CRM_Core_DAO
::copyGeneric('CRM_Contribute_DAO_Widget', array(
624 'contribution_page_id' => $id,
626 'contribution_page_id' => $copy->id
,
630 CRM_Price_BAO_PriceSet
::copyPriceSet('civicrm_contribution_page', $id, $copy->id
);
632 $copyTellFriend = &CRM_Core_DAO
::copyGeneric('CRM_Friend_DAO_Friend', array(
634 'entity_table' => 'civicrm_contribution_page',
636 'entity_id' => $copy->id
,
639 $copyPersonalCampaignPages = &CRM_Core_DAO
::copyGeneric('CRM_PCP_DAO_PCPBlock', array(
641 'entity_table' => 'civicrm_contribution_page',
643 'entity_id' => $copy->id
,
646 $copyPremium = &CRM_Core_DAO
::copyGeneric('CRM_Contribute_DAO_Premium', array(
648 'entity_table' => 'civicrm_contribution_page',
650 'entity_id' => $copy->id
,
654 FROM civicrm_premiums
655 WHERE entity_table = 'civicrm_contribution_page'
656 AND entity_id ={$id}";
658 $premiumDao = CRM_Core_DAO
::executeQuery($premiumQuery, CRM_Core_DAO
::$_nullArray);
659 while ($premiumDao->fetch()) {
660 if ($premiumDao->id
) {
661 $copyPremiumProduct = & CRM_Core_DAO
::copyGeneric('CRM_Contribute_DAO_PremiumsProduct', array(
662 'premiums_id' => $premiumDao->id
,
664 'premiums_id' => $copyPremium->id
,
671 CRM_Utils_Hook
::copy('ContributionPage', $copy);
677 * Function to check if contribution page contains payment
678 * processor that supports recurring payment
680 * @param int $contributionPageId Contribution Page Id
682 * @return boolean true if payment processor supports recurring
688 static function checkRecurPaymentProcessor($contributionPageId) {
692 FROM civicrm_contribution_page cp,
693 civicrm_payment_processor pp
694 WHERE cp.payment_processor = pp.id
695 AND cp.id = {$contributionPageId}
698 if ($recurring = &CRM_Core_DAO
::singleValueQuery($sql, CRM_Core_DAO
::$_nullArray)) {
705 * Function to get info for all sections enable/disable.
707 * @return array $info info regarding all sections.
711 static function getSectionInfo($contribPageIds = array()) {
714 if (is_array($contribPageIds) && !empty($contribPageIds)) {
715 $whereClause = 'WHERE civicrm_contribution_page.id IN ( ' . implode(', ', $contribPageIds) . ' )';
730 SELECT civicrm_contribution_page.id as id,
731 civicrm_contribution_page.financial_type_id as settings,
732 amount_block_is_active as amount,
733 civicrm_membership_block.id as membership,
734 civicrm_uf_join.id as custom,
735 civicrm_contribution_page.thankyou_title as thankyou,
736 civicrm_tell_friend.id as friend,
737 civicrm_pcp_block.id as pcp,
738 civicrm_contribution_widget.id as widget,
739 civicrm_premiums.id as premium
740 FROM civicrm_contribution_page
741 LEFT JOIN civicrm_membership_block ON ( civicrm_membership_block.entity_id = civicrm_contribution_page.id
742 AND civicrm_membership_block.entity_table = 'civicrm_contribution_page'
743 AND civicrm_membership_block.is_active = 1 )
744 LEFT JOIN civicrm_uf_join ON ( civicrm_uf_join.entity_id = civicrm_contribution_page.id
745 AND civicrm_uf_join.entity_table = 'civicrm_contribution_page'
746 AND module = 'CiviContribute'
747 AND civicrm_uf_join.is_active = 1 )
748 LEFT JOIN civicrm_tell_friend ON ( civicrm_tell_friend.entity_id = civicrm_contribution_page.id
749 AND civicrm_tell_friend.entity_table = 'civicrm_contribution_page'
750 AND civicrm_tell_friend.is_active = 1)
751 LEFT JOIN civicrm_pcp_block ON ( civicrm_pcp_block.entity_id = civicrm_contribution_page.id
752 AND civicrm_pcp_block.entity_table = 'civicrm_contribution_page'
753 AND civicrm_pcp_block.is_active = 1 )
754 LEFT JOIN civicrm_contribution_widget ON ( civicrm_contribution_widget.contribution_page_id = civicrm_contribution_page.id
755 AND civicrm_contribution_widget.is_active = 1 )
756 LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm_contribution_page.id
757 AND civicrm_premiums.entity_table = 'civicrm_contribution_page'
758 AND civicrm_premiums.premiums_active = 1 )
761 $contributionPage = CRM_Core_DAO
::executeQuery($query);
762 while ($contributionPage->fetch()) {
763 if (!isset($info[$contributionPage->id
]) ||
!is_array($info[$contributionPage->id
])) {
764 $info[$contributionPage->id
] = array_fill_keys(array_values($sections), FALSE);
766 foreach ($sections as $section) {
767 if ($contributionPage->$section) {
768 $info[$contributionPage->id
][$section] = TRUE;