Merge pull request 'workers without active contract no longer set calendar and timeControl at fault' (#684) from 3003-worker_sections_without_contract_faults into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #684
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2021-07-01 11:50:44 +00:00
commit cb354193c8
2 changed files with 10 additions and 3 deletions

View File

@ -91,8 +91,10 @@ class Controller extends Section {
}
getActiveContract() {
this.$http.get(`Workers/${this.worker.id}/activeContract`)
.then(res => this.businessId = res.data.businessFk);
this.$http.get(`Workers/${this.worker.id}/activeContract`).then(res => {
if (res.data)
this.businessId = res.data.businessFk;
});
}
getContractHolidays() {

View File

@ -90,7 +90,10 @@ class Controller extends Section {
getActiveContract() {
return this.$http.get(`Workers/${this.worker.id}/activeContract`)
.then(res => this.businessId = res.data.businessFk);
.then(res => {
if (res.data)
this.businessId = res.data.businessFk;
});
}
fetchHours() {
@ -111,6 +114,8 @@ class Controller extends Section {
}
getAbsences() {
if (!this.businessId) return;
const fullYear = this.started.getFullYear();
let params = {
businessFk: this.businessId,