-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-20816 - Expose CiviCase settings through "Settings" framework #10609
Changes from 6 commits
b83de99
84d4b6a
1706c6a
d6742e0
74691fc
b452be1
ec61a2b
23d6731
c8fd28d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 4.7 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2017 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License and the CiviCRM Licensing Exception along | | ||
| with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* | ||
* @package CRM | ||
* @copyright CiviCRM LLC (c) 2004-2017 | ||
*/ | ||
|
||
/** | ||
* This class generates form components for CiviCase. | ||
*/ | ||
class CRM_Admin_Form_Setting_Case extends CRM_Admin_Form_Setting { | ||
|
||
protected $_settings = array( | ||
'civicaseRedactActivityEmail' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, | ||
'civicaseAllowMultipleCaseClients' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, | ||
'civicaseNaturalActivityTypeSort' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, | ||
); | ||
|
||
/** | ||
* Build the form object. | ||
*/ | ||
public function buildQuickForm() { | ||
CRM_Utils_System::setTitle(ts('Settings - CiviCase')); | ||
parent::buildQuickForm(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -634,6 +634,10 @@ public function getListeners($caseType) { | |
* @return int | ||
*/ | ||
public function getRedactActivityEmail() { | ||
$setting = Civi::settings()->get('civicaseRedactActivityEmail'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for these three method is the same, I wonder would a private function be helpful to remove the duplication? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, sometimes a little duplication is better. It seems like a placing a bet for where you think it'll go. In this case... the functions are not quite identical. One guards explicitly against the condition where |
||
if ($setting !== 'auto') { | ||
return (int) $setting; | ||
} | ||
$xml = $this->retrieve("Settings"); | ||
return ( string ) $xml->RedactActivityEmail ? 1 : 0; | ||
} | ||
|
@@ -645,6 +649,10 @@ public function getRedactActivityEmail() { | |
* 1 if allowed, 0 if not | ||
*/ | ||
public function getAllowMultipleCaseClients() { | ||
$setting = Civi::settings()->get('civicaseAllowMultipleCaseClients'); | ||
if ($setting !== 'auto') { | ||
return (int) $setting; | ||
} | ||
$xml = $this->retrieve("Settings"); | ||
if ($xml) { | ||
return ( string ) $xml->AllowMultipleCaseClients ? 1 : 0; | ||
|
@@ -659,6 +667,10 @@ public function getAllowMultipleCaseClients() { | |
* 1 if natural, 0 if alphabetic | ||
*/ | ||
public function getNaturalActivityTypeSort() { | ||
$setting = Civi::settings()->get('civicaseNaturalActivityTypeSort'); | ||
if ($setting !== 'auto') { | ||
return (int) $setting; | ||
} | ||
$xml = $this->retrieve("Settings"); | ||
return ( string ) $xml->NaturalActivityTypeSort ? 1 : 0; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,14 @@ | |
|
||
{include file='../CRM/Upgrade/4.7.22.msg_template/civicrm_msg_template.tpl'} | ||
|
||
-- CRM-20816: Add CiviCase settings | ||
|
||
SELECT @civicaseAdminId := id FROM civicrm_navigation WHERE name = 'CiviCase' AND domain_id = {$domainID}; | ||
|
||
INSERT INTO civicrm_navigation | ||
(domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight) | ||
VALUES | ||
({$domainID}, 'civicrm/admin/setting/case?reset=1', '{ts escape="sql" skip="true"}CiviCase Settings{/ts}', 'CiviCase Settings', NULL, 'AND', @civicaseAdminId, '1', NULL, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @totten should you also update the weight of the other case navigation items? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I wondered about that and tested -- as you might expect/hope, the two items with Going the other way, it didn't seem like a good idea to manually set the weight of each of the other items -- because they could have been manually rearranged/supplemented/removed, and changing them seemed edgy. But on second thought... if it really matters... I guess this particular situation could be addressed by incrementing all the
|
||
|
||
-- CRM-20387 | ||
UPDATE `civicrm_contribution` SET `invoice_number` = `invoice_id` WHERE `invoice_id` LIKE CONCAT('%', `id`); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 4.7 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2017 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License and the CiviCRM Licensing Exception along | | ||
| with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* | ||
* @package CRM | ||
* @copyright CiviCRM LLC (c) 2004-2017 | ||
* $Id$ | ||
* | ||
*/ | ||
|
||
/** | ||
* Settings metadata file | ||
*/ | ||
return array( | ||
'civicaseRedactActivityEmail' => array( | ||
'group_name' => 'CiviCRM Preferences', | ||
'group' => 'core', | ||
'name' => 'civicaseRedactActivityEmail', | ||
'type' => 'String', | ||
'quick_form_type' => 'Select', | ||
'html_type' => 'Select', | ||
'html_attributes' => array( | ||
//'class' => 'crm-select2', | ||
), | ||
'default' => 'auto', | ||
'add' => '4.7', | ||
'title' => 'Redact Activity Email', | ||
'is_domain' => 1, | ||
'is_contact' => 0, | ||
'pseudoconstant' => array( | ||
'callback' => 'CRM_Case_Info::getRedactOptions', | ||
), | ||
'description' => 'Should activity emails be redacted? (Set "Auto" to load setting from the legacy "Settings.xml" file.)', | ||
'help_text' => '', | ||
), | ||
'civicaseAllowMultipleCaseClients' => array( | ||
'group_name' => 'CiviCRM Preferences', | ||
'group' => 'core', | ||
'name' => 'civicaseAllowMultipleCaseClients', | ||
'type' => 'String', | ||
'quick_form_type' => 'Select', | ||
'html_type' => 'Select', | ||
'html_attributes' => array( | ||
//'class' => 'crm-select2', | ||
), | ||
'default' => 'auto', | ||
'add' => '4.7', | ||
'title' => 'Allow Multiple Case Clients', | ||
'is_domain' => 1, | ||
'is_contact' => 0, | ||
'pseudoconstant' => array( | ||
'callback' => 'CRM_Case_Info::getMultiClientOptions', | ||
), | ||
'description' => 'How many clients may be associated with a given case? (Set "Auto" to load setting from the legacy "Settings.xml" file.)', | ||
'help_text' => '', | ||
), | ||
'civicaseNaturalActivityTypeSort' => array( | ||
'group_name' => 'CiviCRM Preferences', | ||
'group' => 'core', | ||
'name' => 'civicaseNaturalActivityTypeSort', | ||
'type' => 'String', | ||
'quick_form_type' => 'Select', | ||
'html_type' => 'Select', | ||
'html_attributes' => array( | ||
//'class' => 'crm-select2', | ||
), | ||
'default' => 'auto', | ||
'add' => '4.7', | ||
'title' => 'Activity Type Sorting', | ||
'is_domain' => 1, | ||
'is_contact' => 0, | ||
'pseudoconstant' => array( | ||
'callback' => 'CRM_Case_Info::getSortOptions', | ||
), | ||
'description' => 'How to sort activity-types on the "Manage Case" screen? (Set "Auto" to load setting from the legacy "Settings.xml" file.)', | ||
'help_text' => '', | ||
), | ||
); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 4.7 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2017 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License and the CiviCRM Licensing Exception along | | ||
| with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*} | ||
<div class="crm-block crm-form-block crm-case-form-block"> | ||
{*<div class="help">*} | ||
{*{ts}...{/ts} {docURL page="Debugging for developers" resource="wiki"}*} | ||
{*</div>*} | ||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | ||
<table class="form-layout"> | ||
<tr class="crm-case-form-block-civicaseRedactActivityEmail"> | ||
<td class="label">{$form.civicaseRedactActivityEmail.label}</td> | ||
<td>{$form.civicaseRedactActivityEmail.html}<br /> | ||
<span class="description">{ts}Should activity emails be redacted?{/ts} {ts}(Set "Auto" to load setting from the legacy "Settings.xml" file.){/ts}</span> | ||
</td> | ||
</tr> | ||
<tr class="crm-case-form-block-civicaseAllowMultipleCaseClients"> | ||
<td class="label">{$form.civicaseAllowMultipleCaseClients.label}</td> | ||
<td>{$form.civicaseAllowMultipleCaseClients.html}<br /> | ||
<span class="description">{ts}How many clients may be associated with a given case?{/ts} {ts}(Set "Auto" to load setting from the legacy "Settings.xml" file.){/ts}</span> | ||
</td> | ||
</tr> | ||
<tr class="crm-case-form-block-civicaseNaturalActivityTypeSort"> | ||
<td class="label">{$form.civicaseNaturalActivityTypeSort.label}</td> | ||
<td>{$form.civicaseNaturalActivityTypeSort.html}<br /> | ||
<span class="description">{ts}How to sort activity-types on the "Manage Case" screen? {/ts} {ts}(Set "Auto" to load setting from the legacy "Settings.xml" file.){/ts}</span> | ||
</td> | ||
</tr> | ||
</table> | ||
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | ||
<div class="spacer"></div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think "Auto" will make sense to a user here? I've seen the help text in the template and
settings/Case.setting.php
file. I'm not so familiar with the context, but just thought something like "default" would be more standard here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we could call it "Magic", and it would make just as much sense. ;)
But... yes, "Default" does feel a bit more standard. Updating.