/** * Function to process the form * * @access public * @return None */ function postProcess() { require_once 'CRM/Contribute/BAO/PaymentInstrument.php'; if ($this->_action & CRM_CORE_ACTION_DELETE) { CRM_Contribute_BAO_PaymentInstrument::del($this->_id); CRM_Core_Session::setStatus(ts('Selected Payment Instrument has been deleted.')); } else { $params = $ids = array(); // store the submitted values in an array $params = $this->exportValues(); if ($this->_action & CRM_CORE_ACTION_UPDATE) { $ids['paymentInstrument'] = $this->_id; } $paymentInstrument = CRM_Contribute_BAO_PaymentInstrument::add($params, $ids); CRM_Core_Session::setStatus(ts('The Payment Instrument "%1" has been saved.', array(1 => $paymentInstrument->name))); } }
/** * retrieve the default PaymentInstrument * * @return object The default PaymentInstrument object on success, * null otherwise * @static * @access public */ function &getDefault() { if ($GLOBALS['_CRM_CONTRIBUTE_BAO_PAYMENTINSTRUMENT']['_defaultPaymentInstrument'] == null) { $params = array('is_default' => 1); $defaults = array(); $GLOBALS['_CRM_CONTRIBUTE_BAO_PAYMENTINSTRUMENT']['_defaultPaymentInstrument'] = CRM_Contribute_BAO_PaymentInstrument::retrieve($params, $defaults); } return $GLOBALS['_CRM_CONTRIBUTE_BAO_PAYMENTINSTRUMENT']['_defaultPaymentInstrument']; }