/**
* class constructor
- */
+ */
function __construct() {
parent::__construct();
}
}
/**
- * Function to delete financial Types
+ * Function to delete financial Types
*
* @param int $contributionTypeId
* @static
}
// CRM-12233
- if ($membershipIsActive && !$self->_membershipBlock['is_required']
+ if ($membershipIsActive && !$self->_membershipBlock['is_required']
&& $self->_values['amount_block_is_active']) {
$membershipFieldId = $contributionFieldId = $errorKey = $otherFieldId = NULL;
foreach ($self->_values['fee'] as $fieldKey => $fieldValue) {
elseif ($fieldValue['name'] == 'contribution_amount') {
$contributionFieldId = $fieldKey;
}
-
+
if (!$errorKey || CRM_Utils_Array::value('price_' . $contributionFieldId, $fields) == '0') {
$errorKey = $fieldKey;
}
CRM_Price_BAO_Set::processAmount($self->_values['fee'],
$fields, $lineItem
);
-
+
if ($fields['amount'] < 0) {
$errors['_qf_default'] = ts('Contribution can not be less than zero. Please select the options accordingly');
}
$session->pushUserContext($url);
$this->add('select', 'product_id', ts('Select the Product') . ' ', $this->_products, TRUE);
-
+
$this->addElement('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PremiumsProduct', 'weight'));
-
+
$financialType = CRM_Contribute_PseudoConstant::financialType( );
$premiumFinancialType = array();
CRM_Core_PseudoConstant::populate(
$premiumFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
- $retrieve = 'entity_id',
- $filter = null,
- 'account_relationship = 8'
+ $all = True,
+ $retrieve = 'entity_id',
+ $filter = null,
+ 'account_relationship = 8'
);
-
+
$costFinancialType = array();
CRM_Core_PseudoConstant::populate(
$costFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
- $retrieve = 'entity_id',
- $filter = null,
- 'account_relationship = 7'
+ $all = True,
+ $retrieve = 'entity_id',
+ $filter = null,
+ 'account_relationship = 7'
);
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
foreach( $financialType as $key => $financialTypeName ){
}
if( count( $financialType ) ){
$this->assign( 'financialType', $financialType );
- }
+ }
$this->add(
- 'select',
- 'financial_type_id',
- ts( 'Financial Type' ),
+ 'select',
+ 'financial_type_id',
+ ts( 'Financial Type' ),
array(''=>ts('- select -')) + $financialType
);
$this->addRule('weight', ts('Please enter integer value for weight'), 'integer');
if ($this->_pid) {
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PremiumsProduct', $this->_pid, 'weight', 'id');
}
-
+
// updateOtherWeights needs to filter on premiums_id
$filter = array('premiums_id' => $params['premiums_id']);
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Contribute_DAO_PremiumsProduct', $oldWeight, $params['weight'], $filter);
FALSE
);
$this->addWysiwyg('pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_receipt'));
-
+
//add partial payment options
// add price set fields
$errors['min_amount'] = ts('Minimum Amount should be less than Maximum Amount');
}
}
-
+
if (isset($fields['is_pay_later'])) {
if (empty($fields['pay_later_text'])) {
$errors['pay_later_text'] = ts('Please enter the text for the \'pay later\' checkbox displayed on the contribution form.');
$errors['pay_later_receipt'] = ts('Please enter the instructions to be sent to the contributor when they choose to \'pay later\'.');
}
}
-
+
// don't allow price set w/ membership signup, CRM-5095
if ($priceSetId = CRM_Utils_Array::value('price_set_id', $fields)) {
// don't allow price set w/ membership.
}
}
}
-
+
return $errors;
}
$setParams['title'] = $this->_values['title'];
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle, 'id', 'name')) {
$setParams['name'] = $pageTitle;
- }
+ }
elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle . '_' . $this->_id, 'id', 'name')) {
$setParams['name'] = $pageTitle . '_' . $this->_id;
}
CRM_Price_BAO_Field::retrieve($editedFieldParams, $editedResults);
if (!$priceFieldID = CRM_Utils_Array::value('id', $editedResults)) {
- $fieldParams = array(
+ $fieldParams = array(
'name' => 'other_amount',
'label' => 'Other Amount',
'price_set_id' => $priceSetId,
$fieldParams['option_amount'][1] = 1;
if (!$noContriAmount) {
$fieldParams['is_required'] = 1;
- $fieldParams['option_label'][1] = 'Contribution Amount';
+ $fieldParams['option_label'][1] = 'Contribution Amount';
} else {
$fieldParams['is_required'] = 0;
$fieldParams['option_label'][1] = 'Other Amount';
if ($deletePriceSet) {
CRM_Price_BAO_Set::removeFrom('civicrm_contribution_page', $contributionPageID);
}
-
- if ($deleteAmountBlk ) {
+
+ if ($deleteAmountBlk ) {
$priceField = CRM_Utils_Array::value('price_field_id', $params)?$params['price_field_id']:CRM_Utils_Array::value('price_field_other', $params);
if ($priceField) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $priceField, 'price_set_id');
if (($postProfileType == 'Membership') && !$membershipEnable) {
$errors['custom_post_id'] = $errorMsg;
}
-
+
$behalf = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'is_for_organization');
if ($fields['custom_pre_id']) {
$errorMsg = ts('You should move the membership related fields in the "On Behalf" profile for this Contribution Page');
$this->add('Select', 'frequency_unit', ts('Frequency Unit'), array('' => '- select period -', 'day' => 'Day', 'week' => 'Week', 'month' => 'Month', 'year' => 'Year'));
$this->add('text', 'frequency_interval', ts('Frequency'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'frequency_interval'));
-
+
//Financial Type CRM-11106
$financialType = CRM_Contribute_PseudoConstant::financialType( );
$premiumFinancialType = array();
CRM_Core_PseudoConstant::populate(
$premiumFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
- $retrieve = 'entity_id',
- $filter = null,
- 'account_relationship = 8'
+ $all = True,
+ $retrieve = 'entity_id',
+ $filter = null,
+ 'account_relationship = 8'
);
-
+
$costFinancialType = array();
CRM_Core_PseudoConstant::populate(
$costFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
- $all = True,
- $retrieve = 'entity_id',
- $filter = null,
- 'account_relationship = 7'
+ $all = True,
+ $retrieve = 'entity_id',
+ $filter = null,
+ 'account_relationship = 7'
);
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
foreach( $financialType as $key => $financialTypeName ){
}
if( count( $financialType ) ){
$this->assign( 'financialType', $financialType );
- }
+ }
$this->add(
- 'select',
- 'financial_type_id',
- ts( 'Financial Type' ),
+ 'select',
+ 'financial_type_id',
+ ts( 'Financial Type' ),
array(''=>ts('- select -')) + $financialType
);
-
+
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->addFormRule(array('CRM_Contribute_Form_ManagePremiums', 'formRule'));
if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
$sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
}
-
+
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
CRM_Contact_BAO_Query::MODE_CONTRIBUTE
);
//fix for CRM-2752
$customFields = CRM_Core_BAO_CustomField::getFields('Contribution');
foreach ($this->_contributionIds as $contributionId) {
- $typeId = CRM_Core_DAO::getFieldValue( "CRM_Contribute_DAO_Contribution", $contributionId, 'financial_type_id' );
+ $typeId = CRM_Core_DAO::getFieldValue( "CRM_Contribute_DAO_Contribution", $contributionId, 'financial_type_id' );
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
$deletedContributions++;
}
}
-
+
CRM_Core_Session::setStatus(ts('Deleted Contribution(s): %1', array(1 => $deletedContributions)), '', 'info');
CRM_Core_Session::setStatus(ts('Total Selected Contribution(s): %1', array(1 => count($this->_contributionIds))), '', 'info');
}
$input['trxn_id'] = $contribution->trxn_id;
$input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
- // CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
+ // CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
// CRM_Core_Error::debug('input',$input);
if ($updateStatus) {
CRM_Core_Session::setStatus($updateStatus);
}
-
+
CRM_Utils_System::civiExit(1);
}
//end of function
$validate = FALSE;
//validations
if (count($this->_contributionIds) > $this->_maxContributions) {
- CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch Update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(1 => $this->_maxContributions, 2 => count($this->_contributionIds))), ts('Batch Update Error'), 'error');
+ CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch Update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(1 => $this->_maxContributions, 2 => count($this->_contributionIds))), ts('Batch Update Error'), 'error');
$validate = TRUE;
}
$query = "
SELECT co.total_amount as amount,
co.receive_date as receive_date,
- co.source as source,
- ct.display_name as display_name
- FROM civicrm_contribution co
-INNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id )
+ co.source as source,
+ ct.display_name as display_name
+ FROM civicrm_contribution co
+INNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id )
WHERE co.id IN ( $contribIDs )";
$dao = CRM_Core_DAO::executeQuery($query,
*
* @return void
* @access public
- */
+ */
function preProcess() {
$id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE
'query' => "reset=1&action=add&context=standalone&mode=live",
'ref' => 'new-contribution-cc',
'title' => $title,
- )));
+ )));
}
}
}
);
$query = "
SELECT ccp.title
-FROM civicrm_contribution_page ccp
+FROM civicrm_contribution_page ccp
JOIN civicrm_pcp cp ON ccp.id = cp.page_id
WHERE cp.page_id = {$id}
AND cp.page_type = 'contribute'