This commit is contained in:
parent
74e6e62961
commit
9b8c58ba7d
|
@ -110,7 +110,14 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
return resultInvoice.id;
|
const notificationInfo = {
|
||||||
|
clientName: firstTicket.clientFk.name,
|
||||||
|
clientEmail: firstTicket.clientFk.email,
|
||||||
|
ticketId: resultInvoice.id,
|
||||||
|
url: ctx.req.headers.referer
|
||||||
|
};
|
||||||
|
|
||||||
|
return {invoiceId: resultInvoice.id, notificationInfo};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -248,26 +248,30 @@ class Controller extends Section {
|
||||||
if (this.ticket.address.incotermsFk && !this.ticket.weight && !force)
|
if (this.ticket.address.incotermsFk && !this.ticket.weight && !force)
|
||||||
return this.$.withoutWeightConfirmation.show();
|
return this.$.withoutWeightConfirmation.show();
|
||||||
|
|
||||||
const client = this.ticket.client;
|
|
||||||
if (client.hasElectronicInvoice) {
|
|
||||||
this.$http.post(`NotificationQueues`, {
|
|
||||||
notificationFk: 'invoice-electronic',
|
|
||||||
authorFk: client.id,
|
|
||||||
params: JSON.stringify(
|
|
||||||
{
|
|
||||||
'name': client.name,
|
|
||||||
'email': client.email,
|
|
||||||
'ticketId': this.id,
|
|
||||||
'url': window.location.href
|
|
||||||
})
|
|
||||||
}).then(() => {
|
|
||||||
this.vnApp.showSuccess(this.$t('Invoice sent'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]})
|
return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]})
|
||||||
.then(() => this.reload())
|
.then(() => this.reload())
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
.then(() => {
|
||||||
|
const client = this.ticket.client;
|
||||||
|
|
||||||
|
if (client.hasElectronicInvoice) {
|
||||||
|
const notificationData = {
|
||||||
|
name: client.name,
|
||||||
|
email: client.email,
|
||||||
|
ticketId: this.id,
|
||||||
|
url: window.location.href
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$http.post(`NotificationQueues`, {
|
||||||
|
notificationFk: 'invoice-electronic',
|
||||||
|
authorFk: client.id,
|
||||||
|
params: JSON.stringify(notificationData)
|
||||||
|
}).then(() => {
|
||||||
|
this.vnApp.showSuccess(this.$t('Invoice sent'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.vnApp.showSuccess(this.$t('Ticket invoiced'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createPdfInvoice() {
|
createPdfInvoice() {
|
||||||
|
|
Loading…
Reference in New Issue