Ejemplo n.º 1
0
 public function testAddPCPNoStatus()
 {
     $blockParams = $this->pcpBlockParams();
     $pcpBlock = CRM_PCP_BAO_PCPBlock::create($blockParams, TRUE);
     $params = $this->pcpParams();
     $params['pcp_block_id'] = $pcpBlock->id;
     unset($params['status_id']);
     $pcp = CRM_PCP_BAO_PCP::create($params);
     $this->assertInstanceOf('CRM_PCP_DAO_PCP', $pcp, 'Check for created object');
     $this->assertEquals($params['contact_id'], $pcp->contact_id, 'Check for entity table.');
     $this->assertEquals(0, $pcp->status_id, 'Check for zero status when no status_id passed.');
     $this->assertEquals($params['title'], $pcp->title, 'Check for title.');
     $this->assertEquals($params['intro_text'], $pcp->intro_text, 'Check for intro_text.');
     $this->assertEquals($params['page_text'], $pcp->page_text, 'Check for page_text.');
     $this->assertEquals($params['donate_link_text'], $pcp->donate_link_text, 'Check for donate_link_text.');
     $this->assertEquals($params['is_thermometer'], $pcp->is_thermometer, 'Check for is_thermometer.');
     $this->assertEquals($params['is_honor_roll'], $pcp->is_honor_roll, 'Check for is_honor_roll.');
     $this->assertEquals($params['goal_amount'], $pcp->goal_amount, 'Check for goal_amount.');
     $this->assertEquals($params['is_active'], $pcp->is_active, 'Check for is_active.');
     // Delete our test object
     $delParams = array('id' => $pcp->id);
     // FIXME: Currently this delete fails with an FK constraint error: DELETE FROM civicrm_contribution_type  WHERE (  civicrm_contribution_type.id = 5 )
     // CRM_Core_DAO::deleteTestObjects( 'CRM_PCP_DAO_PCP', $delParams );
 }
Ejemplo n.º 2
0
 /**
  * Process the form submission.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     // Source
     $params['entity_table'] = 'civicrm_contribution_page';
     $params['entity_id'] = $this->_id;
     // Target
     $params['target_entity_type'] = CRM_Utils_Array::value('target_entity_type', $params, 'contribute');
     $params['target_entity_id'] = $this->_id;
     $dao = new CRM_PCP_DAO_PCPBlock();
     $dao->entity_table = $params['entity_table'];
     $dao->entity_id = $this->_id;
     $dao->find(TRUE);
     $params['id'] = $dao->id;
     $params['is_active'] = CRM_Utils_Array::value('pcp_active', $params, FALSE);
     $params['is_approval_needed'] = CRM_Utils_Array::value('is_approval_needed', $params, FALSE);
     $params['is_tellfriend_enabled'] = CRM_Utils_Array::value('is_tellfriend_enabled', $params, FALSE);
     CRM_PCP_BAO_PCPBlock::create($params);
     parent::endPostProcess();
 }
Ejemplo n.º 3
0
 /**
  * Process the form submission.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     // Source
     $params['entity_table'] = 'civicrm_event';
     $params['entity_id'] = $this->_id;
     // Target
     $params['target_entity_type'] = CRM_Utils_Array::value('target_entity_type', $params, 'event');
     if ($params['target_entity_type'] == 'event') {
         $params['target_entity_id'] = $this->_id;
     } else {
         $params['target_entity_id'] = CRM_Utils_Array::value('target_entity_id', $params, $this->_id);
     }
     $dao = new CRM_PCP_DAO_PCPBlock();
     $dao->entity_table = $params['entity_table'];
     $dao->entity_id = $this->_id;
     $dao->find(TRUE);
     $params['id'] = $dao->id;
     $params['is_active'] = CRM_Utils_Array::value('pcp_active', $params, FALSE);
     $params['is_approval_needed'] = CRM_Utils_Array::value('is_approval_needed', $params, FALSE);
     $params['is_tellfriend_enabled'] = CRM_Utils_Array::value('is_tellfriend_enabled', $params, FALSE);
     CRM_PCP_BAO_PCPBlock::create($params);
     // Update tab "disabled" css class
     $this->ajaxResponse['tabValid'] = !empty($params['is_active']);
     parent::endPostProcess();
 }