+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
+ | Copyright CiviCRM LLC (c) 2004-2016 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
*/
/**
if (isset($this->_id) && $this->_id) {
$params = array('id' => $this->_id);
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
+ CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
}
$this->set('values', $this->_values);
}
+ // Check permission to edit contribution page
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && $this->_action & CRM_Core_Action::UPDATE) {
+ $financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']);
+ if (!CRM_Core_Permission::check('edit contributions of type ' . $financialTypeID)) {
+ CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ }
+ }
+
// Preload libraries required by the "Profiles" tab
$schemas = array('IndividualModel', 'OrganizationModel', 'ContributionModel');
if (in_array('CiviMember', CRM_Core_Config::singleton()->enableComponents)) {
list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults();
}
- if (!isset($defaults['for_organization'])) {
- $defaults['for_organization'] = ts('I am contributing on behalf of an organization.');
- }
-
if (!empty($defaults['recur_frequency_unit'])) {
$defaults['recur_frequency_unit'] = array_fill_keys(explode(CRM_Core_DAO::VALUE_SEPARATOR,
$defaults['recur_frequency_unit']
$defaults['recur_frequency_unit'] = array('month' => 1);
}
- if (!empty($defaults['is_for_organization'])) {
- $defaults['is_organization'] = 1;
- }
- else {
- $defaults['is_for_organization'] = 1;
- }
-
// confirm page starts out enabled
if (!isset($defaults['is_confirm_enabled'])) {
$defaults['is_confirm_enabled'] = 1;