3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class provides the functionality to delete a group of
20 * members. This class provides functionality for the actual
23 class CRM_Member_Form_Task_Delete
extends CRM_Member_Form_Task
{
26 * Are we operating in "single mode", i.e. deleting one
27 * specific membership?
31 protected $_single = FALSE;
34 * Build all the data structures needed to build the form.
38 public function preProcess() {
40 if (!CRM_Core_Permission
::checkActionPermission('CiviMember', CRM_Core_Action
::DELETE
)) {
41 CRM_Core_Error
::statusBounce(ts('You do not have permission to access this page.'));
47 * Build the form object.
52 public function buildQuickForm() {
53 $this->addDefaultButtons(ts('Delete Memberships'), 'done');
57 * Process the form after the input has been submitted and validated.
62 public function postProcess() {
63 $deleted = $failed = 0;
64 foreach ($this->_memberIds
as $memberId) {
65 if (CRM_Member_BAO_Membership
::del($memberId)) {
74 $msg = ts('%count membership deleted.', ['plural' => '%count memberships deleted.', 'count' => $deleted]);
75 CRM_Core_Session
::setStatus($msg, ts('Removed'), 'success');
79 CRM_Core_Session
::setStatus(ts('1 could not be deleted.', ['plural' => '%count could not be deleted.', 'count' => $failed]), ts('Error'), 'error');