From aca7613bf2dfff87077b3c78b20f0ff46e3aa451 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 15 Jan 2022 20:50:30 -0500 Subject: [PATCH] CustomField Admin - Decouple page code from form code This moves the forms for creating/editing/previewing/deleting custom data to their own url paths instead of sharing the same path as the page. --- CRM/Campaign/Form/Survey/Questions.php | 2 +- CRM/Core/DAO/CustomField.php | 6 +- CRM/Core/DAO/CustomGroup.php | 10 +- CRM/Core/xml/Menu/Admin.xml | 20 +++ CRM/Custom/Form/DeleteField.php | 2 +- CRM/Custom/Form/DeleteGroup.php | 2 +- CRM/Custom/Form/Field.php | 14 +-- CRM/Custom/Form/Group.php | 24 ++-- CRM/Custom/Form/Preview.php | 22 +++- CRM/Custom/Page/Field.php | 116 ++---------------- CRM/Custom/Page/Group.php | 103 ++-------------- CRM/Dedupe/Merger.php | 2 +- templates/CRM/Custom/{Page => Form}/Group.hlp | 6 +- templates/CRM/Custom/Page/Field.tpl | 14 +-- templates/CRM/Custom/Page/Group.tpl | 16 +-- xml/schema/Core/CustomField.xml | 4 +- xml/schema/Core/CustomGroup.xml | 8 +- 17 files changed, 97 insertions(+), 274 deletions(-) rename templates/CRM/Custom/{Page => Form}/Group.hlp (98%) diff --git a/CRM/Campaign/Form/Survey/Questions.php b/CRM/Campaign/Form/Survey/Questions.php index 1879f022c542..3dae1e4917b0 100644 --- a/CRM/Campaign/Form/Survey/Questions.php +++ b/CRM/Campaign/Form/Survey/Questions.php @@ -58,7 +58,7 @@ public function buildQuickForm() { 'There are no custom data sets for activity type "%1". To create one, click here.', [ 1 => $activityTypes[$subTypeId], - 2 => CRM_Utils_System::url('civicrm/admin/custom/group', 'action=add&reset=1'), + 2 => CRM_Utils_System::url('civicrm/admin/custom/group/edit', 'action=add&reset=1'), 3 => '_blank', ] ) diff --git a/CRM/Core/DAO/CustomField.php b/CRM/Core/DAO/CustomField.php index b28303a25e88..f7f8aab92213 100644 --- a/CRM/Core/DAO/CustomField.php +++ b/CRM/Core/DAO/CustomField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/CustomField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6273bed0debfe48b5b7caf40b3ea78b2) + * (GenCodeChecksum:6653fe86552a321a498736c14cabc41d) */ /** @@ -45,8 +45,8 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { protected static $_paths = [ 'add' => 'civicrm/admin/custom/group/field/add?reset=1&action=add&gid=[custom_group_id]', 'update' => 'civicrm/admin/custom/group/field/update?action=update&reset=1&id=[id]&gid=[custom_group_id]', - 'preview' => 'civicrm/admin/custom/group/field?action=preview&reset=1&id=[id]&gid=[custom_group_id]', - 'delete' => 'civicrm/admin/custom/group/field?action=delete&reset=1&id=[id]&gid=[custom_group_id]', + 'preview' => 'civicrm/admin/custom/group/preview&reset=1&fid=[id]', + 'delete' => 'civicrm/admin/custom/group/field/delete?reset=1&id=[id]', 'move' => 'civicrm/admin/custom/group/field/move?reset=1&fid=[id]', ]; diff --git a/CRM/Core/DAO/CustomGroup.php b/CRM/Core/DAO/CustomGroup.php index e15adbf24a33..6bb2ce18e0df 100644 --- a/CRM/Core/DAO/CustomGroup.php +++ b/CRM/Core/DAO/CustomGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/CustomGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e2730dbbc3151ef18d9aeba73577fa96) + * (GenCodeChecksum:0c41f19103b41d2f82bcd3b60aaf2165) */ /** @@ -43,10 +43,10 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { * @var string[] */ protected static $_paths = [ - 'add' => 'civicrm/admin/custom/group?action=add&reset=1', - 'update' => 'civicrm/admin/custom/group?action=update&reset=1&id=[id]', - 'preview' => 'civicrm/admin/custom/group?action=preview&reset=1&id=[id]', - 'delete' => 'civicrm/admin/custom/group?action=delete&reset=1&id=[id]', + 'add' => 'civicrm/admin/custom/group/edit?action=add&reset=1', + 'update' => 'civicrm/admin/custom/group/edit?action=update&reset=1&id=[id]', + 'preview' => 'civicrm/admin/custom/group/preview?reset=1&gid=[id]', + 'delete' => 'civicrm/admin/custom/group/delete?reset=1&id=[id]', ]; /** diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index be6af284ad0b..596018228add 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -10,6 +10,21 @@ administer CiviCRM data 10 + + civicrm/admin/custom/group/edit + Configure Custom Set + CRM_Custom_Form_Group + + + civicrm/admin/custom/group/preview + Custom Field Preview + CRM_Custom_Form_Preview + + + civicrm/admin/custom/group/delete + Delete Custom Set + CRM_Custom_Form_DeleteGroup + civicrm/admin/custom/group/field Custom Data Fields @@ -17,6 +32,11 @@ true 11 + + civicrm/admin/custom/group/field/delete + Delete Custom Field + CRM_Custom_Form_DeleteField + civicrm/admin/custom/group/field/option Custom Field - Options diff --git a/CRM/Custom/Form/DeleteField.php b/CRM/Custom/Form/DeleteField.php index 993ed6138e86..7793b9ac3953 100644 --- a/CRM/Custom/Form/DeleteField.php +++ b/CRM/Custom/Form/DeleteField.php @@ -41,7 +41,7 @@ class CRM_Custom_Form_DeleteField extends CRM_Core_Form { * @access protected */ public function preProcess() { - $this->_id = $this->get('id'); + $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $defaults = []; $params = ['id' => $this->_id]; diff --git a/CRM/Custom/Form/DeleteGroup.php b/CRM/Custom/Form/DeleteGroup.php index d3b9169fb02b..1fed29e919ce 100644 --- a/CRM/Custom/Form/DeleteGroup.php +++ b/CRM/Custom/Form/DeleteGroup.php @@ -41,7 +41,7 @@ class CRM_Custom_Form_DeleteGroup extends CRM_Core_Form { * @access protected */ public function preProcess() { - $this->_id = $this->get('id'); + $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $defaults = []; $params = ['id' => $this->_id]; diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index 0e026ff654e8..3a4db3b7e554 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -78,8 +78,8 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { * @return void */ public function preProcess() { - //custom field id $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); + $this->setAction($this->_id ? CRM_Core_Action::UPDATE : CRM_Core_Action::ADD); $this->assign('dataToHTML', self::$_dataToHTML); @@ -97,13 +97,13 @@ public function preProcess() { $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this); } - if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) { + if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved')) { CRM_Core_Error::statusBounce("You cannot add or edit fields in a reserved custom field-set."); } if ($this->_gid) { $url = CRM_Utils_System::url('civicrm/admin/custom/group/field', - "reset=1&action=browse&gid={$this->_gid}" + "reset=1&gid={$this->_gid}" ); $session = CRM_Core_Session::singleton(); @@ -192,8 +192,8 @@ public function buildQuickForm() { if ($this->_gid) { $this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'title'); $this->setTitle($this->_title . ' - ' . ($this->_id ? ts('Edit Field') : ts('New Field'))); - $this->assign('gid', $this->_gid); } + $this->assign('gid', $this->_gid); // lets trim all the whitespace $this->applyFilter('__ALL__', 'trim'); @@ -476,7 +476,7 @@ public function buildQuickForm() { // if view mode pls freeze it with the done button. if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); - $url = CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid); + $url = CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&gid=' . $this->_gid); $this->addElement('xbutton', 'done', ts('Done'), @@ -892,12 +892,12 @@ public function postProcess() { if ($buttonName == $this->getButtonName('next', 'new')) { $msg .= '

' . ts("Ready to add another.") . '

'; $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field/add', - 'reset=1&action=add&gid=' . $this->_gid + 'reset=1&gid=' . $this->_gid )); } else { $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', - 'reset=1&action=browse&gid=' . $this->_gid + 'reset=1&gid=' . $this->_gid )); } $session->setStatus($msg, ts('Saved'), 'success'); diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index cf4c37cdac40..46dde5f9b218 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -51,25 +51,16 @@ public function preProcess() { Civi::resources()->addScriptFile('civicrm', 'js/jquery/jquery.crmIconPicker.js'); // current set id - $this->_id = $this->get('id'); + $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); + $this->setAction($this->_id ? CRM_Core_Action::UPDATE : CRM_Core_Action::ADD); - if ($this->_id && $isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_id, 'is_reserved', 'id')) { + if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_id, 'is_reserved', 'id')) { CRM_Core_Error::statusBounce("You cannot edit the settings of a reserved custom field-set."); } - // setting title for html page - if ($this->_action == CRM_Core_Action::UPDATE) { + + if ($this->_id) { $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id); $this->setTitle(ts('Edit %1', [1 => $title])); - } - elseif ($this->_action == CRM_Core_Action::VIEW) { - $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id); - $this->setTitle(ts('Preview %1', [1 => $title])); - } - else { - $this->setTitle(ts('New Custom Field Set')); - } - - if (isset($this->_id)) { $params = ['id' => $this->_id]; CRM_Core_BAO_CustomGroup::retrieve($params, $this->_defaults); @@ -78,6 +69,9 @@ public function preProcess() { $this->_subtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subExtends, 1, -1)); } } + else { + $this->setTitle(ts('New Custom Field Set')); + } } /** @@ -405,7 +399,7 @@ public function postProcess() { else { // Jump directly to adding a field if popups are disabled $action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? '' : '/add'; - $url = CRM_Utils_System::url("civicrm/admin/custom/group/field$action", 'reset=1&new=1&gid=' . $group['id'] . '&action=' . ($action ? 'add' : 'browse')); + $url = CRM_Utils_System::url("civicrm/admin/custom/group/field$action", 'reset=1&new=1&gid=' . $group['id']); CRM_Core_Session::setStatus(ts("Your custom field set '%1' has been added. You can add custom fields now.", [1 => $group['title']] ), ts('Saved'), 'success'); diff --git a/CRM/Custom/Form/Preview.php b/CRM/Custom/Form/Preview.php index 102712d94d0d..7d59ba18282f 100644 --- a/CRM/Custom/Form/Preview.php +++ b/CRM/Custom/Form/Preview.php @@ -25,6 +25,16 @@ */ class CRM_Custom_Form_Preview extends CRM_Core_Form { + /** + * @var int + */ + protected $_groupId; + + /** + * @var int + */ + protected $_fieldId; + /** * The group tree data. * @@ -40,15 +50,15 @@ class CRM_Custom_Form_Preview extends CRM_Core_Form { * @return void */ public function preProcess() { - // get the controller vars - $this->_groupId = $this->get('groupId'); - $this->_fieldId = $this->get('fieldId'); + // Get field id if previewing a single field + $this->_fieldId = CRM_Utils_Request::retrieve('fid', 'Positive', $this); + + // Single field preview if ($this->_fieldId) { - // field preview $defaults = []; $params = ['id' => $this->_fieldId]; - $fieldDAO = new CRM_Core_DAO_CustomField(); CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults); + $this->_groupId = $defaults['custom_group_id']; if (!empty($defaults['is_view'])) { CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.')); @@ -64,7 +74,9 @@ public function preProcess() { $this->_groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, $this); $this->assign('preview_type', 'field'); } + // Group preview else { + $this->_groupId = CRM_Utils_Request::retrieve('gid', 'Positive', $this, TRUE); $groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail($this->_groupId); $this->_groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, TRUE, $this); $this->assign('preview_type', 'group'); diff --git a/CRM/Custom/Page/Field.php b/CRM/Custom/Page/Field.php index 58c44f752546..b11cd85b188a 100644 --- a/CRM/Custom/Page/Field.php +++ b/CRM/Custom/Page/Field.php @@ -64,8 +64,8 @@ public static function &actionLinks() { ], CRM_Core_Action::PREVIEW => [ 'name' => ts('Preview Field Display'), - 'url' => 'civicrm/admin/custom/group/field', - 'qs' => 'action=preview&reset=1&gid=%%gid%%&id=%%id%%', + 'url' => 'civicrm/admin/custom/group/preview', + 'qs' => 'action=preview&reset=1&fid=%%id%%', 'title' => ts('Preview Custom Field'), ], CRM_Core_Action::DISABLE => [ @@ -87,8 +87,8 @@ public static function &actionLinks() { ], CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), - 'url' => 'civicrm/admin/custom/group/field', - 'qs' => 'action=delete&reset=1&gid=%%gid%%&id=%%id%%', + 'url' => 'civicrm/admin/custom/group/field/delete', + 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Delete Custom Field'), ], ]; @@ -174,30 +174,6 @@ public function browse() { $this->assign('customField', $customField); } - /** - * Edit custom data. - * - * editing would involved modifying existing fields + adding data to new fields. - * - * @param string $action - * The action to be invoked. - * - * @return void - */ - public function edit($action) { - // create a simple controller for editing custom dataCRM/Custom/Page/Field.php - $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Field', ts('Custom Field'), $action); - - // set the userContext stack - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid)); - - $controller->set('gid', $this->_gid); - $controller->setEmbedded(TRUE); - $controller->process(); - $controller->run(); - } - /** * Run the page. * @@ -207,92 +183,22 @@ public function edit($action) { * @return void */ public function run() { + $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, TRUE); - $id = CRM_Utils_Request::retrieve('id', 'Positive', - $this, FALSE, 0 - ); - - if ($id) { - $values = civicrm_api3('custom_field', 'getsingle', ['id' => $id]); - $this->_gid = $values['custom_group_id']; - } - // get the group id - else { - $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', - $this - ); - } - - if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) { + if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved')) { CRM_Core_Error::statusBounce("You cannot add or edit fields in a reserved custom field-set."); } - $action = CRM_Utils_Request::retrieve('action', 'String', - // default to 'browse' - $this, FALSE, 'browse' - ); - - if ($action & CRM_Core_Action::DELETE) { - - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid)); - $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_DeleteField', "Delete Custom Field", ''); - $id = CRM_Utils_Request::retrieve('id', 'Positive', - $this, FALSE, 0 - ); - $controller->set('id', $id); - $controller->setEmbedded(TRUE); - $controller->process(); - $controller->run(); - $fieldValues = ['custom_group_id' => $this->_gid]; - $wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_CustomField', $id, $fieldValues); - } - - if ($this->_gid) { - $groupTitle = CRM_Core_BAO_CustomGroup::getTitle($this->_gid); - $this->assign('gid', $this->_gid); - $this->assign('groupTitle', $groupTitle); - if ($action & CRM_Core_Action::BROWSE) { - CRM_Utils_System::setTitle(ts('%1 - Custom Fields', [1 => $groupTitle])); - } - } + $groupTitle = CRM_Core_BAO_CustomGroup::getTitle($this->_gid); + $this->assign('gid', $this->_gid); + $this->assign('groupTitle', $groupTitle); // assign vars to templates - $this->assign('action', $action); + $this->assign('action', 'browse'); - // what action to take ? - if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { - // no browse for edit/update/view - $this->edit($action); - } - elseif ($action & CRM_Core_Action::PREVIEW) { - $this->preview($id); - } - else { - $this->browse(); - } + $this->browse(); - // Call the parents run method return parent::run(); } - /** - * Preview custom field. - * - * @param int $id - * Custom field id. - * - * @return void - */ - public function preview($id) { - $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Preview', ts('Preview Custom Data'), CRM_Core_Action::PREVIEW); - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid)); - $controller->set('fieldId', $id); - $controller->set('groupId', $this->_gid); - $controller->setEmbedded(TRUE); - $controller->process(); - $controller->run(); - } - } diff --git a/CRM/Custom/Page/Group.php b/CRM/Custom/Page/Group.php index ec7b742edef2..919e5260e2a3 100644 --- a/CRM/Custom/Page/Group.php +++ b/CRM/Custom/Page/Group.php @@ -51,13 +51,13 @@ public static function &actionLinks() { ], CRM_Core_Action::PREVIEW => [ 'name' => ts('Preview'), - 'url' => 'civicrm/admin/custom/group', - 'qs' => 'action=preview&reset=1&id=%%id%%', + 'url' => 'civicrm/admin/custom/group/preview', + 'qs' => 'reset=1&gid=%%id%%', 'title' => ts('Preview Custom Data Set'), ], CRM_Core_Action::UPDATE => [ 'name' => ts('Settings'), - 'url' => 'civicrm/admin/custom/group', + 'url' => 'civicrm/admin/custom/group/edit', 'qs' => 'action=update&reset=1&id=%%id%%', 'title' => ts('Edit Custom Set'), ], @@ -73,8 +73,8 @@ public static function &actionLinks() { ], CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), - 'url' => 'civicrm/admin/custom/group', - 'qs' => 'action=delete&reset=1&id=%%id%%', + 'url' => 'civicrm/admin/custom/group/delete', + 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Delete Custom Set'), ], ]; @@ -83,104 +83,17 @@ public static function &actionLinks() { } /** - * Run the page. - * - * This method is called after the page is created. It checks for the - * type of action and executes that action. - * Finally it calls the parent's run method. - * * @return void */ public function run() { - // get the requested action - $action = CRM_Utils_Request::retrieve('action', 'String', - // default to 'browse' - $this, FALSE, 'browse' - ); - - if ($action & CRM_Core_Action::DELETE) { - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/', 'action=browse')); - $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_DeleteGroup', "Delete Cutom Set", NULL); - $id = CRM_Utils_Request::retrieve('id', 'Positive', - $this, FALSE, 0 - ); - $controller->set('id', $id); - $controller->setEmbedded(TRUE); - $controller->process(); - $controller->run(); - } - // assign vars to templates - $this->assign('action', $action); - $id = CRM_Utils_Request::retrieve('id', 'Positive', - $this, FALSE, 0 - ); - - // what action to take ? - if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { - $this->edit($id, $action); - } - elseif ($action & CRM_Core_Action::PREVIEW) { - $this->preview($id); - } - else { - // finally browse the custom groups - $this->browse(); - } - // parent run + $this->browse(); return parent::run(); } - /** - * Edit custom group. - * - * @param int $id - * Custom group id. - * @param string $action - * The action to be invoked. - * - * @return void - */ - public function edit($id, $action) { - // create a simple controller for editing custom data - $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Group', ts('Custom Set'), $action); - - // set the userContext stack - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/', 'action=browse')); - $controller->set('id', $id); - $controller->setEmbedded(TRUE); - $controller->process(); - $controller->run(); - } - - /** - * Preview custom group. - * - * @param int $id - * Custom group id. - * - * @return void - */ - public function preview($id) { - $controller = new CRM_Core_Controller_Simple('CRM_Custom_Form_Preview', ts('Preview Custom Data'), NULL); - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group', 'action=browse')); - $controller->set('groupId', $id); - $controller->setEmbedded(TRUE); - $controller->process(); - $controller->run(); - } - /** * Browse all custom data groups. - * - * @param string $action - * The action to be invoked. - * - * @return void */ - public function browse($action = NULL) { + public function browse() { // get all custom groups sorted by weight $customGroup = []; $dao = new CRM_Core_DAO_CustomGroup(); @@ -300,7 +213,7 @@ public function browse($action = NULL) { } } - $returnURL = CRM_Utils_System::url('civicrm/admin/custom/group', "reset=1&action=browse"); + $returnURL = CRM_Utils_System::url('civicrm/admin/custom/group'); CRM_Utils_Weight::addOrder($customGroup, 'CRM_Core_DAO_CustomGroup', 'id', $returnURL ); diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 48e000f2a8ca..147dd9051820 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -102,7 +102,7 @@ public static function relTables() { 'rel_table_custom_groups' => [ 'title' => ts('Custom Groups'), 'tables' => ['civicrm_custom_group'], - 'url' => CRM_Utils_System::url('civicrm/admin/custom/group', 'reset=1'), + 'url' => CRM_Utils_System::url('civicrm/admin/custom/group'), ], 'rel_table_uf_groups' => [ 'title' => ts('Profiles'), diff --git a/templates/CRM/Custom/Page/Group.hlp b/templates/CRM/Custom/Form/Group.hlp similarity index 98% rename from templates/CRM/Custom/Page/Group.hlp rename to templates/CRM/Custom/Form/Group.hlp index 05cd658563ba..3e9df92edeaa 100644 --- a/templates/CRM/Custom/Page/Group.hlp +++ b/templates/CRM/Custom/Form/Group.hlp @@ -25,12 +25,12 @@ {ts}Display Style{/ts} {/htxt} {htxt id="id-display_style"} - {ts}Select 'Inline' to include this set of fields in the main contact Add/Edit form and Contact Summary screens. Select 'Tab' or 'Tab with Table' to create a separate navigation tab for display and editing these values (generally for less frequently accessed and/or larger sets of fields). 'Tab with Table' is recommended for customs data sets which allow multiple records.{/ts} + {ts}Select 'Inline' to include this set of fields in the main contact Add/Edit form and Contact Summary screens. Select 'Tab' or 'Tab with Table' to create a separate navigation tab for display and editing these values (generally for less frequently accessed and/or larger sets of fields). 'Tab with Table' is recommended for customs data sets which allow multiple records.{/ts}

{ts}NOTE: This setting applies only to custom sets used for Contact records (e.g. Individuals, Households, Organizations, or ALL contact types).{/ts}

{/htxt} {htxt id="id-extends-title"} - {ts}Entity Type{/ts} + {ts}Used For{/ts} {/htxt} {htxt id="id-extends"} {ts}Select the type of record that this set of custom fields is applicable for. You can configure custom data for a specific type of contact (e.g. Individuals but NOT Organizations), ANY type of contact, or other record types such as activities, contributions, memberships and event participants.{/ts} @@ -64,7 +64,7 @@ {/htxt} {htxt id="id-weight-title"} - {ts}Weight{/ts} + {ts}Order{/ts} {/htxt} {htxt id="id-weight"} {ts}Weight controls the order in which custom field sets are presented when there are more than one. Enter a positive or negative integer - lower numbers are displayed ahead of higher numbers.{/ts} diff --git a/templates/CRM/Custom/Page/Field.tpl b/templates/CRM/Custom/Page/Field.tpl index 39b40c802bef..83609a7b8c0e 100644 --- a/templates/CRM/Custom/Page/Field.tpl +++ b/templates/CRM/Custom/Page/Field.tpl @@ -7,14 +7,7 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $action eq 1 or $action eq 2 or $action eq 4} - {include file="CRM/Custom/Form/Field.tpl"} -{elseif $action eq 8} - {include file="CRM/Custom/Form/DeleteField.tpl"} -{elseif $action eq 1024 } - {include file="CRM/Custom/Form/Preview.tpl"} -{else} - {if $customField} + {if $customField}
{strip} @@ -55,15 +48,12 @@
{else} - {if $action eq 16}
{ts}status{/ts} {ts}None found.{/ts}
- {/if} {/if} -{/if} diff --git a/templates/CRM/Custom/Page/Group.tpl b/templates/CRM/Custom/Page/Group.tpl index be07b3f2406a..6652165b7d2a 100644 --- a/templates/CRM/Custom/Page/Group.tpl +++ b/templates/CRM/Custom/Page/Group.tpl @@ -8,13 +8,6 @@ +--------------------------------------------------------------------+ *} {* The name "custom data group" is replaced by "custom data set" *} -{if $action eq 1 or $action eq 2 or $action eq 4} - {include file="CRM/Custom/Form/Group.tpl"} -{elseif $action eq 1024} - {include file="CRM/Custom/Form/Preview.tpl"} -{elseif $action eq 8} - {include file="CRM/Custom/Form/DeleteGroup.tpl"} -{else}
{ts}Custom data is stored in custom fields. Custom fields are organized into logically related custom data sets (e.g. Volunteer Info). Use custom fields to collect and store custom data which are not included in the standard CiviCRM forms. You can create one or many sets of custom fields.{/ts} {docURL page="user/organising-your-data/creating-custom-fields"}
@@ -54,22 +47,17 @@ - {if NOT ($action eq 1 or $action eq 2) } - {/if} {/strip} {else} - {if $action ne 1} {* When we are adding an item, we should not display this message *}
{ts}status{/ts}   - {capture assign=crmURL}{crmURL p='civicrm/admin/custom/group' q='action=add&reset=1'}{/capture} + {capture assign=crmURL}{crmURL p='civicrm/admin/custom/group/edit' q='action=add&reset=1'}{/capture} {ts 1=$crmURL}No custom data groups have been created yet. You can add one.{/ts}
- {/if} {/if} -{/if} diff --git a/xml/schema/Core/CustomField.xml b/xml/schema/Core/CustomField.xml index 8fb1c82c10b0..c5a4a2f617fa 100644 --- a/xml/schema/Core/CustomField.xml +++ b/xml/schema/Core/CustomField.xml @@ -11,8 +11,8 @@ civicrm/admin/custom/group/field/add?reset=1&action=add&gid=[custom_group_id] civicrm/admin/custom/group/field/update?action=update&reset=1&id=[id]&gid=[custom_group_id] - civicrm/admin/custom/group/field?action=preview&reset=1&id=[id]&gid=[custom_group_id] - civicrm/admin/custom/group/field?action=delete&reset=1&id=[id]&gid=[custom_group_id] + civicrm/admin/custom/group/preview&reset=1&fid=[id] + civicrm/admin/custom/group/field/delete?reset=1&id=[id] civicrm/admin/custom/group/field/move?reset=1&fid=[id] diff --git a/xml/schema/Core/CustomGroup.xml b/xml/schema/Core/CustomGroup.xml index 853a106e3263..3fd5522cdf1c 100644 --- a/xml/schema/Core/CustomGroup.xml +++ b/xml/schema/Core/CustomGroup.xml @@ -11,10 +11,10 @@ Custom Field Group title - civicrm/admin/custom/group?action=add&reset=1 - civicrm/admin/custom/group?action=update&reset=1&id=[id] - civicrm/admin/custom/group?action=preview&reset=1&id=[id] - civicrm/admin/custom/group?action=delete&reset=1&id=[id] + civicrm/admin/custom/group/edit?action=add&reset=1 + civicrm/admin/custom/group/edit?action=update&reset=1&id=[id] + civicrm/admin/custom/group/preview?reset=1&gid=[id] + civicrm/admin/custom/group/delete?reset=1&id=[id] id