'currency',
'financial_type_id',
);
- $retrieverequired = 0;
+ $retrieveRequired = 0;
foreach ($titleFields as $titleField) {
if(!isset($contribution->$titleField)){
- $retrieverequired = 1;
+ $retrieveRequired = 1;
break;
}
}
- if ($retrieverequired == 1) {
+ if ($retrieveRequired == 1) {
$contribution->find(true);
}
}
'currency',
'financial_type_id',
);
- $retrieverequired = 0;
+ $retrieveRequired = 0;
foreach ($titleFields as $titleField) {
if(!isset($contribution->$titleField)){
- $retrieverequired = 1;
+ $retrieveRequired = 1;
break;
}
}
- if($retrieverequired == 1){
+ if($retrieveRequired == 1){
$contribution->find(true);
}
$contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$pledgeID = $pledgePayment[0]->pledge_id;
}
-
$membershipStatuses = CRM_Member_PseudoConstant::membershipStatus();
if ($participant) {
*/
static function recordFinancialAccounts(&$params, $ids) {
$skipRecords = $update = FALSE;
- $additionalPaticipantId = array();
+ $additionalParticipantId = array();
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if (CRM_Utils_Array::value('contribution_mode', $params) == 'participant') {
$entityId = $params['participant_id'];
$entityTable = 'civicrm_participant';
- $additionalPaticipantId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
+ $additionalParticipantId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
}
else {
$entityId = $params['contribution']->id;
$entityTable = 'civicrm_contribution';
}
$entityID[] = $entityId;
- if (!empty($additionalPaticipantId)) {
- $entityID += $additionalPaticipantId;
+ if (!empty($additionalParticipantId)) {
+ $entityID += $additionalParticipantId;
}
if (!CRM_Utils_Array::value('prevContribution', $params)) {
$entityID = NULL;
}
// build line item array if its not set in $params
- if (!CRM_Utils_Array::value('line_item', $params) || $additionalPaticipantId) {
+ if (!CRM_Utils_Array::value('line_item', $params) || $additionalParticipantId) {
CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable));
}
$lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_compId);
}
else {
- $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution',1);
+ $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution', 1);
}
empty($lineItem) ? NULL : $this->_lineItems[] = $lineItem;
}
}
// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
- CRM_Utils_System::setTitle(ts('Contribution from') . ' ' . $displayName);
+ CRM_Utils_System::setTitle(ts('Contribution from') . ' ' . $displayName);
}
}
}
$names = array(
- 'first_name', 'middle_name', 'last_name', "street_address-{$this->_bltID}", "city-{$this->_bltID}",
- "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}", "state_province_id-{$this->_bltID}",
- "state_province-{$this->_bltID}", "country-{$this->_bltID}"
- );
+ 'first_name',
+ 'middle_name',
+ 'last_name',
+ "street_address-{$this->_bltID}",
+ "city-{$this->_bltID}",
+ "postal_code-{$this->_bltID}",
+ "country_id-{$this->_bltID}",
+ "state_province_id-{$this->_bltID}",
+ "state_province-{$this->_bltID}",
+ "country-{$this->_bltID}"
+ );
foreach ($names as $name) {
$fields[$name] = 1;
CRM_Core_Payment_Form::buildDirectDebit($this, TRUE);
}
else {
- $additionalInfoFormFunction = 'build' . $type ;
- CRM_Contribute_Form_AdditionalInfo::$additionalInfoFormFunction( $this );
+ $additionalInfoFormFunction = 'build' . $type;
+ CRM_Contribute_Form_AdditionalInfo::$additionalInfoFormFunction($this);
}
}
if (empty($this->_recurPaymentProcessors)) {
}
}
elseif ((!$this->_ppID && $this->_id) || !$this->_id) {
- foreach(array(
- 'Overdue',
- 'In Progress'
- ) as $suppress) {
+ foreach (array(
+ 'Overdue',
+ 'In Progress'
+ ) as $suppress) {
unset($status[CRM_Utils_Array::key($suppress, $statusName)]);
}
}
if ($this->_id) {
$contributionStatus = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->_id, 'contribution_status_id');
$name = CRM_Utils_Array::value($contributionStatus, $statusName);
- switch($name) {
+ switch ($name) {
case 'Completed':
case 'Cancelled':
case 'Refunded':
unset($status[CRM_Utils_Array::key('Refunded', $statusName)]);
break;
case 'Failed':
- foreach(array(
- 'Pending',
- 'Refunded',
- 'Completed',
- 'Cancelled'
- ) as $suppress) {
+ foreach (array(
+ 'Pending',
+ 'Refunded',
+ 'Completed',
+ 'Cancelled'
+ ) as $suppress) {
unset($status[CRM_Utils_Array::key($suppress, $statusName)]);
}
break;
}
- } else {
+ }
+ else {
unset($status[CRM_Utils_Array::key('Refunded', $statusName)]);
}
$this->assign('hasPriceSets', $hasPriceSets);
$currencyFreeze = FALSE;
if (!($this->_action & CRM_Core_Action::UPDATE)) {
- if ($this->_online || $this->_ppID) {
- $attributes['total_amount'] = array_merge($attributes['total_amount'], array(
- 'READONLY' => TRUE,
- 'style' => "background-color:#EBECE4"
- ));
- $optionTypes = array(
- '1' => ts('Adjust Pledge Payment Schedule?'),
- '2' => ts('Adjust Total Pledge Amount?'),
- );
- $this->addRadio('option_type',
- NULL,
- $optionTypes,
- array(), '<br/>'
- );
+ if ($this->_online || $this->_ppID) {
+ $attributes['total_amount'] = array_merge($attributes['total_amount'], array(
+ 'READONLY' => TRUE,
+ 'style' => "background-color:#EBECE4"
+ ));
+ $optionTypes = array(
+ '1' => ts('Adjust Pledge Payment Schedule?'),
+ '2' => ts('Adjust Total Pledge Amount?'),
+ );
+ $this->addRadio('option_type',
+ NULL,
+ $optionTypes,
+ array(), '<br/>'
+ );
- $currencyFreeze = TRUE;
- }
+ $currencyFreeze = TRUE;
+ }
}
$totalAmount = $this->addMoney('total_amount',
CRM_Price_BAO_Field::priceSetValidation($priceSetId, $fields, $errors);
}
}
+ //CRM_CORE_ERROR::DEBUG($fields['soft_credit_amount']);
// if honor roll fields are populated but no PCP is selected
if (!CRM_Utils_Array::value('pcp_made_through_id', $fields)) {
}
}
- if (CRM_Utils_Array::value('total_amount', $fields) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))){
+ if (!empty($fields['soft_credit_amount'])) {
+ foreach ($fields['soft_credit_amount'] as $key => $val) {
+ if (!empty($fields['soft_credit_contact_select_id'][$key])) {
+ if ($fields['soft_credit_amount'][$key] && ($fields['soft_credit_amount'][$key] > $fields['total_amount'])) {
+ $errors["soft_credit_amount[$key]"] = ts('Soft credit amount cannot be more than the total amount.');
+ }
+ if (empty($fields['soft_credit_amount'][$key])) {
+ $errors["soft_credit_amount[$key]"] = ts('Please enter the soft credit amount.');
+ }
+ }
+ }
+ }
+
+ if (CRM_Utils_Array::value('total_amount', $fields) && (CRM_Utils_Array::value('net_amount', $fields) || CRM_Utils_Array::value('fee_amount', $fields))) {
$sum = CRM_Utils_Rule::cleanMoney($fields['net_amount']) + CRM_Utils_Rule::cleanMoney($fields['fee_amount']);
if (CRM_Utils_Rule::cleanMoney($fields['total_amount']) != $sum) {
$errors['total_amount'] = ts('The sum of fee amount and net amount must be equal to total amount');
$errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for this Financial Type");
}
}
+
return $errors;
}
// get the submitted form values.
$submittedValues = $this->controller->exportValues($this->_name);
- if (CRM_Utils_Array::value('price_set_id', $submittedValues) && $this->_action & CRM_Core_Action::UPDATE ) {
- $line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution');
+ if (CRM_Utils_Array::value('price_set_id', $submittedValues) && $this->_action & CRM_Core_Action::UPDATE) {
+ $line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution');
$lineID = key($line);
$priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id');
$quickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config');
);
CRM_Event_BAO_Participant::add($participantParams);
if (empty($this->_lineItems)) {
- $this->_lineItems = CRM_Price_BAO_LineItem::getLineItems($entityID, 'participant',1);
+ $this->_lineItems = CRM_Price_BAO_LineItem::getLineItems($entityID, 'participant', 1);
}
- } else {
+ }
+ else {
$entityTable = 'contribution';
$entityID = $this->_id;
}
//when financial_type_id is passed in form, update the
//lineitems with the financial type selected in form
if ($isQuickConfig && CRM_Utils_Array::value('financial_type_id', $submittedValues)
- && CRM_Utils_Array::value($this->_priceSetId, $lineItem)) {
+ && CRM_Utils_Array::value($this->_priceSetId, $lineItem)
+ ) {
foreach ($lineItem[$this->_priceSetId] as &$values) {
$values['financial_type_id'] = $submittedValues['financial_type_id'];
}
$this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
if (CRM_Utils_Array::value('pcp_made_through_id', $submittedValues)) {
- $fields = array(
- 'pcp_made_through_id', 'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note',
- );
+ $fields = array(
+ 'pcp_made_through_id',
+ 'pcp_display_in_roll',
+ 'pcp_roll_nickname',
+ 'pcp_personal_note',
+ );
foreach ($fields as $f) {
$pcp[$f] = CRM_Utils_Array::value($f, $submittedValues);
}
}
else {
//build soft credit params
- if (!empty($submittedValues['soft_credit_contact_select_id']))
+ if (!empty($submittedValues['soft_credit_contact_select_id'])) {
$softParams = array();
- foreach( $submittedValues['soft_credit_contact_select_id'] as $key => $val) {
+ foreach ($submittedValues['soft_credit_contact_select_id'] as $key => $val) {
if ($val && $submittedValues['soft_credit_amount'][$key]) {
- $softParams[$key]['contact_id'] = $val;
+ $softParams[$key]['contact_id'] = $val;
$softParams[$key]['amount'] = $submittedValues['soft_credit_amount'][$key];
- $softCredit = TRUE;
}
}
- }
- if (!empty($softParams)) {
- $params['soft_credit'] = $softParams;
+ }
}
// set the contact, when contact is selected
}
if ($params['contribution_status_id'] == CRM_Core_OptionGroup::getValue('contribution_status', 'Cancelled', 'name')
- || $params['contribution_status_id'] == CRM_Core_OptionGroup::getValue('contribution_status', 'Refunded', 'name')) {
+ || $params['contribution_status_id'] == CRM_Core_OptionGroup::getValue('contribution_status', 'Refunded', 'name')
+ ) {
if (CRM_Utils_System::isNull(CRM_Utils_Array::value('cancel_date', $params))) {
- $params['cancel_date'] = date("Y-m-d");
+ $params['cancel_date'] = date('Y-m-d');
}
}
else {
- $params['cancel_date'] = $params['cancel_reason'] = 'null';
+ $params['cancel_date'] = $params['cancel_reason'] = 'null';
}
// Set is_pay_later flag for back-office offline Pending status contributions CRM-8996
$selectProduct = $formValues['product_name'][0];
}
// if there is a product - compare the value to the contribution amount
- if (isset($selectProduct))
- {
+ if (isset($selectProduct)) {
$productDAO = new CRM_Contribute_DAO_Product();
$productDAO->id = $selectProduct;
$productDAO->find(TRUE);