Пример #1
0
 /**
  * Get active payment processor types
  */
 private function payProcStats()
 {
     $dao = new CRM_Financial_DAO_PaymentProcessor();
     $dao->is_active = 1;
     $dao->find();
     $ppTypes = array();
     // Get title and id for all processor types
     $ppTypeNames = CRM_Core_PseudoConstant::paymentProcessorType();
     while ($dao->fetch()) {
         $ppTypes[] = $ppTypeNames[$dao->payment_processor_type_id];
     }
     // add the .-separated list of the processor types
     $this->stats['PPTypes'] = implode(',', array_unique($ppTypes));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function onPreUninstall(CRM_Extension_Info $info)
 {
     $paymentProcessorTypes = $this->_getAllPaymentProcessorTypes('class_name');
     if (!array_key_exists($info->key, $paymentProcessorTypes)) {
         CRM_Core_Error::fatal('This payment processor type is not registered.');
     }
     $dao = new CRM_Financial_DAO_PaymentProcessor();
     $dao->payment_processor_type_id = $paymentProcessorTypes[$info->key];
     $dao->find();
     while ($dao->fetch()) {
         throw new CRM_Extension_Exception_DependencyException('payment');
     }
     $this->_runPaymentHook($info, 'uninstall');
     return CRM_Financial_BAO_PaymentProcessorType::del($paymentProcessorTypes[$info->key]);
 }
 /**
  * Browse all payment processors.
  *
  * @param null $action
  *
  * @return void
  * @access public
  * @static
  */
 function browse($action = NULL)
 {
     // get all custom groups sorted by weight
     $paymentProcessor = array();
     $dao = new CRM_Financial_DAO_PaymentProcessor();
     $dao->is_test = 0;
     $dao->domain_id = CRM_Core_Config::domainID();
     $dao->orderBy('name');
     $dao->find();
     while ($dao->fetch()) {
         $paymentProcessor[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $paymentProcessor[$dao->id]);
         $paymentProcessor[$dao->id]['payment_processor_type'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType', $paymentProcessor[$dao->id]['payment_processor_type_id']);
         // form all action links
         $action = array_sum(array_keys($this->links()));
         // update enable/disable links.
         if ($dao->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $paymentProcessor[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'paymentProcessor.manage.action', 'PaymentProcessor', $dao->id);
         $paymentProcessor[$dao->id]['financialAccount'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($dao->id, 'civicrm_payment_processor');
     }
     $this->assign('rows', $paymentProcessor);
 }