/**
  * 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();
 }
 /**
  * retrieve the default payment processor
  *
  * @param NULL
  *
  * @return object           The default payment processor object on success,
  *                          null otherwise
  * @static
  * @access public
  */
 static function &getDefault()
 {
     if (self::$_defaultPaymentProcessorType == NULL) {
         $params = array('is_default' => 1);
         $defaults = array();
         self::$_defaultPaymentProcessorType = self::retrieve($params, $defaults);
     }
     return self::$_defaultPaymentProcessorType;
 }
 public function enable()
 {
     CRM_Core_BAO_PaymentProcessorType::setIsActive($this->paymentProcessorTypes[$this->ext->key], 1);
 }
Beispiel #4
0
 public function enable()
 {
     require_once "CRM/Core/BAO/PaymentProcessorType.php";
     CRM_Core_BAO_PaymentProcessorType::setIsActive($this->paymentProcessorTypes[$this->ext->key], 1);
 }
/**
 * Delete a payment_processor type delete
 *
 * @param  id of payment_processor type  $id
 *
 * @return array API Result Array
 * {@getfields PaymentProcessorType_delete}
 * @static void
 * @access public
 */
function civicrm_api3_payment_processor_type_delete($params)
{
    require_once 'CRM/Utils/Rule.php';
    if ($params['id'] != NULL && !CRM_Utils_Rule::integer($params['id'])) {
        return civicrm_api3_create_error('Invalid value for payment processor type ID');
    }
    $payProcTypeBAO = new CRM_Core_BAO_PaymentProcessorType();
    $result = $payProcTypeBAO->del($params['id']);
    if (!$result) {
        return civicrm_api3_create_error('Could not delete payment processor type');
    }
    return civicrm_api3_create_success($result, $params, 'payment_processor_type', 'delete', $payProcTypeBAO);
}