@@ -169,12 +170,20 @@
class="link">
{{ticket.refFk}}
-
{{ticket.state}}
+
+
+
+ |
-
Filter by selection
-
Exclude selection
-
Remove filter
-
Remove all filters
-
Copy value
diff --git a/modules/route/back/methods/route/specs/clone.spec.js b/modules/route/back/methods/route/specs/clone.spec.js
index 9192854f8..496ae1c89 100644
--- a/modules/route/back/methods/route/specs/clone.spec.js
+++ b/modules/route/back/methods/route/specs/clone.spec.js
@@ -1,6 +1,22 @@
const app = require('vn-loopback/server/server');
+const LoopBackContext = require('loopback-context');
describe('route clone()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
const createdDate = Date.vnNew();
it('should throw an error if the amount of ids pased to the clone function do no match the database', async() => {
const ids = [996, 997, 998, 999];
diff --git a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js
index 5328dc240..baa63f226 100644
--- a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js
+++ b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js
@@ -1,6 +1,20 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('route updateWorkCenter()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
const routeId = 1;
it('should set the commission work center if the worker has workCenter', async() => {
diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json
index 12b9785db..3b12f4ee6 100644
--- a/modules/route/back/models/route.json
+++ b/modules/route/back/models/route.json
@@ -2,7 +2,8 @@
"name": "Route",
"base": "Loggable",
"log": {
- "model":"RouteLog"
+ "model":"RouteLog",
+ "grabUser": true
},
"options": {
"mysql": {
diff --git a/modules/ticket/back/methods/sale/specs/canEdit.spec.js b/modules/ticket/back/methods/sale/specs/canEdit.spec.js
index a6c299321..62f98421a 100644
--- a/modules/ticket/back/methods/sale/specs/canEdit.spec.js
+++ b/modules/ticket/back/methods/sale/specs/canEdit.spec.js
@@ -1,7 +1,21 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale canEdit()', () => {
const employeeId = 1;
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
describe('sale editTracked', () => {
it('should return true if the role is production regardless of the saleTrackings', async() => {
diff --git a/modules/ticket/back/methods/sale/specs/deleteSales.spec.js b/modules/ticket/back/methods/sale/specs/deleteSales.spec.js
index 82cf916b3..3d3e06e22 100644
--- a/modules/ticket/back/methods/sale/specs/deleteSales.spec.js
+++ b/modules/ticket/back/methods/sale/specs/deleteSales.spec.js
@@ -1,6 +1,21 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale deleteSales()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
it('should throw an error if the ticket of the given sales is not editable', async() => {
const tx = await models.Sale.beginTransaction({});
diff --git a/modules/ticket/back/methods/sale/specs/reserve.spec.js b/modules/ticket/back/methods/sale/specs/reserve.spec.js
index 7ab79f9c0..259cb8cd5 100644
--- a/modules/ticket/back/methods/sale/specs/reserve.spec.js
+++ b/modules/ticket/back/methods/sale/specs/reserve.spec.js
@@ -1,4 +1,5 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale reserve()', () => {
const ctx = {
@@ -9,6 +10,20 @@ describe('sale reserve()', () => {
}
};
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
it('should throw an error if the ticket can not be modified', async() => {
const tx = await models.Sale.beginTransaction({});
diff --git a/modules/ticket/back/methods/sale/specs/updateConcept.spec.js b/modules/ticket/back/methods/sale/specs/updateConcept.spec.js
index 0e7e9bf0f..1b42e7140 100644
--- a/modules/ticket/back/methods/sale/specs/updateConcept.spec.js
+++ b/modules/ticket/back/methods/sale/specs/updateConcept.spec.js
@@ -1,6 +1,21 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale updateConcept()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
const ctx = {req: {accessToken: {userId: 9}}};
const saleId = 25;
diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js
index 51cd2403f..133be8de3 100644
--- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js
+++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js
@@ -1,6 +1,21 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale updatePrice()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 18},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
const ctx = {
req: {
accessToken: {userId: 18},
diff --git a/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js b/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js
index 53a05cd7e..4778f6b6d 100644
--- a/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js
+++ b/modules/ticket/back/methods/sale/specs/updateQuantity.spec.js
@@ -1,6 +1,21 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale updateQuantity()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
const ctx = {
req: {
accessToken: {userId: 9},
diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js
index 597ece3e5..a5d04bc4c 100644
--- a/modules/ticket/back/methods/ticket/new.js
+++ b/modules/ticket/back/methods/ticket/new.js
@@ -127,19 +127,6 @@ module.exports = Self => {
], myOptions);
const ticket = await models.Ticket.findById(result[1][0].newTicketId, null, myOptions);
- const cleanInstance = JSON.parse(JSON.stringify(ticket));
-
- const logRecord = {
- originFk: cleanInstance.id,
- userFk: myUserId,
- action: 'insert',
- changedModel: 'Ticket',
- changedModelId: cleanInstance.id,
- oldInstance: {},
- newInstance: cleanInstance
- };
-
- await models.TicketLog.create(logRecord, myOptions);
if (tx) await tx.commit();
diff --git a/modules/ticket/back/methods/ticket/specs/addSale.spec.js b/modules/ticket/back/methods/ticket/specs/addSale.spec.js
index cfd149511..2e568716a 100644
--- a/modules/ticket/back/methods/ticket/specs/addSale.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/addSale.spec.js
@@ -1,7 +1,21 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('ticket addSale()', () => {
const ticketId = 13;
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
it('should create a new sale for the ticket with id 13', async() => {
const tx = await models.Ticket.beginTransaction({});
diff --git a/modules/ticket/back/methods/ticket/specs/merge.spec.js b/modules/ticket/back/methods/ticket/specs/merge.spec.js
index 78eb0c8f3..3254e58a8 100644
--- a/modules/ticket/back/methods/ticket/specs/merge.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/merge.spec.js
@@ -10,11 +10,15 @@ describe('ticket merge()', () => {
workerFk: 1
};
- const activeCtx = {
- accessToken: {userId: 9},
- };
-
- beforeEach(() => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
@@ -35,16 +39,16 @@ describe('ticket merge()', () => {
try {
const options = {transaction: tx};
- const chatNotificationBeforeMerge = await models.Chat.find();
+ const chatNotificationBeforeMerge = await models.Chat.find(null, options);
await models.Ticket.merge(ctx, [tickets], options);
- const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets.originId}}, options);
+ const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets.destinationId}}, options);
const deletedTicket = await models.Ticket.findOne({where: {id: tickets.originId}}, options);
const salesTicketFuture = await models.Sale.find({where: {ticketFk: tickets.destinationId}}, options);
- const chatNotificationAfterMerge = await models.Chat.find();
+ const chatNotificationAfterMerge = await models.Chat.find(null, options);
- expect(createdTicketLog.length).toEqual(2);
+ expect(createdTicketLog.length).toEqual(1);
expect(deletedTicket.isDeleted).toEqual(true);
expect(salesTicketFuture.length).toEqual(2);
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2);
diff --git a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js
index 1f6712087..41de1fd6e 100644
--- a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js
@@ -1,6 +1,20 @@
const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
describe('sale updateDiscount()', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
const originalSaleId = 8;
it('should throw an error if no sales were selected', async() => {
diff --git a/modules/ticket/back/models/sale.json b/modules/ticket/back/models/sale.json
index 669b05be6..7b8cf501b 100644
--- a/modules/ticket/back/models/sale.json
+++ b/modules/ticket/back/models/sale.json
@@ -4,7 +4,8 @@
"log": {
"model": "TicketLog",
"relation": "ticket",
- "showField": "concept"
+ "showField": "concept",
+ "grabUser": true
},
"options": {
"mysql": {
diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json
index 1cf2642a5..dabda838a 100644
--- a/modules/ticket/back/models/ticket.json
+++ b/modules/ticket/back/models/ticket.json
@@ -3,7 +3,8 @@
"base": "Loggable",
"log": {
"model":"TicketLog",
- "showField": "id"
+ "showField": "id",
+ "grabUser": true
},
"options": {
"mysql": {
diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js
index 027261c4b..5ee51de8e 100644
--- a/modules/travel/back/methods/travel/extraCommunityFilter.js
+++ b/modules/travel/back/methods/travel/extraCommunityFilter.js
@@ -130,6 +130,7 @@ module.exports = Self => {
SUM(b.stickers) AS stickers,
s.id AS cargoSupplierFk,
s.nickname AS cargoSupplierNickname,
+ s.name AS supplierName,
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t
@@ -167,6 +168,7 @@ module.exports = Self => {
SUM(b.stickers) AS stickers,
e.evaNotes,
e.notes,
+ e.invoiceAmount,
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg
FROM tmp.travel tr
diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json
index c20b7b0bf..7dd9f5bba 100644
--- a/modules/travel/back/models/travel.json
+++ b/modules/travel/back/models/travel.json
@@ -3,7 +3,8 @@
"base": "Loggable",
"log": {
"model":"TravelLog",
- "showField": "ref"
+ "showField": "ref",
+ "grabUser": true
},
"options": {
"mysql": {
diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html
index 376c81aaf..c888f97da 100644
--- a/modules/travel/front/extra-community/index.html
+++ b/modules/travel/front/extra-community/index.html
@@ -3,7 +3,7 @@
url="Travels/extraCommunityFilter"
user-params="::$ctrl.defaultFilter"
data="travels"
- order="shipped ASC, landed ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
+ order="landed ASC, shipped ASC, travelFk, loadPriority, agencyModeFk, supplierName, evaNotes"
limit="20"
auto-load="true">
@@ -48,6 +48,9 @@
Agency
|
+
+ Amount
+ |
Reference
|
@@ -107,6 +110,7 @@
{{::travel.cargoSupplierNickname}}
|
+ |
{{::travel.agencyModeName}} |
@@ -157,22 +161,15 @@
{{::entry.supplierName}}
|
+ {{::entry.invoiceAmount | currency: 'EUR': 2}} |
|
- {{::entry.ref}} |
+ {{::entry.invoiceNumber}} |
{{::entry.stickers}} |
|
{{::entry.loadedkg}} |
{{::entry.volumeKg}} |
-
-
- {{::entry.notes}}
-
- |
-
-
- {{::entry.evaNotes}}
-
- |
+ |
+ |
|
|
diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html
index eb133c0cd..0be5a30f0 100644
--- a/print/templates/reports/delivery-note/delivery-note.html
+++ b/print/templates/reports/delivery-note/delivery-note.html
@@ -33,7 +33,7 @@