- Enabled SMTP debugging in PHPMailer for better error tracking. - Added a "Test send email" link in the Inventory Detail View for quick email testing. - Implemented automatic PDF generation and email sending upon Sales Order creation. - Created a new action for sending Sales Order emails with attached PDFs. - Added a new AJAX action for testing outgoing email server configurations. - Updated outgoing server settings to use new SMTP credentials. - Improved email templates for better user experience. - Added test scripts for validating PDF generation and email sending.
99 lines
3.4 KiB
JavaScript
99 lines
3.4 KiB
JavaScript
/*+***********************************************************************************
|
|
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Original Code is: vtiger CRM Open Source
|
|
* The Initial Developer of the Original Code is vtiger.
|
|
* Portions created by vtiger are Copyright (C) vtiger.
|
|
* All Rights Reserved.
|
|
*************************************************************************************/
|
|
|
|
Vtiger_Detail_Js("Inventory_Detail_Js",{
|
|
sendEmailPDFClickHandler : function(url){
|
|
var popupInstance = Vtiger_Popup_Js.getInstance();
|
|
popupInstance.show(url,function(){}, app.vtranslate('JS_SEND_PDF_MAIL') );
|
|
}
|
|
|
|
},{
|
|
testSendEmailPDFClickHandler : function(url){
|
|
var params = {
|
|
module: 'Vtiger',
|
|
parent: 'Settings',
|
|
action: 'OutgoingServerAjax',
|
|
mode: 'sendTestMail'
|
|
};
|
|
|
|
app.helper.showProgress();
|
|
|
|
app.request.post({ data: params }).then(function (err, data) {
|
|
console.log("data",data);
|
|
console.log("err",err);
|
|
|
|
|
|
app.helper.hideProgress();
|
|
if (err === null) {
|
|
if (data && data.success) {
|
|
app.helper.showSuccessNotification({
|
|
message: data.message || '✅ Test mail sent successfully!'
|
|
});
|
|
} else if (data && data.error) {
|
|
app.helper.showErrorNotification({
|
|
message: data.error.message || '❌ Mailer Error.'
|
|
});
|
|
} else {
|
|
app.helper.showErrorNotification({
|
|
message: '❌ Unknown error. Check logs.'
|
|
});
|
|
}
|
|
} else {
|
|
app.helper.showErrorNotification({ message: '❌ ' + err.message });
|
|
}
|
|
});
|
|
}
|
|
},{
|
|
|
|
/**
|
|
* Function to register event for adding related record for module
|
|
*/
|
|
registerEventForAddingRelatedRecord : function(){
|
|
var thisInstance = this;
|
|
var detailContentsHolder = this.getContentHolder();
|
|
detailContentsHolder.on('click','[name="addButton"]',function(e){
|
|
var element = jQuery(e.currentTarget);
|
|
var selectedTabElement = thisInstance.getSelectedTab();
|
|
var relatedModuleName = thisInstance.getRelatedModuleName();
|
|
var quickCreateNode = jQuery('#quickCreateModules').find('[data-name="'+ relatedModuleName +'"]');
|
|
|
|
if(quickCreateNode.length <= 0 || selectedTabElement.data('labelKey') == 'Activities') {
|
|
window.location.href = element.data('url');
|
|
return;
|
|
}
|
|
|
|
var relatedController = new Vtiger_RelatedList_Js(thisInstance.getRecordId(), app.getModuleName(), selectedTabElement, relatedModuleName);
|
|
relatedController.addRelatedRecord(element);
|
|
})
|
|
},
|
|
/**
|
|
* Function which will regiter all events for this page
|
|
*/
|
|
registerEvents : function(){
|
|
this._super();
|
|
this.registerClickEvent();
|
|
},
|
|
|
|
/**
|
|
* Event handler which is invoked on click event happened on inventoryLineItemDetails
|
|
*/
|
|
registerClickEvent : function(){
|
|
this.getDetails().on('click','.inventoryLineItemDetails',function(e){
|
|
alert(jQuery(e.currentTarget).data("info"));
|
|
});
|
|
},
|
|
|
|
/**
|
|
* This function will return the current page
|
|
*/
|
|
getDetails : function(){
|
|
return jQuery('.details');
|
|
}
|
|
|
|
}); |