X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FScheduleReminders.php;h=e6156387b8c774a9a27d681212027596c8aff656;hb=fadd4d3794d02aa088774aa37254bfda67207f65;hp=eeb4786d348d4d382eab3b5f38a3cb06c0d3f7e4;hpb=9c20001e41a6780f113893fd2c651d3531312444;p=civicrm-core.git diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index eeb4786d34..e6156387b8 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -1,10 +1,9 @@ _context = CRM_Utils_Request::retrieve('context', 'String', $this); + //CRM-16777: Don't provide access to administer schedule reminder page, with user that does not have 'administer CiviCRM' permission + if (empty($this->_context) && !CRM_Core_Permission::check('administer CiviCRM')) { + CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); + } + //CRM-16777: When user have ACLs 'edit' permission for specific event, do not give access to add, delete & updtae + //schedule reminder for other events. + else { + $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this); + if (!CRM_Event_BAO_Event::checkPermission($this->_compId, CRM_Core_Permission::EDIT)) { + CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); + } + } + if ($this->_action & (CRM_Core_Action::DELETE)) { $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title'); if ($this->_context == 'event') { @@ -247,6 +254,25 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { CRM_Core_PseudoConstant::nestedGroup('Mailing'), FALSE, array('class' => 'crm-select2 huge') ); + // multilingual only options + $multilingual = CRM_Core_I18n::isMultilingual(); + if ($multilingual) { + $smarty = CRM_Core_Smarty::singleton(); + $smarty->assign('multilingual', $multilingual); + + $languages = CRM_Core_I18n::languages(TRUE); + $languageFilter = $languages + array(CRM_Core_I18n::NONE => ts('Contacts with no preferred language')); + $element = $this->add('select', 'filter_contact_language', ts('Recipients language'), $languageFilter, FALSE, + array('multiple' => TRUE, 'class' => 'crm-select2', 'placeholder' => TRUE)); + + $communicationLanguage = array( + '' => ts('System default language'), + CRM_Core_I18n::AUTO => ts('Follow recipient preferred language') + ); + $communicationLanguage = $communicationLanguage + $languages; + $this->add('select', 'communication_language', ts('Communication language'), $communicationLanguage); + } + CRM_Mailing_BAO_Mailing::commonCompose($this); $this->add('text', 'subject', ts('Subject'), @@ -367,6 +393,9 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $defaults['recipient'] = 'manual'; $defaults['recipient_manual_id'] = $defaults['recipient_manual']; } + if ($contactLanguage = CRM_Utils_Array::value('filter_contact_language', $defaults)) { + $defaults['filter_contact_language'] = explode(CRM_Core_DAO::VALUE_SEPARATOR, $contactLanguage); + } } return $defaults; @@ -374,9 +403,6 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { /** * Process the form submission. - * - * - * @return void */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { @@ -492,6 +518,11 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $params['end_date'] = 'null'; } + // multilingual options + $params['filter_contact_language'] = CRM_Utils_Array::value('filter_contact_language', $values, NULL); + $params['filter_contact_language'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params['filter_contact_language']); + $params['communication_language'] = CRM_Utils_Array::value('communication_language', $values, NULL); + if ($this->_action & CRM_Core_Action::UPDATE) { $params['id'] = $this->_id; }