fix: refs #6276 sectorCollection_getSales
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
ae89d59bde
commit
e849f0b6e2
|
@ -92,9 +92,29 @@ module.exports = Self => {
|
||||||
|
|
||||||
for (let sale of sales) {
|
for (let sale of sales) {
|
||||||
if (sale.ticketFk == ticketFk) {
|
if (sale.ticketFk == ticketFk) {
|
||||||
sale.placements = placements.filter(placement =>
|
sale.placements = [];
|
||||||
placement.saleFk == sale.saleFk && placement.order
|
for (const salePlacement of placements) {
|
||||||
);
|
let placement;
|
||||||
|
if (salePlacement.saleFk == sale.saleFk && salePlacement.order) {
|
||||||
|
placement = {
|
||||||
|
saleFk: salePlacement.saleFk,
|
||||||
|
itemFk: salePlacement.itemFk,
|
||||||
|
placement: salePlacement.placement,
|
||||||
|
shelving: salePlacement.shelving,
|
||||||
|
created: salePlacement.created,
|
||||||
|
visible: salePlacement.visible,
|
||||||
|
order: salePlacement.order,
|
||||||
|
grouping: salePlacement.grouping,
|
||||||
|
priority: salePlacement.priority,
|
||||||
|
saleOrder: salePlacement.saleOrder,
|
||||||
|
isPreviousPrepared: salePlacement.isPreviousPrepared,
|
||||||
|
itemShelvingSaleFk: salePlacement.itemShelvingSaleFk,
|
||||||
|
ticketFk: salePlacement.ticketFk,
|
||||||
|
id: salePlacement.id
|
||||||
|
};
|
||||||
|
sale.placements.push(placement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sale.barcodes = [];
|
sale.barcodes = [];
|
||||||
for (const barcode of barcodes) {
|
for (const barcode of barcodes) {
|
||||||
|
@ -143,7 +163,7 @@ module.exports = Self => {
|
||||||
if (state) {
|
if (state) {
|
||||||
await Self.rawSql(
|
await Self.rawSql(
|
||||||
'CALL vn.ticketStateToday_setState(?,?)',
|
'CALL vn.ticketStateToday_setState(?,?)',
|
||||||
[id, source],
|
[id, state],
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,4 +56,23 @@ describe('collection getSalesFromTicketOrCollection()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should add a ticketTracking', async() => {
|
||||||
|
const collectionOrTicketFk = 23;
|
||||||
|
|
||||||
|
const tx = await models.Collection.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
try {
|
||||||
|
const ticketTrackingBefore = await models.TicketTracking.find(null, options);
|
||||||
|
await models.Collection.getSalesFromTicketOrCollection(ctx,
|
||||||
|
collectionOrTicketFk, print, source, options);
|
||||||
|
const ticketTrackingAfter = await models.TicketTracking.find(null, options);
|
||||||
|
|
||||||
|
expect(ticketTrackingAfter.length).toEqual(ticketTrackingBefore.length + 1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue