Squashed 'public/legacy/' changes from 81ce7933fd..4e205ecf45

4e205ecf45 SuiteCRM 7.13.1 Release
c5da36210d Add new modules to unit tests
6321c09b68 Fix #9870 - Fix log level in ImapHandlerFactory
1a0710f537 Add option to enable legacy email compose behaviour
eaff3e776e Remove option to allow user to send as themselves from configuration
7f9c743c78 Only display outbound and system accounts on email compose from
de1b0f2ad8 Update email compose from dropdown
ed30b7575c Allow email compose to send using outbound-only accounts
d3a58bd3e0 Fix #9878 - Catch unhandled error in imap2_close
cc80eabbfd Fix #9878 - Fix InboundEmail save trim error
9190b40c48 Fix #9878 - Fix InboundEmail save error
0db3827d98 Fix #9878 - Fix relate select popup white screen error
e8af74ba7b Fix #9878 - Fix undefined index notice

git-subtree-dir: public/legacy
git-subtree-split: 4e205ecf45d493ad1351c51f8ce787fa1c6400c9
This commit is contained in:
SAgility Dev 2023-01-24 10:52:04 +00:00
parent 9d484f189a
commit c5f636e5bc
51 changed files with 1436 additions and 316 deletions

View file

@ -29,6 +29,24 @@ class AttributeObjectHelper
{
$bean->fixUpFormatting();
$allowedField = [];
$fieldsToParse = $fields;
if (empty($fields)) {
$fieldsToParse = array_keys($bean->field_defs);
}
foreach ($fieldsToParse ?? [] as $index => $field) {
$isSensitive = isTrue($bean->field_defs[$field]['sensitive'] ?? false);
$notApiVisible = isFalse($bean->field_defs[$field]['api-visible'] ?? true);
if ($isSensitive || $notApiVisible){
continue;
}
$allowedField[$index] = $field;
}
// using the ISO 8601 format for dates
$attributes = array_map(function ($value) {
return is_string($value)
@ -38,8 +56,8 @@ class AttributeObjectHelper
: $value;
}, $bean->toArray());
if ($fields !== null) {
$attributes = array_intersect_key($attributes, array_flip($fields));
if ($allowedField !== null) {
$attributes = array_intersect_key($attributes, array_flip($allowedField));
}
unset($attributes['id']);

View file

@ -2,7 +2,7 @@
<img width="180px" height="41px" src="https://suitecrm.com/wp-content/uploads/2017/12/logo.png" align="right" />
</a>
# SuiteCRM 7.13.0
# SuiteCRM 7.13.1
[![LICENSE](https://img.shields.io/github/license/suitecrm/suitecrm.svg)](https://github.com/salesagility/suitecrm/blob/hotfix/LICENSE.txt)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/salesagility/SuiteCRM-Core/issues)

View file

@ -151,6 +151,51 @@ class BeanFactory
return $bean;
}
/**
* Returns a SugarBean object by id.
*
* @static
*
* @param string $module
* @param string $id
* @param array $params
* A name/value array of parameters. Names: encode, deleted.
* If $params is boolean we revert to the old arguments (encode, deleted), and use $params as $encode.
* This will be changed to using only $params in later versions.
* @param bool $deleted
* @see SugarBean::retrieve
*
* @return SugarBean|bool
*/
public static function getReloadedBean($module, $id = null, $params = [], $deleted = true)
{
$params = self::convertParams($params);
$encode = self::hasEncodeFlag($params);
$deleted = self::hasDeletedFlag($params, $deleted);
$beanClass = self::getBeanClass($module);
if (!self::loadBeanFile($module)) {
return false;
}
if (empty($id)) {
return new $beanClass();
}
/* @var SugarBean $bean */
$bean = new $beanClass();
$result = $bean->retrieve($id, $encode, $deleted);
if ($result === null) {
return false;
}
return $bean;
}
/**
* Shallow beans are created by SugarBean during the fill_in_relationship_fields method, and they differ from
* 'complete' bean in that they do not have their own relate fields completed.

View file

@ -1,5 +1,5 @@
<?php
// created: 2022-12-20 17:00:00
// created: 2023-01-23 17:00:00
$md5_string = array (
'./Api/Core/Config/ApiConfig.php' => '69a1e7b3d7755a2a63499a16ddae81cf',
'./Api/Core/Config/slim.php' => 'b134e68765e6a1403577e2a5a06322b8',
@ -37,7 +37,7 @@ $md5_string = array (
'./Api/V8/Helper/ModuleListProvider.php' => 'a6f9b90116408bd7d708801b0cd04001',
'./Api/V8/Helper/OsHelper.php' => '3fa3a69441695035a66e877fbfd0d6c2',
'./Api/V8/Helper/VarDefHelper.php' => '986916d5e675667e5f5e89da6d8fc081',
'./Api/V8/JsonApi/Helper/AttributeObjectHelper.php' => '8c2e2f889cefdc7912fd62da3e6a6f71',
'./Api/V8/JsonApi/Helper/AttributeObjectHelper.php' => '3336452c51560f9a40c107d0ace78165',
'./Api/V8/JsonApi/Helper/PaginationObjectHelper.php' => 'dbeb8f36cc7b70ff9459443c26bdfb70',
'./Api/V8/JsonApi/Helper/RelationshipObjectHelper.php' => '6681a3fc26e420f12875d4239532946e',
'./Api/V8/JsonApi/Repository/Filter.php' => '21279c505e18aacd9f6aea51cc62a3bc',
@ -116,7 +116,7 @@ $md5_string = array (
'./ModuleInstall/PackageManager/tpls/PackageManagerLicense.tpl' => 'df5e267d1df5ce08fb9406e42d5b4816',
'./ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl' => '98e396c0aa57329731fda19c790fffb2',
'./ModuleInstall/extensions.php' => 'de30837895f67175b7fbc04274a837a6',
'./README.md' => '54743d8cbb99f27a15c42be076e7c293',
'./README.md' => '3c49e53b583be73441c2a9a7d3b86cc7',
'./RoboFile.php' => '045b82c1df69553824d0e4ffcce6e03c',
'./SugarSecurity.php' => '47e316b2d408e8c5192c8ea4a4f921b3',
'./TreeData.php' => '32873e20cb5fd33f9d1cdaf18c3cac5c',
@ -511,7 +511,7 @@ $md5_string = array (
'./composer.lock' => '7651f60b1796ac7aec447c2c341ebcba',
'./cron.php' => '0b8b6bd839a2232a8da074b31feaa708',
'./crossdomain.xml' => '24b7711640c652b21aa89c9d83d6ec13',
'./data/BeanFactory.php' => '84b7c36b6a59ea8c5c4069659cc72950',
'./data/BeanFactory.php' => '3007bf65ebc77baa76c338ce6a068790',
'./data/Link.php' => '6a1f4a706142e6231f8ee46f261341c0',
'./data/Link2.php' => '1e2ee0bfd94ff12c0a3b9323059a47ed',
'./data/Relationships/EmailAddressRelationship.php' => 'e2d4f642961cf992c931e57d02e0d122',
@ -550,7 +550,7 @@ $md5_string = array (
'./include/DetailView/header.tpl' => '79e5e7385483e4486ac1f20d739d8cd5',
'./include/EditView/EditView.php' => '6bd1f5815f5c674416efd1e71a67bd65',
'./include/EditView/EditView.tpl' => '4458f5584adfdb8d54e74b8e867e048c',
'./include/EditView/EditView2.php' => '7ad84a44d52c2d5ae9a7e51d170a0efc',
'./include/EditView/EditView2.php' => 'bcc5278e51ae487a9904645febc58b2a',
'./include/EditView/Panels.js' => '580266b80716d8e7003807189565e557',
'./include/EditView/PopupQuickCreate.php' => '09b22d51578ba228a89ba6a7e5f403c8',
'./include/EditView/QuickCreate.php' => 'dbd2c8b5be42047ada748e073b87ff90',
@ -584,10 +584,10 @@ $md5_string = array (
'./include/HTTP_WebDAV_Server/dav.txt' => 'c5235ed64efa685da638c6dcdb6a9708',
'./include/HTTP_WebDAV_Server/license.txt' => 'a45bb1bbeed9e26b26c5763df1d3913d',
'./include/HtmlSanitizer.php' => 'efcd753e725f16eb9212bc3bb2ed2cff',
'./include/Imap/Imap2Handler.php' => '847bc7709b73a75b700e5acca59a5819',
'./include/Imap/Imap2Handler.php' => '1a3f7e4cbf9fc332add2d6386b7df0cd',
'./include/Imap/ImapHandler.php' => '29e289d005995cde4a35144bfe176fb0',
'./include/Imap/ImapHandlerException.php' => '43d045dace421f51ad30eab02e1d1e91',
'./include/Imap/ImapHandlerFactory.php' => '3690854b3f23f1f7e3e73f98a5fa3655',
'./include/Imap/ImapHandlerFactory.php' => '15a2ffca9e48e3cf74270dda4e36e46c',
'./include/Imap/ImapHandlerFake.php' => '836493c75c86459f9449809f9dc6d010',
'./include/Imap/ImapHandlerFakeCalls.php' => '78bb2e1e21c97feab44c1e274050c050',
'./include/Imap/ImapHandlerFakeData.php' => '8269f4b291c9a24abedfc4aee98f1d0e',
@ -596,7 +596,7 @@ $md5_string = array (
'./include/Imap/ImapTestSettingsEntryHandler.php' => '3292a309c3331e60ab13f48c56e672c8',
'./include/Imap.php' => '0f93494ddbae70f85acdcbac5e92dbc5',
'./include/ImapInterface.php' => '1cc17060f7768a0e299fafdd66410baa',
'./include/InlineEditing/InlineEditing.php' => '556f91cf67cb17620fb42a5bd607b7a6',
'./include/InlineEditing/InlineEditing.php' => '981e9c7c35b0f2aefa192ebf46eb3c44',
'./include/InlineEditing/inlineEditing.js' => 'ebc8c66cf49a2bcc77265461a120fe3c',
'./include/JSON.php' => '7cff996ad7e96ff1583e0837f5070f29',
'./include/JsonApiErrorObject.php' => 'bd82e5413b53492f73cb66fa0fe35316',
@ -667,7 +667,7 @@ $md5_string = array (
'./include/MVC/preDispatch.php' => 'f1720fa7dea86c02e0663227c2c08203',
'./include/MassUpdate.php' => 'e1e7bb76e9479209bc9fdb54411eae97',
'./include/MySugar/DashletsDialog/DashletsDialog.php' => '0b7c1af1bb21b3af9b735178de2f3a89',
'./include/MySugar/MySugar.php' => 'c047f36230f6e720537e546ab32e4190',
'./include/MySugar/MySugar.php' => 'eaffdea2231df9ec4a457fb57d499ca4',
'./include/MySugar/dashboardstyle.css' => '4cce65e52281263e484140a1d4b8d2e2',
'./include/MySugar/javascript/AddRemoveDashboardPages.js' => '6baf925bfcaa6c4ac01326af22c8e7c6',
'./include/MySugar/javascript/MySugar.js' => 'f6162f9799abadfdef9c5ea2668808e7',
@ -684,7 +684,7 @@ $md5_string = array (
'./include/Pear/Crypt_Blowfish/Blowfish/DefaultKey.php' => '71c33c848e1219ea3cfad5795f02f3cd',
'./include/Pear/Crypt_Blowfish/Blowfish.php' => '0c73a6dbf2fa10ae60ecb7dde76c67eb',
'./include/Pear/Crypt_Blowfish/license.txt' => 'a45bb1bbeed9e26b26c5763df1d3913d',
'./include/Popups/PopupSmarty.php' => '7f37169149cfce47e441eb3ce43f3661',
'./include/Popups/PopupSmarty.php' => '2e1fe6e08c54aafe9c2ae993066a93a9',
'./include/Popups/Popup_picker.php' => 'efc16459685cc015a472689ca0ab3886',
'./include/Popups/tpls/PopupGeneric.tpl' => '6de12bee73b200444038e28217cdb0e2',
'./include/Popups/tpls/footer.tpl' => 'fe184f626507e4834c6fc442d140fffc',
@ -2289,7 +2289,7 @@ $md5_string = array (
'./include/javascript/yui/build/yuitest/yuitest_core.js' => 'ed5230a0f4a885d8ea51c2fe78895d07',
'./include/javascript/yui/ygDDList.js' => '0cd9051a220de7e8c79bf5b9cccce10f',
'./include/json_config.php' => 'ba7fb6f2fb1df51bc367835406ef7ba5',
'./include/language/en_us.lang.php' => 'ce7095b341f605c0fedb300f9ad95ab6',
'./include/language/en_us.lang.php' => '5420f0bebc2c3a4a5c7346208c5cfba4',
'./include/language/en_us.notify_template.html' => 'c6a897ace7af46a44889dfab1a9d44c5',
'./include/language/getJSLanguage.php' => '1bc910bd5a9953fbf443d3d97fddbffa',
'./include/language/jsLanguage.php' => '3d27819dc00f2fe5426f72733a7edca1',
@ -2400,7 +2400,7 @@ $md5_string = array (
'./include/utils/recaptcha_utils.php' => '73f5eddf707788c1dff4b7d07dc82656',
'./include/utils/security_utils.php' => 'e953d0b673df3df313ecf1ac975e8f57',
'./include/utils/sugar_file_utils.php' => '1c1915cad8c88feb0edbf5bbaee106c4',
'./include/utils.php' => '7ef07e3591bf75669eb1fc8359cbfff0',
'./include/utils.php' => 'cced923f608d95518b88dfc27997a0d1',
'./include/vCard.php' => '44052bbedcdaba3fdf67cfc10a112e75',
'./include/ytree/ExtNode.php' => '000d4ccbdb6e0a7628c636128781b5e3',
'./include/ytree/JQueryTree.php' => '3712d2224b93818b990b876f8405b745',
@ -2491,7 +2491,7 @@ $md5_string = array (
'./install/installSystemCheck.php' => 'd5f666ece13475386610cb7915ae3c93',
'./install/installType.php' => '7acf23c138ceafad2ce0393bd3c116f0',
'./install/install_defaults.php' => 'd25503407f0db14fa875b295d0f34ae5',
'./install/install_utils.php' => '9910d3f9f63ac7fafd1ed474f8a773b1',
'./install/install_utils.php' => '4a8c2ea13fcd9c5902f13a8660fc6263',
'./install/lang.config.php' => 'cb3e68fdb0600481497dcd60f0746aca',
'./install/language/en_us.lang.php' => 'ab18c27ce23d99ef25fcf9602be1804c',
'./install/license.js' => '305c727ac2bd20adb6c169bf07b18a8e',
@ -2677,7 +2677,7 @@ $md5_string = array (
'./lib/API/JsonApi/v1/Resource/Relationship.php' => '84cfef872f4c87f30844b784126a8c9e',
'./lib/API/JsonApi/v1/Resource/Resource.php' => '92ca69094721558c4c985642aa1e2b1d',
'./lib/API/JsonApi/v1/Resource/ResourceIdentifier.php' => 'b970064d6e903d3986b1e709b2ed14ca',
'./lib/API/JsonApi/v1/Resource/SuiteBeanResource.php' => '70039bac401d7af441505cd9f78a9dd9',
'./lib/API/JsonApi/v1/Resource/SuiteBeanResource.php' => '896c39fb5fdd461dfb87c092d220143d',
'./lib/API/JsonApi/v1/schema.json' => '1fe1aa9365e189712bedc71ee875bfd7',
'./lib/API/OAuth2/.htaccess' => '4fe6db46ff1074349c8ffbb840c30de9',
'./lib/API/OAuth2/Entities/AccessTokenEntity.php' => '7ae1d3fb58d93978e8802c6107c9b593',
@ -3484,7 +3484,7 @@ $md5_string = array (
'./modules/AOS_Product_Categories/metadata/subpanels/default.php' => '99ad7a758b45868e9fd9b8ff47a0cb5a',
'./modules/AOS_Product_Categories/vardefs.php' => '61d4bb3451abc9b6670a568b639f4673',
'./modules/AOS_Product_Categories/views/view.edit.php' => 'a8d92ffd0a368d1a25a7649d29228293',
'./modules/AOS_Products/AOS_Products.php' => 'fe7e5ab6086a37067f029cbf80d55caf',
'./modules/AOS_Products/AOS_Products.php' => '0f4f0237cd42e4cdece3d894a53ea9c1',
'./modules/AOS_Products/AOS_Products_sugar.php' => '6769da40aa102583900b9d4d32492906',
'./modules/AOS_Products/Dashlets/AOS_ProductsDashlet/AOS_ProductsDashlet.meta.php' => 'b7812541758289ffbefcf59e976a3f7e',
'./modules/AOS_Products/Dashlets/AOS_ProductsDashlet/AOS_ProductsDashlet.php' => 'ee6d24e58a380e0978c7e84c7cdd7005',
@ -3750,7 +3750,7 @@ $md5_string = array (
'./modules/Administration/UpgradeFields.php' => 'd74cb90a6a24cae3c0b96a97a74d4d62',
'./modules/Administration/UpgradeHistory.php' => '14ba994d7b1d5eccfc4520855a0c4036',
'./modules/Administration/UpgradeIISAccess.php' => 'e5b6fce25e81a6a0d3e807c6fea6350e',
'./modules/Administration/UpgradeWizard.php' => 'b4324887e5715f94d06fdc2c0f91ec1f',
'./modules/Administration/UpgradeWizard.php' => 'd114a8c831c909d1a4c48b0afac7b8a0',
'./modules/Administration/UpgradeWizardCommon.php' => '92f7113707f3de797deb6b894ce81c6f',
'./modules/Administration/UpgradeWizard_commit.php' => '1fe823dac079bc5548debb7ecabcd625',
'./modules/Administration/UpgradeWizard_prepare.php' => 'dac1ff9e81b849f21af62a786be04836',
@ -4081,7 +4081,7 @@ $md5_string = array (
'./modules/Campaigns/WebToLeadFormBuilder.php' => 'b3b054b279d69dd964fba557df665be1',
'./modules/Campaigns/WebToLeadFormBuilderOptInCheckbox.tpl' => '9fd68c7d266560b82eb7667f96792779',
'./modules/Campaigns/WebToLeadFormSave.php' => 'b2596e14bbfdfd9fd75a9a40dac243f6',
'./modules/Campaigns/WebToPersonCapture.php' => '27e24a36a16897c8a4fac043c8b85516',
'./modules/Campaigns/WebToPersonCapture.php' => 'c74104628b33fc9b2a31f2d46bf3809f',
'./modules/Campaigns/WizardCampaignSave.php' => 'f7a73bc932dcf289d4d5d94eee3ad138',
'./modules/Campaigns/WizardEmailSetup.html' => 'bdf9ae5e62512fba93fc6660ecc9bf64',
'./modules/Campaigns/WizardEmailSetup.php' => '2a27180993e401a90335777939309d90',
@ -4120,7 +4120,7 @@ $md5_string = array (
'./modules/Campaigns/tpls/WizardNewsletter.tpl' => '168198cad6b844c66c1f1b7bc0c0d7e3',
'./modules/Campaigns/tpls/campaign-inactive.tpl' => 'fa6ad86dabbbb0350649cdd48bda9801',
'./modules/Campaigns/tpls/progressStepsStyle.html' => '188a9323131c1665062b361e1a26df10',
'./modules/Campaigns/utils.php' => '30877564f0bc47a307586bbf0faf2c78',
'./modules/Campaigns/utils.php' => '515ca9cdf8b005aced4e2ae257e1b770',
'./modules/Campaigns/vardefs.php' => '3356dc662190231795ec344641c886ab',
'./modules/Campaigns/views/view.classic.php' => 'd3dd10e40e7e6a9d5d0168996c80792f',
'./modules/Campaigns/views/view.detail.php' => '21ab18453038a4f2ee5458eea0a94ed9',
@ -4278,7 +4278,7 @@ $md5_string = array (
'./modules/Contacts/Address_picker.html' => 'e5878e0dbf0eae9778916326c5065652',
'./modules/Contacts/Contact.js' => 'a10eea4494b774e047252eee82d9ea1c',
'./modules/Contacts/Contact.php' => 'a982bef94fd8e4b5a6d293f72edd428a',
'./modules/Contacts/ContactFormBase.php' => '093d97d4d6020217c3d41d38136f78bc',
'./modules/Contacts/ContactFormBase.php' => '4aa3fc8f820d2877c4840ea445ac60c4',
'./modules/Contacts/ContactOpportunityRelationship.php' => 'cb54d0dcae9e58cd49ea6e81fced4396',
'./modules/Contacts/ContactOpportunityRelationshipEdit.html' => '028042fe42f810730e817de72ec1e25f',
'./modules/Contacts/ContactOpportunityRelationshipEdit.php' => '3450ef1a5ce8e62769b6df6a4c55819a',
@ -4507,9 +4507,9 @@ $md5_string = array (
'./modules/EmailMan/Forms.php' => 'd939f3555ef708f533a77c77b696ccd8',
'./modules/EmailMan/Menu.php' => '9fec01e70c034091a9fe652a61407886',
'./modules/EmailMan/action_view_map.php' => 'e4b8e3c021d90ed66c74caa7e1f8e4c5',
'./modules/EmailMan/controller.php' => 'f4eddd8447564c1542ce1444eedc366f',
'./modules/EmailMan/controller.php' => '115232ee07f77dcc4bf21ebac3b3b333',
'./modules/EmailMan/field_arrays.php' => '46faacb2ea303c961a1871ea613a455f',
'./modules/EmailMan/language/en_us.lang.php' => 'ba2d83e744656eeb3aae03f3dc5c0396',
'./modules/EmailMan/language/en_us.lang.php' => 'be07937f7e44faea4d8f11b168ad8d23',
'./modules/EmailMan/metadata/SearchFields.php' => '16ab0bf5917fd13e2bb8dd99c3444dd8',
'./modules/EmailMan/metadata/listviewdefs.php' => '947b4f415e1a9940a0997390400c35f1',
'./modules/EmailMan/metadata/searchdefs.php' => 'e7b2db84571e69a69c7faeebbb864331',
@ -4517,10 +4517,10 @@ $md5_string = array (
'./modules/EmailMan/subpanels/default.php' => '7b41db3ccd203cf7b32e133951c48df3',
'./modules/EmailMan/testOutboundEmail.php' => '8caf6009a210a1e769bea85908b2aed5',
'./modules/EmailMan/tpls/campaignconfig.tpl' => 'ce45ccf79ccb1822b742834c2cd5dca9',
'./modules/EmailMan/tpls/config.tpl' => '36947b54dc09f7212d6f874fc1ef32eb',
'./modules/EmailMan/tpls/config.tpl' => '252bff413d5c10839704fc4d56820d3e',
'./modules/EmailMan/vardefs.php' => 'f5e39c351297da9370d7ec2ae55a9cb7',
'./modules/EmailMan/views/view.campaignconfig.php' => 'c430e188a69edbbd7a309912f93fc0c7',
'./modules/EmailMan/views/view.config.php' => '943fb9f76b5b08f399efebe12deac22a',
'./modules/EmailMan/views/view.config.php' => 'b2a5f378d8bd9fd88e67a41647821489',
'./modules/EmailMan/views/view.list.php' => 'cfdff799633fe3f2637e1cb8eced7429',
'./modules/EmailMarketing/Delete.php' => 'a652a5cb47d3eef22a1293e1cee67b65',
'./modules/EmailMarketing/DetailView.html' => '73c8d91507454b0b25a913576b325dbd',
@ -4540,7 +4540,7 @@ $md5_string = array (
'./modules/EmailMarketing/metadata/subpanels/default.php' => '63ed3aea960b881a004b988dec956b77',
'./modules/EmailMarketing/subpanels/default.php' => '7f0e18d1e0c7aee65734a6160264aef3',
'./modules/EmailMarketing/vardefs.php' => '6987d2c54c785fff2ac2acefff0cc01d',
'./modules/EmailTemplates/AttachFiles.php' => '89b77bcfe0184454af0af2b6888d3f44',
'./modules/EmailTemplates/AttachFiles.php' => '38b7dbce86a3bb85986f1001ae22b765',
'./modules/EmailTemplates/CheckDeletable.php' => 'af2ff708cf350fc5a506997907ca01db',
'./modules/EmailTemplates/Delete.php' => '669a71b4d7d39d10e29e50491d3a665c',
'./modules/EmailTemplates/DetailView.html' => 'a9b5cb480845b50a3b8a72e75a9ce31b',
@ -4578,17 +4578,17 @@ $md5_string = array (
'./modules/Emails/Dashlets/MyEmailsDashlet/MyEmailsDashlet.meta.php' => '31dc1ea85cee70a8abab57f66cd77684',
'./modules/Emails/Dashlets/MyEmailsDashlet/MyEmailsDashlet.php' => 'ca55901c82bab1060a87e98af0ca524f',
'./modules/Emails/Delete.php' => '9c783f1e16850cfe4de22d719d7ce8ca',
'./modules/Emails/Email.php' => 'e79b83979c605cc261a93fdd855dee6c',
'./modules/Emails/Email.php' => '820d6000b344210f6c97bb97ded3f368',
'./modules/Emails/EmailException.php' => '360377b7b2b00fc5d6bb9935c3c92a3f',
'./modules/Emails/EmailFromValidator.php' => '275e4e1167d68361483e18bae111fdc3',
'./modules/Emails/EmailUI.css' => '79ef2b93606dc4b6d4e04b679c0b898f',
'./modules/Emails/EmailUI.php' => '7cc23aa2caa633911ea7db193a6f2a70',
'./modules/Emails/EmailUIAjax.php' => '474940d575ae666cd0b00437f75e76d4',
'./modules/Emails/EmailValidatorException.php' => 'cb225382f8842456d005769be4f3752d',
'./modules/Emails/EmailsController.php' => '08748fffab0b9bc0d757b8aee13a766a',
'./modules/Emails/EmailsControllerActionGetFromFields.php' => 'b9d8167b00bff53cf76503c5023207f7',
'./modules/Emails/EmailsDataAddress.php' => 'ba1274fe0f3bc27f4cb6d397adf42de7',
'./modules/Emails/EmailsDataAddressCollector.php' => '2ff867b7e4b76f10e983af57030ddd45',
'./modules/Emails/EmailsController.php' => 'f65ff3b077e89ce9d3e4d9002d8d89ed',
'./modules/Emails/EmailsControllerActionGetFromFields.php' => '79f7a51f4969318d92e273efd42c961f',
'./modules/Emails/EmailsDataAddress.php' => 'a5f8b75980e59788f7eb2a8339e7703f',
'./modules/Emails/EmailsDataAddressCollector.php' => 'ac58f57fb9df4b7dd52d4cff78cbc59c',
'./modules/Emails/EmailsSignatureResolver.php' => '67c883763451b6ff65741fc0c3b1029e',
'./modules/Emails/Folder.php' => '1c15b4b4c6f541b65009384c1936bf0e',
'./modules/Emails/GenerateQuickComposeFrame.php' => 'b3c126bee579c9db56e11f3c3d3fdee0',
@ -4608,10 +4608,10 @@ $md5_string = array (
'./modules/Emails/controller.php' => '65d6d5ad5e977930403a2b89cb15004a',
'./modules/Emails/field_arrays.php' => 'f8ad985446f13141ea7365aa8565c500',
'./modules/Emails/include/ComposeView/ComposeView.php' => '45b1a69671ca5c5f2a8ab1455e9f730c',
'./modules/Emails/include/ComposeView/ComposeView.tpl' => 'aee5736e992aecc485afbb5973d9e535',
'./modules/Emails/include/ComposeView/ComposeView.tpl' => '02a1b64bfde0a319fcac90b1b9ebda13',
'./modules/Emails/include/ComposeView/ComposeViewBlank.tpl' => '22365ce6727ffb560e5ad3fc187f13f2',
'./modules/Emails/include/ComposeView/ComposeViewToolbar.tpl' => '656b26827857375278124e4610b9ff06',
'./modules/Emails/include/ComposeView/EmailsComposeView.js' => '0d361ec6c5e31920da6b2078bf2d0506',
'./modules/Emails/include/ComposeView/EmailsComposeView.js' => '38f9a7aefa68cb1c453cf39e3a7bf54d',
'./modules/Emails/include/DetailView/EmailsDetailView.php' => 'f95937f398f37afe3927ecc035b8b743',
'./modules/Emails/include/DetailView/EmailsDraftDetailView.php' => 'baafca815e89a4c0ec3df8b6192552ea',
'./modules/Emails/include/DetailView/EmailsNonImportedDetailView.php' => 'ef9ecbcf65fa6f03e32f94b6a9805b2f',
@ -4722,7 +4722,7 @@ $md5_string = array (
'./modules/Emails/views/view.popup.php' => '4ff1e52f105970c29fed966e2f058dd3',
'./modules/Emails/views/view.savedraftemail.php' => '000c8d786c87e0ad997fc5de443d9b2c',
'./modules/Emails/views/view.sendemail.php' => '78784b11ddb5257b0f3f5c59c9db17a1',
'./modules/Employees/Employee.php' => '54eaa8f299aa57e555f316b80e71eaab',
'./modules/Employees/Employee.php' => 'acf053a95024ad9d06d55457fc641d6f',
'./modules/Employees/EmployeeStatus.php' => 'a2be5cfeb49ef4f8deec01de9686edb9',
'./modules/Employees/EmployeesSearchForm.php' => '0437d91e2221d02c38e0db6830fef057',
'./modules/Employees/EmployeesStudioModule.php' => '5b71bea7b6e7b7a77bc5a48d4fb10a55',
@ -4993,7 +4993,7 @@ $md5_string = array (
'./modules/InboundEmail/Overview.php' => 'e12117e0d20035b2c04dad6526783f07',
'./modules/InboundEmail/Popup.php' => 'b37711aaab32543d3a6a1fb0386c679e',
'./modules/InboundEmail/PostSave.php' => 'bc1907c89fd2dc22e2ce13ada5f5c62a',
'./modules/InboundEmail/Save.php' => 'cac8ae11bba0f6d9512a835a81355d1a',
'./modules/InboundEmail/Save.php' => '6177a11b30869315ee8927467d338f6b',
'./modules/InboundEmail/SaveGroupFolder.php' => '6894a715a39d2074b652a30a1463a430',
'./modules/InboundEmail/ShowInboundFoldersList.php' => '7c94ce6fa12d6e5ebefd5c1746e20662',
'./modules/InboundEmail/View.html' => 'aeaf0daf6157c5a74738a47145576ee0',
@ -5021,7 +5021,7 @@ $md5_string = array (
'./modules/InboundEmail/tpls/checkImap.tpl' => 'e6ffd2a625f24091435894426d47016c',
'./modules/InboundEmail/tpls/systemSettingsForm.tpl' => 'f9fd7244167a1822c4673637ba9db2ba',
'./modules/InboundEmail/utils.php' => '1f5c1737a6682c63c60aa6270d99d8ed',
'./modules/InboundEmail/vardefs.php' => 'f5222a3d914a052c979391357d92168a',
'./modules/InboundEmail/vardefs.php' => '179f489abeda7ddbf2e498fee03135bf',
'./modules/InboundEmail/views/view.detail.php' => 'c542825b80e41328a0fee82baa891873',
'./modules/InboundEmail/views/view.edit.php' => '7325f9bae56b6fa44a15bbdfa01e09bf',
'./modules/InboundEmail/views/view.list.php' => '0e9f5d43a7400362cee323a7bc332b94',
@ -5038,7 +5038,7 @@ $md5_string = array (
'./modules/Leads/Dashlets/MyLeadsDashlet/MyLeadsDashlet.php' => 'be81a158e3df10a2f27cca07ce5c12f7',
'./modules/Leads/Lead.js' => 'b52ff138ccdb1b4bb79a0ff9870d6feb',
'./modules/Leads/Lead.php' => '85d8e4016282c0f3f1cd893dde8a3170',
'./modules/Leads/LeadFormBase.php' => 'ad656b689844598451098ad61f43ab87',
'./modules/Leads/LeadFormBase.php' => '2c1645940849161817ce36e836c6f028',
'./modules/Leads/LeadsJjwg_MapsLogicHook.php' => '453c9c2a0bcc6f4b28d0c4e477b09fa5',
'./modules/Leads/LeadsListViewSmarty.php' => '15081edc09444a603f3dc5c7d0107cae',
'./modules/Leads/LeadsQuickCreate.php' => '6b00e0ce840f11b87a9235be6a4568f8',
@ -5437,18 +5437,19 @@ $md5_string = array (
'./modules/OutboundEmailAccounts/Dashlets/OutboundEmailAccountsDashlet/OutboundEmailAccountsDashlet.meta.php' => '564160df3adaa9773a86a2a244df28a2',
'./modules/OutboundEmailAccounts/Dashlets/OutboundEmailAccountsDashlet/OutboundEmailAccountsDashlet.php' => '22ef1ad6261d81c6c1b28409629a3d0a',
'./modules/OutboundEmailAccounts/Menu.php' => 'ba722ed3aadca9ab1b969b70b9fbb519',
'./modules/OutboundEmailAccounts/OutboundEmailAccounts.php' => 'a3381c6d65dbbf0e7fb4d7d4c687ef4b',
'./modules/OutboundEmailAccounts/OutboundEmailAccounts.php' => 'fc1b8bdf2279a85a25018e287c25d610',
'./modules/OutboundEmailAccounts/OutboundEmailAccounts_sugar.php' => '20b589d798825ca87ddc5456bcb96ff2',
'./modules/OutboundEmailAccounts/controller.php' => '7ca3815b742cdd6c05566610b4d77171',
'./modules/OutboundEmailAccounts/js/fields.js' => '07c9e6fb4762f099f79477d27f562439',
'./modules/OutboundEmailAccounts/js/owner_toggle.js' => '8e5defb59d799779164997733f7991c5',
'./modules/OutboundEmailAccounts/js/panel_toggle.js' => 'c4f3c2ef96bc101eeed643ee989d95da',
'./modules/OutboundEmailAccounts/js/smtp_auth_toggle.js' => 'b0d4e2ad9d7a92eb57702613d67dfedd',
'./modules/OutboundEmailAccounts/js/ssl_port_set.js' => '97d8f0bef082f24e9fb2dd0d9446c626',
'./modules/OutboundEmailAccounts/language/en_us.lang.php' => 'ea2f58968b90e3e6996e236d2542c499',
'./modules/OutboundEmailAccounts/language/en_us.lang.php' => 'd2a942340a7beb396091b2f475bcd58e',
'./modules/OutboundEmailAccounts/metadata/SearchFields.php' => '8c105dc9670943e3677c33ef51b4a61e',
'./modules/OutboundEmailAccounts/metadata/dashletviewdefs.php' => '93e262245007ffc79f1ff9938e8bbac9',
'./modules/OutboundEmailAccounts/metadata/detailviewdefs.php' => '7e4c8f1bfbd71405a426a403cf820c3f',
'./modules/OutboundEmailAccounts/metadata/editviewdefs.php' => '37225d9f8027552f058bb386de7bc5dc',
'./modules/OutboundEmailAccounts/metadata/detailviewdefs.php' => '6969980159cb35fad5da7661c95a6e3c',
'./modules/OutboundEmailAccounts/metadata/editviewdefs.php' => '3a4ac85c0c1984a5ca743acd2c62c858',
'./modules/OutboundEmailAccounts/metadata/listviewdefs.php' => '428a7fcfcac94e9e1875629f2d898f92',
'./modules/OutboundEmailAccounts/metadata/metafiles.php' => 'd163cfdaa7fa3d697326f798bbcc6867',
'./modules/OutboundEmailAccounts/metadata/popupdefs.php' => 'ccb60aa6a4e11726dab4e1bc99000b34',
@ -5458,7 +5459,7 @@ $md5_string = array (
'./modules/OutboundEmailAccounts/metadata/subpaneldefs.php' => '5928a4543d2c06d6ba9e032e01fc5081',
'./modules/OutboundEmailAccounts/metadata/subpanels/default.php' => 'a58b6710e2acc338ef0712175eb95cf5',
'./modules/OutboundEmailAccounts/smtpPreselection.tpl' => 'f3d86727a10f3fd50e16fa88769478fd',
'./modules/OutboundEmailAccounts/vardefs.php' => '1e9b9038a810365377df4f7beabfc152',
'./modules/OutboundEmailAccounts/vardefs.php' => '50c8bf9e7e1f8c37a4d68d5ccdc95c25',
'./modules/OutboundEmailAccounts/views/view.detail.php' => 'c71af76cd203a164fe5a99e7c0f8db10',
'./modules/OutboundEmailAccounts/views/view.edit.php' => '3fe1866151f37a6a42b9a224b1b65876',
'./modules/OutboundEmailAccounts/views/view.list.php' => 'e2b1a1bd2a9a517fe5eb0bf17f6cf4d5',
@ -5594,7 +5595,7 @@ $md5_string = array (
'./modules/Prospects/Menu.php' => '0af2124f64e4563183672100b6f8911e',
'./modules/Prospects/Popup_picker.html' => 'a56ae077172b05ac9e95cb3218fd6615',
'./modules/Prospects/Prospect.php' => '8c6bcbc1b442b43354da6ad6a445f285',
'./modules/Prospects/ProspectFormBase.php' => 'b48c69d3a1f89a43ac79fbd6febb0f1f',
'./modules/Prospects/ProspectFormBase.php' => '0fd6256da04924ebd8968edb2723bc34',
'./modules/Prospects/ProspectsJjwg_MapsLogicHook.php' => '24a7bb2a9708bfc07dbc732f69ceae85',
'./modules/Prospects/ProspectsListViewSmarty.php' => '87d98922c2a470620706ccb69f817c43',
'./modules/Prospects/Save.php' => '8d48a85c6b8db36d63fe554573196a9f',
@ -6067,7 +6068,7 @@ $md5_string = array (
'./modules/Users/SetTimezone.tpl' => 'f0fb5ed64fae81a5657ebc8f167967c9',
'./modules/Users/UpdateTourStatus.php' => 'cc111e28e6df1d96b98678661dd42490',
'./modules/Users/User.js' => '351f8d8e74bd1bd0a56dcc2bae31b147',
'./modules/Users/User.php' => 'a75ad79197349bc156f9365ef3830b9c',
'./modules/Users/User.php' => '5edd56612b566c0d8b6199f6e2973575',
'./modules/Users/UserEditView.js' => '421e1c38f1ee78933134b987b7c3c251',
'./modules/Users/UserEmailOptions.tpl' => '96b848efbf7f6d4fee7b6bf13a1a1aee',
'./modules/Users/UserEmailSettings.tpl' => '5d9ff3379f63dcf7c5efbbcc3e88d8ed',
@ -6354,23 +6355,23 @@ $md5_string = array (
'./soap.php' => 'e28988c2e0b8e2c484587b537a710525',
'./sugar_version.json' => 'bdfbcefae2f9af559bef6a36367df7bb',
'./sugar_version.php' => 'db7b6c8d51f87879fce1e6172eedfbed',
'./suitecrm_version.php' => '01090b9e33bc845e4138231c914b133e',
'./suitecrm_version.php' => 'a674e4570a1576621197cb3a6ef36d51',
'./themes/SuiteP/css/Dawn/color-palette.scss' => 'e64677d79e1d68c069bdc2dc661c4f99',
'./themes/SuiteP/css/Dawn/icons.scss' => 'd59f8c5855e7a8df09542a663835a196',
'./themes/SuiteP/css/Dawn/select.ico' => '22393ad23f16c3f1462455bae8f20279',
'./themes/SuiteP/css/Dawn/style.css' => '96e4c253c9c91ea1ca1255713c6e2778',
'./themes/SuiteP/css/Dawn/style.css' => 'c26b4a0fe120e05ac9f6ff7002720682',
'./themes/SuiteP/css/Dawn/style.scss' => 'f027cdfded90564faebf0d52ba1ae8b3',
'./themes/SuiteP/css/Dawn/variables.scss' => 'f8f8acf976e6cb0f1d27ea46891ead2e',
'./themes/SuiteP/css/Day/color-palette.scss' => '91bed2ed878a141ccdc521512f0daa33',
'./themes/SuiteP/css/Day/icons.scss' => '7a77bb17a810866e1ec4e0667e58e536',
'./themes/SuiteP/css/Day/select.ico' => '22393ad23f16c3f1462455bae8f20279',
'./themes/SuiteP/css/Day/style.css' => 'd3ed65091e72cefe776e2785ab35c563',
'./themes/SuiteP/css/Day/style.css' => 'e35540424d9d6de0d1e0ad18de3cf088',
'./themes/SuiteP/css/Day/style.scss' => '61ac0ca8c47681b284ecbf14755d18ed',
'./themes/SuiteP/css/Day/variables.scss' => '31b6e279ea974581ad42f95a3bb694a4',
'./themes/SuiteP/css/Dusk/color-palette.scss' => '3fa059d1033bfd1bfa342ec0bc4ffe25',
'./themes/SuiteP/css/Dusk/icons.scss' => '7a77bb17a810866e1ec4e0667e58e536',
'./themes/SuiteP/css/Dusk/select.ico' => '22393ad23f16c3f1462455bae8f20279',
'./themes/SuiteP/css/Dusk/style.css' => 'a3944925c2ef23e1049aabd7fff09657',
'./themes/SuiteP/css/Dusk/style.css' => '4223b5acc98b57005278fa9932a02aef',
'./themes/SuiteP/css/Dusk/style.scss' => 'f027cdfded90564faebf0d52ba1ae8b3',
'./themes/SuiteP/css/Dusk/variables.scss' => 'ac38ee874a0668e1d3b86972a850f91d',
'./themes/SuiteP/css/Night/color-palette.scss' => '25653200b97822a2d0f2594b180858c8',
@ -6382,7 +6383,7 @@ $md5_string = array (
'./themes/SuiteP/css/Noon/color-palette.scss' => '952a2c7a3fb020ca2232b24a9ac58fe4',
'./themes/SuiteP/css/Noon/icons.scss' => 'b5d0e65cf55142e8591bfcd792b6bed6',
'./themes/SuiteP/css/Noon/select.ico' => '09333d8f426c1a4743e9b977a67d1d1f',
'./themes/SuiteP/css/Noon/style.css' => '3fa89f1c509883c52b53feae9fe12dda',
'./themes/SuiteP/css/Noon/style.css' => 'ce08cb60f7234837d67cca7cf9fee761',
'./themes/SuiteP/css/Noon/style.scss' => 'f027cdfded90564faebf0d52ba1ae8b3',
'./themes/SuiteP/css/Noon/variables.scss' => 'bea284c3121762d58279aca24c873d9e',
'./themes/SuiteP/css/bootstrap/alerts.scss' => 'c0e5396555dd4c70b9eeb314e4c4613d',
@ -6479,7 +6480,7 @@ $md5_string = array (
'./themes/SuiteP/css/suitep-base/dashboard.scss' => '64f63cbdfbae00261a17b31bcaf2a98a',
'./themes/SuiteP/css/suitep-base/detailview.scss' => 'a7ece4c3b5ab6c3cc9b2637ac46cf9b3',
'./themes/SuiteP/css/suitep-base/editview.scss' => '942de05cc187175393b9cba06f8e0ddb',
'./themes/SuiteP/css/suitep-base/email.scss' => '8a3dead7e980a0cdf6b44a29cff816b6',
'./themes/SuiteP/css/suitep-base/email.scss' => '812aae974e2c6e066d8a81511d99b28a',
'./themes/SuiteP/css/suitep-base/forms.scss' => 'e1626b89c1cf4ac8fc16c5f5532c8ac0',
'./themes/SuiteP/css/suitep-base/jstree.scss' => '946510970bb0774a31a01c2fb57a9552',
'./themes/SuiteP/css/suitep-base/listview.scss' => '46898f8372bdd796e5ddeed167bd0c30',
@ -7829,7 +7830,7 @@ $md5_string = array (
'./themes/SuiteP/tpls/_head.tpl' => '48dc8d52d1110b76eee996d871ba0d6d',
'./themes/SuiteP/tpls/_headerModuleList.tpl' => '35e093da774057960b47e25d274d2fd4',
'./themes/SuiteP/tpls/footer.tpl' => '38c4fa89e7f7e7118f58f8a3f28fe231',
'./themes/SuiteP/tpls/header.tpl' => '53758953c9f18ea4d5ff2a1140454c5b',
'./themes/SuiteP/tpls/header.tpl' => 'cc3a44e2082244f0122c981984060b23',
'./themes/SuiteP/tpls/login.tpl' => '2e722fa7facd9656fd1c1c348260634d',
'./themes/default/css/bootstrap.css' => '35cda076a2dfccfb460b8225f38c104f',
'./themes/default/css/chart.css' => 'cc19057a4b20d6f05bcd382e25f19fa2',

View file

@ -936,7 +936,7 @@ class EditView
//if popup select add panel if user is a member of multiple groups to metadataFile
global $sugar_config;
if(isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true
&& (empty($this->focus->fetched_row['id']) || $_REQUEST['isDuplicate'] == true) && $this->focus->module_dir != "Users" && $this->focus->module_dir != "SugarFeed") {
&& (empty($this->focus->fetched_row['id']) || ($_REQUEST['isDuplicate'] ?? false) === true) && $this->focus->module_dir != "Users" && $this->focus->module_dir != "SugarFeed") {
//there are cases such as uploading an attachment to an email template where the request module may
//not be the same as the current bean module. If that happens we can just skip it

View file

@ -181,7 +181,13 @@ class Imap2Handler implements ImapHandlerInterface
public function close()
{
$this->logCall(__FUNCTION__, func_get_args());
if (!$ret = imap2_close($this->getStream())) {
try {
$ret = imap2_close($this->getStream());
} catch (Throwable $e) {
$ret = false;
}
if (!$ret) {
$this->log('IMAP close error');
}
$this->logReturn(__FUNCTION__, $ret);

View file

@ -210,7 +210,8 @@ class ImapHandlerFactory
}
$interfaceClass = $this->getHandlerClass($handlerType);
$log->fatal('Using imap handler class: ' . $interfaceClass);
$log->debug('Using imap handler class: ' . $interfaceClass);
if ($test) {
$this->loadTestSettings($testSettings);
} else {

View file

@ -52,6 +52,11 @@ function getEditFieldHTML($module, $fieldname, $aow_field, $view = 'EditView', $
return false;
}
$vardef = $bean->getFieldDefinition($fieldname);
if (isTrue($vardef['sensitive'] ?? false) || isFalse($vardef['api-visible'] ?? true)){
return false;
}
$value = getFieldValueFromModule($fieldname, $module, $id);
// use the mod_strings for this module

View file

@ -95,6 +95,11 @@ class MySugar
$dashlets = $current_user->getPreference('dashlets', $this->type);
if (!empty($_POST['type_module']) && stripos($_POST['type_module'], 'phar://') !== false) {
LoggerManager::getLogger()->security('MySugar:addDashlet unsecure type_module received: ' . $_POST['type_module']);
throw new RuntimeException('Invalid type_module');
}
$guid = create_guid();
$options = array();
if (isset($_POST['type'], $_POST['type_module']) && $_POST['type'] == 'web') {

View file

@ -130,7 +130,10 @@ class PopupSmarty extends ListViewSmarty
$contextMenuObjectsTypes = array();
foreach ($this->displayColumns as $name => $params) {
if (!empty($adjustment)) {
$this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2);
}
// figure out which contextMenu objectsTypes are required
if (!empty($params['contextMenu']['objectType'])) {
$contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;

View file

@ -3945,3 +3945,8 @@ $app_strings['LBL_KEY'] = 'Key';
$app_strings['LBL_VALUE'] = 'Value';
$app_strings['LBL_OPTIONAL'] = 'Optional';
$app_strings['LBL_OPTIONAL_CONNECTION_STRING'] = 'Optional. Set to use a specific connection string';
$app_strings['LBL_OUTBOUND_ACCOUNT'] = 'Outbound Account';
$app_strings['LBL_INBOUND_ACCOUNT'] = 'Inbound Account';
$app_strings['LBL_SYSTEM_ACCOUNT'] = 'System Account';
$app_strings['LBL_FROM_SYSTEM'] = 'Send From System';
$app_strings['LBL_SIGNATURE'] = 'Signature';

View file

@ -206,6 +206,9 @@ function make_sugar_config(&$sugar_config)
'php3',
'php4',
'php5',
'php6',
'php7',
'php8',
'pl',
'cgi',
'py',
@ -277,6 +280,7 @@ function make_sugar_config(&$sugar_config)
'min_cron_interval' => 30, // minimal interval between cron jobs
),
'strict_id_validation' => false,
'legacy_email_behaviour' => false,
);
}
@ -469,6 +473,9 @@ function get_sugar_config_defaults(): array
'php3',
'php4',
'php5',
'php6',
'php7',
'php8',
'pl',
'cgi',
'py',
@ -486,7 +493,8 @@ function get_sugar_config_defaults(): array
'png',
'jpg',
'jpeg',
'svg'
'svg',
'bmp'
],
'allowed_preview' => [
'pdf',
@ -571,6 +579,7 @@ function get_sugar_config_defaults(): array
'gc_probability' => 1,
'gc_divisor' => 100,
],
'legacy_email_behaviour' => false,
];
if (!is_object($locale)) {
@ -1420,7 +1429,7 @@ function return_module_language($language, $module, $refresh = false)
global $currentModule;
// Jenny - Bug 8119: Need to check if $module is not empty
if (empty($module)) {
if (empty($module) || !isAllowedModuleName($module)) {
$GLOBALS['log']->warn('Variable module is not in return_module_language, see more info: debug_backtrace()');
return array();
@ -1984,8 +1993,8 @@ function get_select_options_with_id_separate_key($label_list, $key_list, $select
// the system is evaluating $selected_key == 0 || '' to true. Be very careful when changing this. Test all cases.
// The bug was only happening with one of the users in the drop down. It was being replaced by none.
if (
($option_key != '' && $selected_key == $option_key) || (
$option_key == '' && (($selected_key == '' && !$massupdate) || $selected_key == '__SugarMassUpdateClearField__')
($option_key !== '' && $selected_key === $option_key) || (
$option_key === '' && (($selected_key === '' && !$massupdate) || $selected_key === '__SugarMassUpdateClearField__')
) || (is_array($selected_key) && in_array($option_key, $selected_key))
) {
$selected_string = 'selected ';
@ -6187,3 +6196,22 @@ function isSmtp($value): bool {
return strtolower($value) === 'smtp';
}
/**
* Check if is string is an allowed module name
* @param string $value
* @return bool
*/
function isAllowedModuleName(string $value): bool {
if (empty($value)) {
return false;
}
$result = preg_match("/^[\w\-\_\.]+$/", $value);
if (!empty($result)) {
return true;
}
return false;
}

View file

@ -996,7 +996,7 @@ EOQ;
$restrict_str .= <<<EOQ
RedirectMatch 403 {$ignoreCase}.*\.log$
RedirectMatch 403 {$ignoreCase}/+not_imported_.*\.txt
RedirectMatch 403 {$ignoreCase}/+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules|vendor)/+.*\.(php|tpl)
RedirectMatch 403 {$ignoreCase}/+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules|vendor)/+.*\.(php|tpl|phar)
RedirectMatch 403 {$ignoreCase}/+emailmandelivery\.php
RedirectMatch 403 {$ignoreCase}/+.git
RedirectMatch 403 {$ignoreCase}/+.{$cacheDir}

View file

@ -115,6 +115,13 @@ class SuiteBeanResource extends Resource
throw $exception;
}
$isSensitive = isTrue($definition['sensitive'] ?? false);
$notApiVisible = isFalse($definition['api-visible'] ?? true);
if ($isSensitive || $notApiVisible){
continue;
}
if ($definition['type'] === 'datetime' && isset($sugarBean->$fieldName)) {
// Convert to DB date
$datetime = $dateTimeConverter->fromUser($sugarBean->$fieldName);

View file

@ -64,6 +64,12 @@ class AOS_Products extends AOS_Products_sugar
require_once('include/upload_file.php');
$GLOBALS['log']->debug('UPLOADING PRODUCT IMAGE');
$imageFileName = $_FILES['uploadimage']['name'] ?? '';
if (!has_valid_image_extension('AOS_Products Uploaded image file: ' . $imageFileName , $imageFileName)) {
LoggerManager::getLogger()->fatal("AOS_Products save - Invalid image file ext : '$imageFileName'.");
throw new RuntimeException('Invalid request');
}
if (!empty($_FILES['uploadimage']['tmp_name']) && verify_uploaded_image($_FILES['uploadimage']['tmp_name'])) {
if ($_FILES['uploadimage']['size'] > $sugar_config['upload_maxsize']) {
die($mod_strings['LBL_IMAGE_UPLOAD_FAIL'] . $sugar_config['upload_maxsize']);

View file

@ -106,9 +106,15 @@ if (isset($_REQUEST['run']) && ($_REQUEST['run'] != "")) {
$perform = true;
$base_filename = urldecode($tempFile);
} elseif (!empty($_REQUEST['load_module_from_dir'])) {
$moduleDir = $_REQUEST['load_module_from_dir'];
if (strpos($moduleDir, 'phar://') !== false) {
die();
$moduleDir = $_REQUEST['load_module_from_dir'] ?? '';
if (stripos($moduleDir, 'phar://') !== false) {
LoggerManager::getLogger()->fatal("UpgradeWizard - invalid load_module_from_dir: " . $moduleDir);
throw new RuntimeException('Invalid request');
}
if (strtolower(pathinfo(urldecode($_REQUEST['upgrade_zip_escaped'] ?? ''), PATHINFO_EXTENSION)) !== 'zip'){
LoggerManager::getLogger()->fatal("UpgradeWizard - invalid upgrade_zip_escaped: " . $_REQUEST['upgrade_zip_escaped'] ?? '');
throw new RuntimeException("Invalid request");
}
//copy file to proper location then call performSetup
copy($moduleDir . '/' . $_REQUEST['upgrade_zip_escaped'], "upload://" . $_REQUEST['upgrade_zip_escaped']);

View file

@ -54,6 +54,11 @@ if (isset($_REQUEST['moduleDir']) && $_REQUEST['moduleDir'] != null) {
die('Not a valid module directory');
}
if (!isValidWebToPersonModule($moduleDir)) {
LoggerManager::getLogger()->fatal('Trying to run WepToPersonCapture for invalid module: ' . $moduleDir);
throw new RuntimeException('Not a valid module');
}
global $app_strings, $sugar_config, $timedate, $current_user;
$mod_strings = return_module_language($sugar_config['default_language'], $moduleDir);

View file

@ -1157,3 +1157,33 @@ function filterFieldsFromBeans($beans)
}
return $formattedBeans;
}
/**
* Get valid web to person modules
* @return array
*/
function getValidWebToPersonModules(): array
{
$superclass = 'Person';
$modules = [];
foreach ($GLOBALS['moduleList'] as $mod) {
$item = BeanFactory::getBean($mod);
if ($item && is_subclass_of($item, $superclass)) {
$modules[] = $item->module_name;
}
}
return $modules;
}
/**
* Check if it is a valid WebToPerson module
* @param string $module
* @return bool
*/
function isValidWebToPersonModule(string $module): bool
{
$validModules = getValidWebToPersonModules();
return in_array($module, $validModules, true);
}

View file

@ -73,15 +73,21 @@ class ContactFormBase extends PersonFormBase
// Bug #46427 : Records from other Teams shown on Potential Duplicate Contacts screen during Lead Conversion
// add team security
$dbManager = DBManagerFactory::getInstance();
$query .= ' where contacts.deleted = 0 AND ';
if (isset($_POST[$prefix.'first_name']) && strlen($_POST[$prefix.'first_name']) != 0 && isset($_POST[$prefix.'last_name']) && strlen($_POST[$prefix.'last_name']) != 0) {
$query .= " contacts.first_name LIKE '". $_POST[$prefix.'first_name'] . "%' AND contacts.last_name = '". $_POST[$prefix.'last_name'] ."'";
$firstName = $dbManager->quote($_POST[$prefix.'first_name' ?? '']);
$lastName = $dbManager->quote($_POST[$prefix.'last_name' ?? '']);
$query .= " contacts.first_name LIKE '". $firstName . "%' AND contacts.last_name = '". $lastName ."'";
} else {
$query .= " contacts.last_name = '". $_POST[$prefix.'last_name'] ."'";
$lastName = $dbManager->quote($_POST[$prefix.'last_name' ?? '']);
$query .= " contacts.last_name = '". $lastName ."'";
}
if (!empty($_POST[$prefix.'record'])) {
$query .= " AND contacts.id != '". $_POST[$prefix.'record'] ."'";
$record = $dbManager->quote($_POST[$prefix.'record' ?? '']);
$query .= " AND contacts.id != '". $record ."'";
}
return $query;
}

View file

@ -99,6 +99,7 @@ class EmailManController extends SugarController
$configurator->config['email_enable_auto_send_opt_in'] = (isset($_REQUEST['email_enable_auto_send_opt_in'])) ? true : false;
$configurator->config['email_confirm_opt_in_email_template_id'] = isset($_REQUEST['email_template_id_opt_in']) ? $_REQUEST['email_template_id_opt_in'] : $configurator->config['aop']['confirm_opt_in_template_id'];
$configurator->config['email_allow_send_as_user'] = (isset($_REQUEST['mail_allowusersend']) && $_REQUEST['mail_allowusersend'] == '1') ? true : false;
$configurator->config['legacy_email_behaviour'] = isTrue($_REQUEST['legacy_email_behaviour'] ?? false);
///////////////////////////////////////////////////////////////////////////////
//// SECURITY
$security = array();

View file

@ -59,6 +59,7 @@ $mod_strings = array(
'LBL_EMAIL_ENABLE_CONFIRM_OPT_IN' => 'Opt In Settings',
'LBL_EMAIL_ENABLE_SEND_OPT_IN' => 'Automatically Send Opt In Email',
'LBL_EMAIL_CONFIRM_OPT_IN_TEMPLATE_ID' => 'Confirm Opt In Email Template',
'LBL_LEGACY_EMAIL_COMPOSE_BEHAVIOR' => 'Enable Legacy Email Compose Behaviour',
'LBL_EMAIL_OUTBOUND_CONFIGURATION' => 'Outgoing Mail Configuration',
'LBL_EMAILS_PER_RUN' => 'Number of emails sent per batch:',
'LBL_ID' => 'Id',

View file

@ -200,7 +200,7 @@ function change_state(radiobutton) {
<input id="notify_allow_default_outbound" name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
</td>
</tr>
<tr>
<tr class="legacy-compose-option" {if isset($legacyEmailConfigEnabled)}style="display:none"{/if}>
<td width="20%" scope="row">
{$MOD.LBL_ALLOW_SEND_AS_USER}&nbsp;
<img border="0" class="inlineHelpTip" onclick="return SUGAR.util.showHelpTips(this,'{$MOD.LBL_ALLOW_SEND_AS_USER_DESC}','','','dialogHelpPopup')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
@ -296,6 +296,15 @@ function change_state(radiobutton) {
<select name="email_template_id_opt_in">{$EMAIL_OPT_IN_TEMPLATES}</select>
</td>
</tr>
<tr>
<td width="20%" scope="row" valign='top'>
{$MOD.LBL_LEGACY_EMAIL_COMPOSE_BEHAVIOR}:&nbsp;
</td>
<td width="30%" valign='top'>
<input id="legacy_email_behaviour" name='legacy_email_behaviour' value="true" tabindex='1' class="checkbox" type="checkbox" {if !empty($legacyEmailConfigEnabled)}checked="checked{/if}">
</td>
</tr>
</table>
</div>
</div>
@ -791,6 +800,25 @@ if(window.addEventListener){
}else{
window.attachEvent("onload", function() { SUGAR.util.setEmailPasswordDisplay('mail_smtppass', {/literal}{$mail_haspass}{literal}); });
}
function toggleLegacyComposeOptions()
{
var isSelected = $('#legacy_email_behaviour').is(':checked') || false;
var displayMethod = 'hide';
if(isSelected) {
displayMethod = 'show';
}
$('.legacy-compose-option')[displayMethod]();
}
$(document).ready(function () {
toggleLegacyComposeOptions()
$('#legacy_email_behaviour').on('change', function(){
toggleLegacyComposeOptions()
});
});
{/literal}{if !empty($mail_smtptype)}{literal}
changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}", false);
{/literal}{/if}{literal}

View file

@ -93,6 +93,11 @@ class ViewConfig extends SugarView
$focus->retrieveSettings(); //retrieve all admin settings.
$GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
$useLegacyEmailConfig = $sugar_config['legacy_email_behaviour'] ?? false;
$this->ss->assign("legacyEmailConfigEnabled", $useLegacyEmailConfig);
$this->ss->assign("MOD", $mod_strings);
$this->ss->assign("APP", $app_strings);

View file

@ -61,6 +61,13 @@ $ret = array();
foreach ($_FILES as $k => $file) {
if (in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
$fileName = $_FILES[$k]['name'] ?? '';
if (!has_valid_image_extension('Attach Files Uploaded file: ' . $fileName , $fileName)) {
LoggerManager::getLogger()->fatal("EmailTemplates AttachFiles - Invalid file ext : '$fileName'.");
throw new RuntimeException('Invalid request');
}
$upload_file = new UploadFile($k);
// check the file
if ($upload_file->confirm_upload()) {

View file

@ -2807,6 +2807,55 @@ class Email extends Basic
return $mail;
}
/**
* preps SMTP info for email transmission
* @param SugarPHPMailer $mail SugarPHPMailer object
*/
public function setOutboundBasedMailer(SugarPHPMailer $mail, OutboundEmailAccounts $outboundEmail): void
{
$type = $outboundEmail->type;
if ($type === 'system-override') {
$mail->setMailerForSystem();
} else {
$this->setupMailerFromOutbound($outboundEmail, $mail);
}
$mail->oe = $outboundEmail;
}
/**
* @param OutboundEmailAccounts $oe
* @param SugarPHPMailer $mail
* @return void
*/
protected function setupMailerFromOutbound(OutboundEmailAccounts $oe, SugarPHPMailer $mail): void
{
// ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl://
$mail->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
if (isSmtp($oe->mail_sendtype ?? '')) {
//Set mail send type information
$mail->Mailer = "smtp";
$mail->Host = $oe->mail_smtpserver;
$mail->Port = $oe->mail_smtpport;
if ($oe->mail_smtpssl == 1) {
$mail->SMTPSecure = 'ssl';
} // if
if ($oe->mail_smtpssl == 2) {
$mail->SMTPSecure = 'tls';
} // if
if ($oe->mail_smtpauth_req) {
$mail->SMTPAuth = true;
$mail->Username = $oe->mail_smtpuser;
$mail->Password = $oe->mail_smtppass;
}
} else {
$mail->Mailer = "sendmail";
}
}
/**
* Preps SugarPHPMailer object for HTML or Plain text sends
* @param SugarPHPMailer $mail
@ -2914,62 +2963,14 @@ class Email extends Basic
LoggerManager::getLogger()->error('"To" address(es) is not set or empty to sending email.');
return false; // return false as error, to-address is required to sending an email
}
foreach ((array)$this->to_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
if (!isset($addr_arr['email']) || !$addr_arr['email']) {
LoggerManager::getLogger()->error('"To" email address is missing!');
} else {
$mail->AddAddress($addr_arr['email'], "");
}
} else {
$mail->AddAddress(
$addr_arr['email'],
$locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset)
);
}
}
if (!$this->cc_addrs_arr) {
LoggerManager::getLogger()->warn('"CC" address(es) is not set or empty to sending email.');
}
foreach ((array)$this->cc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddCC($addr_arr['email'], "");
} else {
$mail->AddCC(
$addr_arr['email'],
$locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset)
);
}
}
if (!$this->bcc_addrs_arr) {
LoggerManager::getLogger()->warn('"BCC" address(es) is not set or empty to sending email.');
}
foreach ((array)$this->bcc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddBCC($addr_arr['email'], "");
} else {
$mail->AddBCC(
$addr_arr['email'],
$locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset)
);
}
}
$this->setRecipientAddresses($mail, $locale, $OBCharset);
$ieId = $this->mailbox_id;
$mail = $this->setMailer($mail, '', $ieId);
if (($mail->oe->type === 'system') && (!isset($sugar_config['email_allow_send_as_user']) || (!$sugar_config['email_allow_send_as_user']))) {
$fromAddr = $mail->oe->smtp_from_addr;
$fromName = $mail->oe->smtp_from_name;
$mail->From = $fromAddr;
$sender = $fromAddr;
$ReplyToAddr = $fromAddr;
isValidEmailAddress($mail->From);
$ReplyToName = $fromName;
$mail->FromName = $fromName;
if ($this->isToUseSystemEmail($mail, $sugar_config)) {
[$sender, $ReplyToAddr, $ReplyToName] = $this->setSystemBasedSenderAddresses($mail);
} else {
// FROM ADDRESS
@ -3015,89 +3016,24 @@ class Email extends Basic
$mail->AddReplyTo($ReplyToAddr, $locale->translateCharsetMIME(trim($ReplyToName), 'UTF-8', $OBCharset));
$mail->Subject = html_entity_decode($this->name, ENT_QUOTES, 'UTF-8');
//$mail->Subject = $this->name;
///////////////////////////////////////////////////////////////////////
//// ATTACHMENTS
if (isset($this->saved_attachments)) {
foreach ($this->saved_attachments as $note) {
$mime_type = 'text/plain';
if ($note->object_name == 'Note') {
if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) { // brandy-new file upload/attachment
$file_location = "file/" . $note->file->temp_file_location;
$filename = $note->file->original_file_name;
$mime_type = $note->file->mime_type;
} else { // attachment coming from template/forward
$file_location = "upload/{$note->id}";
// cn: bug 9723 - documents from EmailTemplates sent with Doc Name, not file name.
$filename = !empty($note->filename) ? $note->filename : $note->name;
$mime_type = $note->file_mime_type;
}
} elseif ($note->object_name == 'DocumentRevision') { // from Documents
$filePathName = $note->id;
// cn: bug 9723 - Emails with documents send GUID instead of Doc name
$filename = $note->getDocumentRevisionNameForDisplay();
$file_location = "upload/$note->id";
$mime_type = $note->file_mime_type;
}
$attachmentLabel = $mod_strings['LBL_EMAIL_ATTACHMENT'] ?? '';
// strip out the "Email attachment label if exists
$filename = str_replace($mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ', '', $filename);
$file_ext = pathinfo($filename, PATHINFO_EXTENSION);
//is attachment in our list of bad files extensions? If so, append .txt to file location
//check to see if this is a file with extension located in "badext"
foreach ($sugar_config['upload_badext'] as $badExt) {
if (strtolower($file_ext) == strtolower($badExt)) {
//if found, then append with .txt to filename and break out of lookup
//this will make sure that the file goes out with right extension, but is stored
//as a text in db.
$file_location = $file_location . ".txt";
break; // no need to look for more
}
}
$mail->AddAttachment(
$file_location,
$locale->translateCharsetMIME(trim($filename), 'UTF-8', $OBCharset),
'base64',
$mime_type
$this->setupAttachments(
$attachmentLabel,
$sugar_config['upload_badext'],
$mail,
$locale,
$OBCharset
);
// embedded Images
if ($note->embed_flag == true) {
$cid = $filename;
$mail->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type);
}
}
} else {
LoggerManager::getLogger()->fatal('Attachements not found');
}
//// END ATTACHMENTS
///////////////////////////////////////////////////////////////////////
$mail = $this->handleBody($mail);
$GLOBALS['log']->debug('Email sending --------------------- ');
///////////////////////////////////////////////////////////////////////
//// I18N TRANSLATION
$mail->prepForOutbound();
//// END I18N TRANSLATION
///////////////////////////////////////////////////////////////////////
$validator = new EmailFromValidator();
if (!$validator->isValid($this)) {
// if an email is invalid before sending,
// maybe at this point sould "return false;" because the email having
// invalid from address and/or name but we will trying to send it..
// and we should log the problem at least:
// (needs EmailFromValidation and EmailFromFixer.. everywhere where from name and/or from email address get a value)
$errors = $validator->getErrorsAsText();
$details = "Details:\n{$errors['messages']}\ncodes:{$errors['codes']}\n{$mail->ErrorInfo}";
LoggerManager::getLogger()->error("Invalid email from address or name detected before sending. $details");
}
$this->validateBeforeSend($mail);
if ($mail->send()) {
///////////////////////////////////////////////////////////////////
//// INBOUND EMAIL HANDLING
@ -3116,9 +3052,10 @@ class Email extends Basic
LoggerManager::getLogger()->warn('Email saving error: after save and store in non-gmail sent folder.');
}
}
$GLOBALS['log']->debug(' --------------------- buh bye -- sent successful');
//// END INBOUND EMAIL HANDLING
///////////////////////////////////////////////////////////////////
$GLOBALS['log']->debug(' --------------------- buh bye -- sent successful');
return true;
}
$GLOBALS['log']->debug($app_strings['LBL_EMAIL_ERROR_PREPEND'] . $mail->ErrorInfo);
@ -3126,6 +3063,77 @@ class Email extends Basic
return false;
}
/**
* Send using outbound email configuration only
* @param OutboundEmailAccounts $outboundEmailAccount
* @param SugarPHPMailer|null $mail
* @return bool
* @throws EmailValidatorException
* @throws \PHPMailer\PHPMailer\Exception
* @throws \SuiteCRM\ErrorMessageException
*/
public function sendFromOutbound(
OutboundEmailAccounts $outboundEmailAccount,
SugarPHPMailer $mail = null
) {
global $mod_strings, $app_strings, $sugar_config, $locale;
$this->clearTempEmailAtSend();
$OBCharset = $locale->getPrecedentPreference('default_email_charset');
$mail = $mail ? $mail : new SugarPHPMailer();
if (!$this->to_addrs_arr) {
LoggerManager::getLogger()->error('"To" address(es) is not set or empty to sending email.');
return false; // return false as error, to-address is required to sending an email
}
$this->setRecipientAddresses($mail, $locale, $OBCharset);
$ieId = $this->mailbox_id;
$this->setOutboundBasedMailer($mail, $outboundEmailAccount);
if ($this->isToUseSystemEmail($mail, $sugar_config)) {
[$sender, $ReplyToAddr, $ReplyToName] = $this->setSystemBasedSenderAddresses($mail);
} else {
[$sender, $ReplyToAddr, $ReplyToName] = $this->setOutboundBasedSenderAddresses($outboundEmailAccount, $mail);
}
if (empty($mail->From) || !isValidEmailAddress($mail->From, 'Invalid email address given', false)) {
LoggerManager::getLogger()->fatal('No from address defined');
return false; // return false as error, to-address is required to sending an email
}
$mail->Sender = $sender; /* set Return-Path field in header to reduce spam score in emails sent via Sugar's Email module */
$mail->AddReplyTo($ReplyToAddr, $locale->translateCharsetMIME(trim($ReplyToName), 'UTF-8', $OBCharset));
$mail->Subject = html_entity_decode($this->name, ENT_QUOTES, 'UTF-8');
$this->setupAttachments(
$mod_strings['LBL_EMAIL_ATTACHMENT'],
$sugar_config['upload_badext'],
$mail,
$locale,
$OBCharset
);
$mail = $this->handleBody($mail);
$GLOBALS['log']->debug('Email sending --------------------- ');
$mail->prepForOutbound();
$this->validateBeforeSend($mail);
if ($mail->send()) {
return true;
}
$GLOBALS['log']->debug($app_strings['LBL_EMAIL_ERROR_PREPEND'] . $mail->ErrorInfo);
return false;
}
/**
*
* @param InboundEmail $ie
@ -4839,6 +4847,69 @@ eoq;
return filter_var($emailAddressString, FILTER_VALIDATE_EMAIL);
}
/**
* @param SugarPHPMailer $mail
* @param Localization $locale
* @param string|null $OBCharset
* @return void
* @throws \PHPMailer\PHPMailer\Exception
*/
protected function setRecipientAddresses(SugarPHPMailer $mail, Localization $locale, ?string $OBCharset): void
{
foreach ((array)$this->to_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
if (!isset($addr_arr['email']) || !$addr_arr['email']) {
LoggerManager::getLogger()->error('"To" email address is missing!');
} else {
$mail->AddAddress($addr_arr['email'], "");
}
} else {
$mail->AddAddress(
$addr_arr['email'],
$locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset)
);
}
}
if (!$this->cc_addrs_arr) {
LoggerManager::getLogger()->warn('"CC" address(es) is not set or empty to sending email.');
}
foreach ((array)$this->cc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddCC($addr_arr['email'], "");
} else {
$mail->AddCC(
$addr_arr['email'],
$locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset)
);
}
}
if (!$this->bcc_addrs_arr) {
LoggerManager::getLogger()->warn('"BCC" address(es) is not set or empty to sending email.');
}
foreach ((array)$this->bcc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddBCC($addr_arr['email'], "");
} else {
$mail->AddBCC(
$addr_arr['email'],
$locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset)
);
}
}
}
/**
* @param object $mail
* @param array $sugar_config
* @return bool
*/
public function isToUseSystemEmail(object $mail, array $sugar_config): bool
{
return ($mail->oe->type === 'system') && (!isset($sugar_config['email_allow_send_as_user']) || (!$sugar_config['email_allow_send_as_user']));
}
/**
* @param string $emailField eg from_name
*/
@ -4852,4 +4923,139 @@ eoq;
LoggerManager::getLogger()->error('from_name is invalid email address field.');
}
}
/**
* @param $LBL_EMAIL_ATTACHMENT
* @param $upload_badext
* @param object $mail
* @param Localization $locale
* @param string|null $OBCharset
* @return void
*/
protected function setupAttachments(
$LBL_EMAIL_ATTACHMENT,
$upload_badext,
object $mail,
Localization $locale,
?string $OBCharset
): void {
///////////////////////////////////////////////////////////////////////
//// ATTACHMENTS
if (isset($this->saved_attachments)) {
foreach ($this->saved_attachments as $note) {
$mime_type = 'text/plain';
if ($note->object_name == 'Note') {
if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) { // brandy-new file upload/attachment
$file_location = "file/" . $note->file->temp_file_location;
$filename = $note->file->original_file_name;
$mime_type = $note->file->mime_type;
} else { // attachment coming from template/forward
$file_location = "upload/{$note->id}";
// cn: bug 9723 - documents from EmailTemplates sent with Doc Name, not file name.
$filename = !empty($note->filename) ? $note->filename : $note->name;
$mime_type = $note->file_mime_type;
}
} elseif ($note->object_name == 'DocumentRevision') { // from Documents
$filePathName = $note->id;
// cn: bug 9723 - Emails with documents send GUID instead of Doc name
$filename = $note->getDocumentRevisionNameForDisplay();
$file_location = "upload/$note->id";
$mime_type = $note->file_mime_type;
}
// strip out the "Email attachment label if exists
$filename = str_replace($LBL_EMAIL_ATTACHMENT . ': ', '', $filename);
$file_ext = pathinfo($filename, PATHINFO_EXTENSION);
//is attachment in our list of bad files extensions? If so, append .txt to file location
//check to see if this is a file with extension located in "badext"
foreach ($upload_badext as $badExt) {
if (strtolower($file_ext) == strtolower($badExt)) {
//if found, then append with .txt to filename and break out of lookup
//this will make sure that the file goes out with right extension, but is stored
//as a text in db.
$file_location = $file_location . ".txt";
break; // no need to look for more
}
}
$mail->AddAttachment(
$file_location,
$locale->translateCharsetMIME(trim($filename), 'UTF-8', $OBCharset),
'base64',
$mime_type
);
// embedded Images
if ($note->embed_flag == true) {
$cid = $filename;
$mail->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type);
}
}
} else {
LoggerManager::getLogger()->fatal('Attachements not found');
}
//// END ATTACHMENTS
///////////////////////////////////////////////////////////////////////
}
/**
* @param OutboundEmailAccounts $outboundEmailAccount
* @param object $mail
* @return array
*/
protected function setOutboundBasedSenderAddresses(OutboundEmailAccounts $outboundEmailAccount, object $mail): array
{
$mail->From = $outboundEmailAccount->getFromAddress();
$this->from_addr = $mail->From;
$mail->FromName = $outboundEmailAccount->getFromName();
$this->from_name = $mail->FromName;
$ReplyToAddr = $outboundEmailAccount->getReplyToAddress();
$ReplyToName = $outboundEmailAccount->getReplyToName();
return [$mail->From, $ReplyToAddr, $ReplyToName];
}
/**
* @param object $mail
* @return array
*/
protected function setSystemBasedSenderAddresses(object $mail): array
{
$fromAddr = $mail->oe->smtp_from_addr;
$fromName = $mail->oe->smtp_from_name;
$mail->From = $fromAddr;
$sender = $fromAddr;
$ReplyToAddr = $fromAddr;
isValidEmailAddress($mail->From);
$ReplyToName = $fromName;
$mail->FromName = $fromName;
return [$sender, $ReplyToAddr, $ReplyToName];
}
/**
* @param $mail
* @return void
* @throws EmailValidatorException
* @throws \SuiteCRM\ErrorMessageException
*/
protected function validateBeforeSend($mail): void
{
$validator = new EmailFromValidator();
if (!$validator->isValid($this)) {
// if an email is invalid before sending,
// maybe at this point sould "return false;" because the email having
// invalid from address and/or name but we will trying to send it..
// and we should log the problem at least:
// (needs EmailFromValidation and EmailFromFixer.. everywhere where from name and/or from email address get a value)
$errors = $validator->getErrorsAsText();
$details = "Details:\n{$errors['messages']}\ncodes:{$errors['codes']}\n{$mail->ErrorInfo}";
LoggerManager::getLogger()->error("Invalid email from address or name detected before sending. $details");
}
}
} // end class def

View file

@ -243,7 +243,30 @@ class EmailsController extends SugarController
$inboundEmailAccount = BeanFactory::newBean('InboundEmail');
$inboundEmailAccount->retrieve($_REQUEST['inbound_email_id']);
if ($this->userIsAllowedToSendEmail($current_user, $inboundEmailAccount, $this->bean)) {
if (isset($_REQUEST['from_addr_name']) && !empty($_REQUEST['from_addr_name'])) {
$this->bean->from_name = $_REQUEST['from_addr_name'];
$this->bean->from_addr_name = $_REQUEST['from_addr_name'];
}
$outboundEmailAccount = null;
$useOutbound = false;
if (!empty($_REQUEST['outbound_email_id'])) {
/** @var OutboundEmailAccounts $outboundEmailAccount */
$outboundEmailAccount = BeanFactory::getBean('OutboundEmailAccounts', $_REQUEST['outbound_email_id']);
$outboundType = $outboundEmailAccount->type ?? '';
if ($outboundType === 'system' || $outboundType === 'system-override') {
$useOutbound = (new OutboundEmail())->isAllowUserAccessToSystemDefaultOutbound();
} else {
$useOutbound = $outboundEmailAccount->ACLAccess('view');
}
$this->bean->from_name = $_REQUEST['from_addr_name'];
$this->bean->from_addr_name = $_REQUEST['from_addr_name'];
}
if ($useOutbound || $this->userIsAllowedToSendEmail($current_user, $inboundEmailAccount, $this->bean)) {
$this->bean->save();
$this->bean->handleMultipleFileAttachments();
@ -251,7 +274,13 @@ class EmailsController extends SugarController
// parse and replace bean variables
$this->bean = $this->replaceEmailVariables($this->bean, $request);
if ($this->bean->send()) {
if ($useOutbound) {
$sendResult = $this->bean->sendFromOutbound($outboundEmailAccount);
} else {
$sendResult = $this->bean->send();
}
if ($sendResult) {
$this->bean->status = 'sent';
$this->bean->save();
} else {
@ -432,10 +461,17 @@ class EmailsController extends SugarController
global $current_user;
global $sugar_config;
$email = BeanFactory::newBean('Emails');
$ie = BeanFactory::newBean('InboundEmail');
$collector = new EmailsDataAddressCollector($current_user, $sugar_config);
$handler = new EmailsControllerActionGetFromFields($current_user, $collector);
$useLegacyEmailConfig = $sugar_config['legacy_email_behaviour'] ?? false;
if (isTrue($useLegacyEmailConfig)) {
$ie = BeanFactory::newBean('InboundEmail');
$results = $handler->handleActionGetFromFields($email, $ie);
} else {
$results = $handler->getOutboundFromFields($email);
}
echo $results;
$this->view = 'ajax';
}
@ -505,6 +541,7 @@ class EmailsController extends SugarController
$current_user,
true
);
$out = json_encode(array('response' => $ret));
} catch (SugarFolderEmptyException $e) {
$GLOBALS['log']->warn($e->getMessage());

View file

@ -100,11 +100,42 @@ class EmailsControllerActionGetFromFields
$defaultEmailSignature
);
$dataAddresses = $dataAddresses ?? [];
$this->addOutboundEmailAccounts($dataAddresses);
$dataEncoded = json_encode(array('data' => $dataAddresses), JSON_UNESCAPED_UNICODE);
$results = utf8_decode($dataEncoded);
return $results;
}
/**
* Get Outbound from fields
* @param Email $email
* @return string JSON
* @throws JsonException
*/
public function getOutboundFromFields(Email $email)
{
global $log;
$email->email2init();
$dataAddresses = [];
$this->addOutboundEmailAccounts($dataAddresses);
$this->collector->addSystemEmailAddress($dataAddresses);
$dataEncoded = [];
try {
$dataEncoded = json_encode(array('data' => $dataAddresses), JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
} catch (Exception $e) {
$log->fatal('getOutboundFromFields | unable to json encode the addresses for from fields | message: ' . $e->getMessage() ?? '');
}
return utf8_decode($dataEncoded);
}
/**
*
* @param string|null $accountSignatures
@ -141,4 +172,52 @@ class EmailsControllerActionGetFromFields
return $defaultEmailSignature;
}
/**
* @param array $dataAddresses
* @return void
*/
protected function addOutboundEmailAccounts(array &$dataAddresses): void
{
/** @var OutboundEmailAccounts $outboundAccount */
$outboundAccount = BeanFactory::newBean('OutboundEmailAccounts');
/** @var OutboundEmailAccounts[] $userOutboundAccounts */
$userOutboundAccounts = $outboundAccount->getUserOutboundAccounts();
foreach ($userOutboundAccounts as $userOutboundAccount) {
$id = $userOutboundAccount->id ?? '';
$name = $userOutboundAccount->name ?? '';
$fromAddress = $userOutboundAccount->getFromAddress();
$fromName = $userOutboundAccount->getFromName();
$replyToAddress = $userOutboundAccount->getReplyToAddress();
$replyToName = $userOutboundAccount->getReplyToName();
$type = $userOutboundAccount->type ?? '';
$signature = $userOutboundAccount->signature ?? '';
$isPersonal = $type === 'user';
$isGroup = $type === 'group';
$entry = [
'type' => 'OutboundEmailAccount',
'id' => $id,
'name' => $name,
'attributes' => [
'from' => $fromAddress,
'name' => $fromName,
'oe' => '',
'reply_to' => $replyToAddress,
'reply_to_name' => $replyToName
],
'prepend' => false,
'isPersonalEmailAccount' => $isPersonal,
'isGroupEmailAccount' => $isGroup,
'emailSignatures' => [
'html' => utf8_encode(html_entity_decode($signature)),
'plain' => ''
]
];
$dataAddresses[] = $entry;
}
}
}

View file

@ -77,7 +77,9 @@ class EmailsDataAddress
$isGroupEmailAccount,
$outboundEmailId,
$outboundEmailName,
$emailSignaturesArray
$emailSignaturesArray,
$accountName = '',
$attributesReplyToName = ''
) {
$signatureResolver = new EmailsSignatureResolver();
$signatureResolver->setSignatureArray($emailSignaturesArray);
@ -85,11 +87,13 @@ class EmailsDataAddress
$dataArray = [
'type' => $type,
'id' => $id,
'name' => $accountName,
'attributes' => $this->getDataArrayAttributes(
$attributesReplyTo,
$attributesFrom,
$attributesName,
$attributesOe
$attributesOe,
$attributesReplyToName
),
'prepend' => $prepend,
'isPersonalEmailAccount' => $isPersonalEmailAccount,
@ -99,7 +103,7 @@ class EmailsDataAddress
'name' => $outboundEmailName,
],
'emailSignatures' => [
'html' => $signatureResolver->getHtml(),
'html' => utf8_encode(html_entity_decode($signatureResolver->getHtml())),
'plain' => $signatureResolver->getPlaintext(),
'no_default_available' => $signatureResolver->isNoDefaultAvailable(),
],
@ -114,12 +118,14 @@ class EmailsDataAddress
* @param string $attributesFrom
* @param string $attributesName
* @param string $attributesOe
* @param string $attributesReplyToName
* @return array
*/
protected function getDataArrayAttributes($attributesReplyTo, $attributesFrom, $attributesName, $attributesOe)
protected function getDataArrayAttributes($attributesReplyTo, $attributesFrom, $attributesName, $attributesOe, $attributesReplyToName = '')
{
return [
'reply_to' => utf8_encode($attributesReplyTo),
'reply_to_name' => utf8_encode($attributesReplyToName),
'from' => utf8_encode($attributesFrom),
'name' => utf8_encode($attributesName),
'oe' => utf8_encode($attributesOe),

View file

@ -433,7 +433,9 @@ class EmailsDataAddressCollector
$isGroupEmailAccount,
$this->getOeId(),
$this->getOeName(),
[]
[],
$inboundEmail->name,
$storedOptions['reply_to_name'] ?? ''
);
}
@ -649,7 +651,8 @@ class EmailsDataAddressCollector
[
'html' => utf8_encode(html_entity_decode($signatureHtml)),
'plain' => $signatureTxt,
]
],
$userAddress['email_address']
);
}
@ -677,6 +680,26 @@ class EmailsDataAddressCollector
return $dataAddresses;
}
/**
* Add system email address
* @param array $dataAddresses
*/
public function addSystemEmailAddress(array &$dataAddresses): void
{
$this->setOe(new OutboundEmail());
if ($this->getOe()->isAllowUserAccessToSystemDefaultOutbound()) {
$system = $this->getOe()->getSystemMailerSettings();
$dataAddresses[] = $this->getFillDataAddressArray(
$system->id,
$system->name,
$system->smtp_from_name,
$system->smtp_from_addr,
$system->mail_smtpuser,
[]
);
}
}
/**
* @param $dataAddresses
* @return mixed
@ -693,7 +716,8 @@ class EmailsDataAddressCollector
'from' => $fromString,
'name' => $userAddress['attributes']['name'],
'oe' => $userAddress['attributes']['oe'],
'reply_to' => $replyString
'reply_to' => $replyString,
'reply_to_name' => $emailInfo['reply_to_name'] ?? ''
];
}
}
@ -734,8 +758,8 @@ class EmailsDataAddressCollector
return $dataAddress->getDataArray(
'system',
$id,
"$fromName &lt;$fromAddr&gt;",
"$fromName &lt;$fromAddr&gt;",
$fromAddr,
$fromAddr,
$fromName,
false,
false,
@ -743,7 +767,9 @@ class EmailsDataAddressCollector
$id,
$name,
$mailUser,
$defaultEmailSignature
$defaultEmailSignature,
'System',
$fromName
);
}

View file

@ -256,8 +256,8 @@
$(document).ready(function() {ldelim}
$('#ComposeView').EmailsComposeView({if $RETURN_MODULE != 'Emails' && $RETURN_ID}{ldelim}
'attachment': {ldelim}
'module': '{$RETURN_MODULE}',
'id': '{$RETURN_ID}'
'module': '{$RETURN_MODULE|escape:'javascript'}',
'id': '{$RETURN_ID|escape:'javascript'}'
{rdelim}
{rdelim}{/if});
{rdelim});

View file

@ -349,22 +349,34 @@
};
$.fn.EmailsComposeView.updateSignature = self.updateSignature = function () {
var inboundId = $('#from_addr_name').find('option:selected').attr('inboundId');
if (inboundId === undefined) {
console.warn('Unable to retrieve selected inbound id in the "From" field.');
$.fn.EmailsComposeView.updateSignature = self.updateSignature = function ($selected) {
if(!$selected) {
$selected = $('#from_addr_name').find('option:selected');
}
var signatureId = $selected.attr('data-email-signature-id');
if (signatureId === undefined) {
console.warn('Unable to retrieve signature id');
return false;
}
var body = tinymce.activeEditor.getContent();
if (body !== '' && $(body).hasClass('email-signature-element')) {
var $body = $(body);
var $existingSignature = $body.find('.email-signature-element');
$existingSignature.remove();
tinymce.activeEditor.setContent($body.html(), {format: 'html'});
}
var signatureElement = $('<div></div>')
.addClass('email-signature');
.addClass('email-signature-element');
var signatures = $(self).find('.email-signature');
var htmlSignature = null;
var plainTextSignature = null;
// Find signature
$.each(signatures, function (index, value) {
if ($(value).attr('data-inbound-email-id') === inboundId) {
if ($(value).attr('data-email-signature-id') === signatureId) {
if ($(value).hasClass('html')) {
htmlSignature = $(value).val();
@ -397,26 +409,29 @@
return false;
}
var body = tinymce.activeEditor.getContent();
body = tinymce.activeEditor.getContent();
if (body === '') {
tinymce.activeEditor.setContent('<p></p>' + signatureElement[0].outerHTML, {format: 'html'});
} else if ($(body).hasClass('email-signature')) {
tinymce.activeEditor.setContent('<p></p><p></p>' + signatureElement[0].outerHTML, {format: 'html'});
} else if ($(body).hasClass('email-signature-element')) {
var newBody = $('<div></div>');
$(body).appendTo(newBody);
$(newBody).find('.email-signature').replaceWith(signatureElement[0].outerHTML);
$(newBody).find('.email-signature-element').replaceWith(signatureElement[0].outerHTML);
tinymce.activeEditor.setContent(newBody.html(), {format: 'html'});
} else {
// reply to / forward
if (self.prependSignature === true) {
tinymce.activeEditor.setContent('<p></p>' + signatureElement[0].outerHTML + body, {format: 'html'});
tinymce.activeEditor.setContent('<p></p><p></p>' + signatureElement[0].outerHTML + body, {format: 'html'});
} else {
tinymce.activeEditor.setContent(body + signatureElement[0].outerHTML, {format: 'html'});
}
}
};
self.updateFromInfos = function () {
var infos = $('#from_addr_name').find('option:selected').attr('infos');
self.updateFromInfos = function ($selected) {
if (!$selected) {
$selected = $('#from_addr_name').find('option:selected');
}
var infos = $selected.attr('infos');
if(infos === undefined) {
console.warn('Unable to retrieve selected infos in the "From" field.');
return false;
@ -430,6 +445,69 @@
};
self.updateFromAddressName = function (selectFrom) {
var newlySelected = selectFrom.find('option:selected');
var newlySelectedFromName = newlySelected.attr('data-from-name');
$('#from_addr_name_hidden').val(newlySelectedFromName);
};
self.updateOutboundEmailId = function (selectFrom, newlySelected) {
if(!newlySelected) {
newlySelected = selectFrom.find('option:selected');
}
var entryType = newlySelected.attr('data-type') || '';
$('#outbound_email_id').val('');
if (entryType === 'OutboundEmailAccount' || entryType === 'system') {
var outboundId = newlySelected.attr('data-outbound-email-id');
$('#outbound_email_id').val(outboundId);
}
};
self.onFromSelect = function (selectFrom, ui) {
var newlySelected = ui.item.element;
var entryType = newlySelected.attr('data-type') || '';
$('#outbound_email_id').val('');
if (entryType === 'OutboundEmailAccount' || entryType === 'system') {
self.updateOutboundEmailId(selectFrom, newlySelected);
} else {
$(self).find('[name=inbound_email_id]').val(newlySelected.attr('inboundId'));
}
self.updateSignature(newlySelected);
};
self.getFromEntryLabel = function (entry) {
if (!entry) {
return '';
}
var entryValue = '';
if(entry.attributes.from && (typeof entry.attributes.from === 'string' || entry.attributes.from instanceof String)) {
entryValue = entry.attributes.from;
}
var entryLabel = '';
if(entry.attributes.name && (typeof entry.attributes.name === 'string' || entry.attributes.name instanceof String)) {
entryLabel = entry.attributes.name;
if (entryValue && entryValue !== entryLabel) {
entryLabel = entryLabel + ' (' + entryValue + ')';
}
} else if (entryValue) {
entryLabel = entryValue;
}
if (entryLabel.length > 40) {
entryLabel = entryLabel.substring(0, 40) + '...';
}
return entryLabel;
};
/**
*
* @param editor
@ -1069,26 +1147,71 @@
var from_addr = $(self).find('#from_addr_name');
from_addr.replaceWith(selectFrom);
var hiddenOutboundEmailId = $('<input type="hidden" name="outbound_email_id" id="outbound_email_id" value="">');
selectFrom.parent().append(hiddenOutboundEmailId);
$.ajax({
"url": 'index.php?module=Emails&action=getFromFields'
}).done(function (response) {
var json = JSON.parse(response);
if (typeof json.data !== "undefined") {
var optionGroups = {
InboundEmail: {
label: 'LBL_INBOUND_ACCOUNT',
options: []
},
OutboundEmailAccount: {
label: 'LBL_OUTBOUND_ACCOUNT',
options: []
},
system: {
label: 'LBL_SYSTEM_ACCOUNT',
options: []
},
personal: {
label: 'LBL_FROM_SYSTEM',
options: []
},
};
$(json.data).each(function (i, v) {
var selectOption = $('<option></option>');
selectOption.attr('value', v.attributes.from);
selectOption.attr('inboundId', v.id);
selectOption.attr('infos', '(<b>Reply-to:</b> ' + v.attributes.reply_to + ', <b>From:</b> ' + v.attributes.from + ')');
selectOption.html(v.attributes.name);
selectOption.appendTo(selectFrom);
var entryType = v.type || '';
var entryLabel = self.getFromEntryLabel(v);
if (entryType === 'OutboundEmailAccount' || entryType === 'system') {
selectOption.attr('data-outbound-email-id', v.id);
} else {
selectOption.attr('inboundId', v.id);
}
var fromName = v.attributes.name;
if (!fromName) {
fromName = v.attributes.from;
}
selectOption.attr('infos', '(<b>Reply-to:</b> ' + v.attributes.reply_to + ' , <b>Reply-to Name:</b> ' + v.attributes.reply_to_name + ' , <b>From:</b> ' + v.attributes.from + ', <b>From Name:</b> ' + v.attributes.name + ')');
selectOption.attr('data-from-name', fromName);
selectOption.attr('data-from-address', v.attributes.from);
selectOption.attr('data-reply-to-name', v.attributes.reply_to_name);
selectOption.attr('data-reply-to-address', v.attributes.reply_to);
selectOption.attr('data-type', v.type);
selectOption.attr('label', entryLabel);
selectOption.html(entryLabel);
optionGroups[entryType].options.push(selectOption);
selectOption.attr('data-email-signature-id', v.id);
// include signature for account
$('<textarea></textarea>')
.val(v.emailSignatures.html)
.addClass('email-signature')
.addClass('html')
.addClass('hidden')
.attr('data-inbound-email-id', v.id)
.attr('data-email-signature-id', v.id)
.appendTo(self);
$('<textarea></textarea>')
@ -1096,31 +1219,95 @@
.addClass('email-signature')
.addClass('plain')
.addClass('hidden')
.attr('data-inbound-email-id', v.id)
.attr('data-email-signature-id', v.id)
.appendTo(self);
if (typeof v.prepend !== "undefined" && v.prepend === true) {
self.prependSignature = true;
}
self.updateSignature();
});
Object.keys(optionGroups).forEach(function (type) {
var optionGroup = optionGroups[type];
if (!optionGroup || !optionGroup.options || !optionGroup.options.length) {
return;
}
var $optionGroup = $('<optgroup>', {
label: SUGAR.language.translate('', optionGroup.label)
});
optionGroup.options.forEach(function (option) {
selectFrom.append(option);
});
});
self.updateOutboundEmailId(selectFrom);
var selectedInboundEmail = $(self).find('[name=inbound_email_id]').val();
var selectInboundEmailOption = $(selectFrom).find('[inboundid="' + selectedInboundEmail + '"]');
if (selectInboundEmailOption.val()) {
$(selectFrom).val(selectInboundEmailOption.val());
}
$.widget( "custom.emailselectmenu", $.ui.selectmenu, {
_renderItem: function( ul, item ) {
var $option = item.element;
var fromName = $option.attr('data-from-name');
var fromAddress = $option.attr('data-from-address');
var $info = $('<div>', {
class: 'compose-from-email-account'
});
$info.append("<div class='compose-from-email-address-name'><span>" + fromName + "</span></div>");
$info.append("<div class='compose-from-email-address-from'><span class='small'>&lt;" + fromAddress + "&gt;</span></div>");
return $( "<li>" )
.append($info)
.appendTo( ul );
}
});
$( selectFrom ).emailselectmenu({
change: function( event, ui ) {
self.onFromSelect(selectFrom, ui);
},
select: function( event, ui ) {
self.onFromSelect(selectFrom, ui);
},
appendTo: selectFrom.parent(),
'max-width': '200px'
});
$(selectFrom).change(function (e) {
var newlySelected = selectFrom.find('option:selected');
var entryType = newlySelected.attr('data-type') || '';
$('#outbound_email_id').val('');
if (entryType === 'OutboundEmailAccount' || entryType === 'system') {
self.updateOutboundEmailId(selectFrom);
} else {
$(self).find('[name=inbound_email_id]').val($(this).find('option:selected').attr('inboundId'));
}
self.updateSignature();
self.updateFromInfos();
});
$(self).trigger('emailComposeViewGetFromFields');
self.updateFromInfos();
if (tinymce.initialized === true) {
self.updateSignature();
} else if(tinymce.EditorManager && tinymce.EditorManager.activeEditor) {
tinymce.EditorManager.activeEditor.on('init', function(e) {
self.updateSignature();
});
}
}
if ($(self).find('#is_only_plain_text').length === 1) {

View file

@ -318,6 +318,9 @@ class Employee extends Person
throw new RuntimeException('Not authorized');
}
// If the current user is not an admin, reset the admin flag to the original value.
$this->setIsAdmin();
return parent::save($check_notify);
}
@ -341,4 +344,36 @@ class Employee extends Person
return $sameUser || is_admin($current_user);
}
/**
* Reset is_admin if current user is not an admin user
* @return void
*/
protected function setIsAdmin(): void
{
global $current_user;
if (!isset($this->is_admin)) {
return;
}
$originalIsAdminValue = $this->is_admin ?? false;
if ($this->isUpdate() && isset($this->fetched_row['is_admin'])) {
$originalIsAdminValue = isTrue($this->fetched_row['is_admin'] ?? false);
}
$currentUserReloaded = BeanFactory::getReloadedBean('Users', $current_user->id);
if (!is_admin($currentUserReloaded)) {
$this->is_admin = $originalIsAdminValue;
}
}
/**
* @return bool
*/
protected function isUpdate(): bool
{
return !empty($this->id) && !$this->new_with_id;
}
}

View file

@ -85,23 +85,45 @@ foreach ($focus->column_fields as $field) {
if ($field === 'email_password' && empty($_REQUEST['email_password']) && !empty($_REQUEST['email_user'])) {
continue;
}
if (isset($_REQUEST[$field])) {
if (!isset($_REQUEST[$field])) {
continue;
}
if ($field !== "group_id") {
if (is_string($_REQUEST[$field])) {
$focus->$field = trim($_REQUEST[$field]);
} else {
$focus->$field = $_REQUEST[$field];
}
}
}
foreach ($focus->additional_column_fields as $field) {
if (isset($_REQUEST[$field])) {
if (!isset($_REQUEST[$field])) {
continue;
}
if (is_string($_REQUEST[$field])) {
$value = trim($_REQUEST[$field]);
} else {
$value = $_REQUEST[$field];
}
$focus->$field = $value;
}
}
foreach ($focus->required_fields as $field) {
if (isset($_REQUEST[$field])) {
$value = trim($_REQUEST[$field]);
$focus->$field = $value;
if (!isset($_REQUEST[$field])) {
continue;
}
if (is_string($_REQUEST[$field])) {
$value = trim($_REQUEST[$field]);
} else {
$value = $_REQUEST[$field];
}
$focus->$field = $value;
}
$type = $_REQUEST['type'] ?? '';

View file

@ -196,7 +196,7 @@ $dictionary['InboundEmail'] = [
'vname' => 'LBL_NAME',
'type' => 'varchar',
'len' => '255',
'required' => false,
'required' => true,
'reportable' => false,
'massupdate' => false,
'inline_edit' => false,
@ -668,7 +668,7 @@ $dictionary['InboundEmail'] = [
'returns' => 'html',
'include' => 'modules/InboundEmail/utils.php',
],
'type' => 'varchar',
'type' => 'function',
'reportable' => false,
'massupdate' => false,
'inline_edit' => false,

View file

@ -67,11 +67,15 @@ class LeadFormBase extends PersonFormBase
$query .= " WHERE deleted != 1 AND (status <> 'Converted' OR status IS NULL) AND ";
$dbManager = DBManagerFactory::getInstance();
//Use the first and last name from the $_POST to filter. If only last name supplied use that
if (isset($_POST[$prefix.'first_name']) && strlen($_POST[$prefix.'first_name']) != 0 && isset($_POST[$prefix.'last_name']) && strlen($_POST[$prefix.'last_name']) != 0) {
$query .= " (first_name='". $_POST[$prefix.'first_name'] . "' AND last_name = '". $_POST[$prefix.'last_name'] ."')";
$firstName = $dbManager->quote($_POST[$prefix.'first_name' ?? '']);
$lastName = $dbManager->quote($_POST[$prefix.'last_name' ?? '']);
$query .= " (first_name='". $firstName . "' AND last_name = '". $lastName ."')";
} else {
$query .= " last_name = '". $_POST[$prefix.'last_name'] ."'";
$lastName = $dbManager->quote($_POST[$prefix.'last_name' ?? '']);
$query .= " last_name = '". $lastName ."'";
}
return $query;
}

View file

@ -50,11 +50,41 @@ class OutboundEmailAccounts extends OutboundEmailAccounts_sugar
*/
public $mail_smtppass;
/**
* @var string
*/
public $smtp_from_addr;
/**
* @var string
*/
public $smtp_from_name;
/**
* @var string
*/
public $mail_smtpuser;
/**
* @var string
*/
public $type;
/**
* @var string
*/
public $signature;
/**
* @var string
*/
public $reply_to_addr;
/**
* @var string
*/
public $reply_to_name;
public function __construct()
{
parent::__construct();
@ -107,6 +137,22 @@ class OutboundEmailAccounts extends OutboundEmailAccounts_sugar
return $results;
}
/**
* @return array
*/
public function getUserOutboundAccounts(): array {
global $current_user, $db;
$where = '';
if (is_admin($current_user)) {
$currentUserId = $db->quote($current_user->id);
$tableName = $db->quote($this->table_name);
$where = "(($tableName.type IS NULL) OR ($tableName.type != 'user' ) OR ($tableName.type = 'user' AND $tableName.user_id = '$currentUserId'))";
}
return $this->get_list('', $where)['list'] ?? [];
}
/**
* @inheritDoc
*/
@ -247,6 +293,48 @@ class OutboundEmailAccounts extends OutboundEmailAccounts_sugar
return parent::ACLAccess($view, $is_owner, $in_group);
}
/**
* Get from address
* @return string
*/
public function getFromAddress(): string {
$fromAddress = $this->smtp_from_addr ?? '';
if (empty($fromAddress) || isValidEmailAddress($this->mail_smtpuser, '', false, '')) {
$fromAddress = $this->mail_smtpuser;
}
return $fromAddress;
}
/**
* Get from name
* @return string
*/
public function getFromName(): string {
return $this->smtp_from_name ?? '';
}
/**
* Get reply to address
* @return string
*/
public function getReplyToAddress(): string {
$address = $this->reply_to_addr ?? '';
if (empty($address) && isValidEmailAddress($this->reply_to_addr, '', false, '')) {
return $this->getFromAddress();
}
return $address;
}
/**
* Get reply to name
* @return string
*/
public function getReplyToName(): string {
return $this->reply_to_name ?? '';
}
/**
* @return void
*/

View file

@ -0,0 +1,76 @@
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2022 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program 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 along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
function togglePanels(type) {
var panelsPerType = {
'personal': {
'DEFAULT': true,
'LBL_CONNECTION_CONFIGURATION': true,
'LBL_OUTBOUND_CONFIGURATION': true,
},
'group': {
'DEFAULT': true,
'LBL_CONNECTION_CONFIGURATION': true,
'LBL_OUTBOUND_CONFIGURATION': true,
},
'system-override': {
'DEFAULT': true,
'LBL_CONNECTION_CONFIGURATION': false,
'LBL_OUTBOUND_CONFIGURATION': true,
}
};
var panelDisplay = panelsPerType[type] || panelsPerType.personal;
Object.keys(panelDisplay).forEach(function (panelKey) {
var display = panelDisplay[panelKey];
var method = 'show';
if(!display) {
method = 'hide';
}
$('[data-id="' + panelKey + '"]').closest('.panel')[method]();
});
}
$(document).ready(function () {
var type = outboundEmailFields.getValue('type');
togglePanels(type);
});

View file

@ -110,6 +110,8 @@ $mod_strings = array(
'LBL_MAIL_SMTPSSL' => 'Mail SMTP/SSL',
'LBL_SMTP_FROM_NAME' => '"From" name',
'LBL_SMTP_FROM_ADDR' => '"From" address',
'LBL_REPLY_TO_NAME' => '"Reply-to" name',
'LBL_REPLY_TO_ADDR' => '"Reply-to" address',
'LBL_SECURITYGROUPS_SUBPANEL_TITLE' => 'Security Groups',

View file

@ -36,6 +36,7 @@ $viewdefs ['OutboundEmailAccounts'] = [
{suite_combinescripts
files="modules/OutboundEmailAccounts/js/fields.js,
modules/OutboundEmailAccounts/js/owner_toggle.js,
modules/OutboundEmailAccounts/js/panel_toggle.js,
modules/OutboundEmailAccounts/js/smtp_auth_toggle.js"}
</script>
',
@ -71,10 +72,16 @@ $viewdefs ['OutboundEmailAccounts'] = [
'lbl_outbound_configuration' => [
[
'smtp_from_name',
'reply_to_name'
],
[
'smtp_from_addr',
'reply_to_addr'
],
[
'signature',
''
]
],
],
],

View file

@ -38,6 +38,7 @@ $viewdefs ['OutboundEmailAccounts'] = [
{suite_combinescripts
files="modules/OutboundEmailAccounts/js/fields.js,
modules/OutboundEmailAccounts/js/ssl_port_set.js,
modules/OutboundEmailAccounts/js/panel_toggle.js,
modules/OutboundEmailAccounts/js/owner_toggle.js,
modules/OutboundEmailAccounts/js/smtp_auth_toggle.js"}
</script>
@ -80,10 +81,16 @@ $viewdefs ['OutboundEmailAccounts'] = [
'lbl_outbound_configuration' => [
[
'smtp_from_name',
'reply_to_name'
],
[
'smtp_from_addr',
'reply_to_addr'
],
[
'signature',
''
]
],
],
],

View file

@ -167,6 +167,40 @@ $dictionary["OutboundEmailAccounts"] = [
'exportable' => false,
'unified_search' => false,
],
'reply_to_name' => [
'name' => 'reply_to_name',
'vname' => 'LBL_REPLY_TO_NAME',
'type' => 'varchar',
'reportable' => false,
'massupdate' => false,
'inline_edit' => false,
'importable' => false,
'exportable' => false,
'unified_search' => false,
],
'reply_to_addr' => [
'name' => 'reply_to_addr',
'vname' => 'LBL_REPLY_TO_ADDR',
'type' => 'varchar',
'reportable' => false,
'massupdate' => false,
'inline_edit' => false,
'importable' => false,
'exportable' => false,
'unified_search' => false,
],
'signature' => [
'name' => 'signature',
'vname' => 'LBL_SIGNATURE',
'type' => 'wysiwyg',
'dbType' => 'text',
'reportable' => false,
'massupdate' => false,
'inline_edit' => false,
'importable' => false,
'exportable' => false,
'unified_search' => false,
],
'mail_sendtype' => [
'name' => 'mail_sendtype',
'vname' => 'LBL_MAIL_SENDTYPE',

View file

@ -60,25 +60,33 @@ class ProspectFormBase
if (!checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
$dbManager = DBManagerFactory::getInstance();
$query = '';
$baseQuery = 'select id,first_name, last_name, title, email1, email2 from prospects where deleted!=1 and (';
if (!empty($_POST[$prefix.'first_name']) && !empty($_POST[$prefix.'last_name'])) {
$query = $baseQuery ." (first_name like '". $_POST[$prefix.'first_name'] . "%' and last_name = '". $_POST[$prefix.'last_name'] ."')";
$firstName = $dbManager->quote($_POST[$prefix.'first_name' ?? '']);
$lastName = $dbManager->quote($_POST[$prefix.'last_name' ?? '']);
$query = $baseQuery ." (first_name like '". $firstName . "%' and last_name = '". $lastName ."')";
} else {
$query = $baseQuery ." last_name = '". $_POST[$prefix.'last_name'] ."'";
$lastName = $dbManager->quote($_POST[$prefix.'last_name' ?? '']);
$query = $baseQuery ." last_name = '". $lastName ."'";
}
if (!empty($_POST[$prefix.'email1'])) {
$email1 = $dbManager->quote($_POST[$prefix.'email1' ?? '']);
if (empty($query)) {
$query = $baseQuery. " email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'";
$query = $baseQuery. " email1='". $email1 . "' or email2 = '". $email1 ."'";
} else {
$query .= "or email1='". $_POST[$prefix.'email1'] . "' or email2 = '". $_POST[$prefix.'email1'] ."'";
$query .= "or email1='". $email1 . "' or email2 = '". $email1 ."'";
}
}
if (!empty($_POST[$prefix.'email2'])) {
$email2 = $dbManager->quote($_POST[$prefix.'email2' ?? '']);
if (empty($query)) {
$query = $baseQuery. " email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'";
$query = $baseQuery. " email1='". $email2 . "' or email2 = '". $email2 ."'";
} else {
$query .= "or email1='". $_POST[$prefix.'email2'] . "' or email2 = '". $_POST[$prefix.'email2'] ."'";
$query .= "or email1='". $email2 . "' or email2 = '". $email2 ."'";
}
}

View file

@ -612,7 +612,7 @@ class User extends Person implements EmailInterface
$msg = '';
$isUpdate = !empty($this->id) && !$this->new_with_id;
$isUpdate = $this->isUpdate();
//No SMTP server is set up Error.
$admin = BeanFactory::newBean('Administration');
@ -664,17 +664,16 @@ class User extends Person implements EmailInterface
// wp: do not save user_preferences in this table, see user_preferences module
$this->user_preferences = '';
// If the current user is not an admin, reset the admin flag to the original value.
$this->setIsAdmin();
// if this is an admin user, do not allow is_group or portal_only flag to be set.
if ($this->is_admin) {
$this->is_group = 0;
$this->portal_only = 0;
}
// If the current user is not an admin, do not allow them to set the admin flag to true.
if (!is_admin($current_user)) {
$this->is_admin = 0;
}
// set some default preferences when creating a new user
$setNewUserPreferences = empty($this->id) || !empty($this->new_with_id);
@ -2467,4 +2466,36 @@ EOQ;
return $sameUser || is_admin($current_user);
}
/**
* Reset is_admin if current user is not an admin user
* @return void
*/
protected function setIsAdmin(): void
{
global $current_user;
if (!isset($this->is_admin)) {
return;
}
$originalIsAdminValue = $this->is_admin ?? false;
if ($this->isUpdate() && isset($this->fetched_row['is_admin'])) {
$originalIsAdminValue = isTrue($this->fetched_row['is_admin'] ?? false);
}
$currentUserReloaded = BeanFactory::getReloadedBean('Users', $current_user->id);
if (!is_admin($currentUserReloaded)) {
$this->is_admin = $originalIsAdminValue;
}
}
/**
* @return bool
*/
protected function isUpdate(): bool
{
return !empty($this->id) && !$this->new_with_id;
}
}

View file

@ -3,5 +3,5 @@ if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
$suitecrm_version = '7.13.0';
$suitecrm_timestamp = '2022-12-20 12:00:00';
$suitecrm_version = '7.13.1';
$suitecrm_timestamp = '2023-01-25 12:00:00';

View file

@ -171,12 +171,12 @@ class ViewMetadataTest extends SuitePHPUnitFrameworkTestCase
self::assertIsArray($fields1);
//check with a very common attribute
$attributes = array('id');
$attributes = ['id' => 'true'];
$fields2 = VardefBrowser::findFieldsWithAttributes($attributes);
self::assertIsArray($fields2);
//check with a very specific attribute
$attributes = array('category');
$attributes = ['category' => 'true'];
$fields3 = VardefBrowser::findFieldsWithAttributes($attributes);
self::assertIsArray($fields3);

View file

@ -220,6 +220,7 @@ class file_utilsTest extends SuitePHPUnitFrameworkTestCase
'SecurityGroups' => 'SecurityGroups',
'Studio' => 'Studio',
'SugarFeed' => 'SugarFeed',
'ExternalOAuthProvider' => 'ExternalOAuthProvider',
'SurveyQuestionOptions' => 'SurveyQuestionOptions',
'SurveyQuestionResponses' => 'SurveyQuestionResponses',
'SurveyQuestions' => 'SurveyQuestions',

View file

@ -125,6 +125,11 @@ class ACLRoleTest extends SuitePHPUnitFrameworkTestCase
'EmailMarketing',
'Emails',
'FP_events',
'ExternalOAuthConnection',
'ExternalOAuthProvider',
'InboundEmail',
'AOD_Index',
'AOD_IndexEvent',
'AOS_Invoices',
'AOK_Knowledge_Base_Categories',
'AOK_KnowledgeBase',
@ -150,6 +155,7 @@ class ACLRoleTest extends SuitePHPUnitFrameworkTestCase
'AOR_Reports',
'AOR_Scheduled_Reports',
'SecurityGroups',
'Spots',
'SurveyQuestionOptions',
'SurveyQuestionResponses',
'SurveyQuestions',

View file

@ -2281,6 +2281,7 @@ class InboundEmailTest extends SuitePHPUnitFrameworkTestCase
'IS_AUTO_IMPORT' => '0',
'IS_CREATE_CASE' => '0',
'ALLOW_OUTBOUND_GROUP_USAGE' => '0',
'MOVE_MESSAGES_TO_TRASH_AFTER_IMPORT' => '0'
);
self::assertIsArray($result);

View file

@ -301,6 +301,7 @@ class SecurityGroupTest extends SuitePHPUnitFrameworkTestCase
'Emails',
'ExternalOAuthConnection',
'ProjectTask',
'ExternalOAuthProvider',
'Project',
'FP_events',
'AOR_Reports',

View file

@ -259,6 +259,38 @@
min-width: 0;
visibility: collapse;
}
.compose-from-email-account {
display: flex;
flex-wrap: wrap;
justify-content: start;
.compose-from-email-address-name {
margin-right: 0.5rem;
}
.compose-from-email-address-from {
color: $gray;
}
}
.ui-selectmenu-button.ui-button {
width: auto;
min-width: 50%;
background: inherit;
}
.ui-selectmenu-button.ui-button:hover {
background: inherit;
}
.ui-selectmenu-menu.ui-front.ui-selectmenu-open {
.ui-menu-item-wrapper.ui-state-active {
border: 1px solid transparent;
background: $gray-lighter
50% 50% repeat-x;
}
}
}
.btn-send-email .send-email-label {
@ -604,6 +636,11 @@
.col-sm-8 {
width: 100%;
}
.ui-selectmenu-button.ui-button {
width: 100%;
}
}
}
}

View file

@ -50,7 +50,7 @@
<script type='text/javascript'>
if (SUGAR.ajaxUI && !SUGAR.ajaxUI.hist_loaded) {
YAHOO.util.History.register('ajaxUILoc', "", SUGAR.ajaxUI.go);
{/literal}{if $smarty.request.module != "ModuleBuilder"}{* Module builder will init YUI history on its own *}
{/literal}{if isset($smarty.request.module) && $smarty.request.module != "ModuleBuilder"}{* Module builder will init YUI history on its own *}
YAHOO.util.History.initialize("ajaxUI-history-field", "ajaxUI-history-iframe");
{/if}{literal}
}