0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-03-15 22:04:51 +00:00

Merge pull request from connorshea/render-phone-fields-as-links

Render phone fields as links
This commit is contained in:
Mac Rae 2019-11-26 13:09:19 +00:00 committed by GitHub
commit 82899e4625
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 36 deletions
include
install
modules
Administration
Configurator
tests/unit/phpunit/modules/Administration
themes/SuiteP/include/DetailView

View file

@ -109,12 +109,10 @@ function smarty_function_sugar_phone($params, &$smarty)
$smarty->trigger_error("sugar_phone: missing 'value' parameter");
return '';
}
global $system_config;
if (isset($system_config->settings['system_skypeout_on']) && $system_config->settings['system_skypeout_on'] == 1
&& isset($params['value']) && skype_formatted($params['value'])) {
$GLOBALS['log']->debug($params['value']);
return '<a href="tel:'.format_skype($params['value']).'">'.$params['value'].'</a>';
// Render the field as a simple `tel:` link if it has a value.
if (isset($params['value'])) {
return '<a href="tel:'.$params['value'].'">'.$params['value'].'</a>';
}
return $params['value'];
}

View file

@ -3023,9 +3023,11 @@ function display_notice($msg = false)
}
}
/* checks if it is a number that at least has the plus at the beginning.
/**
* Checks if it is a number that at least has the plus at the beginning.
*
* @deprecated No longer used, will be removed without replacement in SuiteCRM 7.12.
*/
function skype_formatted($number)
{
//kbrill - BUG #15375
@ -3037,6 +3039,9 @@ function skype_formatted($number)
// return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 2) == '011';
}
/**
* @deprecated No longer used, will be removed without replacement in SuiteCRM 7.12.
*/
function format_skype($number)
{
return preg_replace('/[^\+0-9]/', '', $number);

View file

@ -1355,10 +1355,6 @@ function insert_default_settings()
//insert default tracker settings
$db->query("INSERT INTO config (category, name, value) VALUES ('tracker', 'Tracker', '1')");
$db->query("INSERT INTO config (category, name, value) VALUES ( 'system', 'skypeout_on', '1')");
}

View file

@ -65,7 +65,7 @@ class Administration extends SugarBean
'sugarpdf',
);
public $disable_custom_fields = true;
public $checkbox_fields = array("notify_send_by_default", "mail_smtpauth_req", "notify_on", 'portal_on', 'skypeout_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled', 'captcha_on');
public $checkbox_fields = array("notify_send_by_default", "mail_smtpauth_req", "notify_on", 'portal_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled', 'captcha_on');
public function __construct()
{

View file

@ -99,9 +99,6 @@ $mod_strings = array(
'LBL_PROXY_USERNAME' => 'User Name',
'LBL_RESTORE_BUTTON_LABEL' => 'Restore',
'LBL_SYSTEM_SETTINGS' => 'System Settings',
'LBL_SKYPEOUT_ON_DESC' => 'Allows users to click on phone numbers to call using the phone dialer on your mobile device, or a telephony app on your computer (SkypeOut&reg;, etc.). The numbers must be formatted properly to make use of this feature. That is, it must be "+" "The Country Code" "The Number", like +1 (555) 555-1234.',
'LBL_SKYPEOUT_ON' => 'Enable click-to-call for phone numbers',
'LBL_SKYPEOUT_TITLE' => 'Click-To-Call',
'LBL_USE_REAL_NAMES' => 'Show Full Names',
'LBL_USE_REAL_NAMES_DESC' => 'Display users\' full names instead of their User Names in assignment fields.',
'LBL_DISALBE_CONVERT_LEAD' => 'Disable convert lead action for converted leads',

View file

@ -279,23 +279,6 @@
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_SKYPEOUT_TITLE}</h4></th>
</tr>
<tr>
<td width="25%" scope="row" valign='middle'>{$MOD.LBL_SKYPEOUT_ON}&nbsp{sugar_help text=$MOD.LBL_SKYPEOUT_ON_DESC WIDTH=400}</td>
{if !empty($settings.system_skypeout_on)}
{assign var='system_skypeout_on_checked' value='CHECKED'}
{else}
{assign var='system_skypeout_on_checked' value=''}
{/if}
<td width="75%" align="left" valign='middle'><input type='hidden' name='system_skypeout_on' value='0'><input name="system_skypeout_on" value="1" class="checkbox" tabindex='1' type="checkbox" {$system_skypeout_on_checked}></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="4"><h4>{$MOD.ADVANCED}</h4></th>

View file

@ -26,7 +26,7 @@ class AdministrationTest extends SuitePHPUnitFrameworkTestCase
$this->assertAttributeEquals(true, 'new_schema', $admin);
$this->assertAttributeEquals(true, 'disable_custom_fields', $admin);
$this->assertAttributeEquals(array('disclosure', 'notify', 'system', 'portal', 'proxy', 'massemailer', 'ldap', 'captcha', 'sugarpdf'), 'config_categories', $admin);
$this->assertAttributeEquals(array('notify_send_by_default', 'mail_smtpauth_req', 'notify_on', 'portal_on', 'skypeout_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled', 'captcha_on'), 'checkbox_fields', $admin);
$this->assertAttributeEquals(array('notify_send_by_default', 'mail_smtpauth_req', 'notify_on', 'portal_on', 'system_mailmerge_on', 'proxy_auth', 'proxy_on', 'system_ldap_enabled', 'captcha_on'), 'checkbox_fields', $admin);
}
public function testretrieveSettings()

View file

@ -121,10 +121,10 @@
{{if $smarty.foreach.colIteration.total > 1 && $colData.colspan != 3}}
{*<!-- phone (version 1) -->*}
<div class="col-xs-12 col-sm-8 detail-view-field {{if $inline_edit && !empty($colData.field.name) && ($fields[$colData.field.name].inline_edit == 1 || !isset($fields[$colData.field.name].inline_edit))}}inlineEdit{{/if}}" type="{{$fields[$colData.field.name].type}}" field="{{$fields[$colData.field.name].name}}" {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}} {{if isset($fields[$colData.field.name].type) && $fields[$colData.field.name].type == 'phone'}}class="phone"{{/if}}>
<div class="col-xs-12 col-sm-8 detail-view-field{{if $inline_edit && !empty($colData.field.name) && ($fields[$colData.field.name].inline_edit == 1 || !isset($fields[$colData.field.name].inline_edit))}} inlineEdit{{/if}}{{if isset($fields[$colData.field.name].type) && $fields[$colData.field.name].type == 'phone'}} phone{{/if}}" type="{{$fields[$colData.field.name].type}}" field="{{$fields[$colData.field.name].name}}" {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}>
{{else}}
{*<!-- phone (version 2) -->*}
<div class="col-xs-12 col-sm-10 detail-view-field {{if $inline_edit && !empty($colData.field.name) && ($fields[$colData.field.name].inline_edit == 1 || !isset($fields[$colData.field.name].inline_edit))}}inlineEdit{{/if}}" type="{{$fields[$colData.field.name].type}}" field="{{$fields[$colData.field.name].name}}" {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}} {{if isset($fields[$colData.field.name].type) && $fields[$colData.field.name].type == 'phone'}}class="phone"{{/if}}>
<div class="col-xs-12 col-sm-10 detail-view-field{{if $inline_edit && !empty($colData.field.name) && ($fields[$colData.field.name].inline_edit == 1 || !isset($fields[$colData.field.name].inline_edit))}} inlineEdit{{/if}}{{if isset($fields[$colData.field.name].type) && $fields[$colData.field.name].type == 'phone'}} phone{{/if}}" type="{{$fields[$colData.field.name].type}}" field="{{$fields[$colData.field.name].name}}" {{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}>
{{/if}}
{{if !empty($colData.field.name)}}