3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2020 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2020
35 * Build the form object for disable mail feature
37 class CRM_Mailing_Form_Browse
extends CRM_Core_Form
{
40 * Heart of the viewing process. The runner gets all the meta data for
41 * the contact and calls the appropriate type of page to view.
43 public function preProcess() {
44 $this->_mailingId
= CRM_Utils_Request
::retrieve('mid', 'Positive', $this);
45 $this->_action
= CRM_Utils_Request
::retrieve('action', 'String', $this);
47 // check for action permissions.
48 if (!CRM_Core_Permission
::checkActionPermission('CiviMail', $this->_action
)) {
49 CRM_Core_Error
::statusBounce(ts('You do not have permission to access this page.'));
52 $mailing = new CRM_Mailing_BAO_Mailing();
53 $mailing->id
= $this->_mailingId
;
55 if ($mailing->find(TRUE)) {
56 $subject = $mailing->subject
;
58 $this->assign('subject', $subject);
62 * Build the form object.
64 public function buildQuickForm() {
68 'name' => ts('Confirm'),
73 'name' => ts('Cancel'),
78 public function postProcess() {
79 if ($this->_action
& CRM_Core_Action
::DELETE
) {
80 CRM_Mailing_BAO_Mailing
::del($this->_mailingId
);
82 elseif ($this->_action
& CRM_Core_Action
::DISABLE
) {
83 CRM_Mailing_BAO_MailingJob
::cancel($this->_mailingId
);
84 CRM_Core_Session
::setStatus(ts('The mailing has been canceled.'), ts('Canceled'), 'success');
86 elseif ($this->_action
& CRM_Core_Action
::RENEW
) {
87 //set is_archived to 1
88 CRM_Core_DAO
::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId
, 'is_archived', TRUE);