diff --git a/plugins/yetiforce/compose.min.js b/plugins/yetiforce/compose.min.js
new file mode 100644
index 00000000..cd09d3e9
--- /dev/null
+++ b/plugins/yetiforce/compose.min.js
@@ -0,0 +1,12 @@
+'use strict';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+} : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+};
+
+//Add files to mail
+// Select template
+window.rcmail&&rcmail.addEventListener('init',function(){rcmail.crm=rcmail.getCrmWindow(),!1!=rcmail.crm&&(rcmail.env.compose_commands.push('yetiforce.addFilesFromCRM'),rcmail.env.compose_commands.push('yetiforce.selectTemplate'),rcmail.env.compose_commands.push('yetiforce.selectAdress'),rcmail.register_command('yetiforce.addFilesFromCRM',function(){rcmail.addFilesFromCRM();},!0),rcmail.register_command('yetiforce.selectTemplate',function(){rcmail.selectTemplate();},!0),rcmail.register_command('yetiforce.selectAdress',function(module,part){rcmail.selectAdress(module,part);},!0));}),rcube_webmail.prototype.addFilesFromCRM=function(){rcmail.crm.app.showRecordsList({module:'Documents',src_module:'Documents',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData){rcmail.addFilesToMail({ids:Object.keys(responseData)});});});},rcube_webmail.prototype.addFilesToMail=function(data){data._id=rcmail.env.compose_id,data._uploadid=new Date().getTime(),this.http_post('plugin.yetiforce-addFilesToMail',data,this.set_busy(!0,'loading'));},rcube_webmail.prototype.selectTemplate=function(){rcmail.crm.app.showRecordsList({module:'EmailTemplates',src_module:'EmailTemplates',search_params:'[[["email_template_type","e","PLL_MAIL"]]]'},function(modal,instance){instance.setSelectEvent(function(responseData){var recordId=rcmail.env.crmRecord,module=rcmail.env.crmModule,view=rcmail.env.crmView;if('List'==view){var chElement=jQuery(crm.document).find('.listViewEntriesCheckBox')[0];recordId=jQuery(chElement).val();}jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce-getContentEmailTemplate&_id='+rcmail.env.compose_id,data:{id:responseData.id,record_id:recordId,select_module:module},dataType:'json',success:function success(data){var oldSubject=jQuery('[name="_subject"]').val(),html=jQuery('
').html(data.content).html(),ed='';if(jQuery('[name="_subject"]').val(oldSubject+' '+data.subject),window.tinyMCE&&(ed=tinyMCE.get(rcmail.env.composebody))){var oldBody=tinyMCE.activeEditor.getContent();tinymce.activeEditor.setContent(html+oldBody);}else {var _oldBody=jQuery('#composebody').val();jQuery('#composebody').val(html+_oldBody);}'undefined'!=typeof data.attachments&&null!==data.attachments&&rcmail.addFilesToMail(data.attachments);}});});});},rcube_webmail.prototype.selectAdress=function(module,part){rcmail.crm.app.showRecordsList({module:module,src_module:'OSSMail',multi_select:!0,additionalInformations:!1},function(modal,instance){instance.setSelectEvent(function(responseData,e){rcmail.getEmailAddresses(responseData,e,module).done(function(emails){if(emails.length){var paetElement=$('#'+part),value=paetElement.val();''!=value&&','!=value.charAt(value.length-1)&&(value+=','),paetElement.val(value+emails.join(',')),paetElement.change();}else rcmail.crm.app.showNotify({text:rcmail.crm.app.vtranslate('NoFindEmailInRecord'),animation:'show'});});});});},rcube_webmail.prototype.getEmailAddresses=function(responseData,e,module){var aDeferred=$.Deferred(),emails=[],label='',email='';return 'undefined'!=typeof e.target&&('email'===$(e.target).data('type')||'multiEmail'===$(e.target).data('type'))?(emails.push($(e.target).text()),aDeferred.resolve(emails)):function(){var i=0,_loop=function(id){rcmail.crm.app.getRecordDetails({record:id,module:module,fieldType:['email','multiEmail']}).done(function(data){i++,label=email=rcmail.getFirstEmailAddress(data.result.data),responseData[id]&&(label=responseData[id]),emails.push(label+'<'+email+'>'),i===Object.keys(responseData).length&&aDeferred.resolve(emails);});};for(var id in responseData)_loop(id);}(),aDeferred.promise()},rcube_webmail.prototype.getFirstEmailAddress=function(data){var emails=[];for(var key in data)if(data[key])if(rcmail.crm.app.isJsonString(data[key])){var multiEmail=JSON.parse(data[key]);for(var i in multiEmail)emails.push(multiEmail[i].e);break}else {emails.push(data[key]);break}return emails},rcube_webmail.prototype.getCrmWindow=function(){if(null!==opener&&'object'==opener.parent.CONFIG)return opener.parent;return 'object'==_typeof(parent.CONFIG)?parent:'object'==_typeof(parent.parent.CONFIG)?parent.parent:!('object'!=_typeof(opener.crm.CONFIG))&&opener.crm};
+//# sourceMappingURL=compose.min.js.map
diff --git a/plugins/yetiforce/compose.min.js.map b/plugins/yetiforce/compose.min.js.map
new file mode 100644
index 00000000..2de4fda5
--- /dev/null
+++ b/plugins/yetiforce/compose.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"compose.min.js","sources":["compose.js"],"sourcesContent":["'use strict';\n/* {[The file is published on the basis of MIT License]} */\nif (window.rcmail) {\n rcmail.addEventListener('init', function () {\n rcmail.crm = rcmail.getCrmWindow();\n if (rcmail.crm != false) {\n rcmail.env.compose_commands.push('yetiforce.addFilesFromCRM');\n rcmail.env.compose_commands.push('yetiforce.selectTemplate');\n rcmail.env.compose_commands.push('yetiforce.selectAdress');\n rcmail.register_command(\n 'yetiforce.addFilesFromCRM',\n function () {\n rcmail.addFilesFromCRM();\n },\n true\n );\n rcmail.register_command(\n 'yetiforce.selectTemplate',\n function () {\n rcmail.selectTemplate();\n },\n true\n );\n rcmail.register_command(\n 'yetiforce.selectAdress',\n function (module, part) {\n rcmail.selectAdress(module, part);\n },\n true\n );\n }\n });\n}\n//Document selection\nrcube_webmail.prototype.addFilesFromCRM = function () {\n rcmail.crm.app.showRecordsList(\n {\n module: 'Documents',\n src_module: 'Documents',\n multi_select: true,\n additionalInformations: true,\n },\n (modal, instance) => {\n instance.setSelectEvent((responseData) => {\n rcmail.addFilesToMail({\n ids: Object.keys(responseData),\n });\n });\n }\n );\n};\n//Add files to mail\nrcube_webmail.prototype.addFilesToMail = function (data) {\n data._id = rcmail.env.compose_id;\n data._uploadid = new Date().getTime();\n this.http_post('plugin.yetiforce-addFilesToMail', data, this.set_busy(true, 'loading'));\n};\n// Select template\nrcube_webmail.prototype.selectTemplate = function () {\n rcmail.crm.app.showRecordsList(\n {\n module: 'EmailTemplates',\n src_module: 'EmailTemplates',\n search_params: '[[[\"email_template_type\",\"e\",\"PLL_MAIL\"]]]',\n },\n (modal, instance) => {\n instance.setSelectEvent((responseData) => {\n var recordId = rcmail.env.crmRecord,\n module = rcmail.env.crmModule,\n view = rcmail.env.crmView;\n if (view == 'List') {\n var chElement = jQuery(crm.document).find('.listViewEntriesCheckBox')[0];\n recordId = jQuery(chElement).val();\n }\n jQuery.ajax({\n type: 'Get',\n url: '?_task=mail&_action=plugin.yetiforce-getContentEmailTemplate&_id=' + rcmail.env.compose_id,\n data: {\n id: responseData.id,\n record_id: recordId,\n select_module: module,\n },\n dataType: 'json',\n success: function (data) {\n let oldSubject = jQuery('[name=\"_subject\"]').val(),\n html = jQuery('').html(data.content).html(),\n ed = '';\n jQuery('[name=\"_subject\"]').val(oldSubject + ' ' + data.subject);\n if (window.tinyMCE && (ed = tinyMCE.get(rcmail.env.composebody))) {\n let oldBody = tinyMCE.activeEditor.getContent();\n tinymce.activeEditor.setContent(html + oldBody);\n } else {\n let oldBody = jQuery('#composebody').val();\n jQuery('#composebody').val(html + oldBody);\n }\n if (typeof data.attachments !== 'undefined' && data.attachments !== null) {\n rcmail.addFilesToMail(data.attachments);\n }\n },\n });\n });\n }\n );\n};\nrcube_webmail.prototype.selectAdress = function (module, part) {\n rcmail.crm.app.showRecordsList(\n {\n module: module,\n src_module: 'OSSMail',\n multi_select: true,\n additionalInformations: false,\n },\n (modal, instance) => {\n instance.setSelectEvent((responseData, e) => {\n rcmail.getEmailAddresses(responseData, e, module).done((emails) => {\n if (emails.length) {\n let paetElement = $('#' + part);\n let value = paetElement.val();\n if (value != '' && value.charAt(value.length - 1) != ',') {\n value = value + ',';\n }\n paetElement.val(value + emails.join(','));\n paetElement.change();\n } else {\n rcmail.crm.app.showNotify({\n text: rcmail.crm.app.vtranslate('NoFindEmailInRecord'),\n animation: 'show',\n });\n }\n });\n });\n }\n );\n};\nrcube_webmail.prototype.getEmailAddresses = function (responseData, e, module) {\n let aDeferred = $.Deferred(),\n emails = [],\n label = '',\n email = '';\n if (typeof e.target !== 'undefined' && ($(e.target).data('type') === 'email' || $(e.target).data('type') === 'multiEmail')) {\n emails.push($(e.target).text());\n aDeferred.resolve(emails);\n } else {\n let i = 0;\n for (let id in responseData) {\n rcmail.crm.app\n .getRecordDetails({\n record: id,\n module: module,\n fieldType: ['email', 'multiEmail'],\n })\n .done((data) => {\n i++;\n label = email = rcmail.getFirstEmailAddress(data.result.data);\n if (responseData[id]) {\n label = responseData[id];\n }\n emails.push(label + '<' + email + '>');\n if (i === Object.keys(responseData).length) {\n //last iteration\n aDeferred.resolve(emails);\n }\n });\n }\n }\n return aDeferred.promise();\n};\nrcube_webmail.prototype.getFirstEmailAddress = function (data) {\n let emails = [];\n for (let key in data) {\n if (data[key]) {\n if (rcmail.crm.app.isJsonString(data[key])) {\n let multiEmail = JSON.parse(data[key]);\n for (let i in multiEmail) {\n emails.push(multiEmail[i].e);\n }\n break;\n } else {\n emails.push(data[key]);\n break;\n }\n }\n }\n return emails;\n};\nrcube_webmail.prototype.getCrmWindow = function () {\n if (opener !== null && opener.parent.CONFIG == 'object') {\n return opener.parent;\n } else if (typeof parent.CONFIG == 'object') {\n return parent;\n } else if (typeof parent.parent.CONFIG == 'object') {\n return parent.parent;\n } else if (typeof opener.crm.CONFIG == 'object') {\n return opener.crm;\n }\n return false;\n};\n"],"names":["window","rcmail","addEventListener","crm","getCrmWindow","env","compose_commands","push","register_command","addFilesFromCRM","selectTemplate","module","part","selectAdress","rcube_webmail","prototype","app","showRecordsList","src_module","multi_select","additionalInformations","modal","instance","setSelectEvent","responseData","addFilesToMail","ids","Object","keys","data","_id","compose_id","_uploadid","getTime","http_post","set_busy","search_params","crmRecord","crmModule","view","crmView","jQuery","document","find","recordId","chElement","val","ajax","type","url","id","record_id","select_module","dataType","success","html","content","ed","oldSubject","subject","tinyMCE","get","composebody","activeEditor","getContent","tinymce","setContent","oldBody","attachments","e","getEmailAddresses","done","emails","length","$","value","paetElement","charAt","join","change","showNotify","text","vtranslate","animation","Deferred","label","email","target","aDeferred","resolve","getRecordDetails","record","fieldType","i","getFirstEmailAddress","result","promise","key","isJsonString","JSON","parse","multiEmail","parent","CONFIG","opener"],"mappings":";;;;;;;;AAmDA;AAMA;AAvDIA,OAAOC,QACTA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAY,CAC1CD,OAAOE,GAAP,CAAaF,OAAOG,YAAP,EAD6B,CAEtC,WAAOD,GAF+B,GAGxCF,OAAOI,GAAP,CAAWC,gBAAX,CAA4BC,IAA5B,CAAiC,2BAAjC,CAHwC,CAIxCN,OAAOI,GAAP,CAAWC,gBAAX,CAA4BC,IAA5B,CAAiC,0BAAjC,CAJwC,CAKxCN,OAAOI,GAAP,CAAWC,gBAAX,CAA4BC,IAA5B,CAAiC,wBAAjC,CALwC,CAMxCN,OAAOO,gBAAP,CACE,2BADF,CAEE,UAAY,CACVP,OAAOQ,eAAP,GACD,CAJH,IANwC,CAaxCR,OAAOO,gBAAP,CACE,0BADF,CAEE,UAAY,CACVP,OAAOS,cAAP,GACD,CAJH,IAbwC,CAoBxCT,OAAOO,gBAAP,CACE,wBADF,CAEE,SAAUG,MAAV,CAAkBC,IAAlB,CAAwB,CACtBX,OAAOY,YAAP,CAAoBF,MAApB,CAA4BC,IAA5B,EACD,CAJH,IApBwC,EA4B3C,CA5BD,EA+BFE,cAAcC,SAAd,CAAwBN,eAAxB,CAA0C,UAAY,CACpDR,OAAOE,GAAP,CAAWa,GAAX,CAAeC,eAAf,CACE,CACEN,OAAQ,WADV,CAEEO,WAAY,WAFd,CAGEC,eAHF,CAIEC,yBAJF,CADF,CAOE,SAACC,KAAD,CAAQC,QAAR,CAAqB,CACnBA,SAASC,cAAT,CAAwB,SAACC,YAAD,CAAkB,CACxCvB,OAAOwB,cAAP,CAAsB,CACpBC,IAAKC,OAAOC,IAAP,CAAYJ,YA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AMdsB,OAAOjE,IAAP,CAAY8E,MAAQ,GAAR,CAAcC,KAAd,CAAsB,GAAlC,CANc,CAOVO,IAAMlE,OAAOC,IAAP,CAAYJ,YAAZ,EAA0BiD,MAPtB,EASZe,UAAUC,OAAV,CAAkBjB,MAAlB,EAEH,CAjBH,EAoBJ,EArBE,IAAK,MAAL,gBAAA,OAAStB,EAAT,EAqBF,IAAOsC,UAAUQ,OAAV,EACR,EACDlF,cAAcC,SAAd,CAAwB+E,oBAAxB,CAA+C,SAAUjE,IAAV,CAAgB,CAC7D,WAAa,EAAb,CACA,IAAK,OAAL,QAAA,CACE,GAAIA,KAAKoE,GAAL,CAAJ,CACE,GAAIhG,OAAOE,GAAP,CAAWa,GAAX,CAAekF,YAAf,CAA4BrE,KAAKoE,GAAL,CAA5B,CAAJ,CAA4C,CAC1C,eAAiBE,KAAKC,KAAL,CAAWvE,KAAKoE,GAAL,CAAX,CAAjB,CACA,IAAK,KAAL,cAAA,CACEzB,OAAOjE,IAAP,CAAY8F,WAAWR,CAAX,EAAcxB,CAA1B,EAEF,KACD,CAND,KAMO,CACLG,OAAOjE,IAAP,CAAYsB,KAAKoE,GAAL,CAAZ,CADK,CAEL,KACD,CAGL,aACD,EACDnF,cAAcC,SAAd,CAAwBX,YAAxB,CAAuC,UAAY,CACjD,GAAe,IAAX,WAA2C,QAAxB,SAAOkG,MAAP,CAAcC,MAArC,CACE,cAAcD,MAAd,CAF+C,OAGd,QAAxB,UAAOA,OAAOC,MAAd,CAHsC,CAIxCD,MAJwC,CAKP,QAA/B,UAAOA,OAAOA,MAAP,CAAcC,MAArB,CALsC,CAMxCD,OAAOA,MANiC,GAOV,QAA5B,UAAOE,OAAOrG,GAAP,CAAWoG,MAAlB,CAPsC,GAQxCC,OAAOrG,GAGjB"}
\ No newline at end of file
diff --git a/plugins/yetiforce/preview.min.js b/plugins/yetiforce/preview.min.js
new file mode 100644
index 00000000..16aee5f6
--- /dev/null
+++ b/plugins/yetiforce/preview.min.js
@@ -0,0 +1,13 @@
+'use strict';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+} : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+};
+
+// import ICS file action
+// Get raw mail body
+//Show mail analysis modal
+window.rcmail&&rcmail.addEventListener('init',function(){rcmail.crm=rcmail.getCrmWindow(),rcmail.loadActionBar(),rcmail.env.message_commands.push('yetiforce.importICS'),rcmail.register_command('yetiforce.importICS',function(props,type){rcmail.importICS(props,type);},!0),rcmail.register_command('plugin.yetiforce.addSenderToList',function(props){rcmail.addSenderToList(props);},rcmail.env.uid),rcmail.register_command('plugin.yetiforce.loadMailAnalysis',function(props){rcmail.loadMailAnalysis(props);},rcmail.env.uid),rcmail.addEventListener('plugin.yetiforce.showMailAnalysis',function(content){rcmail.showMailAnalysis(content);}),rcmail.message_list&&(rcmail.message_list.addEventListener('select',function(list){rcmail.enable_command('plugin.yetiforce.addSenderToList',0').html(rcmail.env.sender_list[evt.uid]));});}),rcube_webmail.prototype.addSenderToList=function(props){this.http_post('plugin.yetiforce-addSenderToList',this.selection_post_data({_props:props}),this.set_busy(!0,'loading'));},rcube_webmail.prototype.addSenderToListMove=function(mbox){this.move_messages(mbox);},rcube_webmail.prototype.importICS=function(part,type){this.http_post('plugin.yetiforce-importIcs',{_mbox:rcmail.env.mailbox,_uid:rcmail.env.uid,_part:part,_type:type,_mailId:this.mailId},this.set_busy(!0,'loading'));},rcube_webmail.prototype.loadActionBar=function(){this.crmContent=$('#ytActionBarContent'),rcmail.crm.AppConnector.request({module:'OSSMail',view:'MailActionBar',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id}).done(function(response){rcmail.crmContent.find('.ytHeader').html(response),$('#messagecontent').css('top',rcmail.crmContent.outerHeight()+$('#messageheader').outerHeight()+'px'),rcmail.registerEvents();});},rcube_webmail.prototype.registerEvents=function(){this.mailId=this.crmContent.find('#mailActionBarID').val(),this.registerAddRecord(),this.registerAddReletedRecord(),this.registerSelectRecord(),this.registerRemoveRecord(),this.registerImportMail(),rcmail.crm.app.registerPopover(this.crmContent.closest('body')),rcmail.crm.app.registerIframeAndMoreContent(this.crmContent.closest('body'));var block=this.crmContent.find('.ytHeader .js-data');this.crmContent.find('.hideBtn').click(function(){var button=$(this),icon=button.find('span');'0'==button.data('type')?(button.data('type','1'),icon.removeClass('fa-chevron-circle-up').addClass('fa-chevron-circle-down')):(button.data('type','0'),icon.removeClass('fa-chevron-circle-down').addClass('fa-chevron-circle-up')),block.toggle(),$(window).trigger('resize');});},rcube_webmail.prototype.registerImportMail=function(){var clicked=!1,importButton=rcmail.crmContent.find('.importMail');importButton.click(function(){return !clicked&&void(clicked=!0,importButton.addClass('d-none'),rcmail.crm.app.showNotify({text:rcmail.crm.app.vtranslate('StartedDownloadingEmail'),type:'info'}),rcmail.crm.AppConnector.request({module:'OSSMail',action:'ImportMail',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id}).done(function(){rcmail.loadActionBar(),rcmail.crm.app.showNotify({text:rcmail.crm.app.vtranslate('AddFindEmailInRecord'),type:'success'});}).fail(function(){clicked=!1;}))});},rcube_webmail.prototype.registerRemoveRecord=function(){rcmail.crmContent.find('button.removeRecord').click(function(e){rcmail.removeRecord($(e.currentTarget).closest('.rowRelatedRecord').data('id'));});},rcube_webmail.prototype.registerSelectRecord=function(){rcmail.crmContent.find('button.selectRecord').click(function(){var relationSelect=rcmail.crmContent.find('#addRelationSelect').val(),getCacheModule=rcmail.crm.app.moduleCacheGet('selectedModuleName');('undefined'===getCacheModule||relationSelect!==getCacheModule)&&rcmail.crm.app.moduleCacheSet('selectedModuleName',relationSelect);var relParams={mailId:rcmail.mailId};if(0==$(this).data('type')){var module=$(this).closest('.js-head-container').find('.module').val();if(null===module)return}else {var module=$(this).data('module');relParams.crmid=$(this).closest('.rowRelatedRecord').data('id'),relParams.mod=$(this).closest('.rowRelatedRecord').data('module'),relParams.newModule=module;}rcmail.showPopup({module:module,src_module:'OSSMailView',src_record:rcmail.mailId},relParams);});},rcube_webmail.prototype.registerAddReletedRecord=function(){rcmail.crmContent.find('button.addRelatedRecord').click(function(e){var targetElement=$(e.currentTarget),row=targetElement.closest('.rowRelatedRecord');rcmail.showQuickCreateForm(targetElement.data('module'),row.data('id'),{sourceModule:row.data('module')});});},rcube_webmail.prototype.registerAddRecord=function(){var getCacheModule=rcmail.crm.app.moduleCacheGet('selectedModuleName');getCacheModule&&rcmail.crmContent.find('#addRelationSelect').val(getCacheModule),rcmail.crmContent.find('button.addRecord').click(function(e){var relationSelect=rcmail.crmContent.find('#addRelationSelect').val();('undefined'===getCacheModule||relationSelect!==getCacheModule)&&rcmail.crm.app.moduleCacheSet('selectedModuleName',relationSelect);var col=$(e.currentTarget).closest('.js-head-container'),selectValue=col.find('.module').val();if(null!==selectValue){var relatedRecords=[];rcmail.crmContent.find('.js-data').find('.rowRelatedRecord').each(function(i,record){var data=$(record).data();relatedRecords.push({module:data.module,id:data.id});}),rcmail.showQuickCreateForm(selectValue,rcmail.mailId,{relatedRecords:relatedRecords});}});},rcube_webmail.prototype.removeRecord=function(crmid){rcmail.crm.AppConnector.request({async:!1,dataType:'json',data:{module:'OSSMail',action:'ExecuteActions',mode:'removeRelated',params:{mailId:rcmail.mailId,crmid:crmid}}}).done(function(data){var response=data.result,notifyParams={text:response.data,animation:'show'};response.success&&(notifyParams={text:response.data,type:'info',animation:'show'}),rcmail.crm.app.showNotify(notifyParams),rcmail.loadActionBar();});},rcube_webmail.prototype.showPopup=function(params,actionsParams){actionsParams.newModule=params.module,rcmail.crm.app.showRecordsList(params,function(modal,instance){instance.setSelectEvent(function(responseData){actionsParams.newCrmId=responseData.id,rcmail.crm.AppConnector.request({async:!1,dataType:'json',data:{module:'OSSMail',action:'ExecuteActions',mode:'addRelated',params:actionsParams}}).done(function(data){var response=data.result;if(response.success)var notifyParams={text:response.data,type:'info',animation:'show'};else var notifyParams={text:response.data,animation:'show'};rcmail.crm.app.showNotify(notifyParams),rcmail.loadActionBar();});});});},rcube_webmail.prototype.showQuickCreateForm=function(moduleName,record){var params=2').appendTo(data),$('').appendTo(data),$('').appendTo(data);},ids={link:'modulesLevel0',process:'modulesLevel1',subprocess:'modulesLevel2',subprocess_sl:'modulesLevel3',linkextend:'modulesLevel4'};for(var i in ids){var element=rcmail.crmContent.find('#'+ids[i]),value=element.length?JSON.parse(element.val()):[];0<=$.inArray(sourceModule,value)&&(relatedParams[i]=record);}var fillNameFields=function(first){var nameData=rcmail.env.fromName.split(' '),firstName=nameData.shift(),lastName=nameData.join(' ');return first?firstName:lastName},autoCompleteMapRaw=rcmail.crmContent.find('.js-mailAutoCompleteFields').val(),autoCompleteMap=autoCompleteMapRaw?JSON.parse(autoCompleteMapRaw):[];if(autoCompleteMap&&autoCompleteMap[moduleName]){var map=autoCompleteMap[moduleName];for(var name in map)if(map.hasOwnProperty(name)&&map[name])switch(map[name]){case'fromNameFirstPart':relatedParams[name]=fillNameFields(!0);break;case'fromNameSecondPart':relatedParams[name]=fillNameFields(!1);break;case'fromName':relatedParams[name]=rcmail.env.fromName;break;case'subject':relatedParams[name]=rcmail.env.subject;break;case'email':relatedParams[name]=rcmail.env.fromMail;}}relatedParams.email=rcmail.env.fromMail,relatedParams.email1=rcmail.env.fromMail;var messageBody=$('#messagebody').clone();messageBody.find('.image-attachment').remove(),relatedParams.description=messageBody.text(),params.relatedRecords!==void 0&&(relatedParams.relatedRecords=params.relatedRecords),relatedParams.sourceModule=sourceModule,relatedParams.sourceRecord=record,relatedParams.relationOperation=!0;var headerInstance=new rcmail.crm.Vtiger_Header_Js;headerInstance.quickCreateModule(moduleName,{callbackFunction:function callbackFunction(){rcmail.loadActionBar();},callbackPostShown:postShown,data:relatedParams,noCache:!0});},rcube_webmail.prototype.getCrmWindow=function(){if(null!==opener&&'object'==opener.parent.CONFIG)return opener.parent;return 'object'==_typeof(parent.CONFIG)?parent:'object'==_typeof(parent.parent.CONFIG)?parent.parent:!('object'!=_typeof(opener.crm.CONFIG))&&opener.crm},rcube_webmail.prototype.loadMailAnalysis=function(){this.http_post('plugin.yetiforce-loadMailAnalysis',this.selection_post_data(),this.set_busy(!0,'loading'));},rcube_webmail.prototype.showMailAnalysis=function(content){var progressIndicatorElement=rcmail.crm.$.progressIndicator();rcmail.crm.AppConnector.request({module:'AppComponents',view:'MailMessageAnalysisModal',content:content}).done(function(data){progressIndicatorElement.progressIndicator({mode:'hide'}),rcmail.crm.app.showModalWindow(data);}).fail(function(){progressIndicatorElement.progressIndicator({mode:'hide'}),app.showNotify({text:app.vtranslate('JS_ERROR'),type:'error'});});};
+//# sourceMappingURL=preview.min.js.map
diff --git a/plugins/yetiforce/preview.min.js.map b/plugins/yetiforce/preview.min.js.map
new file mode 100644
index 00000000..b780db67
--- /dev/null
+++ b/plugins/yetiforce/preview.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"preview.min.js","sources":["preview.js"],"sourcesContent":["'use strict';\n/* {[The file is published on the basis of MIT License]} */\nif (window.rcmail) {\n\trcmail.addEventListener('init', function () {\n\t\trcmail.crm = rcmail.getCrmWindow();\n\t\trcmail.loadActionBar();\n\t\trcmail.env.message_commands.push('yetiforce.importICS');\n\t\trcmail.register_command(\n\t\t\t'yetiforce.importICS',\n\t\t\tfunction (props, type) {\n\t\t\t\trcmail.importICS(props, type);\n\t\t\t},\n\t\t\ttrue\n\t\t);\n\t\trcmail.register_command(\n\t\t\t'plugin.yetiforce.addSenderToList',\n\t\t\tfunction (props) {\n\t\t\t\trcmail.addSenderToList(props);\n\t\t\t},\n\t\t\trcmail.env.uid\n\t\t);\n\t\trcmail.register_command(\n\t\t\t'plugin.yetiforce.loadMailAnalysis',\n\t\t\tfunction (props) {\n\t\t\t\trcmail.loadMailAnalysis(props);\n\t\t\t},\n\t\t\trcmail.env.uid\n\t\t);\n\t\trcmail.addEventListener('plugin.yetiforce.showMailAnalysis', function (content) {\n\t\t\trcmail.showMailAnalysis(content);\n\t\t});\n\t\tif (rcmail.message_list) {\n\t\t\trcmail.message_list.addEventListener('select', function (list) {\n\t\t\t\trcmail.enable_command('plugin.yetiforce.addSenderToList', list.get_selection(false).length > 0);\n\t\t\t\trcmail.enable_command('plugin.yetiforce.loadMailAnalysis', list.get_selection(false).length > 0);\n\t\t\t});\n\t\t\trcmail.addEventListener('listupdate', function () {\n\t\t\t\tlet btns = $('#toolbar-menu .js-spam-btn');\n\t\t\t\tif (rcmail.env.mailbox === rcmail.env.junk_mailbox) {\n\t\t\t\t\tbtns.hide();\n\t\t\t\t} else {\n\t\t\t\t\tbtns.show();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (rcmail.env.layout == 'widescreen') {\n\t\t\tif (rcmail.gui_objects.messagelist) {\n\t\t\t\trcmail.addEventListener('insertrow', function (evt) {\n\t\t\t\t\tif (typeof rcmail.env.rbl_list[evt.uid] !== 'undefined') {\n\t\t\t\t\t\tevt.row.obj.style.backgroundColor = rcmail.env.rbl_list[evt.uid];\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof rcmail.env.sender_list[evt.uid] !== 'undefined') {\n\t\t\t\t\t\t$('.fromto', evt.row.obj).prepend($('').html(rcmail.env.sender_list[evt.uid]));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n// Add sender to list action\nrcube_webmail.prototype.addSenderToList = function (props) {\n\tthis.http_post(\n\t\t'plugin.yetiforce-addSenderToList',\n\t\tthis.selection_post_data({\n\t\t\t_props: props\n\t\t}),\n\t\tthis.set_busy(true, 'loading')\n\t);\n};\nrcube_webmail.prototype.addSenderToListMove = function (mbox) {\n\tthis.move_messages(mbox);\n};\n// import ICS file action\nrcube_webmail.prototype.importICS = function (part, type) {\n\tthis.http_post(\n\t\t'plugin.yetiforce-importIcs',\n\t\t{\n\t\t\t_mbox: rcmail.env.mailbox,\n\t\t\t_uid: rcmail.env.uid,\n\t\t\t_part: part,\n\t\t\t_type: type,\n\t\t\t_mailId: this.mailId\n\t\t},\n\t\tthis.set_busy(true, 'loading')\n\t);\n};\nrcube_webmail.prototype.loadActionBar = function () {\n\tthis.crmContent = $('#ytActionBarContent');\n\trcmail.crm.AppConnector.request({\n\t\tmodule: 'OSSMail',\n\t\tview: 'MailActionBar',\n\t\tuid: rcmail.env.uid,\n\t\tfolder: rcmail.env.mailbox,\n\t\trcId: rcmail.env.user_id\n\t}).done(function (response) {\n\t\trcmail.crmContent.find('.ytHeader').html(response);\n\t\t$('#messagecontent').css('top', rcmail.crmContent.outerHeight() + $('#messageheader').outerHeight() + 'px');\n\t\trcmail.registerEvents();\n\t});\n};\nrcube_webmail.prototype.registerEvents = function () {\n\tthis.mailId = this.crmContent.find('#mailActionBarID').val();\n\tthis.registerAddRecord();\n\tthis.registerAddReletedRecord();\n\tthis.registerSelectRecord();\n\tthis.registerRemoveRecord();\n\tthis.registerImportMail();\n\trcmail.crm.app.registerPopover(this.crmContent.closest('body'));\n\trcmail.crm.app.registerIframeAndMoreContent(this.crmContent.closest('body'));\n\tvar block = this.crmContent.find('.ytHeader .js-data');\n\tthis.crmContent.find('.hideBtn').click(function () {\n\t\tvar button = $(this);\n\t\tvar icon = button.find('span');\n\t\tif (button.data('type') == '0') {\n\t\t\tbutton.data('type', '1');\n\t\t\ticon.removeClass('fa-chevron-circle-up').addClass('fa-chevron-circle-down');\n\t\t} else {\n\t\t\tbutton.data('type', '0');\n\t\t\ticon.removeClass('fa-chevron-circle-down').addClass('fa-chevron-circle-up');\n\t\t}\n\t\tblock.toggle();\n\t\t$(window).trigger('resize');\n\t});\n};\nrcube_webmail.prototype.registerImportMail = function () {\n\tlet clicked = false;\n\tlet importButton = rcmail.crmContent.find('.importMail');\n\timportButton.click(function (e) {\n\t\tif (clicked) return false;\n\t\tclicked = true;\n\t\timportButton.addClass('d-none');\n\t\trcmail.crm.app.showNotify({\n\t\t\ttext: rcmail.crm.app.vtranslate('StartedDownloadingEmail'),\n\t\t\ttype: 'info'\n\t\t});\n\t\trcmail.crm.AppConnector.request({\n\t\t\tmodule: 'OSSMail',\n\t\t\taction: 'ImportMail',\n\t\t\tuid: rcmail.env.uid,\n\t\t\tfolder: rcmail.env.mailbox,\n\t\t\trcId: rcmail.env.user_id\n\t\t})\n\t\t\t.done(function () {\n\t\t\t\trcmail.loadActionBar();\n\t\t\t\trcmail.crm.app.showNotify({\n\t\t\t\t\ttext: rcmail.crm.app.vtranslate('AddFindEmailInRecord'),\n\t\t\t\t\ttype: 'success'\n\t\t\t\t});\n\t\t\t})\n\t\t\t.fail(function () {\n\t\t\t\tclicked = false;\n\t\t\t});\n\t});\n};\nrcube_webmail.prototype.registerRemoveRecord = function () {\n\trcmail.crmContent.find('button.removeRecord').click(function (e) {\n\t\trcmail.removeRecord($(e.currentTarget).closest('.rowRelatedRecord').data('id'));\n\t});\n};\nrcube_webmail.prototype.registerSelectRecord = function () {\n\trcmail.crmContent.find('button.selectRecord').click(function (e) {\n\t\tlet relationSelect = rcmail.crmContent.find('#addRelationSelect').val();\n\t\tlet getCacheModule = rcmail.crm.app.moduleCacheGet('selectedModuleName');\n\t\tif (getCacheModule === 'undefined' || relationSelect !== getCacheModule) {\n\t\t\trcmail.crm.app.moduleCacheSet('selectedModuleName', relationSelect);\n\t\t}\n\t\tlet relParams = {\n\t\t\tmailId: rcmail.mailId\n\t\t};\n\t\tif ($(this).data('type') == 0) {\n\t\t\tvar module = $(this).closest('.js-head-container').find('.module').val();\n\t\t\tif (module === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tvar module = $(this).data('module');\n\t\t\trelParams.crmid = $(this).closest('.rowRelatedRecord').data('id');\n\t\t\trelParams.mod = $(this).closest('.rowRelatedRecord').data('module');\n\t\t\trelParams.newModule = module;\n\t\t}\n\t\trcmail.showPopup(\n\t\t\t{\n\t\t\t\tmodule: module,\n\t\t\t\tsrc_module: 'OSSMailView',\n\t\t\t\tsrc_record: rcmail.mailId\n\t\t\t},\n\t\t\trelParams\n\t\t);\n\t});\n};\nrcube_webmail.prototype.registerAddReletedRecord = function () {\n\trcmail.crmContent.find('button.addRelatedRecord').click(function (e) {\n\t\tlet targetElement = $(e.currentTarget);\n\t\tlet row = targetElement.closest('.rowRelatedRecord');\n\t\trcmail.showQuickCreateForm(targetElement.data('module'), row.data('id'), {\n\t\t\tsourceModule: row.data('module')\n\t\t});\n\t});\n};\nrcube_webmail.prototype.registerAddRecord = function () {\n\tlet getCacheModule = rcmail.crm.app.moduleCacheGet('selectedModuleName');\n\tif (getCacheModule) {\n\t\trcmail.crmContent.find('#addRelationSelect').val(getCacheModule);\n\t}\n\trcmail.crmContent.find('button.addRecord').click(function (e) {\n\t\tlet relationSelect = rcmail.crmContent.find('#addRelationSelect').val();\n\t\tif (getCacheModule === 'undefined' || relationSelect !== getCacheModule) {\n\t\t\trcmail.crm.app.moduleCacheSet('selectedModuleName', relationSelect);\n\t\t}\n\t\tlet col = $(e.currentTarget).closest('.js-head-container');\n\t\tlet selectValue = col.find('.module').val();\n\t\tif (selectValue !== null) {\n\t\t\tlet relatedRecords = [];\n\t\t\trcmail.crmContent\n\t\t\t\t.find('.js-data')\n\t\t\t\t.find('.rowRelatedRecord')\n\t\t\t\t.each((i, record) => {\n\t\t\t\t\tlet data = $(record).data();\n\t\t\t\t\trelatedRecords.push({\n\t\t\t\t\t\tmodule: data.module,\n\t\t\t\t\t\tid: data.id\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\trcmail.showQuickCreateForm(selectValue, rcmail.mailId, { relatedRecords: relatedRecords });\n\t\t}\n\t});\n};\nrcube_webmail.prototype.removeRecord = function (crmid) {\n\trcmail.crm.AppConnector.request({\n\t\tasync: false,\n\t\tdataType: 'json',\n\t\tdata: {\n\t\t\tmodule: 'OSSMail',\n\t\t\taction: 'ExecuteActions',\n\t\t\tmode: 'removeRelated',\n\t\t\tparams: {\n\t\t\t\tmailId: rcmail.mailId,\n\t\t\t\tcrmid: crmid\n\t\t\t}\n\t\t}\n\t}).done(function (data) {\n\t\tlet response = data['result'];\n\t\tlet notifyParams = {\n\t\t\ttext: response['data'],\n\t\t\tanimation: 'show'\n\t\t};\n\t\tif (response['success']) {\n\t\t\tnotifyParams = {\n\t\t\t\ttext: response['data'],\n\t\t\t\ttype: 'info',\n\t\t\t\tanimation: 'show'\n\t\t\t};\n\t\t}\n\t\trcmail.crm.app.showNotify(notifyParams);\n\t\trcmail.loadActionBar();\n\t});\n};\nrcube_webmail.prototype.showPopup = function (params, actionsParams) {\n\tactionsParams['newModule'] = params['module'];\n\trcmail.crm.app.showRecordsList(params, (modal, instance) => {\n\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\tactionsParams['newCrmId'] = responseData.id;\n\t\t\trcmail.crm.AppConnector.request({\n\t\t\t\tasync: false,\n\t\t\t\tdataType: 'json',\n\t\t\t\tdata: {\n\t\t\t\t\tmodule: 'OSSMail',\n\t\t\t\t\taction: 'ExecuteActions',\n\t\t\t\t\tmode: 'addRelated',\n\t\t\t\t\tparams: actionsParams\n\t\t\t\t}\n\t\t\t}).done(function (data) {\n\t\t\t\tlet response = data['result'];\n\t\t\t\tif (response['success']) {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\trcmail.crm.app.showNotify(notifyParams);\n\t\t\t\trcmail.loadActionBar();\n\t\t\t});\n\t\t});\n\t});\n};\nrcube_webmail.prototype.showQuickCreateForm = function (moduleName, record, params = {}) {\n\tlet relatedParams = {},\n\t\tsourceModule = 'OSSMailView';\n\tif (params['sourceModule']) {\n\t\tsourceModule = params['sourceModule'];\n\t}\n\tconst postShown = function (data) {\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t};\n\tconst ids = {\n\t\tlink: 'modulesLevel0',\n\t\tprocess: 'modulesLevel1',\n\t\tsubprocess: 'modulesLevel2',\n\t\tsubprocess_sl: 'modulesLevel3',\n\t\tlinkextend: 'modulesLevel4'\n\t};\n\tfor (var i in ids) {\n\t\tvar element = rcmail.crmContent.find('#' + ids[i]);\n\t\tvar value = element.length ? JSON.parse(element.val()) : [];\n\t\tif ($.inArray(sourceModule, value) >= 0) {\n\t\t\trelatedParams[i] = record;\n\t\t}\n\t}\n\tconst fillNameFields = (first) => {\n\t\tconst nameData = rcmail.env.fromName.split(' ');\n\t\tconst firstName = nameData.shift();\n\t\tconst lastName = nameData.join(' ');\n\t\treturn first ? firstName : lastName;\n\t};\n\tlet autoCompleteMapRaw = rcmail.crmContent.find('.js-mailAutoCompleteFields').val();\n\tlet autoCompleteMap = autoCompleteMapRaw ? JSON.parse(autoCompleteMapRaw) : [];\n\tif (autoCompleteMap && autoCompleteMap[moduleName]) {\n\t\tlet map = autoCompleteMap[moduleName];\n\t\tfor (let name in map) {\n\t\t\tif (map.hasOwnProperty(name) && map[name]) {\n\t\t\t\tswitch (map[name]) {\n\t\t\t\t\tcase 'fromNameFirstPart':\n\t\t\t\t\t\trelatedParams[name] = fillNameFields(true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'fromNameSecondPart':\n\t\t\t\t\t\trelatedParams[name] = fillNameFields(false);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'fromName':\n\t\t\t\t\t\trelatedParams[name] = rcmail.env.fromName;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'subject':\n\t\t\t\t\t\trelatedParams[name] = rcmail.env.subject;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'email':\n\t\t\t\t\t\trelatedParams[name] = rcmail.env.fromMail;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\trelatedParams['email'] = rcmail.env.fromMail;\n\trelatedParams['email1'] = rcmail.env.fromMail;\n\tlet messageBody = $('#messagebody').clone();\n\tmessageBody.find('.image-attachment').remove();\n\trelatedParams['description'] = messageBody.text();\n\t//relatedParams['related_to'] = record;\n\tif (params.relatedRecords !== undefined) {\n\t\trelatedParams['relatedRecords'] = params.relatedRecords;\n\t}\n\trelatedParams['sourceModule'] = sourceModule;\n\trelatedParams['sourceRecord'] = record;\n\trelatedParams['relationOperation'] = true;\n\tconst headerInstance = new rcmail.crm.Vtiger_Header_Js();\n\theaderInstance.quickCreateModule(moduleName, {\n\t\tcallbackFunction: (data) => {\n\t\t\trcmail.loadActionBar();\n\t\t},\n\t\tcallbackPostShown: postShown,\n\t\tdata: relatedParams,\n\t\tnoCache: true\n\t});\n};\nrcube_webmail.prototype.getCrmWindow = function () {\n\tif (opener !== null && opener.parent.CONFIG == 'object') {\n\t\treturn opener.parent;\n\t} else if (typeof parent.CONFIG == 'object') {\n\t\treturn parent;\n\t} else if (typeof parent.parent.CONFIG == 'object') {\n\t\treturn parent.parent;\n\t} else if (typeof opener.crm.CONFIG == 'object') {\n\t\treturn opener.crm;\n\t}\n\treturn false;\n};\n// Get raw mail body\nrcube_webmail.prototype.loadMailAnalysis = function (props) {\n\tthis.http_post('plugin.yetiforce-loadMailAnalysis', this.selection_post_data(), this.set_busy(true, 'loading'));\n};\n//Show mail analysis modal\nrcube_webmail.prototype.showMailAnalysis = function (content) {\n\tlet progressIndicatorElement = rcmail.crm.$.progressIndicator();\n\trcmail.crm.AppConnector.request({\n\t\tmodule: 'AppComponents',\n\t\tview: 'MailMessageAnalysisModal',\n\t\tcontent: content\n\t})\n\t\t.done(function (data) {\n\t\t\tprogressIndicatorElement.progressIndicator({ mode: 'hide' });\n\t\t\trcmail.crm.app.showModalWindow(data);\n\t\t})\n\t\t.fail(function () {\n\t\t\tprogressIndicatorElement.progressIndicator({ mode: 'hide' });\n\t\t\tapp.showNotify({\n\t\t\t\ttext: app.vtranslate('JS_ERROR'),\n\t\t\t\ttype: 'error'\n\t\t\t});\n\t\t});\n};\n"],"names":["window","rcmail","addEventListener","crm","getCrmWindow","loadActionBar","env","message_commands","push","register_command","props","type","importICS","addSenderToList","uid","loadMailAnalysis","content","showMailAnalysis","message_list","list","enable_command","get_selection","length","$","mailbox","junk_mailbox","btns","hide","show","layout","gui_objects","messagelist","evt","rbl_list","row","obj","style","backgroundColor","sender_list","prepend","html","rcube_webmail","prototype","http_post","selection_post_data","_props","set_busy","addSenderToListMove","mbox","move_messages","part","_mbox","_uid","_part","_type","_mailId","mailId","crmContent","AppConnector","request","module","view","folder","rcId","user_id","done","response","find","css","outerHeight","registerEvents","val","registerAddRecord","registerAddReletedRecord","registerSelectRecord","registerRemoveRecord","registerImportMail","app","registerPopover","closest","registerIframeAndMoreContent","click","icon","button","data","removeClass","addClass","block","toggle","trigger","importButton","clicked","showNotify","text","vtranslate","action","fail","e","removeRecord","currentTarget","getCacheModule","moduleCacheGet","relationSelect","moduleCacheSet","relParams","crmid","mod","newModule","showPopup","src_module","src_record","targetElement","showQuickCreateForm","sourceModule","selectValue","col","each","i","record","relatedRecords","id","async","dataType","mode","params","notifyParams","animation","actionsParams","showRecordsList","modal","instance","setSelectEvent","responseData","moduleName","relatedParams","appendTo","ids","link","process","subprocess","subprocess_sl","linkextend","value","element","JSON","parse","inArray","first","fromName","split","firstName","nameData","shift","lastName","join","autoCompleteMapRaw","autoCompleteMap","map","hasOwnProperty","name","fillNameFields","subject","fromMail","clone","messageBody","remove","Vtiger_Header_Js","headerInstance","quickCreateModule","callbackFunction","callbackPostShown","postShown","noCache","parent","CONFIG","opener","progressIndicator","progressIndicatorElement","showModalWindow"],"mappings":";;;;;;;;AAwEA;AAsTA;AAIA;AAhYIA,OAAOC,QACVA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAY,CAC3CD,OAAOE,GAAP,CAAaF,OAAOG,YAAP,EAD8B,CAE3CH,OAAOI,aAAP,EAF2C,CAG3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A"}
\ No newline at end of file
diff --git a/plugins/yetiforce/yetiforce.php b/plugins/yetiforce/yetiforce.php
index 93eca500..952cee6d 100644
--- a/plugins/yetiforce/yetiforce.php
+++ b/plugins/yetiforce/yetiforce.php
@@ -217,11 +217,17 @@ public function loginAfter($args)
if (!empty($row['params']['language'])) {
$language = $row['params']['language'];
}
- } else {
+ } elseif (!empty($args['cuid'])) {
$_SESSION['crm']['id'] = $args['cuid'];
$language = \App\Language::getLanguageTag();
+ } else {
+ if (!empty($_COOKIE['YTSID']) && \App\Session::load()) {
+ $sessionData = \App\Session::getById($_COOKIE['YTSID']);
+ $_SESSION['crm']['id'] = $sessionData['authenticated_user_id'] ?? '';
+ $language = $sessionData['language'] ?? '';
+ }
}
- if (isset($language)) {
+ if (!empty($language)) {
$languages = $this->rc->list_languages();
$lang = explode('_', $row['params']['language']);
$lang[1] = strtoupper($lang[1]);
@@ -953,7 +959,7 @@ public function addSenderToList(): void
$message = new rcube_message($uid, $mbox);
$body = $message->first_html_part();
}
- $db->query('INSERT INTO `s_yf_mail_rbl_request` (`datetime`,`type`,`user`,`header`,`body`) VALUES (?,?,?,?,?)', date('Y-m-d H:i:s'), $props, $_SESSION['crm']['id'], $headers, $body);
+ $db->query('INSERT INTO `s_yf_mail_rbl_request` (`datetime`,`type`,`user`,`header`,`body`) VALUES (?,?,?,?,?)', date('Y-m-d H:i:s'), $props, ($_SESSION['crm']['id'] ?: 0), $headers, $body);
}
}
if (0 === $props && ($junkMbox = $this->rc->config->get('junk_mbox')) && $mbox !== $junkMbox) {
diff --git a/version.php b/version.php
index da71fbd0..12ff02f1 100644
--- a/version.php
+++ b/version.php
@@ -1,6 +1,6 @@
'2020.11.19',
- 'version' => '0.0.101'
+ 'patch' => '2020.11.20',
+ 'version' => '0.0.102'
];