Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into hotfix-7323workerHoliday
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
cb516d2022
|
@ -7,7 +7,8 @@ def RUN_BUILD
|
||||||
|
|
||||||
def BRANCH_ENV = [
|
def BRANCH_ENV = [
|
||||||
test: 'test',
|
test: 'test',
|
||||||
master: 'production'
|
master: 'production',
|
||||||
|
beta: 'production'
|
||||||
]
|
]
|
||||||
|
|
||||||
node {
|
node {
|
||||||
|
@ -18,7 +19,8 @@ node {
|
||||||
PROTECTED_BRANCH = [
|
PROTECTED_BRANCH = [
|
||||||
'dev',
|
'dev',
|
||||||
'test',
|
'test',
|
||||||
'master'
|
'master',
|
||||||
|
'beta'
|
||||||
].contains(env.BRANCH_NAME)
|
].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||||
|
|
|
@ -130,6 +130,9 @@
|
||||||
"Payment": {
|
"Payment": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"PbxConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Postcode": {
|
"Postcode": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "PbxConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "pbx.config"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"defaultPrefix": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"property": "*",
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "employee",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -2040,7 +2040,7 @@ INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxC
|
||||||
INSERT INTO `pbx`.`config` (id,defaultPrefix)
|
INSERT INTO `pbx`.`config` (id,defaultPrefix)
|
||||||
VALUES (1,'0034');
|
VALUES (1,'0034');
|
||||||
|
|
||||||
INSERT INTO `pbx`.`prefix` (country, prefix)
|
INSERT IGNORE INTO `pbx`.`prefix` (country, prefix)
|
||||||
VALUES
|
VALUES
|
||||||
('es', '0034'),
|
('es', '0034'),
|
||||||
('fr', '0033'),
|
('fr', '0033'),
|
||||||
|
@ -4028,7 +4028,8 @@ INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, c
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
|
||||||
VALUES (19, '1169'),
|
VALUES (19, '1169'),
|
||||||
(8, '1183');
|
(8, '1183'),
|
||||||
|
(1, '1320');
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
||||||
VALUES ('saysimle-url-mock', 1320);
|
VALUES ('saysimle-url-mock', '1819');
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWithoutInventory`(
|
||||||
|
vItemFk INT,
|
||||||
|
vWarehouseFk INT
|
||||||
|
)
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Retorna la última compra que no sea inventario.
|
||||||
|
*
|
||||||
|
* @param vItemFk Id del artículo
|
||||||
|
* @param vWarehouseFk Id del almacén
|
||||||
|
* @return Id de compra
|
||||||
|
*/
|
||||||
|
DECLARE vBuyFk INT;
|
||||||
|
|
||||||
|
SELECT b.id INTO vBuyFk
|
||||||
|
FROM buy b
|
||||||
|
JOIN entry e ON e.id = b.entryFk
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
WHERE e.id <> (SELECT defaultEntry FROM entryConfig)
|
||||||
|
AND e.supplierFk <> (SELECT supplierFk FROM inventoryConfig)
|
||||||
|
AND e.typeFk <> 'inventory'
|
||||||
|
AND b.itemFk = vItemFk
|
||||||
|
AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL)
|
||||||
|
ORDER BY ABS(DATEDIFF(util.VN_CURDATE(), t.landed)), e.created DESC
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
RETURN vBuyFk;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -54,7 +54,9 @@ proc:BEGIN
|
||||||
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
|
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
|
||||||
AND clientFk = vClientFk
|
AND clientFk = vClientFk
|
||||||
AND addressFk = vAddressFk
|
AND addressFk = vAddressFk
|
||||||
AND warehouseFk = vWarehouseFk;
|
AND warehouseFk = vWarehouseFk
|
||||||
|
AND nickname = 'CAJAS AUTOCONSUMO'
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
||||||
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
|
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
INSERT IGNORE INTO vn.saySimpleCountry
|
||||||
|
SET countryFk = 1,
|
||||||
|
channel = '1320';
|
||||||
|
|
||||||
|
UPDATE vn.saySimpleConfig
|
||||||
|
SET defaultChannel = '1819';
|
||||||
|
|
||||||
|
INSERT IGNORE INTO pbx.prefix (country, prefix) VALUES
|
||||||
|
('ES', '0034'),
|
||||||
|
('IT', '0039'),
|
||||||
|
('DE', '0049'),
|
||||||
|
('RO', '0040'),
|
||||||
|
('NL', '0031'),
|
||||||
|
('BE', '0032'),
|
||||||
|
('RU', '007'),
|
||||||
|
('PT', '00351'),
|
||||||
|
('LT', '00370'),
|
||||||
|
('UA', '00380'),
|
||||||
|
('CO', '0057'),
|
||||||
|
('FI', '00358'),
|
||||||
|
('EC', '00593'),
|
||||||
|
('LB', '00961'),
|
||||||
|
('IL', '00972'),
|
||||||
|
('TH', '0066'),
|
||||||
|
('PA', '00507'),
|
||||||
|
('GB', '0044'),
|
||||||
|
('FR', '0033'),
|
||||||
|
('PL', '0048'),
|
||||||
|
('MX', '0052'),
|
||||||
|
('MA', '00212'),
|
||||||
|
('AI', '001268'),
|
||||||
|
('GH', '00233'),
|
||||||
|
('SE', '0046'),
|
||||||
|
('AE', '00971'),
|
||||||
|
('KE', '00254'),
|
||||||
|
('AD', '00376'),
|
||||||
|
('AO', '00244'),
|
||||||
|
('LU', '00352'),
|
||||||
|
('BY', '00375'),
|
||||||
|
('MD', '00373'),
|
||||||
|
('DK', '0045'),
|
||||||
|
('ET', '00251'),
|
||||||
|
('AU', '0061'),
|
||||||
|
('CA', '0001'),
|
||||||
|
('CL', '0056'),
|
||||||
|
('CN', '0086'),
|
||||||
|
('CR', '00506'),
|
||||||
|
('GT', '00502'),
|
||||||
|
('CI', '00225'),
|
||||||
|
('PE', '0051'),
|
||||||
|
('LK', '0094'),
|
||||||
|
('ZA', '0027'),
|
||||||
|
('TR', '0090'),
|
||||||
|
('ZW', '00263'),
|
||||||
|
('MY', '0060'),
|
||||||
|
('NZ', '0064'),
|
||||||
|
('IE', '00353'),
|
||||||
|
('MN', '00976'),
|
||||||
|
('SV', '00503'),
|
||||||
|
('ZM', '00260'),
|
||||||
|
('JP', '0081'),
|
||||||
|
('RW', '00250'),
|
||||||
|
('AL', '00355'),
|
||||||
|
('KW', '00965'),
|
||||||
|
('SG', '0065'),
|
||||||
|
('SR', '00597'),
|
||||||
|
('KR', '0082'),
|
||||||
|
('US', '0001'),
|
||||||
|
('RS', '00381'),
|
||||||
|
('AT', '0043'),
|
||||||
|
('EG', '0020'),
|
||||||
|
('LV', '00371'),
|
||||||
|
('CY', '00357'),
|
||||||
|
('CZ', '00420'),
|
||||||
|
('BB', '001246'),
|
||||||
|
('SK', '00421'),
|
||||||
|
('IN', '0091'),
|
||||||
|
('DZ', '00213'),
|
||||||
|
('BR', '0055'),
|
||||||
|
('GR', '0030'),
|
||||||
|
('MC', '00377'),
|
||||||
|
('SI', '00386'),
|
||||||
|
('GP', '00590'),
|
||||||
|
('NO', '0047'),
|
||||||
|
('CH', '0041'),
|
||||||
|
('AR', '0054'),
|
||||||
|
('CU', '0053'),
|
||||||
|
('GQ', '00240'),
|
||||||
|
('GN', '00224'),
|
||||||
|
('HN', '00504'),
|
||||||
|
('ML', '00223'),
|
||||||
|
('NI', '00505'),
|
||||||
|
('PK', '0092'),
|
||||||
|
('PY', '00595'),
|
||||||
|
('SN', '00221'),
|
||||||
|
('UY', '00598'),
|
||||||
|
('VE', '0058'),
|
||||||
|
('BG', '00359'),
|
||||||
|
('GE', '00995'),
|
||||||
|
('EE', '00372'),
|
||||||
|
('SA', '00966'),
|
||||||
|
('RN', '00234'),
|
||||||
|
('HK', '00852'),
|
||||||
|
('GI', '00350'),
|
||||||
|
('CM', '00237'),
|
||||||
|
('HU', '0036'),
|
||||||
|
('AM', '00374');
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.ticket DROP FOREIGN KEY tickets_zone_fk;
|
||||||
|
ALTER TABLE vn.ticket ADD CONSTRAINT tickets_zone_fk FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@ -9,6 +9,10 @@ module.exports = Self => {
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id',
|
description: 'The entry id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'showEntryLines',
|
||||||
|
type: 'boolean',
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
|
|
@ -47,8 +47,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
for (const buy of buys) {
|
for (const buy of buys) {
|
||||||
if (buy.stickers < 1) continue;
|
if (buy.stickers < 1) continue;
|
||||||
ctx.args.id = buy.id;
|
ctx.args = {...ctx.args, id: buy.id, showEntryLines: true};
|
||||||
ctx.args.copies = buy.stickers;
|
|
||||||
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
|
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
|
||||||
await merger.add(new Uint8Array(pdfBuffer[0]));
|
await merger.add(new Uint8Array(pdfBuffer[0]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,12 @@ module.exports = Self => {
|
||||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||||
http: {source: 'query'}
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The invoiceOut id',
|
||||||
|
http: {source: 'query'}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
arg: 'search',
|
arg: 'search',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -106,6 +112,8 @@ module.exports = Self => {
|
||||||
return {'i.created': value};
|
return {'i.created': value};
|
||||||
case 'clientFk':
|
case 'clientFk':
|
||||||
return {'i.clientFk': value};
|
return {'i.clientFk': value};
|
||||||
|
case 'id':
|
||||||
|
return {'i.id': value};
|
||||||
case 'fi':
|
case 'fi':
|
||||||
return {'c.fi': value};
|
return {'c.fi': value};
|
||||||
case 'amount':
|
case 'amount':
|
||||||
|
|
|
@ -88,6 +88,11 @@ module.exports = Self => {
|
||||||
arg: 'alertLevel',
|
arg: 'alertLevel',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: `The alert level of the tickets`
|
description: `The alert level of the tickets`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'countryFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The country id filter'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -182,6 +187,7 @@ module.exports = Self => {
|
||||||
t.totalWithVat,
|
t.totalWithVat,
|
||||||
io.id invoiceOutId,
|
io.id invoiceOutId,
|
||||||
a.provinceFk,
|
a.provinceFk,
|
||||||
|
p.countryFk,
|
||||||
p.name province,
|
p.name province,
|
||||||
w.name warehouse,
|
w.name warehouse,
|
||||||
am.name agencyMode,
|
am.name agencyMode,
|
||||||
|
@ -360,6 +366,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
case 'agencyModeFk':
|
case 'agencyModeFk':
|
||||||
case 'warehouseFk':
|
case 'warehouseFk':
|
||||||
|
case 'countryFk':
|
||||||
param = `f.${param}`;
|
param = `f.${param}`;
|
||||||
return {[param]: value};
|
return {[param]: value};
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,10 +387,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
newOrderFromTicket() {
|
newOrderFromTicket() {
|
||||||
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => {
|
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => {
|
||||||
const path = this.$state.href('order.card.catalog', {id: res.data});
|
const path = await this.vnApp.getUrl(`order/${res.data}/catalog`);
|
||||||
window.open(path, '_blank');
|
|
||||||
|
|
||||||
|
window.open(path, '_blank');
|
||||||
this.vnApp.showSuccess(this.$t('Order created'));
|
this.vnApp.showSuccess(this.$t('Order created'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -567,14 +567,10 @@ describe('Ticket', () => {
|
||||||
const expectedResponse = {id: 123};
|
const expectedResponse = {id: 123};
|
||||||
|
|
||||||
window.open = jasmine.createSpy('open');
|
window.open = jasmine.createSpy('open');
|
||||||
controller.$state.href = jasmine.createSpy('href')
|
|
||||||
.and.returnValue('/somePath');
|
|
||||||
|
|
||||||
$httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse);
|
$httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse);
|
||||||
controller.newOrderFromTicket();
|
controller.newOrderFromTicket();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(window.open).toHaveBeenCalledWith('/somePath', '_blank');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||||
|
@ -87,7 +86,7 @@ module.exports = Self => {
|
||||||
return /^\d+$/.test(value)
|
return /^\d+$/.test(value)
|
||||||
? {'t.id': value}
|
? {'t.id': value}
|
||||||
: {'t.ref': {like: `%${value}%`}};
|
: {'t.ref': {like: `%${value}%`}};
|
||||||
case 'ref':
|
case 'reference':
|
||||||
return {'t.ref': {like: `%${value}%`}};
|
return {'t.ref': {like: `%${value}%`}};
|
||||||
case 'shippedFrom':
|
case 'shippedFrom':
|
||||||
return {'t.shipped': {gte: value}};
|
return {'t.shipped': {gte: value}};
|
||||||
|
@ -115,42 +114,39 @@ module.exports = Self => {
|
||||||
`CREATE TEMPORARY TABLE tmp.travel
|
`CREATE TEMPORARY TABLE tmp.travel
|
||||||
(INDEX (id))
|
(INDEX (id))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT
|
SELECT t.id,
|
||||||
t.id,
|
|
||||||
t.ref,
|
t.ref,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
t.landed,
|
t.landed,
|
||||||
t.kg,
|
t.kg,
|
||||||
am.id AS agencyModeFk,
|
am.id agencyModeFk,
|
||||||
am.name AS agencyModeName,
|
am.name agencyModeName,
|
||||||
wo.id AS warehouseOutFk,
|
wo.id warehouseOutFk,
|
||||||
wo.name AS warehouseOutName,
|
wo.name warehouseOutName,
|
||||||
w.name AS warehouseInFk,
|
w.name warehouseInFk,
|
||||||
w.name AS warehouseInName,
|
w.name warehouseInName,
|
||||||
SUM(b.stickers) AS stickers,
|
SUM(b.stickers) stickers,
|
||||||
s.id AS cargoSupplierFk,
|
s.id cargoSupplierFk,
|
||||||
s.nickname AS cargoSupplierNickname,
|
s.nickname cargoSupplierNickname,
|
||||||
s.name AS supplierName,
|
s.name supplierName,
|
||||||
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
|
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) loadedKg,
|
||||||
CAST(
|
CAST(
|
||||||
SUM(
|
SUM(
|
||||||
vc.aerealVolumetricDensity *
|
vc.aerealVolumetricDensity *
|
||||||
b.stickers *
|
b.stickers *
|
||||||
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
||||||
) as DECIMAL(10,0)
|
) AS DECIMAL(10,0)
|
||||||
) as volumeKg,
|
) volumeKg,
|
||||||
GREATEST(
|
CAST(
|
||||||
CAST(SUM(b.weight * b.stickers) AS INT),
|
GREATEST(
|
||||||
CAST(
|
SUM(b.weight * b.stickers) ,
|
||||||
SUM(vc.aerealVolumetricDensity *
|
SUM(vc.aerealVolumetricDensity *
|
||||||
b.stickers *
|
b.stickers *
|
||||||
IF(pkg.volume,
|
IF(pkg.volume,
|
||||||
pkg.volume,
|
pkg.volume,
|
||||||
pkg.width * pkg.depth * pkg.height
|
pkg.width * pkg.depth * pkg.height) / 1000000)
|
||||||
) / 1000000
|
) / t.kg * 100 AS INT
|
||||||
) AS INT
|
) percentageKg
|
||||||
)
|
|
||||||
/ t.kg * 100, 0) percentageKg
|
|
||||||
FROM travel t
|
FROM travel t
|
||||||
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
||||||
LEFT JOIN entry e ON e.travelFk = t.id
|
LEFT JOIN entry e ON e.travelFk = t.id
|
||||||
|
|
|
@ -51,9 +51,9 @@ module.exports = Self => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const ticketList = await models.Ticket.find(filter, myOptions);
|
const ticketList = await models.Ticket.find(filter, myOptions);
|
||||||
|
const hasRefFk = ticketList.some(ticket => ticket.refFk);
|
||||||
if (ticketList.length > 0)
|
if (hasRefFk)
|
||||||
throw new UserError('There are tickets for this area, delete them first');
|
throw new UserError('There are tickets to be invoiced');
|
||||||
|
|
||||||
await models.Zone.destroyById(id, myOptions);
|
await models.Zone.destroyById(id, myOptions);
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@ describe('zone deletezone()', () => {
|
||||||
__: value => value
|
__: value => value
|
||||||
};
|
};
|
||||||
const ctx = {req: activeCtx};
|
const ctx = {req: activeCtx};
|
||||||
const zoneId = 4;
|
|
||||||
const zoneId2 = 3;
|
|
||||||
let ticketIDs;
|
let ticketIDs;
|
||||||
|
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const zoneId = 4;
|
||||||
const originalTickets = await models.Ticket.find({
|
const originalTickets = await models.Ticket.find({
|
||||||
where: {
|
where: {
|
||||||
zoneFk: zoneId
|
zoneFk: zoneId
|
||||||
|
@ -29,7 +29,7 @@ describe('zone deletezone()', () => {
|
||||||
|
|
||||||
it('should delete a zone and update their tickets', async() => {
|
it('should delete a zone and update their tickets', async() => {
|
||||||
const tx = await models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
const zoneId = 4;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
await models.Zone.deleteZone(ctx, zoneId, options);
|
await models.Zone.deleteZone(ctx, zoneId, options);
|
||||||
|
@ -47,17 +47,18 @@ describe('zone deletezone()', () => {
|
||||||
|
|
||||||
it('should not delete the zone if it has tickets', async() => {
|
it('should not delete the zone if it has tickets', async() => {
|
||||||
const tx = await models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
const zoneId = 1;
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
await models.Zone.deleteZone(ctx, zoneId2, options);
|
await models.Zone.deleteZone(ctx, zoneId, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e.message;
|
error = e.message;
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toEqual('There are tickets for this area, delete them first');
|
expect(error).toEqual('There are tickets to be invoiced');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<td>
|
<td>
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
<span class="lbl">{{$t('boxNum')}}</span>
|
<span class="lbl">{{$t('boxNum')}}</span>
|
||||||
{{`${buy.labelNum} / ${buy.maxLabelNum}`}}
|
{{getTotal(buy)}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
mixins: [vnReport],
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
const buy = await models.Buy.findById(this.id, null);
|
const buy = await models.Buy.findById(this.id, null);
|
||||||
this.buys = await this.rawSqlFromDef('buy', [buy.entryFk, buy.entryFk, buy.entryFk, this.id]);
|
this.buys = await this.rawSqlFromDef('buy', [buy.entryFk, buy.entryFk, buy.entryFk, this.id, this.id]);
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
this.weekNum = moment(date).isoWeek();
|
this.weekNum = moment(date).isoWeek();
|
||||||
this.dayNum = moment(date).day();
|
this.dayNum = moment(date).day();
|
||||||
|
@ -27,6 +27,11 @@ module.exports = {
|
||||||
height: 115,
|
height: 115,
|
||||||
});
|
});
|
||||||
return new XMLSerializer().serializeToString(svgNode);
|
return new XMLSerializer().serializeToString(svgNode);
|
||||||
|
},
|
||||||
|
getTotal(buy) {
|
||||||
|
return (this.showEntryLines) ?
|
||||||
|
`${buy.entryLabelNum} / ${buy.entryLabels}` :
|
||||||
|
`${buy.buyLabelNum} / ${buy.buyLabels}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -34,6 +39,10 @@ module.exports = {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id'
|
description: 'The entry id'
|
||||||
|
},
|
||||||
|
showEntryLines: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ WITH RECURSIVE numbers AS (
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
labels AS (
|
labels AS (
|
||||||
SELECT ROW_NUMBER() OVER(ORDER BY b.id, num.n) labelNum,
|
SELECT ROW_NUMBER() OVER(ORDER BY b.id, num.n) entryLabelNum,
|
||||||
i.name,
|
i.name,
|
||||||
i.`size`,
|
i.`size`,
|
||||||
i.category,
|
i.category,
|
||||||
|
@ -33,6 +33,9 @@ labels AS (
|
||||||
WHERE b.entryFk = ?
|
WHERE b.entryFk = ?
|
||||||
AND num.n <= b.stickers
|
AND num.n <= b.stickers
|
||||||
)
|
)
|
||||||
SELECT *, (SELECT SUM(stickers) FROM buy WHERE entryFk = ?) maxLabelNum
|
SELECT *,
|
||||||
|
ROW_NUMBER() OVER(ORDER BY entryLabelNum) buyLabelNum,
|
||||||
|
(SELECT SUM(stickers) FROM buy WHERE entryFk = ?) entryLabels,
|
||||||
|
(SELECT stickers FROM buy WHERE id = ?) buyLabels
|
||||||
FROM labels
|
FROM labels
|
||||||
WHERE id = ?
|
WHERE id = ?
|
Loading…
Reference in New Issue