/** * Function to delete payment processor * * @param int $paymentProcessorTypeId ID of the processor to be deleted. * * @return bool * @access public * @static */ static function del($paymentProcessorTypeId) { $query = "\nSELECT pp.id processor_id\nFROM civicrm_payment_processor pp, civicrm_payment_processor_type ppt\nWHERE pp.payment_processor_type_id = ppt.id 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.'), ts('Deletion Error'), 'error'); return; } $paymentProcessorType = new CRM_Financial_DAO_PaymentProcessorType(); $paymentProcessorType->id = $paymentProcessorTypeId; if ($paymentProcessorType->delete()) { CRM_Core_Session::setStatus(ts('Selected Payment Processor type has been deleted.<br>'), '', 'success'); return TRUE; } }