This commit is contained in:
parent
3305d2897c
commit
39b52e706a
|
@ -150,7 +150,7 @@
|
|||
"Receipt's bank was not found": "Receipt's bank was not found",
|
||||
"This receipt was not compensated": "This receipt was not compensated",
|
||||
"Client's email was not found": "Client's email was not found",
|
||||
"Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d",
|
||||
"Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %s",
|
||||
"It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
|
||||
"It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
|
||||
"It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
|
||||
|
|
|
@ -272,7 +272,7 @@
|
|||
"Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
|
||||
"Warehouse inventory not set": "El almacén inventario no está establecido",
|
||||
"This locker has already been assigned": "Esta taquilla ya ha sido asignada",
|
||||
"Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d",
|
||||
"Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %s",
|
||||
"Not exist this branch": "La rama no existe",
|
||||
"This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
|
||||
"Collection does not exist": "La colección no existe",
|
||||
|
|
|
@ -272,7 +272,7 @@
|
|||
"Invoice date can't be less than max date": "La date de la facture ne peut pas être inférieure à la date limite",
|
||||
"Warehouse inventory not set": "L'inventaire de l'entrepôt n'est pas établi",
|
||||
"This locker has already been assigned": "Ce casier a déjà été assigné",
|
||||
"Tickets with associated refunds": "Vous ne pouvez pas supprimer des tickets avec des remboursements associés. Ce ticket est associé au remboursement Nº %d",
|
||||
"Tickets with associated refunds": "Vous ne pouvez pas supprimer des tickets avec des remboursements associés. Ce ticket est associé au remboursement Nº %s",
|
||||
"Not exist this branch": "La branche n'existe pas",
|
||||
"This ticket cannot be signed because it has not been boxed": "Ce ticket ne peut pas être signé car il n'a pas été emballé",
|
||||
"Collection does not exist": "La collection n'existe pas",
|
||||
|
|
|
@ -43,11 +43,22 @@ module.exports = Self => {
|
|||
|
||||
// Check if ticket has refunds
|
||||
const ticketRefunds = await models.TicketRefund.find({
|
||||
where: {originalTicketFk: id},
|
||||
fields: ['id']}
|
||||
, myOptions);
|
||||
if (ticketRefunds.length > 0)
|
||||
throw new UserError('Tickets with associated refunds', 'TICKET_REFUND', ticketRefunds[0].id);
|
||||
include: [
|
||||
{relation: 'refundTicket'}
|
||||
],
|
||||
where: {originalTicketFk: id}
|
||||
}, myOptions);
|
||||
|
||||
const allDeleted = ticketRefunds.every(refund => refund.refundTicket().isDeleted);
|
||||
|
||||
if (ticketRefunds?.length && !allDeleted) {
|
||||
const notDeleted = [];
|
||||
for (const refund of ticketRefunds)
|
||||
if (!refund.refundTicket().isDeleted) notDeleted.push(refund.refundTicket().id);
|
||||
|
||||
throw new UserError('Tickets with associated refunds', 'TICKET_REFUND',
|
||||
notDeleted.join(', '));
|
||||
}
|
||||
|
||||
// Check if has sales with shelving
|
||||
const canDeleteTicketWithPartPrepared =
|
||||
|
|
Loading…
Reference in New Issue