Skip to content

Commit

Permalink
add message templates
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiez committed Jan 12, 2024
1 parent 39c567a commit a452645
Show file tree
Hide file tree
Showing 27 changed files with 814 additions and 426 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.zip
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
//WARNING: The contents of this file are auto-generated

$admin_options_defs = [];
$admin_options_defs['Administration']['Configuration1'] = [
$admin_options_defs['Administration']['Seven_Index'] = [
'PANELSETTINGS',
'LBL_SEVEN_CONFIGURATION_TITLE',
'LBL_SEVEN_CONFIGURATION_DESC',
'./index.php?module=seven&action=index',
];
$admin_options_defs['Administration']['Configuration2'] = [
$admin_options_defs['Administration']['Seven_Contact'] = [
'PANELSETTINGS',
'LBL_SEVEN_TEMPLATE_CONFIGURATION_TITLE',
'LBL_SEVEN_TEMPLATE_CONFIGURATION_DESC',
'./index.php?module=seven&action=template',
'./index.php?module=seven&action=contact',
];
$admin_options_defs['Administration']['Configuration3'] = [
$admin_options_defs['Administration']['Seven_Lead'] = [
'PANELSETTINGS',
'LBL_SEVEN_LEAD_CONFIGURATION_TITLE',
'LBL_SEVEN_LEAD_CONFIGURATION_DESC',
'./index.php?module=seven&action=lead',
];
$admin_options_defs['Administration']['Configuration4'] = [
$admin_options_defs['Administration']['Seven_Account'] = [
'PANELSETTINGS',
'LBL_SEVEN_ACCOUNT_CONFIGURATION_TITLE',
'LBL_SEVEN_ACCOUNT_CONFIGURATION_DESC',
'./index.php?module=seven&action=account',
];
$admin_options_defs['Administration']['Configuration5'] = [
$admin_options_defs['Administration']['Seven_Employee'] = [
'PANELSETTINGS',
'LBL_SEVEN_EMPLOYEE_CONFIGURATION_TITLE',
'LBL_SEVEN_EMPLOYEE_CONFIGURATION_DESC',
Expand Down
4 changes: 2 additions & 2 deletions SuiteModules/modules/seven/FeedPusher.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ protected function init($bean): array {

$relation = $bean;
if ('Contacts' === $this->module) {
$templateActive = $sms->getTemplateActive();
$template = $sms->getTemplateBody();
$templateActive = $sms->getContactActive();
$template = $sms->getContactBody();
} elseif ('Leads' === $this->module) {
$templateActive = $sms->getLeadActive();
$template = $sms->getLeadBody();
Expand Down
14 changes: 4 additions & 10 deletions SuiteModules/modules/seven/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require_once 'modules/Configurator/Configurator.php';
require_once 'include/Sugar_Smarty.php';
require_once 'settings_form.php';
require_once 'utils.php';

global $sugar_config, $mod_strings;

Expand All @@ -26,14 +27,7 @@

$administration->retrieveSettings();

$sugar_smarty = new Sugar_Smarty;
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('config', $configurator->config);
$sugar_smarty->assign('seven_config', $settingsForm);
$sugar_smarty->assign('error', $configurator->errors);
$sugar_smarty->assign('placeholders', implode('<br/>', [
seven_smarty_render(new Account, $configurator, 'modules/seven/account_form.tpl', [
'{account_type} => Account Type',
'{annual_revenue} => Annual Revenue',
'{assigned_user_id} => Assigned User ID',
Expand Down Expand Up @@ -67,5 +61,5 @@
'{sic_code} => SIC Code',
'{ticker_symbol} => Ticker Symbol',
'{website} => Website',
]));
$sugar_smarty->display('modules/seven/account_form.tpl');
], $settingsForm);

131 changes: 42 additions & 89 deletions SuiteModules/modules/seven/account_form.tpl
Original file line number Diff line number Diff line change
@@ -1,91 +1,44 @@
<form method='POST' action='index.php' enctype='multipart/form-data'>
<input type='hidden' name='module' value='seven'/>
<input type='hidden' name='action' value='account'/>

<span class='error'>{$error.main}</span>

<table>
<tr>
<td>{$MOD.LBL_SEVEN_ACTIVE}</td>

<td>
{if empty($config.seven_account_active)}
{assign var='seven_account_active' value=$seven_config.seven_account_active.default}
{else}
{assign var='seven_account_active' value=$config.seven_account_active}
{/if}

<label for='seven_account_active_yes'>{$MOD.LBL_SEVEN_YES}</label>
<input
id='seven_account_active_yes'
name='seven_account_active'
type='radio'
value='yes'
{if $seven_account_active =='yes'}checked{/if}
/>

<label for='seven_account_active_no'>{$MOD.LBL_SEVEN_NO}</label>
<input
id='seven_account_active_no'
name='seven_account_active'
type='radio'
value='no'
{if $seven_account_active =='no'}checked{/if}
/>
</td>
</tr>

<tr>
<td><label for='description'>{$MOD.LBL_SEVEN_TEXT}</label></td>
<td>
{if empty($config.seven_account_body)}
{assign var='seven_account_body' value=$seven_config.seven_account_body.default}
{else}
{assign var='seven_account_body' value=$config.seven_account_body}
{/if}

<textarea
cols='80'
id='description'
name='seven_account_body'
rows='10'
style='height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;'
tabindex='0'
>{$seven_account_body}</textarea>
</td>
</tr>
</table>

<p>
<span class='text-danger'>{$MOD.LBL_SEVEN_NOTICE}: </span>
{$MOD.LBL_SEVEN_SMS_ON_CREATION}
</p>

<p>
<span class='text-danger'>{$MOD.LBL_SEVEN_PROPERTY_PLACEHOLDERS}:</span>
<br/>
{$placeholders}
</p>

<div>
<input
class='button'
title='{$APP.LBL_SAVE_BUTTON_TITLE}'
type='submit'
value='{$APP.LBL_SAVE_BUTTON_LABEL}'
name='save'
/>

<input
class='button'
name='cancel'
onclick='document.location.href="index.php?module=Administration&action=index"'
title='{$MOD.LBL_CANCEL_BUTTON_TITLE}'
type='button'
value='{$APP.LBL_CANCEL_BUTTON_LABEL}'
/>
</div>
</form>

{extends file='modules/seven/base_form.tpl'}
{block name=action}account{/block}
{block name=table}
<tr>
<td>{$MOD.LBL_SEVEN_ACTIVE}</td>

<td>
{if empty($config.seven_account_active)}
{assign var='seven_account_active' value=$seven_config.seven_account_active.default}
{else}
{assign var='seven_account_active' value=$config.seven_account_active}
{/if}

<label for='seven_account_active_yes'>{$MOD.LBL_SEVEN_YES}</label>
<input
id='seven_account_active_yes'
name='seven_account_active'
type='radio'
value='yes'
{if $seven_account_active =='yes'}checked{/if}
/>

<label for='seven_account_active_no'>{$MOD.LBL_SEVEN_NO}</label>
<input
id='seven_account_active_no'
name='seven_account_active'
type='radio'
value='no'
{if $seven_account_active =='no'}checked{/if}
/>
</td>
</tr>
{/block}
{block name=text_var}
{if empty($config.seven_account_body)}
{assign var='seven_text_content' value=$seven_config.seven_account_body.default}
{else}
{assign var='seven_text_content' value=$config.seven_account_body}
{/if}

{assign var='seven_text_name' value='seven_text_content'}
{/block}


56 changes: 56 additions & 0 deletions SuiteModules/modules/seven/base_form.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{include file='modules/seven/tpls/message_templates.tpl'}

<form action='index.php' enctype='multipart/form-data' method='POST'>
<input type='hidden' name='module' value='seven'/>
<input type='hidden' name='action' value='{block name=action}{/block}'/>

<span class='error'>{$error.main}</span>

<table>
{block name=table}{/block}
<tr>
<td><label for='seven_text'>{$MOD.LBL_SEVEN_TEXT}</label></td>
<td>
{block name=text_var}{/block}

<textarea
cols='80'
id='seven_text'
name='{$seven_text_name}'
rows='10'
tabindex='0'
>{$seven_text_content}</textarea>
</td>
</tr>
</table>

<p>
<span class='text-danger'>{$MOD.LBL_SEVEN_NOTICE}: </span>
{$MOD.LBL_SEVEN_SMS_ON_CREATION}
</p>

<p>
<span class='text-danger'>{$MOD.LBL_SEVEN_PROPERTY_PLACEHOLDERS}:</span>
<br/>
{$placeholders}
</p>

<div>
<input
class='button'
name='save'
title='{$APP.LBL_SAVE_BUTTON_TITLE}'
type='submit'
value='{$APP.LBL_SAVE_BUTTON_LABEL}'
/>

<input
class='button'
name='cancel'
onclick='document.location.href="index.php?module=Administration&action=index"'
title='{$MOD.LBL_CANCEL_BUTTON_TITLE}'
type='button'
value='{$APP.LBL_CANCEL_BUTTON_LABEL}'
/>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require_once 'modules/Configurator/Configurator.php';
require_once 'include/Sugar_Smarty.php';
require_once 'settings_form.php';
require_once 'utils.php';

global $sugar_config, $mod_strings;

Expand All @@ -26,14 +27,7 @@

$administration->retrieveSettings();

$sugar_smarty = new Sugar_Smarty;
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('config', $configurator->config);
$sugar_smarty->assign('seven_config', $settingsForm);
$sugar_smarty->assign('error', $configurator->errors);
$sugar_smarty->assign('placeholders', implode('<br/>', [
seven_smarty_render(new Contact, $configurator, 'modules/seven/contact_form.tpl', [
'{first-name} => First Name',
'{last-name} => last Name',
'{full-name} => Full Name',
Expand All @@ -55,5 +49,4 @@
'{alter-country} => Alternative Country',
'{description} => Description',
'{date} => Date',
]));
$sugar_smarty->display('modules/seven/template_form.tpl');
], $settingsForm);
43 changes: 43 additions & 0 deletions SuiteModules/modules/seven/contact_form.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{extends file='modules/seven/base_form.tpl'}
{block name=action}contact{/block}
{block name=table}
<tr>
<td>{$MOD.LBL_SEVEN_ACTIVE}</td>
<td>
{if empty($config.seven_contact_active)}
{assign var='seven_contact_active' value=$seven_config.seven_contact_active.default}
{else}
{assign var='seven_contact_active' value=$config.seven_contact_active}
{/if}

<label for='seven_contact_active_yes'>Yes</label>
<input
id='seven_contact_active_yes'
type='radio'
value='yes'
name='seven_contact_active'
{if $seven_contact_active =='yes'}checked{/if}
/>

<label for='seven_contact_active_no'>No</label>
<input
id='seven_contact_active_no'
type='radio'
name='seven_contact_active'
value='no'
{if $seven_contact_active =='no'}checked{/if}
/>
</td>
</tr>
{/block}
{block name=text_var}
{if empty($config.seven_contact_body)}
{assign var='seven_text_content' value=$seven_config.seven_contact_body.default}
{else}
{assign var='seven_text_content' value=$config.seven_contact_body}
{/if}

{assign var='seven_text_name' value='seven_text_content'}
{/block}


14 changes: 4 additions & 10 deletions SuiteModules/modules/seven/employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require_once 'modules/Configurator/Configurator.php';
require_once 'include/Sugar_Smarty.php';
require_once 'settings_form.php';
require_once 'utils.php';

global $sugar_config, $mod_strings;

Expand All @@ -26,14 +27,7 @@

$administration->retrieveSettings();

$sugar_smarty = new Sugar_Smarty;
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('config', $configurator->config);
$sugar_smarty->assign('seven_config', $settingsForm);
$sugar_smarty->assign('error', $configurator->errors);
$sugar_smarty->assign('placeholders', implode('<br/>', [
seven_smarty_render(new Employee, $configurator, 'modules/seven/employee_form.tpl', [
'{address_city}',
'{address_country}',
'{address_postalcode}',
Expand Down Expand Up @@ -75,5 +69,5 @@
'{title}',
'{user_hash}',
'{user_name}',
]));
$sugar_smarty->display('modules/seven/employee_form.tpl');

], $settingsForm);
Loading

0 comments on commit a452645

Please sign in to comment.