2019-07-03 06:29:40 +00:00
|
|
|
|
2018-05-04 09:46:03 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
require('../methods/ticket/changeWorker')(Self);
|
|
|
|
require('../methods/ticket/getVolume')(Self);
|
2018-05-28 07:16:06 +00:00
|
|
|
require('../methods/ticket/getTotalVolume')(Self);
|
2018-04-10 05:48:04 +00:00
|
|
|
require('../methods/ticket/summary')(Self);
|
2018-05-04 09:46:03 +00:00
|
|
|
require('../methods/ticket/getTotal')(Self);
|
|
|
|
require('../methods/ticket/getTaxes')(Self);
|
2019-02-21 07:43:04 +00:00
|
|
|
require('../methods/ticket/subtotal')(Self);
|
2019-07-26 09:48:01 +00:00
|
|
|
require('../methods/ticket/priceDifference')(Self);
|
2018-05-16 06:13:39 +00:00
|
|
|
require('../methods/ticket/componentUpdate')(Self);
|
2018-07-11 11:52:04 +00:00
|
|
|
require('../methods/ticket/new')(Self);
|
2018-06-06 14:54:40 +00:00
|
|
|
require('../methods/ticket/isEditable')(Self);
|
2019-06-03 12:54:03 +00:00
|
|
|
require('../methods/ticket/delete')(Self);
|
2018-06-19 10:10:38 +00:00
|
|
|
require('../methods/ticket/getVAT')(Self);
|
2018-07-04 12:41:01 +00:00
|
|
|
require('../methods/ticket/getSales')(Self);
|
2018-06-28 13:24:27 +00:00
|
|
|
require('../methods/ticket/getSalesPersonMana')(Self);
|
2018-08-08 12:26:54 +00:00
|
|
|
require('../methods/ticket/filter')(Self);
|
2019-01-18 12:36:13 +00:00
|
|
|
require('../methods/ticket/getPossibleStowaways')(Self);
|
2019-04-05 10:24:39 +00:00
|
|
|
require('../methods/ticket/canBeInvoiced')(Self);
|
|
|
|
require('../methods/ticket/makeInvoice')(Self);
|
2019-05-03 10:23:57 +00:00
|
|
|
require('../methods/ticket/updateEditableTicket')(Self);
|
2019-08-09 06:04:44 +00:00
|
|
|
require('../methods/ticket/isEmpty')(Self);
|
2019-06-05 11:39:15 +00:00
|
|
|
require('../methods/ticket/updateDiscount')(Self);
|
2019-06-06 11:59:11 +00:00
|
|
|
require('../methods/ticket/uploadFile')(Self);
|
2019-07-02 10:12:15 +00:00
|
|
|
require('../methods/ticket/addSale')(Self);
|
2019-08-09 06:04:44 +00:00
|
|
|
require('../methods/ticket/transferSales')(Self);
|
2019-07-03 06:29:40 +00:00
|
|
|
|
|
|
|
Self.observe('before save', async function(ctx) {
|
|
|
|
if (ctx.isNewInstance) return;
|
|
|
|
|
|
|
|
let changes = ctx.data || ctx.instance;
|
|
|
|
|
|
|
|
if (changes.routeFk === null && ctx.currentInstance.routeFk != null) {
|
|
|
|
let instance = JSON.parse(JSON.stringify(ctx.currentInstance));
|
|
|
|
let userId = ctx.options.accessToken.userId;
|
|
|
|
let logRecord = {
|
|
|
|
originFk: ctx.currentInstance.routeFk,
|
|
|
|
userFk: userId,
|
|
|
|
action: 'delete',
|
|
|
|
changedModel: 'Route',
|
|
|
|
oldInstance: {ticket: instance.id},
|
|
|
|
newInstance: null
|
|
|
|
};
|
|
|
|
await Self.app.models.RouteLog.create(logRecord);
|
|
|
|
}
|
|
|
|
});
|
2017-07-06 07:55:28 +00:00
|
|
|
};
|