diff --git a/config.performance.php b/config.performance.php index db6125cdc0ff2af6a0bc7943f02cdda4fcfa92ab..303c0dcf5006bb1737ab28658ccf554a2ca414cf 100644 --- a/config.performance.php +++ b/config.performance.php @@ -10,7 +10,7 @@ /* Performance paramters can be configured to fine tune vtiger CRM runtime */ $PERFORMANCE_CONFIG = Array( // Enable Vtiger Log Level for debugging only if requried - 'LOGLEVEl_DEBUG' => false, + 'LOGLEVEL_DEBUG' => false, // Should the caller information be captured in SQL Logging? // It adds little overhead for performance but will be useful to debug diff --git a/layouts/v7/modules/Documents/resources/Documents.js b/layouts/v7/modules/Documents/resources/Documents.js index ac8e4123aaec00a9f564f5cdff56cf0684be4a63..492273eb7d6cb405d82639addcc989a94bddda98 100644 --- a/layouts/v7/modules/Documents/resources/Documents.js +++ b/layouts/v7/modules/Documents/resources/Documents.js @@ -471,7 +471,16 @@ Vtiger.Class('Documents_Index_Js', { vtigerInstance.referenceModulePopupRegisterEvent(container); vtigerInstance.registerClearReferenceSelectionEvent(container); vtigerInstance.registerAutoCompleteFields(container); - app.helper.registerModalDismissWithoutSubmit(container.find('form')); + + // Avoid duplicate registrations + // container could remain in DOM where as form in it could get replaced next invoke after cancel + // to avoid duplicate registration on form close/cancel within same transaction we are handling state in form DOM element. + var containerForm = container.find("form"); + if (!containerForm.data("isDismissWithoutSubmitRegistered")) { + app.helper.registerModalDismissWithoutSubmit(container.find('form')); + containerForm.data("isDismissWithoutSubmitRegistered", true); + } + var moduleInstance = Vtiger_Edit_Js.getInstanceByModuleName('Documents'); moduleInstance.registerEventForPicklistDependencySetup(container); diff --git a/layouts/v7/modules/Settings/Tags/resources/List.js b/layouts/v7/modules/Settings/Tags/resources/List.js index 0a945a6cb2b726e5d7942b5b06094ba6f5d70c0b..2a084ad13de1b6273d148755138d8a3a1cf70226 100644 --- a/layouts/v7/modules/Settings/Tags/resources/List.js +++ b/layouts/v7/modules/Settings/Tags/resources/List.js @@ -82,7 +82,7 @@ Settings_Vtiger_List_Js('Settings_Tags_List_Js',{ var editTagContainer = this.getEditTagContainer(); editTagContainer.find('[name="id"]').val(tagInfo.id); - editTagContainer.find('[name="tagName"]').val(tagInfo.tag); + editTagContainer.find('[name="tagName"]').val(app.helper.getDecodedValue(tagInfo.tag)); if(tagInfo.visibility == "public") { editTagContainer.find('[type="checkbox"]').prop('checked',true); }else{ @@ -199,4 +199,4 @@ Settings_Vtiger_List_Js('Settings_Tags_List_Js',{ self.registerEditTagSaveEvent(); }) } -}); \ No newline at end of file +}); diff --git a/layouts/v7/modules/Vtiger/RecentComments.tpl b/layouts/v7/modules/Vtiger/RecentComments.tpl index 5bbec85ea00036bd438f7ac81c91a6586c12b36b..a9de04159e12716a4bf45044506aadfcadd50eb7 100644 --- a/layouts/v7/modules/Vtiger/RecentComments.tpl +++ b/layouts/v7/modules/Vtiger/RecentComments.tpl @@ -232,8 +232,8 @@ </div> </div> - <div class="hide basicEditCommentBlock container-fluid" style="min-height: 150px;"> - <div class="row commentArea" > + <div class="hide basicEditCommentBlock container-fluid"> + <div class="row commentArea" style="padding-bottom: 10px" > <input style="width:100%;height:30px;" type="text" name="reasonToEdit" placeholder="{vtranslate('LBL_REASON_FOR_CHANGING_COMMENT', $MODULE_NAME)}" class="input-block-level"/> </div> <div class="row" style="padding-bottom: 10px;"> @@ -242,9 +242,11 @@ </div> </div> <input type="hidden" name="is_private"> - <div class="pull-right row"> - <button class="btn btn-success btn-sm detailViewSaveComment" type="button" data-mode="edit">{vtranslate('LBL_POST', $MODULE_NAME)}</button> - <a href="javascript:void(0);" class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> + <div class="row" style="padding-bottom: 10px;"> + <div class="pull-right"> + <button class="btn btn-success btn-sm detailViewSaveComment" type="button" data-mode="edit">{vtranslate('LBL_POST', $MODULE_NAME)}</button> + <a href="javascript:void(0);" class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> + </div> </div> </div> </div> diff --git a/layouts/v7/modules/Vtiger/resources/Vtiger.js b/layouts/v7/modules/Vtiger/resources/Vtiger.js index 2056278a69126f995b647bc308cf8399f24f4eb5..3d13692268e5d2c9990f9cc479101d5a5c4f96ce 100644 --- a/layouts/v7/modules/Vtiger/resources/Vtiger.js +++ b/layouts/v7/modules/Vtiger/resources/Vtiger.js @@ -1230,7 +1230,7 @@ Vtiger.Class('Vtiger_Index_Js', { var quickCreateNode = jQuery('#quickCreateModules').find('[data-name="'+ referenceModuleName +'"]'); if(quickCreateNode.length <= 0) { var notificationOptions = { - 'title' : app.vtranslate('JS_NO_CREATE_OR_NOT_QUICK_CREATE_ENABLED') + 'message' : app.vtranslate('JS_NO_CREATE_OR_NOT_QUICK_CREATE_ENABLED') } app.helper.showAlertNotification(notificationOptions); } diff --git a/layouts/v7/resources/application.js b/layouts/v7/resources/application.js index 834d54ae8456456f644e41e835d054d0b669427c..8676d95e63c447a895d319db566b5f828b9b2497 100644 --- a/layouts/v7/resources/application.js +++ b/layouts/v7/resources/application.js @@ -537,4 +537,20 @@ jQuery(function () { modal_this.$element.focus() } })}; -}); \ No newline at end of file +}); + +/** + * Pre-filter Ajax requests to guard against XSS attacks. + * + * See https://github.com/jquery/jquery/issues/2432 + */ +if (jQuery.ajaxPrefilter) { + // For newer versions of jQuery, use an Ajax prefilter to prevent + // auto-executing script tags from untrusted domains. This is similar to the + // fix that is built in to jQuery 3.0 and higher. + jQuery.ajaxPrefilter(function (s) { + if (s.crossDomain) { + s.contents.script = false; + } + }); +} diff --git a/modules/Calendar/models/Field.php b/modules/Calendar/models/Field.php index 05d260d74cec283c667dbae97de0f1ac0084c79d..cb81df21944800b02ad1010760b1f81a211bc105 100644 --- a/modules/Calendar/models/Field.php +++ b/modules/Calendar/models/Field.php @@ -55,6 +55,8 @@ class Calendar_Field_Model extends Vtiger_Field_Model { return 'reminder'; } else if($this->getName() == 'recurringtype') { return 'recurrence'; + } else if($this->get('uitype') == '9'){ + return 'percentage'; } $webserviceField = $this->getWebserviceFieldObject(); return $webserviceField->getFieldDataType(); diff --git a/modules/Emails/models/Record.php b/modules/Emails/models/Record.php index 44d3e41e78df7235de375f3b7c5cc75c76738474..7f5e1d99ec23cdc7cc82cc8deb6a321772502065 100644 --- a/modules/Emails/models/Record.php +++ b/modules/Emails/models/Record.php @@ -220,9 +220,10 @@ class Emails_Record_Model extends Vtiger_Record_Model { $status = $mailer->Send(true); } if(!$status) { - $status = $mailer->getError(); - //If mailer error, then update emailflag as saved - if($status){ + // Before inspecting for mailer error do a explict check on its configuration. + $err = $mailer->_serverConfigured ? $mailer->getError() : vtranslate("LBL_MAIL_SERVER_DESCRIPTION", "Settings:Vtiger"); + // If mailer error, then update emailflag as saved + if($err){ $this->updateEmailFlag(); } } else { diff --git a/modules/Settings/LayoutEditor/actions/Field.php b/modules/Settings/LayoutEditor/actions/Field.php index d3d85189626718f2a4bd07907b6e33a132dbb3cf..22796ebc77923a27bdfbe20fc88c257b2f768588 100644 --- a/modules/Settings/LayoutEditor/actions/Field.php +++ b/modules/Settings/LayoutEditor/actions/Field.php @@ -97,7 +97,7 @@ class Settings_LayoutEditor_Field_Action extends Settings_Vtiger_Index_Action { $fieldInstance->set('masseditable', $massEditable); } - $defaultValue = $fieldInstance->get('defaultvalue'); + $defaultValue = decode_html($fieldInstance->get('defaultvalue')); if(!is_null($request->get('fieldDefaultValue', null))) { if(is_array($request->get('fieldDefaultValue'))) { @@ -109,6 +109,10 @@ class Settings_LayoutEditor_Field_Action extends Settings_Vtiger_Index_Action { { $defaultValue=Vtiger_Time_UIType::getTimeValueWithSeconds($defaultValue); } + // Converting the date value to DB format (yyyy-mm-dd) + if ($defaultValue && $fieldInstance->get('uitype')=='5') { + $defaultValue = Vtiger_Date_UIType::getDBInsertedValue($defaultValue); + } $fieldInstance->set('defaultvalue', $defaultValue); } @@ -200,6 +204,21 @@ class Settings_LayoutEditor_Field_Action extends Settings_Vtiger_Index_Action { foreach($fieldIds as $fieldId) { $fieldModel = Settings_LayoutEditor_Field_Model::getInstance($fieldId); $fieldInfo = $fieldModel->getFieldInfo(); + //The default value is set to response after reactivating the field. + $defaultValue = $fieldModel->getDefaultFieldValue(); + if (isset($defaultValue)) { + if ($defaultValue && $fieldInfo['type'] == 'date') { + $defaultValue = DateTimeField::convertToUserFormat($defaultValue); + } else if (!$defaultValue) { + $defaultValue = $fieldInstance->getDisplayValue($defaultValue); + } else if (is_array($defaultValue)) { + foreach ($defaultValue as $key => $value) { + $defaultValue[$key] = $fieldInstance->getDisplayValue($value); + } + $defaultValue = Zend_Json::encode($defaultValue); + } + } + $fieldInfo['fieldDefaultValue'] = $defaultValue; $responseData[] = array_merge(array('id'=>$fieldModel->getId(), 'blockid'=>$fieldModel->get('block')->id, 'customField'=>$fieldModel->isCustomField()),$fieldInfo); } $response->setResult($responseData); diff --git a/modules/Settings/Picklist/models/Module.php b/modules/Settings/Picklist/models/Module.php index e5c4274cf7c3beb37160eb43abff491031f27e06..a46aebd0d53535bc5e6cbbdc364ab5a563e09f5c 100644 --- a/modules/Settings/Picklist/models/Module.php +++ b/modules/Settings/Picklist/models/Module.php @@ -499,7 +499,7 @@ class Settings_Picklist_Module_Model extends Vtiger_Module_Model { $db = PearDatabase::getInstance(); $primaryKey = Vtiger_Util_Helper::getPickListId($fieldName); $colums = $db->getColumnNames("vtiger_$fieldName"); - if(in_array('color',$colums)) { + if(is_array($columns) && in_array('color',$colums)) { $query = 'SELECT '.$primaryKey.',color,'.$fieldName.' FROM vtiger_'.$fieldName; $result = $db->pquery($query, array()); $pickListColorMap = array(); diff --git a/modules/Settings/Roles/actions/Save.php b/modules/Settings/Roles/actions/Save.php index 62124df5dd03a3815b90262f311bfb90b1e17aa9..5b2587ea4455a2eae77a656d59cef4de1de57f96 100644 --- a/modules/Settings/Roles/actions/Save.php +++ b/modules/Settings/Roles/actions/Save.php @@ -25,6 +25,10 @@ class Settings_Roles_Save_Action extends Vtiger_Action_Controller { $recordId = $request->get('record'); $roleName = $request->get('rolename'); $allowassignedrecordsto = $request->get('allowassignedrecordsto'); + $duplicate = Settings_Roles_Record_Model::getInstanceByName($roleName,array($recordId)); + if($duplicate) { + throw new Exception(vtranslate('LBL_DUPLICATES_EXIST',$request->getModule(false))); + } $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName); if(!empty($recordId)) { diff --git a/modules/Vtiger/helpers/Logger.php b/modules/Vtiger/helpers/Logger.php index 9a8ac5e00f0f155eb14a41a1dde36773fb8a1d6d..d55d8387f6a17355bf968f46d7a77597d0fd8bd6 100644 --- a/modules/Vtiger/helpers/Logger.php +++ b/modules/Vtiger/helpers/Logger.php @@ -32,7 +32,7 @@ class Logger { if (!self::$initialized) { global $PERFORMANCE_CONFIG; // Check if the performance config is set and debug logging is enabled - if (isset($PERFORMANCE_CONFIG) && isset($PERFORMANCE_CONFIG['LOGLEVEl_DEBUG']) && $PERFORMANCE_CONFIG['LOGLEVEl_DEBUG']) { + if (isset($PERFORMANCE_CONFIG) && isset($PERFORMANCE_CONFIG['LOGLEVEL_DEBUG']) && $PERFORMANCE_CONFIG['LOGLEVEL_DEBUG']) { // Set the default log level to 100 and the log file path self::$logLevel = 100; self::$filePath = "logs/vtigercrm.log"; diff --git a/pkg/vtiger/modules/Import/modules/Import/actions/Data.php b/pkg/vtiger/modules/Import/modules/Import/actions/Data.php index eef394e0a99ae04a2406add4efd22060ae46783c..b1c64ce239fdae4bfeadc6ca54a1f9abfd6e799a 100644 --- a/pkg/vtiger/modules/Import/modules/Import/actions/Data.php +++ b/pkg/vtiger/modules/Import/modules/Import/actions/Data.php @@ -765,9 +765,11 @@ class Import_Data_Action extends Vtiger_Action_Controller { $_REQUEST['cur_'.$this->lineitem_currency_id.'_check'] = 1; } $fieldData['currency_id'] = $this->lineitem_currency_id; - // to save Source of Record while Creating - $fieldData['source'] = $this->recordSource; + + } + // to save Source of Record while Creating + $fieldData['source'] = $this->recordSource; if ($fieldData != null && $checkMandatoryFieldValues) { foreach ($moduleFields as $fieldName => $fieldInstance) { if ((($fieldData[$fieldName] == '') || ($fieldData[$fieldName] == null)) && $fieldInstance->isMandatory()) { diff --git a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/resources/List.js b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/resources/List.js index 92dc028d998934cdd62bf73581889e7a914efcce..09290bd42a9a8c2cd478b7914cc95623b8b23f32 100644 --- a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/resources/List.js +++ b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/resources/List.js @@ -354,7 +354,7 @@ Vtiger_List_Js("MailManager_List_Js", {}, { '_msgno' : msgNos.join(',') }; app.request.post({data : params}).then(function(err,data) { - app.helper.hideProgress(); + self.openFolder(folder); if(data.status) { app.helper.showSuccessNotification({'message': app.vtranslate('JSLBL_MAILS_DELETED')}); self.updateUnreadCount("-"+self.getUnreadCountByMsgNos(msgNos), folder); @@ -418,7 +418,7 @@ Vtiger_List_Js("MailManager_List_Js", {}, { '_msgno' : msgNos.join(',') }; app.request.post({data : params}).then(function(err,data) { - app.helper.hideProgress(); + self.openFolder(folder); if(data.status) { app.helper.showSuccessNotification({'message': app.vtranslate('JSLBL_MAIL_MOVED')}); var unreadCount = self.getUnreadCountByMsgNos(msgNos);