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 = [
|
||||
test: 'test',
|
||||
master: 'production'
|
||||
master: 'production',
|
||||
beta: 'production'
|
||||
]
|
||||
|
||||
node {
|
||||
|
@ -18,7 +19,8 @@ node {
|
|||
PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
'master',
|
||||
'beta'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||
|
|
|
@ -130,6 +130,9 @@
|
|||
"Payment": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"PbxConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Postcode": {
|
||||
"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)
|
||||
VALUES (1,'0034');
|
||||
|
||||
INSERT INTO `pbx`.`prefix` (country, prefix)
|
||||
INSERT IGNORE INTO `pbx`.`prefix` (country, prefix)
|
||||
VALUES
|
||||
('es', '0034'),
|
||||
('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)
|
||||
VALUES (19, '1169'),
|
||||
(8, '1183');
|
||||
(8, '1183'),
|
||||
(1, '1320');
|
||||
|
||||
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)
|
||||
AND clientFk = vClientFk
|
||||
AND addressFk = vAddressFk
|
||||
AND warehouseFk = vWarehouseFk;
|
||||
AND warehouseFk = vWarehouseFk
|
||||
AND nickname = 'CAJAS AUTOCONSUMO'
|
||||
LIMIT 1;
|
||||
|
||||
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
||||
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,
|
||||
description: 'The entry id',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'showEntryLines',
|
||||
type: 'boolean',
|
||||
required: false
|
||||
}
|
||||
],
|
||||
returns: [
|
||||
|
|
|
@ -47,8 +47,7 @@ module.exports = Self => {
|
|||
|
||||
for (const buy of buys) {
|
||||
if (buy.stickers < 1) continue;
|
||||
ctx.args.id = buy.id;
|
||||
ctx.args.copies = buy.stickers;
|
||||
ctx.args = {...ctx.args, id: buy.id, showEntryLines: true};
|
||||
const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions);
|
||||
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',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
description: 'The invoiceOut id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'search',
|
||||
type: 'string',
|
||||
|
@ -106,6 +112,8 @@ module.exports = Self => {
|
|||
return {'i.created': value};
|
||||
case 'clientFk':
|
||||
return {'i.clientFk': value};
|
||||
case 'id':
|
||||
return {'i.id': value};
|
||||
case 'fi':
|
||||
return {'c.fi': value};
|
||||
case 'amount':
|
||||
|
|
|
@ -88,6 +88,11 @@ module.exports = Self => {
|
|||
arg: 'alertLevel',
|
||||
type: 'number',
|
||||
description: `The alert level of the tickets`
|
||||
},
|
||||
{
|
||||
arg: 'countryFk',
|
||||
type: 'number',
|
||||
description: 'The country id filter'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -182,6 +187,7 @@ module.exports = Self => {
|
|||
t.totalWithVat,
|
||||
io.id invoiceOutId,
|
||||
a.provinceFk,
|
||||
p.countryFk,
|
||||
p.name province,
|
||||
w.name warehouse,
|
||||
am.name agencyMode,
|
||||
|
@ -360,6 +366,7 @@ module.exports = Self => {
|
|||
}
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseFk':
|
||||
case 'countryFk':
|
||||
param = `f.${param}`;
|
||||
return {[param]: value};
|
||||
}
|
||||
|
|
|
@ -387,10 +387,10 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
newOrderFromTicket() {
|
||||
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => {
|
||||
const path = this.$state.href('order.card.catalog', {id: res.data});
|
||||
window.open(path, '_blank');
|
||||
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => {
|
||||
const path = await this.vnApp.getUrl(`order/${res.data}/catalog`);
|
||||
|
||||
window.open(path, '_blank');
|
||||
this.vnApp.showSuccess(this.$t('Order created'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -567,14 +567,10 @@ describe('Ticket', () => {
|
|||
const expectedResponse = {id: 123};
|
||||
|
||||
window.open = jasmine.createSpy('open');
|
||||
controller.$state.href = jasmine.createSpy('href')
|
||||
.and.returnValue('/somePath');
|
||||
|
||||
$httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse);
|
||||
controller.newOrderFromTicket();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith('/somePath', '_blank');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||
|
@ -87,7 +86,7 @@ module.exports = Self => {
|
|||
return /^\d+$/.test(value)
|
||||
? {'t.id': value}
|
||||
: {'t.ref': {like: `%${value}%`}};
|
||||
case 'ref':
|
||||
case 'reference':
|
||||
return {'t.ref': {like: `%${value}%`}};
|
||||
case 'shippedFrom':
|
||||
return {'t.shipped': {gte: value}};
|
||||
|
@ -115,42 +114,39 @@ module.exports = Self => {
|
|||
`CREATE TEMPORARY TABLE tmp.travel
|
||||
(INDEX (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
t.id,
|
||||
SELECT t.id,
|
||||
t.ref,
|
||||
t.shipped,
|
||||
t.landed,
|
||||
t.kg,
|
||||
am.id AS agencyModeFk,
|
||||
am.name AS agencyModeName,
|
||||
wo.id AS warehouseOutFk,
|
||||
wo.name AS warehouseOutName,
|
||||
w.name AS warehouseInFk,
|
||||
w.name AS warehouseInName,
|
||||
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,
|
||||
am.id agencyModeFk,
|
||||
am.name agencyModeName,
|
||||
wo.id warehouseOutFk,
|
||||
wo.name warehouseOutName,
|
||||
w.name warehouseInFk,
|
||||
w.name warehouseInName,
|
||||
SUM(b.stickers) stickers,
|
||||
s.id cargoSupplierFk,
|
||||
s.nickname cargoSupplierNickname,
|
||||
s.name supplierName,
|
||||
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) 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,
|
||||
GREATEST(
|
||||
CAST(SUM(b.weight * b.stickers) AS INT),
|
||||
CAST(
|
||||
) AS DECIMAL(10,0)
|
||||
) volumeKg,
|
||||
CAST(
|
||||
GREATEST(
|
||||
SUM(b.weight * b.stickers) ,
|
||||
SUM(vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume,
|
||||
pkg.volume,
|
||||
pkg.width * pkg.depth * pkg.height
|
||||
) / 1000000
|
||||
) AS INT
|
||||
)
|
||||
/ t.kg * 100, 0) percentageKg
|
||||
IF(pkg.volume,
|
||||
pkg.volume,
|
||||
pkg.width * pkg.depth * pkg.height) / 1000000)
|
||||
) / t.kg * 100 AS INT
|
||||
) percentageKg
|
||||
FROM travel t
|
||||
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
||||
LEFT JOIN entry e ON e.travelFk = t.id
|
||||
|
|
|
@ -51,9 +51,9 @@ module.exports = Self => {
|
|||
};
|
||||
|
||||
const ticketList = await models.Ticket.find(filter, myOptions);
|
||||
|
||||
if (ticketList.length > 0)
|
||||
throw new UserError('There are tickets for this area, delete them first');
|
||||
const hasRefFk = ticketList.some(ticket => ticket.refFk);
|
||||
if (hasRefFk)
|
||||
throw new UserError('There are tickets to be invoiced');
|
||||
|
||||
await models.Zone.destroyById(id, myOptions);
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@ describe('zone deletezone()', () => {
|
|||
__: value => value
|
||||
};
|
||||
const ctx = {req: activeCtx};
|
||||
const zoneId = 4;
|
||||
const zoneId2 = 3;
|
||||
let ticketIDs;
|
||||
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
const zoneId = 4;
|
||||
const originalTickets = await models.Ticket.find({
|
||||
where: {
|
||||
zoneFk: zoneId
|
||||
|
@ -29,7 +29,7 @@ describe('zone deletezone()', () => {
|
|||
|
||||
it('should delete a zone and update their tickets', async() => {
|
||||
const tx = await models.Zone.beginTransaction({});
|
||||
|
||||
const zoneId = 4;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
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() => {
|
||||
const tx = await models.Zone.beginTransaction({});
|
||||
const zoneId = 1;
|
||||
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Zone.deleteZone(ctx, zoneId2, options);
|
||||
await models.Zone.deleteZone(ctx, zoneId, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
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>
|
||||
<div class="cell">
|
||||
<span class="lbl">{{$t('boxNum')}}</span>
|
||||
{{`${buy.labelNum} / ${buy.maxLabelNum}`}}
|
||||
{{getTotal(buy)}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
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();
|
||||
this.weekNum = moment(date).isoWeek();
|
||||
this.dayNum = moment(date).day();
|
||||
|
@ -27,6 +27,11 @@ module.exports = {
|
|||
height: 115,
|
||||
});
|
||||
return new XMLSerializer().serializeToString(svgNode);
|
||||
},
|
||||
getTotal(buy) {
|
||||
return (this.showEntryLines) ?
|
||||
`${buy.entryLabelNum} / ${buy.entryLabels}` :
|
||||
`${buy.buyLabelNum} / ${buy.buyLabels}`;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -34,6 +39,10 @@ module.exports = {
|
|||
type: Number,
|
||||
required: true,
|
||||
description: 'The entry id'
|
||||
},
|
||||
showEntryLines: {
|
||||
type: Boolean,
|
||||
required: false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ WITH RECURSIVE numbers 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.`size`,
|
||||
i.category,
|
||||
|
@ -33,6 +33,9 @@ labels AS (
|
|||
WHERE b.entryFk = ?
|
||||
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
|
||||
WHERE id = ?
|
Loading…
Reference in New Issue