refator: code unified
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-17 09:49:47 +02:00
parent 5918b3e0df
commit 15ba6681af
2 changed files with 9 additions and 11 deletions

View File

@ -102,7 +102,7 @@ module.exports = Self => {
// Validates ticket nagative base
const hasAnyNegativeBase = await getNegativeBase(myOptions);
if (hasAnyNegativeBase && isSpanishCompany)
return tx.rollback(); // continue
return tx.rollback();
query = `SELECT invoiceSerial(?, ?, ?) AS serial`;
const [invoiceSerial] = await Self.rawSql(query, [
@ -132,7 +132,7 @@ module.exports = Self => {
id: client.id,
stacktrace: e
});
await notifyFailures(ctx, failedClients, myOptions); // continue
await notifyFailures(ctx, failedClients, myOptions);
}
if (tx) await tx.commit();

View File

@ -5,8 +5,6 @@ import './style.scss';
class Controller extends Dialog {
constructor($element, $, $transclude) {
super($element, $, $transclude);
this.lastClientId = null;
this.invoice = {
maxShipped: new Date()
};
@ -46,6 +44,11 @@ class Controller extends Dialog {
this.invoice.companyFk = value;
}
restartValues() {
this.lastClientId = null;
this.$.invoiceButton.disabled = false;
}
async responseHandler(response) {
try {
if (response !== 'accept')
@ -92,15 +95,10 @@ class Controller extends Dialog {
})
.then(() => super.responseHandler(response))
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
.finally(() => {
this.lastClientId = null; // unificar en una función
this.$.invoiceButton.disabled = false; // unificar en una función
});
.finally(() => this.restartValues());
} catch (e) {
this.restartValues();
this.vnApp.showError(this.$t(e.message));
this.lastClientId = null; // unificar en una función
this.$.invoiceButton.disabled = false; // unificar en una función
throw e;
return false;
}
}