refs #5772 feat: si falla al enviar el pdf, envia un rocket al comercial
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
807596f735
commit
9d1a181b73
|
@ -7,29 +7,29 @@ class Controller extends Section {
|
|||
$onInit() {
|
||||
const date = Date.vnNew();
|
||||
Object.assign(this, {
|
||||
maxShipped: new Date(date.getFullYear(), date.getMonth(), 0),
|
||||
clientsToInvoice: 'all',
|
||||
maxShipped: new Date(date.getFullYear(), date.getMonth(), 0),
|
||||
clientsToInvoice: 'all',
|
||||
});
|
||||
|
||||
this.$http.get('UserConfigs/getUserConfig')
|
||||
.then(res => {
|
||||
this.companyFk = res.data.companyFk;
|
||||
this.getInvoiceDate(this.companyFk);
|
||||
});
|
||||
}
|
||||
.then(res => {
|
||||
this.companyFk = res.data.companyFk;
|
||||
this.getInvoiceDate(this.companyFk);
|
||||
});
|
||||
}
|
||||
|
||||
getInvoiceDate(companyFk) {
|
||||
const params = { companyFk: companyFk };
|
||||
getInvoiceDate(companyFk) {
|
||||
const params = {companyFk: companyFk};
|
||||
this.fetchInvoiceDate(params);
|
||||
}
|
||||
}
|
||||
|
||||
fetchInvoiceDate(params) {
|
||||
this.$http.get('InvoiceOuts/getInvoiceDate', { params })
|
||||
.then(res => {
|
||||
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null;
|
||||
this.invoiceDate = this.minInvoicingDate;
|
||||
});
|
||||
}
|
||||
fetchInvoiceDate(params) {
|
||||
this.$http.get('InvoiceOuts/getInvoiceDate', {params})
|
||||
.then(res => {
|
||||
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null;
|
||||
this.invoiceDate = this.minInvoicingDate;
|
||||
});
|
||||
}
|
||||
|
||||
stopInvoicing() {
|
||||
this.status = 'stopping';
|
||||
|
@ -111,11 +111,34 @@ class Controller extends Section {
|
|||
if (res.status >= 400 && res.status < 500) {
|
||||
const error = res.data?.error;
|
||||
let isWarning;
|
||||
switch(error?.code) {
|
||||
case 'pdfError':
|
||||
case 'mailNotSent':
|
||||
isWarning = true;
|
||||
break;
|
||||
const filter = {
|
||||
where: {
|
||||
id: address.clientId
|
||||
}
|
||||
};
|
||||
switch (error?.code) {
|
||||
case 'pdfError':
|
||||
isWarning = true;
|
||||
break;
|
||||
case 'mailNotSent':
|
||||
this.$http.get(`Clients/findOne`, {filter})
|
||||
.then(res => {
|
||||
const salesPersonFk = res.data.salesPersonFk;
|
||||
if (!salesPersonFk) return;
|
||||
|
||||
const message = this.$t('Mail not sent', {
|
||||
clientId: address.clientId,
|
||||
clientUrl: `${window.location.origin}/#!/client/${this.clientId}/summary`
|
||||
});
|
||||
|
||||
const params = {
|
||||
workerId: salesPersonFk,
|
||||
message: message,
|
||||
};
|
||||
this.$http.post('Chats/sendCheckingPresence', params);
|
||||
});
|
||||
isWarning = true;
|
||||
break;
|
||||
}
|
||||
|
||||
const message = error?.message || res.message;
|
||||
|
@ -126,7 +149,7 @@ class Controller extends Section {
|
|||
this.status = 'done';
|
||||
throw new UserError(`Critical invoicing error, proccess stopped`);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
invoiceNext() {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Mail not sent: There has been an error sending the invoice to the client {{clientId}} {{clientUrl}}, please check the email address
|
|
@ -18,4 +18,5 @@ Invoice out: Facturar
|
|||
One client: Un solo cliente
|
||||
Choose a valid client: Selecciona un cliente válido
|
||||
Stop: Parar
|
||||
Critical invoicing error, proccess stopped: Error crítico al facturar, proceso detenido
|
||||
Critical invoicing error, proccess stopped: Error crítico al facturar, proceso detenido
|
||||
Mail not sent: Se ha producido un fallo al enviar la factura al cliente {{clientId}} {{clientUrl}}, por favor revisa la dirección de correo electrónico
|
||||
|
|
Loading…
Reference in New Issue