2018-10-21 12:49:33 +00:00
|
|
|
const frappe = require('frappejs');
|
|
|
|
const registerReportMethods = require('../reports');
|
2019-02-18 05:42:04 +00:00
|
|
|
const sender = require('../email/sender');
|
2018-10-21 12:49:33 +00:00
|
|
|
|
|
|
|
module.exports = function registerServerMethods() {
|
|
|
|
registerReportMethods();
|
|
|
|
|
2019-02-18 05:42:04 +00:00
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'send-mail',
|
|
|
|
handler: sender.sendMail
|
|
|
|
});
|
2019-07-30 12:02:49 +00:00
|
|
|
|
2018-10-21 12:49:33 +00:00
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'import-coa',
|
|
|
|
async handler() {
|
|
|
|
const importCOA = require('../models/doctype/Account/importCOA');
|
2019-02-11 13:14:50 +00:00
|
|
|
await importCOA();
|
2018-10-21 12:49:33 +00:00
|
|
|
}
|
|
|
|
});
|
2018-10-22 18:02:47 +00:00
|
|
|
|
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'print-pdf',
|
2019-07-30 12:02:49 +00:00
|
|
|
handler({ doctype, name, html }) {
|
2018-10-22 18:02:47 +00:00
|
|
|
if (frappe.isElectron) {
|
|
|
|
const path = require('path');
|
|
|
|
const { getPDFForElectron } = require('frappejs/server/pdf');
|
|
|
|
const { getSettings } = require('../electron/settings');
|
2019-09-03 09:45:59 +00:00
|
|
|
getPDFForElectron(doctype, name, undefined, html);
|
2018-10-22 18:02:47 +00:00
|
|
|
}
|
|
|
|
}
|
2019-07-30 12:02:49 +00:00
|
|
|
});
|
|
|
|
frappe.registerMethod({
|
2019-08-01 13:00:52 +00:00
|
|
|
method: 'show-dialog',
|
2019-07-30 12:02:49 +00:00
|
|
|
handler({ title, message }) {
|
|
|
|
frappe.showModal({
|
|
|
|
modalProps: { title, noFooter: true },
|
|
|
|
component: require('../src/components/MessageDialog').default,
|
|
|
|
props: { message }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|