Commit c6762960 authored by Johan Vervloet's avatar Johan Vervloet
Browse files

is_active=1 if not explicitely set, moved to base class.

parent 1bd714cd
......@@ -101,5 +101,11 @@ abstract class CRM_Civiconfig_Entity {
if (isset($existing['id'])) {
$params['id'] = $existing['id'];
}
if (!isset($params['is_active'])) {
// if is_active is not explicitly given, assume that the entity is active.
// the entities 'setting' and 'tag' don't have an 'is_active' field, but I don't think
// it hurts that the param is set.
$params['is_active'] = 1;
}
}
}
......@@ -138,9 +138,6 @@ class CRM_Civiconfig_Entity_Group extends CRM_Civiconfig_Entity {
protected function prepareParams(array &$params, array $existing = []) {
parent::prepareParams($params, $existing);
if (!isset($params['is_active'])) {
$params['is_active'] = 1;
}
if (isset($params['group_type'])) {
$params['group_type'] = CRM_Utils_Array::implodePadded($params['group_type']);
}
......
......@@ -22,11 +22,6 @@ class CRM_Civiconfig_Entity_OptionGroup extends CRM_Civiconfig_Entity {
* @param array $existing existing entity (if available)
*/
protected function prepareParams(array &$params, array $existing = []) {
if (!isset($params['is_active'])) {
// If is_active is not explicitly given, assume that the option value
// should be active.
$params['is_active'] = 1;
}
$params['is_reserved'] = 1;
if (!isset($params['title'])) {
$params['title'] = ucfirst($params['name']);
......
......@@ -35,11 +35,6 @@ class CRM_Civiconfig_Entity_OptionValue extends CRM_Civiconfig_Entity {
* @param array $existing existing entity (if available)
*/
protected function prepareParams(array &$params, array $existing = []) {
if (!isset($params['is_active'])) {
// If is_active is not explicitly given, assume that the option value
// should be active.
$params['is_active'] = 1;
}
$params['is_reserved'] = 1;
if (!isset($params['label'])) {
$params['label'] = CRM_Civiconfig_Utils::buildLabelFromName($params['name']);
......
......@@ -29,9 +29,6 @@ class CRM_Civiconfig_Entity_Tag extends CRM_Civiconfig_Entity {
}
unset($params['parent']);
}
if (!isset($params['is_active'])) {
$params['is_active'] = 1;
}
if (empty($params['description'])) {
$params['description'] = CRM_Civiconfig_Utils::buildLabelFromName($params['name']);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment