Compare commits

...

23 Commits

Author SHA1 Message Date
Juanjo Breso c9294680a5 Merge branch 'dev' into 6693-revisarTriggersPendientes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 12:53:13 +00:00
Jorge Penadés 9bd8c21660 Merge pull request '#6813 fix creditClient' (!2026) from 6813-fixCreditClient into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
Reviewed-on: #2026
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: JAVIER SEGARRA MARTINEZ <jsegarra@verdnatura.es>
2024-02-13 10:53:38 +00:00
Jorge Penadés 76b4f8f46f Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6813-fixCreditClient
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 11:46:47 +01:00
Guillermo Bonet bf6d068830 Merge pull request 'refactor: refs #6781 Deleted timeControlDevice' (!2032) from 6781-timeControlDevice into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2032
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2024-02-13 10:16:43 +00:00
Jorge Penadés 579f2abe5b fix: refs #6813 remove quotation marks
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 11:16:00 +01:00
Jorge Penadés db2919b482 fix: refs #6813 procedure 2024-02-13 11:05:21 +01:00
Jorge Penadés d7fb31ee60 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6813-fixCreditClient
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 10:16:12 +01:00
Josep Domingo 51b336d9f7 Merge pull request 'refs#6685 RestoreViewCredit' (!2030) from 6685-fixRestoreViewCredit into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2030
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-02-13 09:00:03 +00:00
Josep Domingo 68034fc404 Merge branch 'dev' into 6685-fixRestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 08:56:05 +00:00
Juan Ferrer 4f9b46346f fix: refs#6706 back tests spec timeout reduced
gitea/salix/pipeline/head There was a failure building this commit Details
2024-02-13 09:49:33 +01:00
Guillermo Bonet bbb3f3807a Merge pull request 'fix: refs #6184 Minor change' (!2031) from 6184-externalCmr into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #2031
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-02-13 08:45:03 +00:00
Guillermo Bonet b449da28ef Merge branch 'dev' into 6184-externalCmr
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 08:42:31 +00:00
Jorge Penadés 995e249495 Merge pull request '#6106 where filter' (!2024) from 6106-fixSignView into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #2024
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-02-13 08:42:14 +00:00
Guillermo Bonet 744171dd4c fix: refs #6184 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:41:26 +01:00
Jorge Penadés c8e13fa858 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6106-fixSignView
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:36:07 +01:00
Jorge Penadés 6116ada156 fix: refs #6813 remove inserts
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:35:39 +01:00
Guillermo Bonet 41db1c924f refactor: refs #6781 Deleted timeControlDevice
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:20:21 +01:00
Guillermo Bonet e08fb3d229 fix: refs #6184 Minor change
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 08:59:58 +01:00
Josep Domingo 4feae72ee3 Merge branch 'dev' into 6685-fixRestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 07:58:41 +00:00
Josep Domingo 3b35e4dae8 refs#6685 RestoreViewCredit
gitea/salix/pipeline/pr-dev Build queued... Details
2024-02-13 08:57:49 +01:00
Josep Domingo 5b137ad825 Merge pull request 'feat: refs #6685 RestoreViewCredit' (!2028) from 6685-fixRestoreViewCredit into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #2028
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-02-13 07:46:18 +00:00
Josep Domingo a897a05e8b feat: refs#6685RestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 07:52:09 +01:00
Jorge Penadés 534b5bb05a fix: refs #6106 where filter
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-12 11:26:00 +01:00
8 changed files with 37 additions and 31 deletions

View File

@ -17,7 +17,8 @@ const opts = getopts(process.argv.slice(2), {
let server; let server;
const PARALLEL = false; const PARALLEL = false;
const TIMEOUT = 900000; const SETUP_TIMEOUT = 15 * 60 * 1000;
const SPEC_TIMEOUT = 30 * 1000;
process.on('exit', teardown); process.on('exit', teardown);
process.on('uncaughtException', onError); process.on('uncaughtException', onError);
@ -74,9 +75,9 @@ async function test() {
let runner; let runner;
const config = { const config = {
globalSetup: setup, globalSetup: setup,
globalSetupTimeout: TIMEOUT, globalSetupTimeout: SETUP_TIMEOUT,
globalTeardown: teardown, globalTeardown: teardown,
globalTeardownTimeout: TIMEOUT, globalTeardownTimeout: SETUP_TIMEOUT,
spec_dir: '.', spec_dir: '.',
spec_files: [ spec_files: [
'back/**/*[sS]pec.js', 'back/**/*[sS]pec.js',
@ -111,7 +112,7 @@ async function test() {
runner.addReporter(new JunitReporter.JUnitXmlReporter()); runner.addReporter(new JunitReporter.JUnitXmlReporter());
} }
if (opts.ci) if (opts.ci)
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT; runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
// runner.loadConfigFile('back/jasmine.json'); // runner.loadConfigFile('back/jasmine.json');
runner.loadConfig(config); runner.loadConfig(config);

View File

@ -8,16 +8,10 @@ BEGIN
END; END;
START TRANSACTION; START TRANSACTION;
INSERT INTO vn.clientCredit(clientFk, amount)
SELECT c.id, 0
FROM vn.`client` c
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
WHERE c.credit <> 0 AND pm.`code` = 'card';
UPDATE vn.`client` c UPDATE vn.`client` c
JOIN vn.payMethod pm ON pm.id = c.payMethodFk JOIN vn.payMethod pm ON pm.id = c.payMethodFk
SET credit = 0 SET credit = 0
WHERE pm.`code` = 'card'; WHERE pm.`code` = 'card';
DROP TEMPORARY TABLE IF EXISTS clientes_credit; DROP TEMPORARY TABLE IF EXISTS clientes_credit;
CREATE TEMPORARY TABLE clientes_credit CREATE TEMPORARY TABLE clientes_credit
@ -44,10 +38,6 @@ BEGIN
UPDATE Clientes UPDATE Clientes
JOIN clientes_credit USING(Id_Cliente) JOIN clientes_credit USING(Id_Cliente)
SET Clientes.Credito = newCredit; SET Clientes.Credito = newCredit;
INSERT INTO credit(Id_Cliente, amount, Id_Trabajador)
SELECT Id_Cliente, newCredit, NULL
FROM clientes_credit;
DROP TEMPORARY TABLE clientes_credit; DROP TEMPORARY TABLE clientes_credit;
COMMIT; COMMIT;

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`credit`
AS SELECT `c`.`id` AS `id`,
`c`.`clientFk` AS `Id_Cliente`,
`c`.`workerFk` AS `Id_Trabajador`,
`c`.`amount` AS `amount`,
`c`.`created` AS `odbc_date`
FROM `vn`.`clientCredit` `c`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`credit`AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.credit TO financialBoss;

View File

@ -0,0 +1 @@
DROP TABLE vn.timeControlDevice;

View File

@ -339,8 +339,9 @@
"No tickets to invoice": "No hay tickets para facturar", "No tickets to invoice": "No hay tickets para facturar",
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
"Name should be uppercase": "El nombre debe ir en mayúscula", "Name should be uppercase": "El nombre debe ir en mayúscula",
"Bank entity must be specified": "La entidad bancaria es obligatoria", "Bank entity must be specified": "La entidad bancaria es obligatoria",
"An email is necessary": "Es necesario un email", "An email is necessary": "Es necesario un email",
"You cannot update these fields": "No puedes actualizar estos campos", "You cannot update these fields": "No puedes actualizar estos campos",
"CountryFK cannot be empty": "El país no puede estar vacío" "CountryFK cannot be empty": "El país no puede estar vacío",
"Cmr file does not exist": "El archivo del cmr no existe"
} }

View File

@ -1,5 +1,5 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const {ParameterizedSQL} = require('loopback-connector');
module.exports = Self => { module.exports = Self => {
Self.remoteMethod('getTickets', { Self.remoteMethod('getTickets', {
@ -83,13 +83,15 @@ module.exports = Self => {
const where = filter.where; const where = filter.where;
where['r.id'] = filter.id; where['r.id'] = filter.id;
where.and = [{or: [
{'t.packages': {gt: 0}},
{and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]}
]}];
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id')); stmt.merge(conn.makeGroupBy('t.id'));
stmt.merge(conn.makeOrderBy(filter.order)); stmt.merge(conn.makeOrderBy(filter.order));
const tickets = await conn.executeStmt(stmt, myOptions); return conn.executeStmt(stmt, myOptions);
return tickets;
}; };
}; };

View File

@ -34,8 +34,7 @@ module.exports = Self => {
const myOptions = {userId: ctx.req.accessToken.userId}; const myOptions = {userId: ctx.req.accessToken.userId};
let tx; let tx;
let ticket; let ticket;
let dms; let externalTickets = [];
let gestDocCreated;
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -86,12 +85,11 @@ module.exports = Self => {
contentType: 'image/png', contentType: 'image/png',
hasFile: true hasFile: true
}; };
dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
gestDocCreated = true; await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
} }
try { try {
let externalTickets = [];
for (const ticketId of tickets) { for (const ticketId of tickets) {
ticket = await models.Ticket.findById(ticketId, { ticket = await models.Ticket.findById(ticketId, {
include: [{ include: [{
@ -137,9 +135,8 @@ module.exports = Self => {
throw new UserError('Ticket is already signed'); throw new UserError('Ticket is already signed');
if (location) await setLocation(ticketId); if (location) await setLocation(ticketId);
if (!await hasSignDms(ticketId) && !gestDocCreated) if (!await hasSignDms(ticketId))
await createGestDoc(ticketId); await createGestDoc(ticketId);
await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions);
await ticket.updateAttribute('isSigned', true, myOptions); await ticket.updateAttribute('isSigned', true, myOptions);
const deliveryState = await models.State.findOne({ const deliveryState = await models.State.findOne({
@ -157,11 +154,10 @@ module.exports = Self => {
} }
} }
if (tx) await tx.commit(); if (tx) await tx.commit();
await models.Route.cmrEmail(ctx, externalTickets);
return;
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();
throw e; throw e;
} }
await models.Route.cmrEmail(ctx, externalTickets);
}; };
}; };