Example #1
1
 /**
  * Class constructor.
  *
  * @param null $title
  * @param bool|int $action
  * @param bool $modal
  *
  * @throws \Exception
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
     // New:            civicrm/mailing/send?reset=1
     // Re-use:         civicrm/mailing/send?reset=1&mid=%%mid%%
     // Continue:       civicrm/mailing/send?reset=1&mid=%%mid%%&continue=true
     $mid = CRM_Utils_Request::retrieve('mid', 'Positive');
     $continue = CRM_Utils_Request::retrieve('continue', 'String');
     if (!$mid) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/new'));
     }
     if ($mid && $continue) {
         //CRM-15979 - check if abtest exist for mailing then redirect accordingly
         $abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
         if (!empty($abtest) && !empty($abtest->id)) {
             $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id);
         } else {
             $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mid);
         }
         CRM_Utils_System::redirect($redirect);
     }
     if ($mid && !$continue) {
         $clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $clone['id']));
     }
 }
 function postProcess()
 {
     $values = $this->exportValues();
     // find/determine household name
     if ($values['hh_option'] == 'new') {
         // extract the name:
         if ($values['household_name_pattern'] == 'custom') {
             $household_name = $values['household_name'];
         } else {
             $household_name = $values['household_name_pattern'];
         }
         $household = civicrm_api3('Contact', 'create', array('contact_type' => 'Household', 'household_name' => $household_name));
         $household_id = $household['id'];
     } elseif ($values['hh_option'] == 'existing') {
         $household_id = (int) $values['existing_household'];
     } else {
         // has to be the selected_XXX preselected household change
         $household_id = (int) substr($values['hh_option'], 9);
     }
     // find contact_ids
     $contact_ids = $values['hh_contacts'];
     // ...and pass the ball to the merge view
     $mergeview_url = CRM_Utils_System::url('civicrm/household/mergeview', "hid={$household_id}&oids={$contact_ids}");
     CRM_Utils_System::redirect($mergeview_url);
     parent::postProcess();
 }
 function postProcess()
 {
     $values = $this->exportValues();
     $pcp_type_contact = $values['pcp_contact_id'];
     $pcp_type = $values['pcp_type'];
     $custom_group_name = CRM_Pcpteams_Constant::C_PCP_CUSTOM_GROUP_NAME;
     $customGroupParams = array('version' => 3, 'sequential' => 1, 'name' => $custom_group_name);
     $custom_group_ret = civicrm_api('CustomGroup', 'GET', $customGroupParams);
     $customGroupID = $custom_group_ret['id'];
     $customGroupTableName = $custom_group_ret['values'][0]['table_name'];
     $query = "SELECT ct.pcp_type_contact as contactID FROM {$customGroupTableName} ct WHERE ct.pcp_type = '{$pcp_type}'";
     $dao = CRM_Core_DAO::executeQuery($query);
     $pcpFound = FALSE;
     while ($dao->fetch()) {
         if ($dao->contactID == $pcp_type_contact) {
             CRM_Core_Session::setStatus(ts('PCP Found. Redirecting to dashboard'));
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
             $pcpFound = TRUE;
             break;
         }
     }
     if (!$pcpFound) {
         CRM_Core_Session::setStatus(ts('PCP Not Found. Creating New PCP Record'));
         $PcpID = $this->_pcpId;
         $insertQuery = "\n        INSERT INTO `civicrm_value_pcp_custom_set` (`id`, `entity_id`, `team_pcp_id`, `pcp_type`, `pcp_type_contact`) VALUES (NULL, {$PcpID}, NULL, '{$pcp_type}', {$pcp_type_contact})";
         $dao = CRM_Core_DAO::executeQuery($insertQuery);
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
     }
     //Fixme:
     parent::postProcess();
 }
Example #4
0
 function buildForm(&$form)
 {
     $groups =& CRM_Core_PseudoConstant::group();
     $tags =& CRM_Core_PseudoConstant::tag();
     if (count($groups) == 0 || count($tags) == 0) {
         CRM_Core_Session::setStatus(ts("Atleast one Group and Tag must be present, for Custom Group / Tag search."));
         $url = CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1');
         CRM_Utils_System::redirect($url);
     }
     $inG =& $form->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outG =& $form->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $andOr =& $form->addElement('checkbox', 'andOr', 'Combine With (AND, Uncheck For OR)', null, array('checked' => 'checked'));
     $int =& $form->addElement('advmultiselect', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outt =& $form->addElement('advmultiselect', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     //add/remove buttons for groups
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     //add/remove buttons for tags
     $int->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outt->setButtonAttributes('add', array('value' => ts('Add >>')));
     $int->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('includeGroups', 'excludeGroups', 'andOr', 'includeTags', 'excludeTags'));
 }
Example #5
0
 function run()
 {
     require_once 'CRM/Utils/Request.php';
     require_once 'CRM/Core/DAO.php';
     $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, true);
     $fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, false);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
     $quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     require_once 'CRM/Core/BAO/File.php';
     list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, null, $quest);
     if (!$path) {
         CRM_Core_Error::statusBounce('Could not retrieve the file');
     }
     $buffer = file_get_contents($path);
     if (!$buffer) {
         CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
     }
     if ($action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
             CRM_Core_BAO_File::delete($id, $eid, $fid);
             CRM_Core_Session::setStatus(ts('The attached file has been deleted.'));
             $session = CRM_Core_Session::singleton();
             $toUrl = $session->popUserContext();
             CRM_Utils_System::redirect($toUrl);
         } else {
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run('CRM_Custom_Form_DeleteFile', ts('Domain Information Page'), null);
         }
     } else {
         require_once 'CRM/Utils/File.php';
         CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
     }
 }
Example #6
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action == CRM_Core_Action::DELETE) {
         if ($this->_id && ($tag = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $this->_id, 'name', 'parent_id'))) {
             CRM_Core_Session::setStatus(ts("This tag cannot be deleted! You must Delete all its child tags ('%1', etc) prior to deleting this tag.", array(1 => $tag)));
             $url = CRM_Utils_System::url('civicrm/admin/tag', "reset=1");
             CRM_Utils_System::redirect($url);
             return true;
         } else {
             $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         }
     } else {
         $this->applyFilter('__ALL__', 'trim');
         $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name'), true);
         $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Tag', $this->_id));
         $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'description'));
         //@lobo haven't a clue why the checkbox isn't displayed (it should be checked by default
         $this->add('checkbox', 'is_selectable', ts("If it's a tag or a category"));
         $allTag = array('' => '- ' . ts('select') . ' -') + CRM_Core_PseudoConstant::tag();
         if ($this->_id) {
             unset($allTag[$this->_id]);
         }
         $this->add('select', 'parent_id', ts('Parent Tag'), $allTag);
         parent::buildQuickForm();
     }
 }
Example #7
0
 function run()
 {
     $this->setActivityStatusIds();
     $this->setValues();
     $contactParams = array('is_opt_out' => 1);
     $groupId = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id');
     $location = '';
     if ($this->isGroupContactAdded($this->contactId, $groupId)) {
         $this->setGroupContactRemoved($this->contactId, $groupId);
         $location = 'removed from Members after optout link';
         if (CRM_Speakcivi_Cleanup_Leave::hasJoins($this->contactId)) {
             CRM_Speakcivi_Logic_Activity::leave($this->contactId, 'confirmation_link', $this->campaignId, $this->activityId, '', 'Added by SpeakCivi Optout');
         }
     }
     if ($this->campaignId) {
         $campaign = new CRM_Speakcivi_Logic_Campaign($this->campaignId);
         $locale = $campaign->getLanguage();
         $language = substr($locale, 0, 2);
         $this->setLanguageTag($this->contactId, $language);
     }
     CRM_Speakcivi_Logic_Contact::set($this->contactId, $contactParams);
     $aids = $this->findActivitiesIds($this->activityId, $this->campaignId, $this->contactId);
     $this->setActivitiesStatuses($this->activityId, $aids, 'optout', $location);
     $country = $this->getCountry($this->campaignId);
     $url = "{$country}/post_optout";
     CRM_Utils_System::redirect($url);
 }
 function __construct()
 {
     // don’t display the ‘Add these Contacts to Group’ button
     $this->_add2groupSupported = FALSE;
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->db = $dsn['database'];
     $this->log_conn_id = CRM_Utils_Request::retrieve('log_conn_id', 'Integer', CRM_Core_DAO::$_nullObject);
     $this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject);
     parent::__construct();
     CRM_Utils_System::resetBreadCrumb();
     $breadcrumb = array(array('title' => ts('Home'), 'url' => CRM_Utils_System::url()), array('title' => ts('CiviCRM'), 'url' => CRM_Utils_System::url('civicrm', 'reset=1')), array('title' => ts('View Contact'), 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")), array('title' => ts('Search Results'), 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")));
     CRM_Utils_System::appendBreadCrumb($breadcrumb);
     if (CRM_Utils_Request::retrieve('revert', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         $reverter = new CRM_Logging_Reverter($this->log_conn_id, $this->log_date);
         $reverter->revert($this->tables);
         CRM_Core_Session::setStatus(ts('The changes have been reverted.'));
         if ($this->cid) {
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
         } else {
             CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary, 'reset=1', FALSE, TRUE));
         }
     }
     // make sure the report works even without the params
     if (!$this->log_conn_id or !$this->log_date) {
         $dao = new CRM_Core_DAO();
         $dao->query("SELECT log_conn_id, log_date FROM `{$this->db}`.log_{$this->tables[0]} WHERE log_action = 'Update' ORDER BY log_date DESC LIMIT 1");
         $dao->fetch();
         $this->log_conn_id = $dao->log_conn_id;
         $this->log_date = $dao->log_date;
     }
     $this->_columnHeaders = array('field' => array('title' => ts('Field')), 'from' => array('title' => ts('Changed From')), 'to' => array('title' => ts('Changed To')));
 }
Example #9
0
 /**
  * Function to set variables up before form is built
  * 
  * @param null
  * 
  * @return void
  * @access public
  */
 public function preProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         //check permission for action.
         if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
         }
         $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'title');
         $this->assign('title', $this->_title);
         parent::preProcess();
     }
     if (!$this->_action) {
         $action = CRM_Utils_Array::value('action', $_GET);
         $id = CRM_Utils_Array::value('id', $_GET);
         switch ($action) {
             case 'delete':
                 require_once 'CRM/Contribute/BAO/PCP.php';
                 $title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $id, 'title');
                 CRM_Contribute_BAO_PCP::delete($id);
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $title)));
                 break;
             case 'disable':
                 require_once 'CRM/Contribute/BAO/PCP.php';
                 CRM_Contribute_BAO_PCP::setDisable($id, '0');
                 break;
             case 'enable':
                 require_once 'CRM/Contribute/BAO/PCP.php';
                 CRM_Contribute_BAO_PCP::setDisable($id, '1');
                 break;
         }
         $session =& CRM_Core_Session::singleton();
         CRM_Utils_System::redirect($session->popUserContext());
     }
 }
 /**
  * Method to process civicrm pre hook:
  * If objectName = GroupContact and Group is a protected group, check if user has permission.
  * When user does not have permission, redirect to user context with status message
  *
  */
 public static function pre($op, $objectName, $objectId, $params)
 {
     if ($objectName == 'GroupContact' && self::groupIsProtected($objectId) == TRUE) {
         // check if request is from webform, and allow groupcontact action if from webform
         $webFormRequest = FALSE;
         $request = CRM_Utils_Request::exportValues();
         if (isset($request['form_id'])) {
             $requestParts = explode('_', $request['form_id']);
             if (isset($requestParts[2])) {
                 if ($requestParts[0] == 'webform' && $requestParts[1] == 'client' && ($requestParts[2] = 'form')) {
                     $webFormRequest = TRUE;
                 }
             }
         }
         if (!$webFormRequest) {
             if (!CRM_Core_Permission::check('manage protected groups')) {
                 CRM_Core_Session::setStatus(ts("You are not allowed to add or remove contacts to this group"), ts("Not allowed"), "error");
                 // if from report, redirect to report instance
                 if (isset($request['q']) && substr($request['q'], 0, 15) == "civicrm/report/") {
                     CRM_Utils_System::redirect(CRM_Utils_System::url($request['q'], 'reset=1', true));
                 } else {
                     $session = CRM_Core_Session::singleton();
                     CRM_Utils_System::redirect($session->readUserContext());
                 }
             }
         }
     }
 }
 /**
  * @param CRM_Core_Form $form
  * @param null $type
  * @param null $mode
  *
  * @throws Exception
  */
 public static function preProcess(&$form, $type = NULL, $mode = NULL)
 {
     if ($type) {
         $form->_type = $type;
     } else {
         $form->_type = CRM_Utils_Request::retrieve('type', 'String', $form);
     }
     if ($form->_type) {
         $form->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($form->_type, $form->_mode);
     }
     $form->set('paymentProcessor', $form->_paymentProcessor);
     // also set cancel subscription url
     if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) {
         $form->_paymentObject = CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form);
         $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL();
     }
     //checks after setting $form->_paymentProcessor
     // we do this outside of the above conditional to avoid
     // saving the country/state list in the session (which could be huge)
     CRM_Core_Payment_Form::setPaymentFieldsByProcessor($form, $form->_paymentProcessor);
     $form->assign_by_ref('paymentProcessor', $form->_paymentProcessor);
     // check if this is a paypal auto return and redirect accordingly
     //@todo - determine if this is legacy and remove
     if (CRM_Core_Payment::paypalRedirect($form->_paymentProcessor)) {
         $url = CRM_Utils_System::url('civicrm/contribute/transact', "_qf_ThankYou_display=1&qfKey={$form->controller->_key}");
         CRM_Utils_System::redirect($url);
     }
     // make sure we have a valid payment class, else abort
     if (!empty($form->_values['is_monetary']) && !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) {
         CRM_Core_Error::fatal(ts('Payment processor is not set for this page'));
     }
     if (!empty($form->_membershipBlock) && !empty($form->_membershipBlock['is_separate_payment']) && (!empty($form->_paymentProcessor['class_name']) && !(CRM_Utils_Array::value('billing_mode', $form->_paymentProcessor) & CRM_Core_Payment::BILLING_MODE_FORM))) {
         CRM_Core_Error::fatal(ts('This contribution page is configured to support separate contribution and membership payments. This %1 plugin does not currently support multiple simultaneous payments, or the option to "Execute real-time monetary transactions" is disabled. Please contact the site administrator and notify them of this error', array(1 => $form->_paymentProcessor['payment_processor_type'])));
     }
 }
Example #12
0
 function __construct()
 {
     parent::__construct();
     $check = CRM_Core_Permission::check('access Contact Dashboard');
     if (!$check) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
         break;
     }
     $this->_contactId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $session =& CRM_Core_Session::singleton();
     $userID = $session->get('userID');
     if (!$this->_contactId) {
         $this->_contactId = $userID;
     } else {
         if ($this->_contactId != $userID) {
             require_once 'CRM/Contact/BAO/Contact/Permission.php';
             if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::VIEW)) {
                 CRM_Core_Error::fatal(ts('You do not have permission to view this contact'));
             }
             if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
                 $this->_edit = false;
             }
         }
     }
 }
Example #13
0
 public function run()
 {
     $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE);
     $fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
     $quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, NULL, $quest);
     if (!$path) {
         CRM_Core_Error::statusBounce('Could not retrieve the file');
     }
     $buffer = file_get_contents($path);
     if (!$buffer) {
         CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
     }
     if ($action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
             CRM_Core_BAO_File::deleteFileReferences($id, $eid, $fid);
             CRM_Core_Session::setStatus(ts('The attached file has been deleted.'), ts('Complete'), 'success');
             $session = CRM_Core_Session::singleton();
             $toUrl = $session->popUserContext();
             CRM_Utils_System::redirect($toUrl);
         }
     } else {
         CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
     }
 }
Example #14
0
 /**
  * called when action is update.
  *
  * @param int $groupId
  *
  * @return null
  */
 public function edit($groupId = NULL)
 {
     $this->assign('edit', $this->_edit);
     if (!$this->_edit) {
         return NULL;
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'browse');
     if ($action == CRM_Core_Action::DELETE) {
         $groupContactId = CRM_Utils_Request::retrieve('gcid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
         $status = CRM_Utils_Request::retrieve('st', 'String', CRM_Core_DAO::$_nullObject, TRUE);
         if (is_numeric($groupContactId) && $status) {
             CRM_Contact_Page_View_GroupContact::del($groupContactId, $status, $this->_contactId);
         }
         $url = CRM_Utils_System::url('civicrm/user', "reset=1&id={$this->_contactId}");
         CRM_Utils_System::redirect($url);
     }
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_GroupContact', ts("Contact's Groups"), CRM_Core_Action::ADD, FALSE, FALSE, TRUE, FALSE);
     $controller->setEmbedded(TRUE);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1&id={$this->_contactId}"), FALSE);
     $controller->reset();
     $controller->set('contactId', $this->_contactId);
     $controller->set('groupId', $groupId);
     $controller->set('context', 'user');
     $controller->set('onlyPublicGroups', $this->_onlyPublicGroups);
     $controller->process();
     $controller->run();
 }
 public function postProcess()
 {
     $session = CRM_Core_Session::singleton();
     $session->setStatus('Rule ' . $this->rule->label . ' parameters updated', 'Rule parameters updated', 'success');
     $redirectUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id=' . $this->rule->id, TRUE);
     CRM_Utils_System::redirect($redirectUrl);
 }
Example #16
0
 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('Your do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         CRM_Report_BAO_Instance::delete($instanceId);
         CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
     } else {
         require_once 'CRM/Core/OptionGroup.php';
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         if (strstr($templateInfo['name'], '_Form')) {
             $instanceInfo = array();
             CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper =& new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], null, null);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
Example #17
0
 function run()
 {
     $this->setValues();
     $this->setIsOptOut($this->contactId, 0);
     $groupId = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id');
     $activityStatus = 'Completed';
     // Completed existing member
     if (!$this->isGroupContactAdded($this->contactId, $groupId)) {
         CRM_Speakcivi_Logic_Activity::join($this->contactId, 'confirmation_link', $this->campaignId);
         $this->setGroupContactAdded($this->contactId, $groupId);
         $activityStatus = 'optin';
         // Completed new member
     }
     if ($this->campaignId) {
         $campaign = new CRM_Speakcivi_Logic_Campaign($this->campaignId);
         $locale = $campaign->getLanguage();
         $language = substr($locale, 0, 2);
         $this->setLanguageGroup($this->contactId, $language);
         $this->setLanguageTag($this->contactId, $language);
     }
     $aids = $this->findActivitiesIds($this->activityId, $this->campaignId, $this->contactId);
     $this->setActivitiesStatuses($this->activityId, $aids, $activityStatus);
     $email = CRM_Speakcivi_Logic_Contact::getEmail($this->contactId);
     $speakcivi = new CRM_Speakcivi_Page_Speakcivi();
     $speakcivi->sendConfirm($email, $this->contactId, $this->activityId, $this->campaignId, false);
     $country = $this->getCountry($this->campaignId);
     $url = "{$country}/post_confirm";
     CRM_Utils_System::redirect($url);
 }
Example #18
0
 public function preProcess()
 {
     parent::preProcess();
     list($groupId, $ssId) = $this->createHiddenGroup();
     $mailing = civicrm_api3('Mailing', 'create', array('name' => "", 'campaign_id' => NULL, 'replyto_email' => "", 'subject' => "", 'body_html' => "", 'body_text' => "", 'groups' => array('include' => array($groupId), 'exclude' => array(), 'base' => array()), 'mailings' => array('include' => array(), 'exclude' => array())));
     CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mailing['id']));
 }
 /**
  * Function to process the form
  *
  * @access public
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $errors = CRM_Financial_BAO_FinancialType::del($this->_id);
         if (!empty($errors)) {
             $message = ts('This item cannot be deleted.') . $errors['error_message'];
             CRM_Core_Session::setStatus($message);
             return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialType', "reset=1&action=browse"));
         }
         CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'));
     } else {
         $params = $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['financialType'] = $this->_id;
         }
         $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
             CRM_Core_Session::setStatus(ts('The financial type \'%1\' has been saved.', array(1 => $financialType->name)));
         } else {
             $url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);
             $statusArray = array(1 => $financialType->name, 2 => $financialType->name, 3 => $financialType->titles[0], 4 => $financialType->titles[1], 5 => $financialType->titles[2]);
             CRM_Core_Session::setStatus(ts('Your Financial \'%1\' Type has been created, along with a corresponding income account \'%2\'. That income account, along with standard financial accounts \'%3\', \'%4\' and \'%5\' have been linked to the financial type. You may edit or replace those relationships here.', $statusArray));
         }
         $session = CRM_Core_Session::singleton();
         $session->replaceUserContext($url);
     }
 }
Example #20
0
/**
 * Implementation of hook_civicrm_postProcess().
 *
 * Called when a form comes back for processing. Basically, we want to process
 * the button we added in cdntaxreceipts_civicrm_buildForm().
 */
function cdntaxreceipts_civicrm_postProcess($formName, &$form)
{
    // first check whether I really need to process this form
    if (!is_a($form, 'CRM_Contribute_Form_ContributionView')) {
        return;
    }
    $types = array('issue_tax_receipt', 'view_tax_receipt');
    $action = '';
    foreach ($types as $type) {
        $post = '_qf_ContributionView_submit_' . $type;
        if (isset($_POST[$post])) {
            if ($_POST[$post] == ts('Tax Receipt', array('domain' => 'org.civicrm.cdntaxreceipts'))) {
                $action = $post;
            }
        }
    }
    if (empty($action)) {
        return;
    }
    // the tax receipt button has been pressed.  redirect to the tax receipt 'view' screen, preserving context.
    $contributionId = $form->get('id');
    $contactId = $form->get('cid');
    $session = CRM_Core_Session::singleton();
    $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&id={$contributionId}&cid={$contactId}&action=view&context=contribution&selectedChild=contribute"));
    $urlParams = array('reset=1', 'id=' . $contributionId, 'cid=' . $contactId);
    CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/cdntaxreceipts/view', implode('&', $urlParams)));
}
Example #21
0
 function buildForm(&$form)
 {
     $this->setTitle(ts('Include / Exclude Search'));
     $groups = CRM_Core_PseudoConstant::group();
     $tags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
     if (count($groups) == 0 || count($tags) == 0) {
         CRM_Core_Session::setStatus(ts("At least one Group and Tag must be present for Custom Group / Tag search."), ts('Missing Group/Tag'));
         $url = CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1');
         CRM_Utils_System::redirect($url);
     }
     $inG =& $form->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outG =& $form->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $andOr = array('1' => ts('Show contacts that meet the Groups criteria AND the Tags criteria'), '0' => ts('Show contacts that meet the Groups criteria OR  the Tags criteria'));
     $form->addRadio('andOr', ts('AND/OR'), $andOr, NULL, '<br />', TRUE);
     $int =& $form->addElement('advmultiselect', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outt =& $form->addElement('advmultiselect', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     //add/remove buttons for groups
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     //add/remove buttons for tags
     $int->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outt->setButtonAttributes('add', array('value' => ts('Add >>')));
     $int->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('includeGroups', 'excludeGroups', 'andOr', 'includeTags', 'excludeTags'));
 }
Example #22
0
 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     if (!CRM_Core_Permission::check('administer Reports')) {
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
     }
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl();
     $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', 'String', FALSE);
     $extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.');
     $reportClass = NULL;
     if ($extKey !== FALSE) {
         $ext = CRM_Extension_System::singleton()->getMapper();
         $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
         $templateInfo['name'] = $reportClass;
     }
     if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form') || !is_null($reportClass)) {
         CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template');
         $this->assign('reportTitle', $templateInfo['label']);
         $session = CRM_Core_Session::singleton();
         $session->set('reportDescription', $templateInfo['description']);
         $wrapper = new CRM_Utils_Wrapper();
         return $wrapper->run($templateInfo['name'], NULL, NULL);
     }
     if ($optionVal) {
         CRM_Core_Session::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'), ts('Template Not Found'), 'error');
     }
     return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
 }
 function run()
 {
     $get = $_GET;
     $cid = $get['cid'];
     $mid = $get['mid'];
     $cr_id = $get['cr_id'];
     $payer_reference = $get['reference_number'];
     $this->assign('payer_reference', $reference_number);
     $params = array();
     if (!empty($cid)) {
         $contact = CRM_SmartdebitReconciliation_Page_MembershipRecurDetails::_get_contact_details($cid);
         $address = CRM_SmartdebitReconciliation_Page_MembershipRecurDetails::_get_address($cid);
         $this->assign('aContact', $contact);
         $this->assign('aAddress', $address);
         $params['contact_id'] = $cid;
     }
     if (!empty($mid)) {
         $membership = CRM_SmartdebitReconciliation_Page_MembershipRecurDetails::_get_membership($mid);
         $this->assign('aMembership', $membership);
         $params['membership_id'] = $mid;
     }
     if (!empty($cr_id)) {
         $cRecur = CRM_SmartdebitReconciliation_Page_MembershipRecurDetails::_get_contribution_recur($cr_id);
         $this->assign('aContributionRecur', $cRecur);
         $params['contribution_recur_id'] = $cr_id;
     }
     $params['payer_reference'] = $payer_reference;
     // Check the details are correct and everything has been passed over
     // Call the routine that will fix everything
     require_once 'CRM/SmartdebitReconciliation/Form/SmartdebitReconciliationList.php';
     CRM_SmartdebitReconciliation_Form_SmartdebitReconciliationList::repair_missing_from_civicrm_record($params);
     $params = sprintf('reset=1&cid=%d', $params['contact_id']);
     $url = CRM_Utils_System::url('civicrm/contact/view', $params);
     CRM_Utils_System::redirect($url);
 }
 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     CRM_Core_BAO_File::delete($this->_id, $this->_eid);
     CRM_Core_Session::setStatus(ts('The attached file has been deleted.'));
     $session = CRM_Core_Session::singleton();
     $toUrl = $session->popUserContext();
     CRM_Utils_System::redirect($toUrl);
 }
 function postProcess()
 {
     $values = $this->exportValues();
     if ($values['teamOption'] == 0) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/support', "code=cpfgq&qfKey={$this->controller->_key}"));
     } else {
         $this->set("workflowTeam", $values['teamOption']);
     }
 }
 function postProcess()
 {
     $values = $this->exportValues();
     if ($values['teamOption'] == 0) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', "reset=1"));
     } else {
         $this->set("workflowTribute", $values['teamOption']);
     }
 }
 /**
  * Process the form submission.
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $params['web_tracking_report_id'] = CRM_Utils_Array::value('web_tracking_report_id', $params, NULL);
     civicrm_api3('setting', 'create', array('sequential' => 1, 'web_tracking_report_id' => $params['web_tracking_report_id']));
     $url = 'civicrm/report/webtracking';
     $urlParams = 'action=update&reset=1';
     CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
 }
 function run()
 {
     CRM_CiviMailchimp_BAO_SyncLog::clearAllMessages();
     $session = CRM_Core_Session::singleton();
     $session->setStatus(ts("All unread CiviMailchimp log messages cleared."), '', 'success');
     $url = CRM_Utils_System::url('civicrm/admin/mailchimp/log', 'reset=1');
     CRM_Utils_System::redirect($url);
     parent::run();
 }
Example #29
0
 /**
  * Process the form when submitted.
  */
 public function postProcess()
 {
     if ($this->_surveyId) {
         CRM_Campaign_BAO_Survey::del($this->_surveyId);
         CRM_Core_Session::setStatus('', ts("'%1' survey has been deleted.", array(1 => $this->_surveyTitle)), 'success');
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'));
     } else {
         CRM_Core_Error::fatal(ts('Delete action is missing expected survey ID.'));
     }
 }
 function postProcess()
 {
     $values = $this->exportValues();
     $mailchimp_sync_setting = CRM_CiviMailchimp_BAO_SyncSettings::findByGroupId($values['group']);
     $mailchimp_export_url = CRM_CiviMailchimp_Utils::formatMailchimpExportApiUrl($mailchimp_sync_setting->mailchimp_list_id);
     list($contacts, $mailchimp_members) = self::processForcedSync($mailchimp_sync_setting, $mailchimp_export_url);
     parent::postProcess();
     CRM_Core_Session::setStatus(ts("%1 contacts were synced to Mailchimp and %2  Mailchimp members were synced to CiviCRM.", array(1 => count($contacts), 2 => count($mailchimp_members))), ts('CiviMailchimp Force Sync Successful'), 'success');
     CRM_Utils_System::redirect($this->controller->_entryURL);
 }