Skip to content

Commit

Permalink
CRM-13965-qa-fixes : activity selector links for Payment, Refund, Cha…
Browse files Browse the repository at this point in the history
…nge Registration types
  • Loading branch information
Pratik Joshi committed Mar 5, 2014
1 parent 9ad04fb commit 6652666
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CRM/Activity/Selector/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public static function actionLinks($activityTypeId,
//when activity type is disabled or no more exists give only delete.
switch ($activityTypeName) {
case 'Event Registration':
case 'Change Registration':
$url = 'civicrm/contact/view/participant';
$qsView = "action=view&reset=1&id={$sourceRecordId}&cid=%%cid%%&context=%%cxt%%{$extraParams}";
break;
Expand All @@ -137,6 +138,15 @@ public static function actionLinks($activityTypeId,
$qsView = "action=view&reset=1&id={$sourceRecordId}&cid=%%cid%%&context=%%cxt%%{$extraParams}";
break;

case 'Payment':
case 'Refund':
$participantId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantPayment', $sourceRecordId, 'participant_id', 'contribution_id');
if (!empty($participantId)) {
$url = 'civicrm/contact/view/participant';
$qsView = "action=view&reset=1&id={$participantId}&cid=%%cid%%&context=%%cxt%%{$extraParams}";
}
break;

case 'Membership Signup':
case 'Membership Renewal':
case 'Change Membership Status':
Expand Down
16 changes: 4 additions & 12 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3081,28 +3081,20 @@ static function recordAdditionalPayment($contributionId, $trxnsData, $paymentTyp
}
$activityType = ($paymentType == 'refund') ? 'Refund' : 'Payment';

// creation of activity
$activity = new CRM_Activity_DAO_Activity();
$activity->source_record_id = $financialTrxn->id;
$activity->activity_type_id = CRM_Core_OptionGroup::getValue('activity_type',
$activityType,
'name'
);
if (!$activity->find(TRUE)) {
self::addActivityForPayment($entityObj, $financialTrxn, $activityType, $component);
}
self::addActivityForPayment($entityObj, $financialTrxn, $activityType, $component, $contributionId);
}
return $financialTrxn;
}

static function addActivityForPayment($entityObj, $trxnObj, $activityType, $component) {
static function addActivityForPayment($entityObj, $trxnObj, $activityType, $component, $contributionId) {
if ($component == 'event') {
$date = CRM_Utils_Date::isoToMysql($trxnObj->trxn_date);
$paymentAmount = CRM_Utils_Money::format($trxnObj->total_amount, $trxnObj->currency);
$eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Event', $entityObj->event_id, 'title');
$subject = "{$paymentAmount} - Offline {$activityType} for {$eventTitle}";
$targetCid = $entityObj->contact_id;
$srcRecId = $trxnObj->id;
// source record id would be the contribution id
$srcRecId = $contributionId;
}

// activity params
Expand Down
1 change: 1 addition & 0 deletions CRM/Contribute/Form/AdditionalPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public function setDefaultValues() {
if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
return;
}
$defaults = array( );
if ($this->_mode) {
$defaults = $this->_values;

Expand Down

0 comments on commit 6652666

Please sign in to comment.