本文整理汇总了PHP中CRM_Pledge_BAO_Pledge::deletePledge方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Pledge_BAO_Pledge::deletePledge方法的具体用法?PHP CRM_Pledge_BAO_Pledge::deletePledge怎么用?PHP CRM_Pledge_BAO_Pledge::deletePledge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Pledge_BAO_Pledge
的用法示例。
在下文中一共展示了CRM_Pledge_BAO_Pledge::deletePledge方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_pledge_delete
/**
* Delete a pledge
*
* @param array $params array included 'pledge_id' of pledge to delete
*
* @return boolean true if success, else false
* @static void
* {@getfields pledge_delete}
* @example PledgeDelete.php
* @access public
*/
function civicrm_api3_pledge_delete($params)
{
if (CRM_Pledge_BAO_Pledge::deletePledge($params['id'])) {
return civicrm_api3_create_success(array('id' => $params['id']), $params, 'pledge', 'delete');
} else {
return civicrm_api3_create_error('Could not delete pledge');
}
}
示例2: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return void
*/
public function postProcess()
{
$deletedPledges = 0;
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
$deletedPledges++;
}
}
$status = ts('Deleted Pledge(s): %1 (Total Selected: %2) ', array(1 => $deletedPledges, 2 => count($this->_pledgeIds)));
CRM_Core_Session::setStatus($status, '', 'info');
}
示例3: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
public function postProcess()
{
$deletedPledges = 0;
require_once 'CRM/Pledge/BAO/Pledge.php';
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
$deletedPledges++;
}
}
$status = array(ts('Deleted Pledge(s): %1', array(1 => $deletedPledges)), ts('Total Selected Pledge(s): %1', array(1 => count($this->_pledgeIds))));
CRM_Core_Session::setStatus($status);
}
示例4: postProcess
/**
* Process the form after the input has been submitted and validated.
*
*
* @return void
*/
public function postProcess()
{
$deleted = $failed = 0;
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
$deleted++;
} else {
$failed++;
}
}
if ($deleted) {
$msg = ts('%count pledge deleted.', array('plural' => '%count pledges deleted.', 'count' => $deleted));
CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
if ($failed) {
CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
}
}
示例5: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Pledge_BAO_Pledge::deletePledge($this->_id);
return;
}
// get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
// set the contact, when contact is selected
if (!empty($formValues['contact_id'])) {
$this->_contactID = $formValues['contact_id'];
}
$session = CRM_Core_Session::singleton();
// get All Payments status types.
$paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$fields = array('frequency_unit', 'frequency_interval', 'frequency_day', 'installments', 'financial_type_id', 'initial_reminder_day', 'max_reminders', 'additional_reminder_day', 'contribution_page_id', 'campaign_id');
foreach ($fields as $f) {
$params[$f] = CRM_Utils_Array::value($f, $formValues);
}
// defaults status is "Pending".
// if update get status.
if ($this->_id) {
$params['pledge_status_id'] = $params['status_id'] = $this->_values['status_id'];
} else {
$params['pledge_status_id'] = $params['status_id'] = array_search('Pending', $paymentStatusTypes);
}
// format amount
$params['amount'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('amount', $formValues));
$params['currency'] = CRM_Utils_Array::value('currency', $formValues);
$params['original_installment_amount'] = $params['amount'] / $params['installments'];
$dates = array('create_date', 'start_date', 'acknowledge_date', 'cancel_date');
foreach ($dates as $d) {
if ($this->_id && !$this->_isPending && !empty($this->_values[$d])) {
if ($d == 'start_date') {
$params['scheduled_date'] = CRM_Utils_Date::processDate($this->_values[$d]);
}
$params[$d] = CRM_Utils_Date::processDate($this->_values[$d]);
} elseif (!empty($formValues[$d]) && !CRM_Utils_System::isNull($formValues[$d])) {
if ($d == 'start_date') {
$params['scheduled_date'] = CRM_Utils_Date::processDate($formValues[$d]);
}
$params[$d] = CRM_Utils_Date::processDate($formValues[$d]);
} else {
$params[$d] = 'null';
}
}
if (!empty($formValues['is_acknowledge'])) {
$params['acknowledge_date'] = date('Y-m-d');
}
// assign id only in update mode
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
}
$params['contact_id'] = $this->_contactID;
// format custom data
if (!empty($formValues['hidden_custom'])) {
$params['hidden_custom'] = 1;
$customFields = CRM_Core_BAO_CustomField::getFields('Pledge');
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($formValues, $this->_id, 'Pledge');
}
// handle pending pledge.
$params['is_pledge_pending'] = $this->_isPending;
// create pledge record.
$pledge = CRM_Pledge_BAO_Pledge::create($params);
$statusMsg = NULL;
if ($pledge->id) {
// set the status msg.
if ($this->_action & CRM_Core_Action::ADD) {
$statusMsg = ts('Pledge has been recorded and the payment schedule has been created.<br />');
} elseif ($this->_action & CRM_Core_Action::UPDATE) {
$statusMsg = ts('Pledge has been updated.<br />');
}
}
// handle Acknowledgment.
if (!empty($formValues['is_acknowledge']) && $pledge->id) {
// calculate scheduled amount.
$params['scheduled_amount'] = round($params['amount'] / $params['installments']);
$params['total_pledge_amount'] = $params['amount'];
// get some required pledge values in params.
$params['id'] = $pledge->id;
$params['acknowledge_date'] = $pledge->acknowledge_date;
$params['is_test'] = $pledge->is_test;
$params['currency'] = $pledge->currency;
// retrieve 'from email id' for acknowledgement
$params['from_email_id'] = $formValues['from_email_address'];
$this->paymentId = NULL;
// send Acknowledgment mail.
CRM_Pledge_BAO_Pledge::sendAcknowledgment($this, $params);
if (!isset($this->userEmail)) {
list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
}
$statusMsg .= ' ' . ts("An acknowledgment email has been sent to %1.<br />", array(1 => $this->userEmail));
// build the payment urls.
if ($this->paymentId) {
$urlParams = "reset=1&action=add&cid={$this->_contactID}&ppid={$this->paymentId}&context=pledge";
$contribURL = CRM_Utils_System::url('civicrm/contact/view/contribution', $urlParams);
$urlParams .= "&mode=live";
//.........这里部分代码省略.........
示例6: testDeletePaymentsZeroId
/**
* Pass Zero Id for a payment deletion for one pledge
*/
function testDeletePaymentsZeroId()
{
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
$paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(0);
$result = CRM_Pledge_BAO_Pledge::deletePledge($payment->pledge_id);
}
示例7: civicrm_pledge_delete
/**
* Delete a pledge
*
* @param array $params array included 'pledge_id' of pledge to delete
*
* @return boolean true if success, else false
* @static void
* @access public
*/
function civicrm_pledge_delete(&$params)
{
if (!empty($params['id'])) {
//handle field name or unique db name
$params['pledge_id'] = $params['id'];
}
$pledgeID = CRM_Utils_Array::value('pledge_id', $params);
if (!$pledgeID) {
return civicrm_create_error('Could not find pledge_id in input parameters');
}
require_once 'CRM/Pledge/BAO/Pledge.php';
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeID)) {
return civicrm_create_success();
} else {
return civicrm_create_error('Could not delete pledge');
}
}