/** * Function to process the form * * @access public * @return None */ public function postProcess() { CRM_Utils_System::flushCache('CRM_Core_DAO_PaymentProcessorType'); if ($this->_action & CRM_Core_Action::DELETE) { CRM_Core_BAO_PaymentProcessorType::del($this->_id); return; } $values = $this->controller->exportValues($this->_name); if (CRM_Utils_Array::value('is_default', $values)) { $query = "\nUPDATE civicrm_payment_processor SET is_default = 0"; CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); } $dao = new CRM_Core_DAO_PaymentProcessorType(); $dao->id = $this->_id; $dao->is_default = CRM_Utils_Array::value('is_default', $values, 0); $dao->is_active = CRM_Utils_Array::value('is_active', $values, 0); $dao->is_recur = CRM_Utils_Array::value('is_recur', $values, 0); $dao->name = $values['name']; $dao->description = $values['description']; foreach ($this->_fields as $field) { $dao->{$field['name']} = trim($values[$field['name']]); if (empty($dao->{$field['name']})) { $dao->{$field['name']} = 'null'; } } $dao->save(); }
private static function getAllPaymentProcessorTypes($attr) { $ppt = array(); $dao = new CRM_Core_DAO_PaymentProcessorType(); $dao->find(); while ($dao->fetch()) { $ppt[$dao->{$attr}] = $dao->id; } return $ppt; }
/** * class constructor */ function __construct() { parent::__construct(); }
/** * returns the list of fields that can be exported * * @access public * return array * @static */ static function &export($prefix = false) { if (!self::$_export) { self::$_export = array(); $fields = self::fields(); foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { self::$_export['payment_processor_type'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
private function _getAllPaymentProcessorTypes($attr) { $ppt = array(); require_once "CRM/Core/DAO/PaymentProcessorType.php"; require_once "CRM/Core/DAO.php"; $dao = new CRM_Core_DAO_PaymentProcessorType(); $dao->find(); while ($dao->fetch()) { $ppt[$dao->{$attr}] = $dao->id; } return $ppt; }
/** * Function to delete payment processor * * @param int $paymentProcessorTypeId ID of the processor to be deleted. * * @access public * @static */ static function del($paymentProcessorTypeId) { $query = "SELECT pp.id processor_id \n FROM civicrm_payment_processor pp, civicrm_payment_processor_type ppt\n WHERE pp.payment_processor_type = ppt.name AND ppt.id = %1"; $params = array(1 => array($paymentProcessorTypeId, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $params); if ($dao->fetch()) { CRM_Core_Session::setStatus(ts('There is a Payment Processor associated with selected Payment Processor type, hence it can not be deleted.')); return; } $paymentProcessorType = new CRM_Core_DAO_PaymentProcessorType(); $paymentProcessorType->id = $paymentProcessorTypeId; $paymentProcessorType->delete(); CRM_Core_Session::setStatus(ts('Selected Payment Processor type has been deleted.')); }