refs #5684 Removed xxxLog.create and dependences
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
2fec5bf2aa
commit
cc5021a75f
|
@ -177,7 +177,6 @@
|
|||
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
|
||||
"Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
|
||||
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
||||
"Sorts whole route": "Reordena ruta entera",
|
||||
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
|
||||
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
||||
"Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
|
||||
|
|
|
@ -77,14 +77,6 @@ module.exports = Self => {
|
|||
if (salesPersonId)
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPersonId, message);
|
||||
|
||||
await models.ClaimLog.create({
|
||||
originFk: args.id,
|
||||
userFk: userId,
|
||||
action: 'insert',
|
||||
description: 'Claim-pickup-order sent',
|
||||
changedModel: 'Mail'
|
||||
});
|
||||
|
||||
const email = new Email('claim-pickup-order', params);
|
||||
|
||||
return email.send();
|
||||
|
|
|
@ -34,29 +34,8 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const oldTpvTransaction = await models.TpvTransaction.findById(id, null, myOptions);
|
||||
|
||||
const confirm = await Self.rawSql('CALL hedera.tpvTransaction_confirmById(?)', [id], myOptions);
|
||||
|
||||
const tpvTransaction = await models.TpvTransaction.findById(id, null, myOptions);
|
||||
|
||||
const oldInstance = {status: oldTpvTransaction.status};
|
||||
const newInstance = {status: tpvTransaction.status};
|
||||
|
||||
const logRecord = {
|
||||
originFk: tpvTransaction.clientFk,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'TpvTransaction',
|
||||
changedModelId: id,
|
||||
oldInstance: oldInstance,
|
||||
newInstance: newInstance
|
||||
};
|
||||
|
||||
await models.ClientLog.create(logRecord, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return confirm;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
|
|
@ -144,20 +144,7 @@ module.exports = Self => {
|
|||
|
||||
if (taxDataChecked && !hasSageData)
|
||||
throw new UserError(`You need to fill sage information before you check verified data`);
|
||||
if (args.despiteOfClient) {
|
||||
const logRecord = {
|
||||
originFk: clientId,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Client',
|
||||
changedModelId: clientId,
|
||||
description: $t(`Client checked as validated despite of duplication`, {
|
||||
clientId: args.despiteOfClient
|
||||
})
|
||||
};
|
||||
|
||||
await models.ClientLog.create(logRecord, myOptions);
|
||||
}
|
||||
// Remove unwanted properties
|
||||
delete args.ctx;
|
||||
delete args.id;
|
||||
|
|
|
@ -479,21 +479,6 @@ module.exports = Self => {
|
|||
hasChanges = oldData.name != changes.name || oldData.active != changes.active;
|
||||
|
||||
if (!hasChanges) return;
|
||||
|
||||
const isClient = await Self.app.models.Client.count({id: oldData.id});
|
||||
if (isClient) {
|
||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
const userId = loopBackContext.active.accessToken.userId;
|
||||
const logRecord = {
|
||||
originFk: oldData.id,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'VnUser',
|
||||
oldInstance: {name: oldData.name, active: oldData.active},
|
||||
newInstance: {name: changes.name, active: changes.active}
|
||||
};
|
||||
await Self.app.models.ClientLog.create(logRecord);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,6 @@ module.exports = Self => {
|
|||
|
||||
Self.guessPriority = async(ctx, id) => {
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const $t = ctx.req.__; // $translate
|
||||
const query = `CALL vn.routeGuessPriority(?)`;
|
||||
const tx = await Self.beginTransaction({});
|
||||
|
||||
|
@ -30,16 +29,6 @@ module.exports = Self => {
|
|||
|
||||
const priority = await Self.rawSql(query, [id], options);
|
||||
|
||||
let logRecord = {
|
||||
originFk: id,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Route',
|
||||
description: $t('Sorts whole route')
|
||||
};
|
||||
|
||||
await Self.app.models.RouteLog.create(logRecord, options);
|
||||
|
||||
await tx.commit();
|
||||
return priority;
|
||||
} catch (e) {
|
||||
|
|
|
@ -35,24 +35,11 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const originalRoute = await models.Route.findById(id, null, myOptions);
|
||||
|
||||
await Self.rawSql(`CALL vn.routeUpdateM3(?)`, [id], myOptions);
|
||||
|
||||
const updatedRoute = await models.Route.findById(id, null, myOptions);
|
||||
|
||||
await models.RouteLog.create({
|
||||
originFk: id,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Route',
|
||||
changedModelId: id,
|
||||
oldInstance: {m3: originalRoute.m3},
|
||||
newInstance: {m3: updatedRoute.m3}
|
||||
}, myOptions);
|
||||
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return updatedRoute;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
|
|
@ -242,16 +242,6 @@ module.exports = Self => {
|
|||
const oldProperties = await loggable.translateValues(Self, changes.old);
|
||||
const newProperties = await loggable.translateValues(Self, changes.new);
|
||||
|
||||
await models.TicketLog.create({
|
||||
originFk: args.id,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Ticket',
|
||||
changedModelId: args.id,
|
||||
oldInstance: oldProperties,
|
||||
newInstance: newProperties
|
||||
}, myOptions);
|
||||
|
||||
const salesPersonId = originalTicket.client().salesPersonFk;
|
||||
if (salesPersonId) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
|
|
|
@ -52,22 +52,9 @@ module.exports = Self => {
|
|||
});
|
||||
if (!ticket.originId || !ticket.destinationId) continue;
|
||||
|
||||
const ticketDestinationLogRecord = {
|
||||
originFk: ticket.destinationId,
|
||||
userFk: ctx.req.accessToken.userId,
|
||||
action: 'update',
|
||||
changedModel: 'Ticket',
|
||||
changedModelId: ticket.destinationId,
|
||||
changedModelValue: ticket.destinationId,
|
||||
oldInstance: {},
|
||||
newInstance: {mergedTicket: ticket.originId}
|
||||
};
|
||||
|
||||
await models.Sale.updateAll({ticketFk: ticket.originId}, {ticketFk: ticket.destinationId}, myOptions);
|
||||
if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions)) {
|
||||
await models.TicketLog.create(ticketDestinationLogRecord, myOptions);
|
||||
if (await models.Ticket.setDeleted(ctx, ticket.originId, myOptions))
|
||||
await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message);
|
||||
}
|
||||
}
|
||||
if (tx)
|
||||
await tx.commit();
|
||||
|
|
|
@ -100,48 +100,6 @@ module.exports = Self => {
|
|||
await transferPartialSale(
|
||||
ticketId, originalSale, sale, myOptions);
|
||||
}
|
||||
|
||||
// Log to original ticket
|
||||
await models.TicketLog.create({
|
||||
originFk: id,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Sale',
|
||||
changedModelId: sale.id,
|
||||
oldInstance: {
|
||||
item: originalSaleData.itemFk,
|
||||
quantity: originalSaleData.quantity,
|
||||
concept: originalSaleData.concept,
|
||||
ticket: originalSaleData.ticketFk
|
||||
},
|
||||
newInstance: {
|
||||
item: sale.itemFk,
|
||||
quantity: sale.quantity,
|
||||
concept: sale.concept,
|
||||
ticket: ticketId
|
||||
}
|
||||
}, myOptions);
|
||||
|
||||
// Log to destination ticket
|
||||
await models.TicketLog.create({
|
||||
originFk: ticketId,
|
||||
userFk: userId,
|
||||
action: 'update',
|
||||
changedModel: 'Sale',
|
||||
changedModelId: sale.id,
|
||||
oldInstance: {
|
||||
item: originalSaleData.itemFk,
|
||||
quantity: originalSaleData.quantity,
|
||||
concept: originalSaleData.concept,
|
||||
ticket: originalSaleData.ticketFk
|
||||
},
|
||||
newInstance: {
|
||||
item: sale.itemFk,
|
||||
quantity: sale.quantity,
|
||||
concept: sale.concept,
|
||||
ticket: ticketId
|
||||
}
|
||||
}, myOptions);
|
||||
}
|
||||
|
||||
const isTicketEmpty = await models.Ticket.isEmpty(id, myOptions);
|
||||
|
|
|
@ -81,18 +81,6 @@ module.exports = Self => {
|
|||
]
|
||||
});
|
||||
|
||||
const oldProperties = await loggable.translateValues(Self, travel);
|
||||
const newProperties = await loggable.translateValues(Self, newTravel);
|
||||
await models.TravelLog.create({
|
||||
originFk: newTravel.id,
|
||||
userFk: userId,
|
||||
action: 'insert',
|
||||
changedModel: 'Travel',
|
||||
changedModelId: newTravel.id,
|
||||
oldInstance: oldProperties,
|
||||
newInstance: newProperties
|
||||
});
|
||||
|
||||
return newTravel.id;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -30,21 +30,6 @@ module.exports = Self => {
|
|||
SET travelFk = NULL, dmsFk = NULL
|
||||
WHERE id = ?`, [id], {userId});
|
||||
|
||||
const oldInstance = {
|
||||
travelFk: travelThermograph.travelFk,
|
||||
dmsFk: travelThermograph.dmsFk
|
||||
};
|
||||
|
||||
await models.TravelLog.create({
|
||||
originFk: travelThermograph.travelFk,
|
||||
userFk: userId,
|
||||
action: 'delete',
|
||||
changedModel: 'TravelThermograph',
|
||||
changedModelId: id,
|
||||
oldInstance: oldInstance,
|
||||
newInstance: {}
|
||||
});
|
||||
|
||||
travelThermograph.travelFk = null;
|
||||
travelThermograph.dmsFk = null;
|
||||
|
||||
|
|
Loading…
Reference in New Issue