/** * This method returns the links that are given for honor search row. * currently the links added for each row are * * - View * - Edit * * @return array * @access public * */ static function &honorLinks() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/contact/view/contribution', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&honorId=%%honorId%%&action=view&context=%%cxt%%&selectedChild=contribute', 'title' => ts('View Contribution')), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/contact/view/contribution', 'qs' => 'reset=1&action=update&id=%%id%%&cid=%%cid%%&honorId=%%honorId%%&context=%%cxt%%&subType=%%contributionType%%', 'title' => ts('Edit Contribution')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/contact/view/contribution', 'qs' => 'reset=1&action=delete&id=%%id%%&cid=%%cid%%&honorId=%%honorId%%&context=%%cxt%%', 'title' => ts('Delete Contribution'))); } return self::$_links; }
/** * This method returns the links that are given for recur search row. * currently the links added for each row are: * - View * - Edit * - Cancel * * @return array * @access public * */ static function &recurLinks($recurID = FALSE, $context = 'contribution') { if (!self::$_links) { self::$_links = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'title' => ts('View Recurring Payment'), 'url' => 'civicrm/contact/view/contributionrecur', 'qs' => "reset=1&id=%%crid%%&cid=%%cid%%&context={$context}"), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'title' => ts('Edit Recurring Payment'), 'url' => 'civicrm/contribute/updaterecur', 'qs' => "reset=1&action=update&crid=%%crid%%&cid=%%cid%%&context={$context}"), CRM_Core_Action::DISABLE => array('name' => ts('Cancel'), 'title' => ts('Cancel'), 'ref' => 'crm-enable-disable')); } if ($recurID) { $paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj'); if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('cancelSubscription')) { unset(self::$_links[CRM_Core_Action::DISABLE]['extra'], self::$_links[CRM_Core_Action::DISABLE]['ref']); self::$_links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe"; 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'), 'title' => ts('Change Billing Details'), 'url' => 'civicrm/contribute/updatebilling', 'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}"); } } return self::$_links; }
/** * called when action is browse. */ public function listContribution() { $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), NULL, FALSE, FALSE, TRUE, FALSE); $controller->setEmbedded(TRUE); $controller->reset(); $controller->set('limit', 12); $controller->set('cid', $this->_contactId); $controller->set('context', 'user'); $controller->set('force', 1); $controller->process(); $controller->run(); //add honor block $params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId); if (!empty($params)) { // assign vars to templates $this->assign('honorRows', $params); $this->assign('honor', TRUE); } $recur = new CRM_Contribute_DAO_ContributionRecur(); $recur->contact_id = $this->_contactId; $recur->is_test = 0; $recur->find(); $config = CRM_Core_Config::singleton(); $recurStatus = CRM_Contribute_PseudoConstant::contributionStatus(); $recurRow = array(); $recurIDs = array(); while ($recur->fetch()) { $mode = $recur->is_test ? 'test' : 'live'; $paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode); if (!$paymentProcessor) { continue; } require_once 'api/v3/utils.php'; //@todo calling api functions directly is not supported _civicrm_api3_object_to_array($recur, $values); $values['recur_status'] = $recurStatus[$values['contribution_status_id']]; $recurRow[$values['id']] = $values; $action = array_sum(array_keys(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard'))); $details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recur->id, 'recur'); $hideUpdate = $details->membership_id & $details->auto_renew; if ($hideUpdate) { $action -= CRM_Core_Action::UPDATE; } $recurRow[$values['id']]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard'), $action, array('cid' => $this->_contactId, 'crid' => $values['id'], 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.dashboard.recurring', 'Contribution', $values['id']); $recurIDs[] = $values['id']; //reset $paymentObject for checking other paymenet processor //recurring url $paymentObject = NULL; } if (is_array($recurIDs) && !empty($recurIDs)) { $getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs); foreach ($getCount as $key => $val) { $recurRow[$key]['completed'] = $val; $recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}"); } } $this->assign('recurRows', $recurRow); if (!empty($recurRow)) { $this->assign('recur', TRUE); } else { $this->assign('recur', FALSE); } }