//CRM-15297 - contributionType is obsolete - pass financial type as well so people can deprecate it
$paymentParams['financialType_name'] = $paymentParams['contributionType_name'] = $form->_params['contributionType_name'] = $contributionType->name;
//CRM-11456
- $paymentParams['financialType_accounting_code'] = $paymentParams['contributionType_accounting_code'] = $form->_params['contributionType_accounting_code'] = CRM_Financial_BAO_FinancialAccount::getAccountingCode($contributionTypeId);
+ $paymentParams['financialType_accounting_code'] = $paymentParams['contributionType_accounting_code'] = $form->_params['contributionType_accounting_code'] = CRM_Financial_BAO_FinancialAccount::getAccountingCode($contributionTypeId);
$paymentParams['contributionPageID'] = $form->_params['contributionPageID'] = $form->_values['id'];
-
$payment = NULL;
$paymentObjError = ts('The system did not record payment details for this payment and so could not process the transaction. Please report this error to the site administrator.');
);
if ($contribution) {
- $form->_params['contributionID'] = $contribution->id;
+ $form->_params['contributionID'] = $contribution->id;
}
$form->_params['contributionTypeID'] = $contributionTypeId;
// finally send an email receipt
if ($contribution) {
- $form->_values['contribution_id'] = $contribution->id;
+ $form->_values['contribution_id'] = $contribution->id;
CRM_Contribute_BAO_ContributionPage::sendMail($contactID,
$form->_values, $contribution->is_test,
FALSE, $fieldTypes
- );
- }
+ );
+ }
}
/**
}
if (!CRM_Utils_System::isNull($params['email'])) {
$params['email'] = array(
- 1 => array('email' => $params['email'],
+ 1 => array(
+ 'email' => $params['email'],
'location_type_id' => $billingLocTypeId,
));
}
*/
public static function calculateTaxAmount($amount, $taxRate) {
$taxAmount = array();
- $taxAmount['tax_amount'] = ($taxRate/100) * CRM_Utils_Rule::cleanMoney($amount);
+ $taxAmount['tax_amount'] = ($taxRate / 100) * CRM_Utils_Rule::cleanMoney($amount);
return $taxAmount;
}
// if ($values ['financial_type_id']) {
// $values ['accountingCode'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $values ['financial_type_id'], 'accounting_code' );
// }
- }
+ }
/**
* Send the emails
if ($gId) {
$email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
if ($email) {
- $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), true );
+ $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), TRUE );
CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val);
}
}
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if (count($taxAmt) > 0 && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
- $sendTemplateParams['isEmailPdf'] = True;
+ $sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $values['contribution_id'];
}
list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
case 'financial_type_id':
// Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
- break;
+
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
/**
* Get or Set multilingually affected honor params for processing module_data or setting default values.
*
- * @param array|String $params: Array when we need to format it according to language state or String as a json encode
+ * @param string $params:
* @param bool $setDefault: If yes then returns array to used for setting default value afterward
*
* @return array|string
else {
//if in multilingual state then retrieve the module_data against this contribution and
//merge with earlier module_data json data to current so not to lose earlier multilingual module_data information
- $sctJson = array(
+ $sctJson = array(
'soft_credit' => array(
'soft_credit_types' => $params['soft_credit_types'],
- $config->lcMessages => array (
+ $config->lcMessages => array(
'honor_block_title' => $params['honor_block_title'],
'honor_block_text' => $params['honor_block_text']
)
$ufJoinDAO->find(TRUE);
$jsonData = json_decode($ufJoinDAO->module_data);
if ($jsonData) {
- $sctJson['soft_credit'] = array_merge((array)$jsonData->soft_credit, $sctJson['soft_credit']);
+ $sctJson['soft_credit'] = array_merge((array) $jsonData->soft_credit, $sctJson['soft_credit']);
}
$sctJson = json_encode($sctJson);
}
return $sctJson;
}
- /**
+ /**
* Generate html for pdf in confirmation receipt email attachment
* @param int $contributionId
* Contribution Page Id.
else {
$details .= '
<br/>' . ts('The recurring contribution of %1, every %2 %3 has been cancelled.', array(
- 1 => $dao->amount,
+ 1 => $dao->amount,
2 => $dao->frequency_interval,
3 => $dao->frequency_unit
));
WHERE cc.is_test = %2 AND ccs.contact_id = %1
GROUP BY currency';
- $params = array(1 => array($contact_id, 'Integer'),
+ $params = array(
+ 1 => array($contact_id, 'Integer'),
2 => array($isTest, 'Integer'));
$cs = CRM_Core_DAO::executeQuery($query, $params);
*
* @return array
*/
- public static function getSoftCreditIds($contributionID , $isPCP = FALSE) {
+ public static function getSoftCreditIds($contributionID, $isPCP = FALSE) {
$query = "
SELECT id
FROM civicrm_contribution_soft
);
unset($profileFields['prefix_id']);
}
- $honorName .= ' ' . $params['first_name'] . ' ' . $params['last_name'];
- unset($profileFields['first_name']);
- unset($profileFields['last_name']);
- if (array_key_exists('suffix_id', $params)) {
- $honorName .= ' ' . CRM_Utils_Array::value(CRM_Utils_Array::value('suffix_id', $params),
+ $honorName .= ' ' . $params['first_name'] . ' ' . $params['last_name'];
+ unset($profileFields['first_name']);
+ unset($profileFields['last_name']);
+ if (array_key_exists('suffix_id', $params)) {
+ $honorName .= ' ' . CRM_Utils_Array::value(CRM_Utils_Array::value('suffix_id', $params),
CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id')
);
- unset($profileFields['suffix_id']);
- }
- break;
- case 'Organization':
- $honorName = $params['organization_name'];
- unset($profileFields['organization_name']);
- break;
- case 'Household':
- $honorName = $params['household_name'];
- unset($profileFields['household_name']);
- break;
+ unset($profileFields['suffix_id']);
+ }
+ break;
+
+ case 'Organization':
+ $honorName = $params['organization_name'];
+ unset($profileFields['organization_name']);
+ break;
+
+ case 'Household':
+ $honorName = $params['household_name'];
+ unset($profileFields['household_name']);
+ break;
}
if ($honorId) {
}
/**
- * add the financial types
+ * add the financial types
*
* @param array $params
* Reference array contains the values submitted by the form.
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/contribute/managePremiums', 'reset=1&action=browse'));
}
- //delete from financial Type table
+ //delete from financial Type table
$premium = new CRM_Contribute_DAO_Product();
$premium->id = $productID;
$premium->delete();
public static function del($premiumID) {
//check dependencies
- //delete from financial Type table
+ //delete from financial Type table
$premium = new CRM_Contribute_DAO_Premium();
$premium->id = $premiumID;
$premium->delete();
}
elseif ($this->_action == CRM_Core_Action::ADD) {
$condition = " AND is_default = 1";
- $values = CRM_Core_OptionGroup::values('financial_account_type', false, false, false, $condition);
+ $values = CRM_Core_OptionGroup::values('financial_account_type', FALSE, FALSE, FALSE, $condition);
$defaults['financial_account_type_id'] = array_keys($values);
$defaults['is_active'] = 1;
class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_ContributionBase {
/**
- *Define default MembershipType Id
+ * Define default MembershipType Id
*
*/
public $_defaultMemTypeId;
CRM_Contact_Form_ProfileContact::buildQuickForm($this);
}
-
//don't build pledge block when mid is passed
if (!$this->_mid) {
$config = CRM_Core_Config::singleton();
// CRM 10860, display text instead of a dropdown if there's only 1 frequency unit
if(sizeof($unitVals) == 1) {
- $form->assign('one_frequency_unit', true);
+ $form->assign('one_frequency_unit', TRUE);
$unit = $unitVals[0];
$form->add('hidden', 'frequency_unit', $unit);
if (!empty($form->_values['is_recur_interval']) || $className == 'CRM_Contribute_Form_Contribution') {
}
$form->assign('frequency_unit', $unit);
} else {
- $form->assign('one_frequency_unit', false);
+ $form->assign('one_frequency_unit', FALSE);
$units = array();
$frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
foreach ($unitVals as $key => $val) {
$frequencyUnit = &$form->add('select', 'frequency_unit', NULL, $units);
}
-
// FIXME: Ideally we should freeze select box if there is only
// one option but looks there is some problem /w QF freeze.
//if ( count( $units ) == 1 ) {
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
if ($is_quick_config) {
foreach ($this->_priceSet['fields'] as $fieldKey => $fieldVal) {
- if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey ])) {
+ if ($fieldVal['name'] == 'membership_amount' && !empty($params['price_' . $fieldKey])) {
$fieldId = $fieldVal['id'];
$fieldOption = $params['price_' . $fieldId];
$proceFieldAmount += $fieldVal['options'][$this->_submitValues['price_' . $fieldId]]['amount'];
}
}
}
-
+
if (!isset($params['amount_other'])) {
$this->set('amount_level', CRM_Utils_Array::value('amount_level', $params));
}
$lineItem = array();
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config' );
if ( $is_quick_config ) {
- foreach ( $this->_values['fee'] as $key => & $val ) {
+ foreach ( $this->_values['fee'] as $key => & $val ) {
if ( $val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists( 'price_'.$key, $params ) ) {
$params['price_'.$key] = CRM_Utils_Rule::cleanMoney($params['price_'.$key]); //Clean out any currency symbols
if ( $params['price_'.$key] != 0 ) {
// redirect to thank you page
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_ThankYou_display=1&qfKey=$qfKey", TRUE, NULL, FALSE));
}
-
+
}
/**
$this->assign('useForMember', $this->get('useForMember'));
$params = $this->_params;
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
if ($invoicing) {
$getTaxDetails = FALSE;
$this->assign('totalTaxAmount', $params['tax_amount']);
}
if ($this->_honor_block_is_active && !empty($params['soft_credit_type_id'])) {
- $honorName = null;
+ $honorName = NULL;
$softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
$this->assign('honor_block_is_active', $this->_honor_block_is_active);
}
}
- $this->assign( 'qParams' , $qParams );
+ $this->assign( 'qParams', $qParams );
if ($membershipTypeID) {
$transactionID = $this->get('membership_trx_id');
public $_action;
- /**
- * Is honor block is enabled for this contribution?
- *
- * @var boolean
- */
+ /**
+ * Is honor block is enabled for this contribution?
+ *
+ * @var boolean
+ */
public $_honor_block_is_active = FALSE;
/**
krsort($this->_years);
}
foreach ($this->_years as $k => $v) {
- $years[substr($k,0,4)] = substr($k,0,4);
+ $years[substr($k, 0, 4)] = substr($k, 0, 4);
}
}
if ($chartKey == 'by_year') {
$yearlyChart = TRUE;
if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] !== 1 || $config->fiscalYearStart['d'] !== 1)) {
- $values['xLabelAngle'] = 45 ;
+ $values['xLabelAngle'] = 45;
} else {
- $values['xLabelAngle'] = 0 ;
+ $values['xLabelAngle'] = 0;
}
}
if ($chartKey == 'by_month') {
}
elseif ($chartKey == 'by_year') {
if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) {
- $startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index,0,4)));
- $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index,0,4)) + 1));
+ $startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index, 0, 4)));
+ $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1));
}
else {
- $startDate = CRM_Utils_Date::format(array('Y' => substr($index,0,4)));
- $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index,0,4)));
+ $startDate = CRM_Utils_Date::format(array('Y' => substr($index, 0, 4)));
+ $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4)));
}
$urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
}
$this->addElement('hidden', 'cancelURL', $this->_cancelURL);
}
-
if ($this->_single) {
$this->addButtons(array(
array(
case 'Contribute':
$attributes = $this->getVar('_attributes');
$subPage = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
- $subPageName = ucFirst($subPage);
+ $subPageName = ucfirst($subPage);
if ($subPage == 'friend') {
$nextPage = 'custom';
}
$dao->id = $this->_pid;
$dao->find(TRUE);
$defaults['product_id'] = $dao->product_id;
- $defaults['financial_type_id'] = $dao->financial_type_id;
+ $defaults['financial_type_id'] = $dao->financial_type_id;
$defaults['weight'] = $dao->weight;
} else {
$dao = new CRM_Contribute_DAO_Product();
CRM_Core_PseudoConstant::populate(
$premiumFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
+ $all = TRUE,
$retrieve = 'entity_id',
- $filter = null,
+ $filter = NULL,
'account_relationship = 8'
);
CRM_Core_PseudoConstant::populate(
$costFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
+ $all = TRUE,
$retrieve = 'entity_id',
- $filter = null,
+ $filter = NULL,
'account_relationship = 7'
);
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
foreach( $financialType as $key => $financialTypeName ){
- if(!in_array( $key, $productFinancialType))
+ if(!in_array( $key, $productFinancialType)) {
unset( $financialType[$key] );
+ }
}
if( count( $financialType ) ){
$this->assign( 'financialType', $financialType );
'select',
'financial_type_id',
ts( 'Financial Type' ),
- array(''=>ts('- select -')) + $financialType
+ array('' => ts('- select -')) + $financialType
);
$this->addRule('weight', ts('Please enter integer value for weight'), 'integer');
$session->pushUserContext(CRM_Utils_System::url($urlParams, 'action=update&reset=1&id=' . $this->_id));
array(' ', ' ', ' ', '<br/>')
);
-
//check if selected payment processor supports recurring payment
if (!empty($recurringPaymentProcessor)) {
$this->addElement('checkbox', 'is_recur', ts('Recurring Contributions'), NULL,
$paymentProcessorID,
'payment_processor_type_id'
);
- $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, $paymentProcessorTypeId, 'name');
+ $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, $paymentProcessorTypeId, 'name');
if ($paymentProcessorType == 'Google_Checkout') {
$errors['is_recur_interval'] = ts('Google Checkout does not support recurring intervals');
break;
if (isset($values[$i]) &&
(strlen(trim($values[$i])) > 0)
) {
- $options[] = array('label' => trim($labels[$i]),
+ $options[] = array(
+ 'label' => trim($labels[$i]),
'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])),
'weight' => $i,
'is_active' => 1,
);
}
}
- /* || !empty($params['price_field_value']) || CRM_Utils_Array::value( 'price_field_other', $params )*/
+ /* || !empty($params['price_field_value']) || CRM_Utils_Array::value( 'price_field_other', $params )*/
if (!empty($options) || !empty($params['is_allow_other_amount'])) {
$fieldParams['is_quick_config'] = 1;
$noContriAmount = NULL;
$setParams['name'] = $pageTitle . '_' . $this->_id;
}
else {
- $timeSec = explode(".", microtime(true));
+ $timeSec = explode(".", microtime(TRUE));
$setParams['name'] = $pageTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
CRM_Price_BAO_PriceField::setIsActive($priceFieldId, '0');
}
}
- else $priceFieldId = CRM_Utils_Array::value('price_field_other', $params);
+ else { $priceFieldId = CRM_Utils_Array::value('price_field_other', $params);
+ }
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceFieldId, 'price_set_id');
}
CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $this->_id, $priceSetId);
}
if ($deleteAmountBlk ) {
- $priceField = !empty($params['price_field_id']) ?$params['price_field_id']:CRM_Utils_Array::value('price_field_other', $params);
+ $priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : CRM_Utils_Array::value('price_field_other', $params);
if ($priceField) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id');
- CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0);
+ CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
}
}
CRM_Utils_System::setTitle(ts('Include Profiles') . " ($title)");
}
-
$ufJoinParams = array(
'module' => 'CiviContribute',
'entity_table' => 'civicrm_contribution_page',
$second) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$defaults['custom_post_id'] = $second ? array_shift($second) : '';
-
return $defaults;
}
// CRM-10999 Control label and position for No Thank-you radio button
$this->add('text', 'premiums_nothankyou_label', ts('No Thank-you Label'), $attributes['premiums_nothankyou_label']);
$positions = array(1 => ts('Before Premiums'), 2 => ts('After Premiums'));
- $this->add('select','premiums_nothankyou_position', ts('No Thank-you Option'), $positions);
+ $this->add('select', 'premiums_nothankyou_position', ts('No Thank-you Option'), $positions);
$showForm = TRUE;
if ($this->_single) {
)
);
-
foreach ($ufJoinParams as $index => $ufJoinParam) {
if (!empty($params[$index])) {
- $ufJoinParam['weight'] = 1;
- if ($index == 'honor_block_is_active') {
- $ufJoinParam['is_active'] = 1;
- $ufJoinParam['module'] = 'soft_credit';
- $ufJoinParam['uf_group_id'] = $params['honoree_profile'];
- $ufJoinParam['module_data'] = $sctJSON;
- }
- else {
- // first delete all past entries
- CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam);
- $ufJoinParam['uf_group_id'] = $params[$index];
- }
- CRM_Core_BAO_UFJoin::create($ufJoinParam);
+ $ufJoinParam['weight'] = 1;
+ if ($index == 'honor_block_is_active') {
+ $ufJoinParam['is_active'] = 1;
+ $ufJoinParam['module'] = 'soft_credit';
+ $ufJoinParam['uf_group_id'] = $params['honoree_profile'];
+ $ufJoinParam['module_data'] = $sctJSON;
+ }
+ else {
+ // first delete all past entries
+ CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam);
+ $ufJoinParam['uf_group_id'] = $params[$index];
}
+ CRM_Core_BAO_UFJoin::create($ufJoinParam);
+ }
elseif ($index == 'honor_block_is_active') {
//On subsequent honor_block_is_active uncheck, disable(don't delete)
//that particular honoree profile entry in UFjoin table, CRM-13981
$form->assign_by_ref('tabHeader', $tabs);
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
- ->addSetting(array('tabSettings' => array(
+ ->addSetting(array(
+ 'tabSettings' => array(
'active' => self::getCurrentTab($tabs),
)));
return $tabs;
}
$tabs = array(
- 'settings' => array('title' => ts('Title'),
+ 'settings' => array(
+ 'title' => ts('Title'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'amount' => array('title' => ts('Amounts'),
+ 'amount' => array(
+ 'title' => ts('Amounts'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'membership' => array('title' => ts('Memberships'),
+ 'membership' => array(
+ 'title' => ts('Memberships'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'thankyou' => array('title' => ts('Receipt'),
+ 'thankyou' => array(
+ 'title' => ts('Receipt'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'friend' => array('title' => ts('Tell a Friend'),
+ 'friend' => array(
+ 'title' => ts('Tell a Friend'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'custom' => array('title' => ts('Profiles'),
+ 'custom' => array(
+ 'title' => ts('Profiles'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'premium' => array('title' => ts('Premiums'),
+ 'premium' => array(
+ 'title' => ts('Premiums'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'widget' => array('title' => ts('Widgets'),
+ 'widget' => array(
+ 'title' => ts('Widgets'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
'current' => FALSE,
),
- 'pcp' => array('title' => ts('Personal Campaigns'),
+ 'pcp' => array(
+ 'title' => ts('Personal Campaigns'),
'link' => NULL,
'valid' => FALSE,
'active' => FALSE,
$this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_title'), TRUE);
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_text');
- $attributes['click_wysiwyg'] = true;
+ $attributes['click_wysiwyg'] = TRUE;
$this->addWysiwyg('thankyou_text', ts('Thank-you Message'), $attributes);
// FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing
// explicit height and width.
$footerAttribs = array(
'rows' => 2,
'cols' => 40,
- 'click_wysiwyg' => true,
+ 'click_wysiwyg' => TRUE,
);
$this->addWysiwyg('thankyou_footer', ts('Thank-you Footer'), $footerAttribs);
'title'
);
- $this->_fields = array('title' => array(ts('Title'),
+ $this->_fields = array(
+ 'title' => array(ts('Title'),
'text',
FALSE,
$title,
),
);
- $this->_colorFields = array('color_title' => array(ts('Title Text Color'),
+ $this->_colorFields = array(
+ 'color_title' => array(ts('Title Text Color'),
'text',
FALSE,
'#2786C2',
// assign values to the template
$this->assign($values);
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$this->assign('invoicing', $invoicing);
if ($invoicing && isset($values['tax_amount'])) {
$this->add('file', 'uploadFile', ts('Image File Name'), 'onChange="select_option();"');
-
$this->add('text', 'price', ts('Market Value'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'price'), TRUE);
$this->addRule('price', ts('Please enter the Market Value for this product.'), 'money');
CRM_Core_PseudoConstant::populate(
$premiumFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
+ $all = TRUE,
$retrieve = 'entity_id',
- $filter = null,
+ $filter = NULL,
'account_relationship = 8'
);
CRM_Core_PseudoConstant::populate(
$costFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
+ $all = TRUE,
$retrieve = 'entity_id',
- $filter = null,
+ $filter = NULL,
'account_relationship = 7'
);
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
foreach( $financialType as $key => $financialTypeName ){
- if(!in_array( $key, $productFinancialType))
+ if(!in_array( $key, $productFinancialType)) {
unset( $financialType[$key] );
+ }
}
if( count( $financialType ) ){
$this->assign( 'financialType', $financialType );
'select',
'financial_type_id',
ts( 'Financial Type' ),
- array(''=>ts('- select -')) + $financialType
+ array('' => ts('- select -')) + $financialType
);
$this->add('checkbox', 'is_active', ts('Enabled?'));
$errors['frequency_interval'] = ts('Please enter the Frequency Interval for this subscription or service.');
}
-
return empty($errors) ? TRUE : $errors;
}
$gdSupport = CRM_Utils_System::getModuleSetting('gd', 'GD Support');
if($gdSupport) {
if($imageFile) {
- $error = false;
+ $error = FALSE;
$params['image'] = $this->_resizeImage($imageFile, "_full", 200, 200);
$params['thumbnail'] = $this->_resizeImage($imageFile, "_thumb", 50, 50);
}
} else {
- $error = true;
+ $error = TRUE;
$params['image'] = $config->resourceBase . 'i/contribute/default_premium.jpg';
$params['thumbnail'] = $config->resourceBase . 'i/contribute/default_premium_thumb.jpg';
}
// save the resized image
$fp = fopen($newFilename, 'w+');
ob_start();
- ImageJPEG($image);
+ imagejpeg($image);
$image_buffer = ob_get_contents();
ob_end_clean();
- ImageDestroy($image);
+ imagedestroy($image);
fwrite($fp, $image_buffer);
rewind($fp);
fclose($fp);
}
public function setDefaultValues() {
- if (empty($this->_defaults
-['contribution_status'])) {
+ if (empty($this->_defaults['contribution_status'])) {
$this->_defaults['contribution_status'][1] = 1;
}
return $this->_defaults;
}
}
-
if (!$config->groupTree) {
$group = CRM_Utils_Array::value('group', $this->_formValues);
if ($group && !is_array($group)) {
return;
}
-
$sortID = NULL;
if ($this->get(CRM_Utils_Sort::SORT_ID)) {
$sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID),
$form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE);
}
}
- return $form;
+ return $form;
}
// by default generate 5 blocks
}
else {
$queryParams = $form->get('queryParams');
- $sortOrder = null;
+ $sortOrder = NULL;
if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
$sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
}
)
);
-
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_contributionIds);
* @return string
*/
static public function putFile($html) {
- require_once("packages/dompdf/dompdf_config.inc.php");
+ require_once "packages/dompdf/dompdf_config.inc.php";
spl_autoload_register('DOMPDF_autoload');
$doc = new DOMPDF();
$doc->load_html($html);
$url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
$breadCrumb = array(
- array('url' => $url,
+ array(
+ 'url' => $url,
'title' => ts('Search Results'),
));
$values = array();
$mail = $elements['baseIPN']->sendMail($input, $ids, $objects, $values, FALSE, $elements['createPdf']);
-
if ($mail['html']) {
$message[] = $mail['html'];
}
(empty($params['override_privacy']) && !empty($values['do_not_email']))
|| CRM_Utils_Array::value('is_deceased', $values)
|| !empty($values['on_hold'])) {
- $suppressedEmails++;
- $pdfElements['suppressedEmails'] = $suppressedEmails;
- $excludeContactIds[] = $values['contact_id'];
+ $suppressedEmails++;
+ $pdfElements['suppressedEmails'] = $suppressedEmails;
+ $excludeContactIds[] = $values['contact_id'];
}
}
}
return ($within == $total);
}
- /**
- *
- * @param string $html_message
- * @param array $contact
- * @param array $contribution
- * @param array $messageToken
- * @param array $categories
- * @param bool $grouped
- * Does this letter represent more than one contribution.
- * @param string $separator
- * What is the preferred letter separator.
- * @return string
- */
- private static function resolveTokens($html_message, $contact, $contribution, $messageToken, $categories, $grouped, $separator) {
- $tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact, TRUE, $messageToken);
- if($grouped) {
- $tokenHtml = CRM_Utils_Token::replaceMultipleContributionTokens($separator, $tokenHtml, $contribution, TRUE, $messageToken);
- }
- else {
- // no change to normal behaviour to avoid risk of breakage
- $tokenHtml = CRM_Utils_Token::replaceContributionTokens($tokenHtml, $contribution, TRUE, $messageToken);
- }
- $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact, $categories, TRUE);
- if (defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY) {
+ /**
+ *
+ * @param string $html_message
+ * @param array $contact
+ * @param array $contribution
+ * @param array $messageToken
+ * @param array $categories
+ * @param bool $grouped
+ * Does this letter represent more than one contribution.
+ * @param string $separator
+ * What is the preferred letter separator.
+ * @return string
+ */
+ private static function resolveTokens($html_message, $contact, $contribution, $messageToken, $categories, $grouped, $separator) {
+ $tokenHtml = CRM_Utils_Token::replaceContactTokens($html_message, $contact, TRUE, $messageToken);
+ if($grouped) {
+ $tokenHtml = CRM_Utils_Token::replaceMultipleContributionTokens($separator, $tokenHtml, $contribution, TRUE, $messageToken);
+ }
+ else {
+ // no change to normal behaviour to avoid risk of breakage
+ $tokenHtml = CRM_Utils_Token::replaceContributionTokens($tokenHtml, $contribution, TRUE, $messageToken);
+ }
+ $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $contact, $categories, TRUE);
+ if (defined('CIVICRM_MAIL_SMARTY') && CIVICRM_MAIL_SMARTY) {
$smarty = CRM_Core_Smarty::singleton();
// also add the tokens to the template
$smarty->assign_by_ref('contact', $contact);
//@todo find out why this happens & add comments
list($contactID) = explode('-', $item);
$contactID = (int) $contactID;
- }
+ }
else {
- $contactID = $contribution['contact_id'];
+ $contactID = $contribution['contact_id'];
}
if(!isset($contacts[$contactID])) {
list($contact) = CRM_Utils_Token::getTokenDetails(array('contact_id' => $contactID),
*
* @return void
*/
- public function preProcess() {}
+ public function preProcess() {
+ }
/**
* Build the form object
array('CRM_Contribute_DAO_Contribution', $dao->contribution_id, 'trxn_id')
);
-
$row['fee_amount'] = &$this->add('text', "fee_amount_{$row['contribution_id']}", ts('Fee Amount'),
$attributes['fee_amount']
);
case 'currency':
return CRM_Utils_Rule::currencyCode($this->_value);
- case 'financial_type':
+ case 'financial_type':
static $contributionTypes = NULL;
if (!$contributionTypes) {
- $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
+ $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
}
if (in_array($this->_value, $contributionTypes)) {
return TRUE;
else {
return FALSE;
}
- break;
+ break;
case 'payment_instrument':
static $paymentInstruments = NULL;
);
}
if(!empty($mapperKeysValues) && $mapperKeysValues[$i][0] == 'soft_credit') {
- $js .="cj('#mapper_".$i."_1').val($mapperKeysValues[$i][1]);\n";
- $js .="cj('#mapper_".$i."_2').val($mapperKeysValues[$i][2]);\n";
+ $js .= "cj('#mapper_".$i."_1').val($mapperKeysValues[$i][1]);\n";
+ $js .= "cj('#mapper_".$i."_2').val($mapperKeysValues[$i][2]);\n";
}
}
- $sel->setOptions(array($sel1, $sel2, $sel3,$sel4));
+ $sel->setOptions(array($sel1, $sel2, $sel3, $sel4));
}
$js .= "</script>\n";
$this->assign('initHideBoxes', $js);
if (isset($mapperKeys[$i][0]) && $mapperKeys[$i][0] == 'soft_credit') {
$mapperSoftCredit[$i] = $mapperKeys[$i][1];
- if (strpos($mapperSoftCredit[$i], '_') !== false) {
+ if (strpos($mapperSoftCredit[$i], '_') !== FALSE) {
list($first, $second) = explode('_', $mapperSoftCredit[$i]);
$softCreditFields[$i] = ucwords($first . " " . $second);
}
);
}
else {
- $mapperSoftCredit[$i] = $softCreditFields[$i] = $mapperSoftCreditType[$i] = NULL;
+ $mapperSoftCredit[$i] = $softCreditFields[$i] = $mapperSoftCreditType[$i] = NULL;
}
}
$mapperSoftCreditType[$key] = $mapperSoftCreditType[$key]['value'];
}
else {
- $mapperSoftCredit[$key] = $mapperSoftCreditType[$key] = NULL;
+ $mapperSoftCredit[$key] = $mapperSoftCreditType[$key] = NULL;
}
}
* @return array|null
*/
public function getUserDashboardElement() {
- return array('name' => ts('Contributions'),
+ return array(
+ 'name' => ts('Contributions'),
'title' => ts('Your Contribution(s)'),
'perm' => array('make online contributions'),
'weight' => 10,
* @return array|null
*/
public function registerTab() {
- return array('title' => ts('Contributions'),
+ return array(
+ 'title' => ts('Contributions'),
'url' => 'contribution',
'weight' => 20,
);
);
// set breadcrumb to append to 2nd layer pages
- $breadCrumb = array(array('title' => ts('Manage Contribution Pages'),
+ $breadCrumb = array(array(
+ 'title' => ts('Manage Contribution Pages'),
'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
'reset=1'
),
$action += array_sum(array_keys(self::contributionLinks()));
if ($dao->is_active) {
- $action -= (int)CRM_Core_Action::ENABLE;
+ $action -= (int) CRM_Core_Action::ENABLE;
}
else {
- $action -= (int)CRM_Core_Action::DISABLE;
+ $action -= (int) CRM_Core_Action::DISABLE;
}
//CRM-4418
if (!$allowToDelete) {
- $action -= (int)CRM_Core_Action::DELETE;
+ $action -= (int) CRM_Core_Action::DELETE;
}
//build the configure links.
}
public function search() {
- if (isset($this->_action) &
- (CRM_Core_Action::ADD |
+ if (isset($this->_action) & (CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
CRM_Core_Action::DELETE
)
// The unfiltered value from the session cannot be trusted, it needs to be
// processed to get a clean array of positive integers.
$ids = array();
- foreach ((array)$this->get('campaign_id') as $id) {
- if ((string)(int)$id === (string)$id && $id > 0) {
+ foreach ((array) $this->get('campaign_id') as $id) {
+ if ((string) (int) $id === (string) $id && $id > 0) {
$ids[] = $id;
}
}
// form all action links
$action = array_sum(array_keys($this->links()));
-
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
}
'Premium',
$dao->id
);
- //Financial Type
- if( !empty( $dao->financial_type_id ) ){
- require_once 'CRM/Core/DAO.php';
- $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' );
+ //Financial Type
+ if( !empty( $dao->financial_type_id ) ){
+ require_once 'CRM/Core/DAO.php';
+ $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' );
+ }
}
- }
$this->assign('rows', $premiums);
}
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
- $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, TRUE);
- $this->_cid = CRM_Utils_Request::retrieve('cid', 'String', $this, TRUE);
+ $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, TRUE);
+ $this->_cid = CRM_Utils_Request::retrieve('cid', 'String', $this, TRUE);
$this->assign('cid', $this->_cid);
$this->assign('id', $this->_id);
* return null
*/
public function run() {
- $task = CRM_Utils_Request::retrieve('task', 'String', CRM_Core_DAO::$_nullObject);
- $result = CRM_Utils_Request::retrieve('result', 'Integer', CRM_Core_DAO::$_nullObject);
+ $task = CRM_Utils_Request::retrieve('task', 'String', CRM_Core_DAO::$_nullObject);
+ $result = CRM_Utils_Request::retrieve('result', 'Integer', CRM_Core_DAO::$_nullObject);
- $this->assign('task', $task);
+ $this->assign('task', $task);
$this->assign('result', $result);
if ( $task == 'billing' ) {
self::$_links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}";
}
if (is_object( $paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) {
- self::$_links[CRM_Core_Action::RENEW] = array('name' => ts('Change Billing Details'),
+ self::$_links[CRM_Core_Action::RENEW] = array(
+ 'name' => ts('Change Billing Details'),
'title' => ts('Change Billing Details'),
'url' => 'civicrm/contribute/updatebilling',
'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}",
$this->assign('honor', TRUE);
}
-
$recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->contact_id = $this->_contactId;
$recur->is_test = 0;
* return null
*/
public function run() {
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$this->assign('invoicing', $invoicing);
parent::preProcess();
*/
private static $financialAccount;
- /**
- * Contribution pages
- * @var array
- * @static
- */
+ /**
+ * Contribution pages
+ * @var array
+ * @static
+ */
private static $contributionPageActive = NULL;
/**
* @static
*/
public static function &financialAccount($id = NULL, $financialAccountTypeId = NULL, $retrieveColumn = 'name', $key = 'id') {
- $condition = NUll;
+ $condition = NULL;
if ($financialAccountTypeId) {
$condition = " financial_account_type_id = ". $financialAccountTypeId;
}
* @param bool|string $name pseudoconstant to be flushed
*/
public static function flush($name = 'cache') {
- if (isset(self::$$name)) {
+ if (isset(self::$$name)) {
self::$$name = NULL;
- }
+ }
}
/**
CRM_Core_PseudoConstant::populate(
self::$financialTypeAccount[$financialTypeId],
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = true,
+ $all = TRUE,
$retrieve = 'financial_account_id',
$filter = NULL,
$condition,
@access public
*/
function __construct(&$queryParams,
- $action = CRM_Core_Action::NONE,
+ $action = CRM_Core_Action::NONE,
$contributionClause = NULL,
- $single = FALSE,
- $limit = NULL,
- $context = 'search',
- $compContext = NULL
+ $single = FALSE,
+ $limit = NULL,
+ $context = 'search',
+ $compContext = NULL
) {
// submitted form values
//get all campaigns.
$allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
- While ($result->fetch()) {
+ while ($result->fetch()) {
$row = array();
// the columns we are interested in
foreach (self::$_properties as $property) {
$result->contribution_id
);
- $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
- $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
+ $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
);
if (!empty($row['amount_level'])) {
}
//CRM-12920 - check for edit permission
if( !CRM_Core_Permission::check('edit contributions') ){
- unset(self::$_tasks[4],self::$_tasks[6]);
+ unset(self::$_tasks[4], self::$_tasks[6]);
}
// remove action "Print or Email Contribution Invoices"