Compare commits

..

33 Commits

Author SHA1 Message Date
Robert Ferrús 9894591aa9 Merge branch 'dev' into 5854-itemShelvingTraduciones
gitea/salix/pipeline/head This commit looks good Details
2023-12-11 17:56:40 +00:00
Javier Segarra 24c7271dd8 Merge pull request '#6487 - Stop test container when finish' (!1884) from 6487_stop_test_container into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1884
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2023-12-11 11:47:34 +00:00
Javier Segarra 10247c744f Merge branch 'dev' into 6487_stop_test_container
gitea/salix/pipeline/head This commit looks good Details
2023-12-11 11:37:15 +00:00
Guillermo Bonet a36f22a414 Merge pull request 'refs #6172 Change' (!1735) from 6172-errorMsg into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1735
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2023-12-11 10:48:58 +00:00
Guillermo Bonet 95a8646d07 Merge branch 'dev' into 6172-errorMsg
gitea/salix/pipeline/head This commit looks good Details
2023-12-11 10:27:14 +00:00
Guillermo Bonet 09ad31a92d feat: refs #6172 Requested changes
gitea/salix/pipeline/head This commit looks good Details
2023-12-11 10:58:48 +01:00
Sergio De la torre f774297321 Merge pull request 'refs #5867 fix: tickets sql' (!1800) from 5867-Driver-Route-Pdf into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1800
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-11 06:05:07 +00:00
Sergio De la torre 64ecf2e229 Merge branch 'dev' into 5867-Driver-Route-Pdf
gitea/salix/pipeline/head This commit looks good Details
2023-12-11 05:48:21 +00:00
Javier Segarra b86c73777f Update back/tests.js
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 19:05:54 +00:00
Carlos Satorres f5ef6c66a4 Merge pull request 'refs #6010 remove pending' (!1876) from 6010-testBackPending into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1876
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-07 08:41:03 +00:00
Carlos Satorres 3abbae7612 Merge branch 'dev' into 6010-testBackPending
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 07:16:17 +00:00
Javi Gallego be5df940bf Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 08:01:20 +01:00
Javi Gallego 58ba1c10d0 ci: dev-test 2023-12-07 08:01:16 +01:00
Carlos Satorres 3c9c221220 Merge branch 'dev' into 6010-testBackPending
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-07 06:59:38 +00:00
Carlos Satorres c75ee22345 Merge pull request 'refs #6318 quantity' (!1875) from 6318-negativeQuantity into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #1875
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-07 06:59:24 +00:00
Carlos Satorres c7d960229d Merge branch 'dev' into 6010-testBackPending
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 06:34:32 +00:00
Carlos Satorres acfa0fd857 Merge branch 'dev' into 6318-negativeQuantity
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 06:31:21 +00:00
Javi Gallego 7ff8ec93ff Merge pull request 'test' (!1879) from test into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1879
2023-12-06 07:54:13 +00:00
Carlos Satorres f55e85a189 refs #6010 remove pending
gitea/salix/pipeline/head This commit looks good Details
2023-12-05 10:35:48 +01:00
Carlos Satorres af07a531ed refs #6318 quantity
gitea/salix/pipeline/head This commit looks good Details
2023-12-05 08:49:55 +01:00
Alex Moreno 6699f5d5a6 Merge pull request 'fix(getFiltered): refs #3271 fix to event filter' (!1872) from 3271-zoneGetFilterdFix into test
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1872
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-11-30 13:49:55 +00:00
Pablo Natek 72283005b8 remove(console.log): refs #3271 remove console.log
gitea/salix/pipeline/head This commit looks good Details
2023-11-30 14:43:14 +01:00
Pablo Natek c457b5c4d2 Merge branch 'test' into 3271-zoneGetFilterdFix
gitea/salix/pipeline/head This commit looks good Details
2023-11-30 12:39:26 +00:00
Pablo Natek 3f22f48df7 fix(getFiltered): refs #3271 fix to event filter
gitea/salix/pipeline/head This commit looks good Details
2023-11-30 12:13:12 +01:00
Guillermo Bonet 1373d7071b Merge branch 'dev' into 6172-errorMsg
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-20 06:19:43 +00:00
Guillermo Bonet 6527cae72a refactor: refs #6172 Added real message error
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-14 07:58:33 +01:00
Guillermo Bonet b53e454b8b Merge branch 'dev' into 6172-errorMsg
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-10 10:56:23 +00:00
Sergio De la torre 426b3aa4de Merge branch 'dev' into 5867-Driver-Route-Pdf
gitea/salix/pipeline/head This commit looks good Details
2023-11-02 10:02:13 +00:00
Sergio De la torre d0def8abcc Merge branch 'dev' into 5867-Driver-Route-Pdf
gitea/salix/pipeline/head This commit looks good Details
2023-11-02 06:01:29 +00:00
Sergio De la torre 60ffc21d5a Merge branch 'dev' into 5867-Driver-Route-Pdf
gitea/salix/pipeline/head This commit looks good Details
2023-10-27 04:49:16 +00:00
Sergio De la torre fa08ebf416 refs #5867 fix: tickets sql
gitea/salix/pipeline/head There was a failure building this commit Details
2023-10-17 08:57:45 +02:00
Guillermo Bonet 175f53c0c5 Merge branch 'dev' into 6172-errorMsg
gitea/salix/pipeline/head This commit looks good Details
2023-09-05 05:46:23 +00:00
Guillermo Bonet 04008110f1 refs #6172 Change
gitea/salix/pipeline/head This commit looks good Details
2023-09-04 08:32:02 +02:00
13 changed files with 145 additions and 135 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2352.01] - 2023-12-28
### Added
### Changed
### Fixed
## [2350.01] - 2023-12-14
### Added

View File

@ -7,6 +7,10 @@ process.on('warning', warning => {
console.log(warning.stack);
});
process.on('SIGUSR2', async() => {
if (container) await container.rm();
});
process.on('exit', async function() {
if (container) await container.rm();
});

View File

View File

@ -2351,9 +2351,11 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`)
(8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'),
(10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun');
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`)
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`, `weekDays`)
VALUES
(9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR));
(9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR), 'mon'),
(9, 'range', util.VN_CURDATE(), NULL, 'tue'),
(9, 'range', NULL, util.VN_CURDATE(), 'wed');
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `isSendMail`)
VALUES

View File

@ -18,6 +18,7 @@ Show summary: Mostrar vista previa
What is new: Novedades de la versión
Settings: Ajustes
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
This ticket is locked.: Este ticket está bloqueado
# Actions

View File

@ -120,7 +120,7 @@ function $exceptionHandler(vnApp, $window, $state, $injector) {
messageT = 'Invalid login';
break;
case 403:
messageT = 'Access denied';
messageT = exception.data?.error?.message || 'Access denied';
break;
case 502:
messageT = 'It seems that the server has fall down';

View File

@ -3,99 +3,101 @@ const buildFilter = require('vn-loopback/util/filter').buildFilter;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethod('getExternalCmrs', {
description: 'Returns an array of external cmrs',
accessType: 'READ',
accepts: [
{
arg: 'filter',
type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
},
{
arg: 'cmrFk',
type: 'integer',
description: 'Searchs the route by id',
},
{
arg: 'ticketFk',
type: 'integer',
description: 'The worker id',
},
{
arg: 'routeFk',
type: 'integer',
description: 'The route id',
},
{
arg: 'country',
type: 'string',
description: 'The agencyMode id',
},
{
arg: 'clientFk',
type: 'integer',
description: 'The vehicle id',
},
{
arg: 'hasCmrDms',
type: 'boolean',
description: 'The vehicle id',
},
{
arg: 'shipped',
type: 'date',
description: 'The to date filter',
},
],
returns: {
type: ['object'],
root: true
},
http: {
path: `/getExternalCmrs`,
verb: 'GET'
}
});
Self.remoteMethod('getExternalCmrs', {
description: 'Returns an array of external cmrs',
accessType: 'READ',
accepts: [
{
arg: 'filter',
type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
},
{
arg: 'cmrFk',
type: 'integer',
description: 'Searchs the route by id',
},
{
arg: 'ticketFk',
type: 'integer',
description: 'The worker id',
},
{
arg: 'routeFk',
type: 'integer',
description: 'The route id',
},
{
arg: 'country',
type: 'string',
description: 'The agencyMode id',
},
{
arg: 'clientFk',
type: 'integer',
description: 'The vehicle id',
},
{
arg: 'hasCmrDms',
type: 'boolean',
description: 'The vehicle id',
},
{
arg: 'shipped',
type: 'date',
description: 'The to date filter',
},
],
returns: {
type: ['object'],
root: true
},
http: {
path: `/getExternalCmrs`,
verb: 'GET'
}
});
Self.getExternalCmrs = async(
filter,
cmrFk,
ticketFk,
routeFk,
country,
clientFk,
hasCmrDms,
shipped,
options
) => {
const params = {
cmrFk,
ticketFk,
routeFk,
country,
clientFk,
hasCmrDms,
shipped,
};
const conn = Self.dataSource.connector;
Self.getExternalCmrs = async(
filter,
cmrFk,
ticketFk,
routeFk,
country,
clientFk,
hasCmrDms,
shipped,
options
) => {
const params = {
cmrFk,
ticketFk,
routeFk,
country,
clientFk,
hasCmrDms,
shipped,
};
const conn = Self.dataSource.connector;
let where = buildFilter(params, (param, value) => {return {[param]: value}});
filter = mergeFilters(filter, {where});
let where = buildFilter(params, (param, value) => {
return {[param]: value};
});
filter = mergeFilters(filter, {where});
if (!filter.where) {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
filter.where = {'shipped': yesterday.toISOString().split('T')[0]}
}
if (!filter.where) {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
filter.where = {'shipped': yesterday.toISOString().split('T')[0]};
}
const myOptions = {};
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (typeof options == 'object')
Object.assign(myOptions, options);
let stmts = [];
const stmt = new ParameterizedSQL(`
let stmts = [];
const stmt = new ParameterizedSQL(`
SELECT *
FROM (
SELECT t.cmrFk,
@ -129,13 +131,13 @@ module.exports = Self => {
AND dm.code = 'DELIVERY'
AND t.cmrFk
) sub
`);
`);
stmt.merge(conn.makeSuffix(filter));
const itemsIndex = stmts.push(stmt) - 1;
stmt.merge(conn.makeSuffix(filter));
const itemsIndex = stmts.push(stmt) - 1;
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex];
};
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex];
};
};

View File

@ -63,7 +63,7 @@ module.exports = Self => {
const isAvailable = itemStock.available > 0;
if (!isAvailable)
if (!isAvailable || !ctx.args.quantity)
throw new UserError(`This item is not available`);
if (request.saleFk)

View File

@ -141,7 +141,6 @@ describe('ticket filter()', () => {
});
it('should return the tickets that are not pending', async() => {
pending('#6010 test intermitente');
const tx = await models.Ticket.beginTransaction({});
try {

View File

@ -35,44 +35,39 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
query = `
SELECT *
FROM vn.zoneEvent
WHERE zoneFk = ?
AND ((type = 'indefinitely')
OR (type = 'day' AND dated BETWEEN ? AND ?)
OR (type = 'range'
AND (
(started BETWEEN ? AND ?)
OR
(ended BETWEEN ? AND ?)
OR
(started <= ? AND ended >= ?)
)
)
)
ORDER BY type='indefinitely' DESC, type='range' DESC, type='day' DESC;`;
const events = await Self.rawSql(query,
[zoneFk, started, ended, started, ended, started, ended, started, ended], myOptions);
ended = simpleDate(ended);
started = simpleDate(started);
query = `
SELECT e.*
FROM vn.zoneExclusion e
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
WHERE e.zoneFk = ?
AND e.dated BETWEEN ? AND ?
AND eg.zoneExclusionFk IS NULL;`;
SELECT *
FROM vn.zoneEvent
WHERE zoneFk = ?
AND (IFNULL(started, ?) <= ? AND IFNULL(ended,?) >= ?)
ORDER BY type='indefinitely' DESC, type='range' DESC, type='day' DESC;`;
const events = await Self.rawSql(query,
[zoneFk, started, ended, ended, started], myOptions);
query = `
SELECT e.*
FROM vn.zoneExclusion e
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
WHERE e.zoneFk = ?
AND e.dated BETWEEN ? AND ?
AND eg.zoneExclusionFk IS NULL;`;
const exclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
query = `
SELECT eg.*, e.zoneFk, e.dated, e.created, e.userFk
FROM vn.zoneExclusion e
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
WHERE e.zoneFk = ?
AND e.dated BETWEEN ? AND ?
AND eg.zoneExclusionFk IS NOT NULL;`;
SELECT eg.*, e.zoneFk, e.dated, e.created, e.userFk
FROM vn.zoneExclusion e
LEFT JOIN vn.zoneExclusionGeo eg ON eg.zoneExclusionFk = e.id
WHERE e.zoneFk = ?
AND e.dated BETWEEN ? AND ?
AND eg.zoneExclusionFk IS NOT NULL;`;
const geoExclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
return {events, exclusions, geoExclusions};
};
function simpleDate(date) {
return date.toISOString().split('T')[0];
}
};

View File

@ -30,7 +30,7 @@ describe('zone getEventsFiltered()', () => {
const result = await models.Zone.getEventsFiltered(9, today, today, options);
expect(result.events.length).toEqual(1);
expect(result.events.length).toEqual(3);
expect(result.exclusions.length).toEqual(0);
await tx.rollback();
@ -47,11 +47,12 @@ describe('zone getEventsFiltered()', () => {
const options = {transaction: tx};
const date = Date.vnNew();
date.setFullYear(date.getFullYear() - 2);
const dateTomorrow = new Date(date.setDate(date.getDate() + 1));
const dateTomorrow = new Date(date);
dateTomorrow.setDate(dateTomorrow.getDate() + 1);
const result = await models.Zone.getEventsFiltered(9, date, dateTomorrow, options);
expect(result.events.length).toEqual(0);
expect(result.events.length).toEqual(1);
expect(result.exclusions.length).toEqual(0);
await tx.rollback();

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "23.50.01",
"version": "23.52.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",

View File

@ -20,7 +20,7 @@ SELECT
u.nickName salesPersonName,
ipkg.itemPackingTypes
FROM route r
LEFT JOIN ticket t ON t.routeFk = r.id
JOIN ticket t ON t.routeFk = r.id
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE())