コード例 #1
0
ファイル: Delete.php プロジェクト: hampelm/Ginsberg-CiviDemo
 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     // first delete the join entries associated with this contribution page
     require_once 'CRM/Core/DAO/UFJoin.php';
     $dao = new CRM_Core_DAO_UFJoin();
     $params = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
     $dao->copyValues($params);
     $dao->delete();
     require_once 'CRM/Core/OptionGroup.php';
     $groupName = "civicrm_contribution_page.amount.{$this->_id}";
     CRM_Core_OptionGroup::deleteAssoc($groupName);
     //next delete the membership block fields
     require_once 'CRM/Member/DAO/MembershipBlock.php';
     $dao = new CRM_Member_DAO_MembershipBlock();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $this->_id;
     $dao->delete();
     //next delete the pcp block fields
     require_once 'CRM/Contribute/DAO/PCPBlock.php';
     $dao = new CRM_Contribute_DAO_PCPBlock();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $this->_id;
     $dao->delete();
     // need to delete premiums. CRM-4586
     require_once 'CRM/Contribute/BAO/Premium.php';
     CRM_Contribute_BAO_Premium::deletePremium($this->_id);
     // price set cleanup, CRM-5527
     require_once 'CRM/Price/BAO/Set.php';
     CRM_Price_BAO_Set::removeFrom('civicrm_contribution_page', $this->_id);
     // finally delete the contribution page
     require_once 'CRM/Contribute/DAO/ContributionPage.php';
     $dao = new CRM_Contribute_DAO_ContributionPage();
     $dao->id = $this->_id;
     $dao->delete();
     $transaction->commit();
     CRM_Core_Session::setStatus(ts('The contribution page \'%1\' has been deleted.', array(1 => $this->_title)));
 }
コード例 #2
0
 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     $transaction = new CRM_Core_Transaction();
     // first delete the join entries associated with this contribution page
     $dao = new CRM_Core_DAO_UFJoin();
     $params = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
     $dao->copyValues($params);
     $dao->delete();
     //next delete the membership block fields
     $dao = new CRM_Member_DAO_MembershipBlock();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $this->_id;
     $dao->delete();
     //next delete the pcp block fields
     $dao = new CRM_PCP_DAO_PCPBlock();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $this->_id;
     $dao->delete();
     // need to delete premiums. CRM-4586
     CRM_Contribute_BAO_Premium::deletePremium($this->_id);
     // price set cleanup, CRM-5527
     CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id);
     // finally delete the contribution page
     $dao = new CRM_Contribute_DAO_ContributionPage();
     $dao->id = $this->_id;
     $dao->delete();
     $transaction->commit();
     CRM_Core_Session::setStatus(ts("The contribution page '%1' has been deleted.", array(1 => $this->_title)), ts('Deleted'), 'success');
 }