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 * Build the form object for disable mail feature
21 class CRM_Mailing_Form_Browse
extends CRM_Core_Form
{
24 * Heart of the viewing process. The runner gets all the meta data for
25 * the contact and calls the appropriate type of page to view.
27 public function preProcess() {
28 $this->_mailingId
= CRM_Utils_Request
::retrieve('mid', 'Positive', $this);
29 $this->_action
= CRM_Utils_Request
::retrieve('action', 'String', $this);
31 // check for action permissions.
32 if (!CRM_Core_Permission
::checkActionPermission('CiviMail', $this->_action
)) {
33 CRM_Core_Error
::statusBounce(ts('You do not have permission to access this page.'));
36 $mailing = new CRM_Mailing_BAO_Mailing();
37 $mailing->id
= $this->_mailingId
;
39 if ($mailing->find(TRUE)) {
40 $subject = $mailing->subject
;
42 $this->assign('subject', $subject);
46 * Build the form object.
48 public function buildQuickForm() {
52 'name' => ts('Confirm'),
57 'name' => ts('Cancel'),
62 public function postProcess() {
63 if ($this->_action
& CRM_Core_Action
::DELETE
) {
64 CRM_Mailing_BAO_Mailing
::del($this->_mailingId
);
66 elseif ($this->_action
& CRM_Core_Action
::DISABLE
) {
67 CRM_Mailing_BAO_MailingJob
::cancel($this->_mailingId
);
68 CRM_Core_Session
::setStatus(ts('The mailing has been canceled.'), ts('Canceled'), 'success');
70 elseif ($this->_action
& CRM_Core_Action
::RENEW
) {
71 //set is_archived to 1
72 CRM_Core_DAO
::setFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingId
, 'is_archived', TRUE);