- {{::sale.item.name}}
+ {{::sale.concept}}
{{::sale.item.subName}}
diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js
index e90c849b78..42ec6290a2 100644
--- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js
+++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js
@@ -14,7 +14,6 @@ describe('workerTimeControl add/delete timeEntry()', () => {
const tuesday = 2;
const thursday = 4;
const friday = 5;
- const saturday = 6;
const sunday = 7;
const activeCtx = {
accessToken: {userId: 50},
@@ -200,15 +199,15 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
describe('WorkerTimeControl_clockIn calls', () => {
- it('should fail to add a time entry if the target user has an absence that day', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
+ let workerId;
+ beforeEach(() => {
activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
+ workerId = hankPymId;
+ });
+ it('should fail to add a time entry if the target user has an absence that day', async() => {
const date = Date.vnNew();
- date.setDate(date.getDate() - 16);
date.setHours(8, 0, 0);
- let error;
-
+ date.setDate(date.getDate() - 16);
const tx = await models.WorkerTimeControl.beginTransaction({});
const options = {transaction: tx};
try {
@@ -225,15 +224,12 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
it('should fail to add a time entry for a worker without an existing contract', async() => {
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
const date = Date.vnNew();
date.setFullYear(date.getFullYear() - 2);
- let error;
const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
try {
- const options = {transaction: tx};
ctx.args = {timed: date, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
@@ -246,19 +242,39 @@ describe('workerTimeControl add/delete timeEntry()', () => {
expect(error.message).toBe(`No hay un contrato en vigor`);
});
+ it('should fail to add a time entry for a worker without an existing contract', async() => {
+ let date = Date.vnNew();
+ date.setDate(date.getDate() - 2);
+ let error;
+
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+ date.setHours(0, 0, 0);
+ ctx.args = {timed: date, direction: 'in'};
+ await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
+
+ try {
+ date.setHours(20,0, 1);
+ ctx.args = {timed: date, direction: 'out'};
+ await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error.message).toBe(`Superado el tiempo máximo entre entrada y salida`);
+ });
+
describe('direction errors', () => {
+ let date = Date.vnNew();
+ date.setDate(date.getDate() - 1);
+ let error;
it('should throw an error when trying "in" direction twice', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
- let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
- date = weekDay(date, monday);
- let error;
-
const tx = await models.WorkerTimeControl.beginTransaction({});
const options = {transaction: tx};
+
date.setHours(8, 0, 0);
ctx.args = {timed: date, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
@@ -278,21 +294,13 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
it('should throw an error when trying "in" direction after insert "in" and "middle"', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
- let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
- date = weekDay(date, monday);
- let error;
-
const tx = await models.WorkerTimeControl.beginTransaction({});
const options = {transaction: tx};
date.setHours(8, 0, 0);
ctx.args = {timed: date, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
+
date.setHours(9, 0, 0);
ctx.args = {timed: date, direction: 'middle'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
@@ -312,15 +320,6 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
it('Should throw an error when trying "out" before closing a "middle" couple', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
- let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
- date = weekDay(date, monday);
- let error;
-
const tx = await models.WorkerTimeControl.beginTransaction({});
const options = {transaction: tx};
@@ -346,15 +345,6 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
it('should throw an error when trying "middle" after "out"', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
- let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
- date = weekDay(date, monday);
- let error;
-
const tx = await models.WorkerTimeControl.beginTransaction({});
const options = {transaction: tx};
@@ -380,15 +370,6 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
it('should throw an error when trying "out" direction twice', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
- let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
- date = weekDay(date, monday);
- let error;
-
const tx = await models.WorkerTimeControl.beginTransaction({});
const options = {transaction: tx};
@@ -415,14 +396,12 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
describe('12h rest', () => {
+ activeCtx.accessToken.userId = salesBossId;
+ const workerId = hankPymId;
it('should throw an error when the 12h rest is not fulfilled yet', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
-
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
+ date.setDate(date.getDate() - 2);
date = weekDay(date, monday);
let error;
@@ -448,16 +427,12 @@ describe('workerTimeControl add/delete timeEntry()', () => {
error = e;
}
- expect(error.message).toBe(`Descanso diario 12h.`);
+ expect(error.message).toBe(`Descanso diario`);
});
it('should not fail as the 12h rest is fulfilled', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
+ date.setDate(date.getDate() - 2);
date = weekDay(date, monday);
let error;
@@ -488,13 +463,12 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
describe('for 3500kg drivers with enforced 9h rest', () => {
+ activeCtx.accessToken.userId = salesBossId;
+ const workerId = jessicaJonesId;
it('should throw an error when the 9h enforced rest is not fulfilled', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = jessicaJonesId;
let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
+ date.setDate(date.getDate() - 2);
date = weekDay(date, monday);
let error;
@@ -520,16 +494,13 @@ describe('workerTimeControl add/delete timeEntry()', () => {
error = e;
}
- expect(error.message).toBe(`Descanso diario 9h.`);
+ expect(error.message).toBe(`Descanso diario`);
});
it('should not fail when the 9h enforced rest is fulfilled', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = jessicaJonesId;
-
+
let date = Date.vnNew();
- date.setDate(date.getDate() - 21);
+ date.setDate(date.getDate() - 2);
date = weekDay(date, monday);
let error;
@@ -559,14 +530,11 @@ describe('workerTimeControl add/delete timeEntry()', () => {
});
});
- describe('for 36h weekly rest', () => {
- it('should throw an error when the 36h weekly rest is not fulfilled', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
+ describe('for 72h weekly rest', () => {
+
+ it('should throw an error when work 11 consecutive days', async() => {
let date = Date.vnNew();
- date.setMonth(date.getMonth() - 2);
+ date.setMonth(date.getMonth() - 1);
date.setDate(1);
let error;
@@ -576,66 +544,24 @@ describe('workerTimeControl add/delete timeEntry()', () => {
await populateWeek(date, monday, sunday, ctx, workerId, options);
date = nextWeek(date);
await populateWeek(date, monday, thursday, ctx, workerId, options);
- date = weekDay(date, friday);
- date.setHours(7, 59, 0);
- ctx.args = {timed: date, direction: 'in'};
- await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
-
try {
- date.setHours(8, 1, 0);
- ctx.args = {timed: date, direction: 'out'};
- await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- error = e;
- }
-
- expect(error.message).toBe(`Descanso semanal 36h. / 72h.`);
- });
-
- it('should throw an error when the 36h weekly rest is not fulfilled again', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
-
- let date = Date.vnNew();
- date.setMonth(date.getMonth() - 2);
- date.setDate(1);
- let error;
-
- const tx = await models.WorkerTimeControl.beginTransaction({});
- const options = {transaction: tx};
-
- await populateWeek(date, monday, sunday, ctx, workerId, options);
- date = nextWeek(date);
- await populateWeek(date, monday, thursday, ctx, workerId, options);
-
- try {
- date = weekDay(date, saturday);
- date.setHours(3, 59, 0);
+ date = weekDay(date, friday);
+ date.setHours(10, 0, 1);
ctx.args = {timed: date, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
-
await tx.rollback();
} catch (e) {
await tx.rollback();
error = e;
}
- expect(error.message).toBe(`Descanso semanal 36h. / 72h.`);
+ expect(error.message).toBe(`Descanso semanal`);
});
- });
- describe('for 72h weekly rest', () => {
- it('should throw when the 72h weekly rest is not fulfilled yet', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- activeCtx.accessToken.userId = salesBossId;
- const workerId = hankPymId;
+ it('should throw an error when the 72h weekly rest is not fulfilled', async() => {
let date = Date.vnNew();
- date.setMonth(date.getMonth() - 2);
+ date.setMonth(date.getMonth() - 1);
date.setDate(1);
let error;
@@ -645,32 +571,263 @@ describe('workerTimeControl add/delete timeEntry()', () => {
await populateWeek(date, monday, sunday, ctx, workerId, options);
date = nextWeek(date);
await populateWeek(date, monday, thursday, ctx, workerId, options);
- date = nextWeek(date);
- await populateWeek(date, monday, friday, ctx, workerId, options);
- date = nextWeek(date);
- await populateWeek(date, monday, saturday, ctx, workerId, options);
- date = nextWeek(date);
- await populateWeek(date, monday, saturday, ctx, workerId, options);
- date = lastWeek(date);
try {
date = weekDay(date, sunday);
- date.setHours(8, 0, 0);
+ date.setHours(17, 59, 0);
ctx.args = {timed: date, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
-
await tx.rollback();
} catch (e) {
await tx.rollback();
error = e;
}
- expect(error.message).toBe(`Descanso semanal 36h. / 72h.`);
+ expect(error.message).toBe(`Descanso semanal`);
+ });
+
+ it('should throw an error when the 72h weekly rest is fulfilled', async() => {
+
+ let date = Date.vnNew();
+ date.setMonth(date.getMonth() - 1);
+ date.setDate(1);
+ let error;
+
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ await populateWeek(date, monday, sunday, ctx, workerId, options);
+ date = nextWeek(date);
+ await populateWeek(date, monday, thursday, ctx, workerId, options);
+
+ try {
+ date = weekDay(date, sunday);
+ date.setHours(18, 00, 0);
+ ctx.args = {timed: date, direction: 'in'};
+ await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error).not.toBeDefined;
+ });
+ });
+
+ describe('WorkerTimeControl_calculate calls', () => {
+ let dated = Date.vnNew();
+ dated.setDate(dated.getDate() - 7);
+ dated = new Date(weekDay(dated, monday));
+ const end = new Date(dated);
+ end.setDate(end.getDate() + 1);
+
+ it(`should return today's worked 8 hours without break`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(28800);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return today's worked hours with 15min break and work time consecutive less than 5h`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ dated.setHours(14, 59, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+ dated.setHours(15, 14, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(28800);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return today's worked hours with 15min break and work time consecutive greater than 5h`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ dated.setHours(15, 0, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+ dated.setHours(15, 15, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(28800);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return today's worked hours with 25min break and work time consecutive less than 5h`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ dated.setHours(14, 59, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+ dated.setHours(15, 24, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(28500);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return today's worked hours with 25min break and work time consecutive greater than 5h`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ dated.setHours(15, 0, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+ dated.setHours(15, 25, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(28500);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return today's worked hours with 60min break and work time consecutive less than 5h`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ dated.setHours(14, 59, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+ dated.setHours(15, 59, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(25200);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return today's worked hours with 60min break and work time consecutive greater than 5h`, async() => {
+ const tx = await models.WorkerTimeControl.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ await populateWeek(dated, monday, monday, ctx, hankPymId, options);
+ dated.setHours(15, 0, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+ dated.setHours(16, 0, 0);
+ await addTimeEntry(ctx, dated, 'middle', hankPymId, options);
+
+ const start = new Date(dated - 1);
+ start.setHours(0, 0, 0);
+ await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [
+ hankPymId,
+ start,
+ end
+ ], options);
+
+ let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options);
+
+ expect(timeControlCalculateTable.timeWorkSeconds).toEqual(26400);
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
});
});
});
});
+async function addTimeEntry(ctx, dated, direction, userId, option) {
+ ctx.args = {timed: dated, direction};
+ await models.WorkerTimeControl.addTimeEntry(ctx, userId, option);
+}
+
function weekDay(date, dayToSet) {
const currentDay = date.getDay();
const distance = dayToSet - currentDay;
@@ -704,10 +861,10 @@ async function populateWeek(date, dayStart, dayEnd, ctx, workerId, options) {
dateEnd.setDate(dateStart.getDate() + dayEnd);
for (let i = dayStart; i <= dayEnd; i++) {
- dateStart.setHours(8, 0, 0);
+ dateStart.setHours(10, 0, 0);
ctx.args = {timed: dateStart, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
- dateStart.setHours(16, 0, 0);
+ dateStart.setHours(18, 0, 0);
ctx.args = {timed: dateStart, direction: 'out'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
dateStart.setDate(dateStart.getDate() + 1);
diff --git a/modules/worker/back/models/operator.json b/modules/worker/back/models/operator.json
index 2417078e1a..6da3945fc3 100644
--- a/modules/worker/back/models/operator.json
+++ b/modules/worker/back/models/operator.json
@@ -33,6 +33,16 @@
"type": "belongsTo",
"model": "Sector",
"foreignKey": "sectorFk"
+ },
+ "train": {
+ "type": "belongsTo",
+ "model": "Train",
+ "foreignKey": "trainFk"
+ },
+ "printer": {
+ "type": "belongsTo",
+ "model": "Printer",
+ "foreignKey": "labelerFk"
}
}
}
diff --git a/modules/worker/front/index.js b/modules/worker/front/index.js
index 8fad2c0df7..5c03dc8de7 100644
--- a/modules/worker/front/index.js
+++ b/modules/worker/front/index.js
@@ -20,4 +20,5 @@ import './dms/create';
import './dms/edit';
import './note/index';
import './note/create';
+import './notifications';
diff --git a/modules/worker/front/notifications/index.html b/modules/worker/front/notifications/index.html
new file mode 100644
index 0000000000..7fb3b870e0
--- /dev/null
+++ b/modules/worker/front/notifications/index.html
@@ -0,0 +1,2 @@
+
+
diff --git a/modules/worker/front/notifications/index.js b/modules/worker/front/notifications/index.js
new file mode 100644
index 0000000000..622892979a
--- /dev/null
+++ b/modules/worker/front/notifications/index.js
@@ -0,0 +1,21 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+class Controller extends Section {
+ constructor($element, $) {
+ super($element, $);
+ }
+
+ async $onInit() {
+ const url = await this.vnApp.getUrl(`worker/${this.$params.id}/notifications`);
+ window.open(url).focus();
+ }
+}
+
+ngModule.vnComponent('vnWorkerNotifications', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ ticket: '<'
+ }
+});
diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json
index 7906b1f45c..489b4346a4 100644
--- a/modules/worker/front/routes.json
+++ b/modules/worker/front/routes.json
@@ -15,6 +15,7 @@
{"state": "worker.card.timeControl", "icon": "access_time"},
{"state": "worker.card.calendar", "icon": "icon-calendar"},
{"state": "worker.card.pda", "icon": "phone_android"},
+ {"state": "worker.card.notifications", "icon": "notifications"},
{"state": "worker.card.pbx", "icon": "icon-pbx"},
{"state": "worker.card.dms.index", "icon": "cloud_upload"},
{
@@ -112,6 +113,14 @@
"params": {
"worker": "$ctrl.worker"
}
+ }, {
+ "url": "/notifications",
+ "state": "worker.card.notifications",
+ "component": "vn-worker-notifications",
+ "description": "Notifications",
+ "params": {
+ "worker": "$ctrl.worker"
+ }
}, {
"url": "/time-control?timestamp",
"state": "worker.card.timeControl",
diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js
index 36a632c584..0a955c5862 100644
--- a/modules/worker/front/time-control/index.js
+++ b/modules/worker/front/time-control/index.js
@@ -111,9 +111,10 @@ class Controller extends Section {
dayIndex.setDate(dayIndex.getDate() + 1);
}
- if (!this.weekTotalHours) this.fetchHours();
- if (this.worker)
+ if (this.worker) {
+ this.fetchHours();
this.getWeekData();
+ }
}
set weekTotalHours(totalHours) {
diff --git a/package-lock.json b/package-lock.json
index 5bf7a2cb1e..b66279ae36 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "salix-back",
- "version": "23.46.01",
+ "version": "23.48.01",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "salix-back",
- "version": "23.46.01",
+ "version": "23.48.01",
"license": "GPL-3.0",
"dependencies": {
"axios": "^1.2.2",
diff --git a/package.json b/package.json
index b1539f9a06..04fcb008bc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-back",
- "version": "23.46.01",
+ "version": "23.48.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",
diff --git a/print/templates/reports/invoice-incoterms/sql/incoterms.sql b/print/templates/reports/invoice-incoterms/sql/incoterms.sql
index 435b3a51ac..0c4af803d8 100644
--- a/print/templates/reports/invoice-incoterms/sql/incoterms.sql
+++ b/print/templates/reports/invoice-incoterms/sql/incoterms.sql
@@ -1,7 +1,7 @@
SELECT io.issued,
c.socialName,
c.street postalAddress,
- IF (ios.taxAreaFk IS NOT NULL, CONCAT(cty.code, c.fi), c.fi) fi,
+ c.fi,
io.clientFk,
c.postcode,
c.city,
@@ -50,7 +50,7 @@ SELECT io.issued,
) sub2 ON TRUE
JOIN vn.itemTaxCountry itc ON itc.countryFk = su.countryFk AND itc.itemFk = s.itemFk
JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
- LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial AND ios.taxAreaFk = 'CEE'
+ JOIN vn.invoiceOutSerial ios ON ios.code = io.serial AND ios.taxAreaFk = 'WORLD'
JOIN vn.country cty ON cty.id = c.countryFk
JOIN vn.payMethod pm ON pm.id = c .payMethodFk
JOIN vn.company co ON co.id=io.companyFk