fix: refs #7906 remake method #3109

Merged
carlossa merged 8 commits from 7906-notDeleteZone into dev 2024-10-18 08:33:04 +00:00
3 changed files with 8 additions and 4 deletions
Showing only changes of commit 46e657675b - Show all commits

View File

@ -240,5 +240,6 @@
"There is already a tray with the same height": "There is already a tray with the same height",
"The height must be greater than 50cm": "The height must be greater than 50cm",
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line"
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first"
}

View File

@ -382,5 +382,6 @@
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
"No valid travel thermograph found": "No se encontró un termógrafo válido",
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
"type cannot be blank": "Se debe rellenar el tipo"
}
"type cannot be blank": "Se debe rellenar el tipo",
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero"
}

View File

@ -1,3 +1,4 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('deleteZone', {
description: 'Delete a zone',
@ -57,7 +58,8 @@ module.exports = Self => {
where: {id: userId}
}, myOptions);
carlossa marked this conversation as resolved Outdated
Outdated
Review

Quitar

Quitar
await models.Ticket.rawSql('UPDATE ticket SET zoneFk = NULL WHERE zoneFk = ?', [id], myOptions);
if (ticketList.length > 0)
throw new UserError('There are tickets for this area, delete them first');
for (ticket of ticketList) {
carlossa marked this conversation as resolved Outdated
Outdated
Review

Pero si no se vol que se puga si te tickets, ja no cal mirar els tickets no?

Pero si no se vol que se puga si te tickets, ja no cal mirar els tickets no?
if (ticket.ticketState().alertLevel == 0) {