Merge pull request '8267-devToTest' (!3270) from 8267-devToTest into test
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #3270
Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
Alex Moreno 2024-12-03 12:18:19 +00:00
commit 87136f1aba
87 changed files with 626 additions and 676 deletions

View File

@ -36,3 +36,7 @@ rules:
jasmine/no-focused-tests: 0 jasmine/no-focused-tests: 0
jasmine/prefer-toHaveBeenCalledWith: 0 jasmine/prefer-toHaveBeenCalledWith: 0
arrow-spacing: ["error", { "before": true, "after": true }] arrow-spacing: ["error", { "before": true, "after": true }]
no-restricted-syntax:
- "error"
- selector: "NewExpression[callee.name='Date']"
message: "Use Date.vnNew() instead of new Date()."

View File

@ -28,9 +28,10 @@ describe('ticket assign()', () => {
await tx.rollback(); await tx.rollback();
}); });
it('should throw an error when there is not picking tickets', async() => { it('should throw an error when there are no picking tickets', async() => {
try { try {
await models.Collection.assign(ctx, options); await models.Collection.assign(ctx, options);
fail('Expected an error to be thrown, but none was thrown.');
} catch (e) { } catch (e) {
expect(e.message).toEqual('There are not picking tickets'); expect(e.message).toEqual('There are not picking tickets');
} }

View File

@ -22,7 +22,7 @@ module.exports = Self => {
const url = await Self.app.models.Url.findOne({ const url = await Self.app.models.Url.findOne({
where: { where: {
appName, appName,
environment: process.env.NODE_ENV || 'dev' environment: process.env.NODE_ENV || 'development'
} }
}); });
return url?.url; return url?.url;

View File

@ -31,7 +31,7 @@ module.exports = Self => {
return await Self.rawSql(` return await Self.rawSql(`
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model) INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
SELECT ?, ?, ? SELECT ?, ?, ?
FROM workerTimeControlParams wtcp FROM workerTimeControlConfig wtcc
LEFT JOIN ( LEFT JOIN (
SELECT wa.workerFk, SELECT wa.workerFk,
wa.created, wa.created,
@ -44,7 +44,7 @@ module.exports = Self => {
) sub ON TRUE ) sub ON TRUE
WHERE sub.workerFk IS NULL WHERE sub.workerFk IS NULL
OR sub.code <> ? OR sub.code <> ?
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcp.dayBreak;` OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcc.dayBreak;`
, [userId, code, model, userId, code], myOptions); , [userId, code, model, userId, code], myOptions);
}; };
}; };

View File

@ -9,7 +9,7 @@
}, },
"vn": { "vn": {
"view": { "view": {
"expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e" "expeditionPallet_Print": "04fc5f2967ce53bfbb85f7f48b9a3dca4a4f7111ac41e1775f4cc7d6538774b2"
} }
} }
} }

View File

@ -745,15 +745,15 @@ INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1'); INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1');
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`) INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`, `dated`)
VALUES VALUES
(1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1), (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1, util.VN_CURDATE()),
(2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9), (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9, util.VN_CURDATE()),
(3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10), (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10, util.VN_CURDATE()),
(4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12), (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12, util.VN_CURDATE()),
(5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13), (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13, util.VN_CURDATE()),
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3), (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3, util.VN_CURDATE()),
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5); (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5, util.VN_CURDATE());
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`) INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`)
VALUES VALUES
@ -1511,26 +1511,26 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, FALSE, NULL), (3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, FALSE, NULL),
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, FALSE, NULL), (4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, FALSE, NULL),
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, FALSE, NULL), (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, FALSE, NULL),
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, FALSE, NULL), (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, FALSE,NULL),
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, TRUE, 2), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, TRUE, 2),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, FALSE, NULL), (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, FALSE, NULL),
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, TRUE, 2), (10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, TRUE, 2),
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL), (11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL),
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL); (12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`) INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`)
VALUES VALUES
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, ''), (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, '', 'packaging'),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two'), (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two', 'product'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three'), (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three', 'product'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four'), (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four', 'product'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five'), (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five', 'product'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six', 'product'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven', 'product'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1,''), (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, '', 'product'),
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, ''), (9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, '', 'product'),
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, ''), (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, '', 'product'),
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, ''); (99, 69, util.VN_CURDATE() - INTERVAL 1 MONTH, 11, 0, 442, 'IN2009', 'Movement 99', 0, '', 'product');
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`) INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1); VALUES (2, 4, 1);
@ -2521,10 +2521,6 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`, `code`)
(2, 'Normal', 'normal'), (2, 'Normal', 'normal'),
(3, 'Baja', 'low'); (3, 'Baja', 'low');
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`, `weekMaxBreak`, `weekMaxScope`, `askInOut`)
VALUES
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
INSERT INTO `vn`.`thermograph`(`id`, `model`) INSERT INTO `vn`.`thermograph`(`id`, `model`)
@ -4008,6 +4004,9 @@ INSERT IGNORE INTO pbx.queueMember
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
INSERT INTO vn.workerRelatives (workerFk, isDescendant, disabilityGradeFk, birthed, adoptionYear, isDependend, isJointCustody, updated)
VALUES
(1106, 1, NULL, 0, NULL, 0, 0, '2024-10-29 08:42:44.000');
INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0); INSERT INTO vn.routeAction (id, name, price, isMainlineDelivered) VALUES(1, 'Pintar traje', 50.00, 0);
INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1); INSERT INTO vn.routeComplement (id, dated, workerFk, price, routeActionFk) VALUES(1, util.VN_CURDATE(), 9, 50.00, 1);
@ -4025,7 +4024,6 @@ INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, c
(9, 1400, 1500, 500, 13000, 1, 1, 1, '04B', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL), (9, 1400, 1500, 500, 13000, 1, 1, 1, '04B', 4, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL),
(10, 0, 2000, 500, 13000, 1, 1, 1, '05A', 5, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL); (10, 0, 2000, 500, 13000, 1, 1, 1, '05A', 5, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL);
INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
VALUES (19, '1169'), VALUES (19, '1169'),
(8, '1183'), (8, '1183'),
@ -4033,3 +4031,6 @@ INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel) INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
VALUES ('saysimle-url-mock', '1819'); VALUES ('saysimle-url-mock', '1819');
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
VALUES (1106,'26493101E','2019-09-20');

View File

@ -19,14 +19,14 @@ BEGIN
bultos) bultos)
SELECT r.id, SELECT r.id,
r.agencyModeFk, r.agencyModeFk,
r.created, r.dated,
SUM(sv.volume / ebv.m3) SUM(sv.volume / ebv.m3)
FROM vn.route r FROM vn.route r
JOIN vn.ticket t ON t.routeFk = r.id JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
JOIN vn.saleVolume sv ON sv.ticketFk = t.id JOIN vn.saleVolume sv ON sv.ticketFk = t.id
JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox' JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox'
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND z.isVolumetric AND z.isVolumetric
GROUP BY r.id; GROUP BY r.id;
@ -38,12 +38,12 @@ BEGIN
Bultos) Bultos)
SELECT r.id, SELECT r.id,
r.agencyModeFk, r.agencyModeFk,
r.created, r.dated,
SUM(t.packages) SUM(t.packages)
FROM vn.route r FROM vn.route r
JOIN vn.ticket t ON t.routeFk = r.id JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND NOT z.isVolumetric AND NOT z.isVolumetric
GROUP BY r.id GROUP BY r.id
ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos);
@ -60,7 +60,7 @@ BEGIN
JOIN vn.component c ON c.id = sc.componentFk JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE ct.code = 'freight' WHERE ct.code = 'freight'
AND r.created BETWEEN vDatedFrom AND vDatedTo AND r.dated BETWEEN vDatedFrom AND vDatedTo
GROUP BY r.id GROUP BY r.id
) sub ON sub.routeFk = r.Id_Ruta ) sub ON sub.routeFk = r.Id_Ruta
SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0); SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0);
@ -77,7 +77,7 @@ BEGIN
JOIN vn.address ad ON ad.id = t.addressFk JOIN vn.address ad ON ad.id = t.addressFk
JOIN vn.client c ON c.id = ad.clientFk JOIN vn.client c ON c.id = ad.clientFk
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND NOT z.isVolumetric AND NOT z.isVolumetric
GROUP BY t.routeFk GROUP BY t.routeFk
) sub ON r.Id_Ruta = sub.routeFk ) sub ON r.Id_Ruta = sub.routeFk
@ -93,7 +93,7 @@ BEGIN
JOIN vn.saleVolume sf ON sf.ticketFk = t.id JOIN vn.saleVolume sf ON sf.ticketFk = t.id
JOIN vn.client c ON c.id = t.clientFk JOIN vn.client c ON c.id = t.clientFk
JOIN vn.`zone` z ON z.id = t.zoneFk JOIN vn.`zone` z ON z.id = t.zoneFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND z.isVolumetric AND z.isVolumetric
GROUP BY t.routeFk GROUP BY t.routeFk
) sub ON r.Id_Ruta = sub.routeFk ) sub ON r.Id_Ruta = sub.routeFk
@ -108,7 +108,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
JOIN vn.greuge g ON g.ticketFk = t.id JOIN vn.greuge g ON g.ticketFk = t.id
JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk
WHERE r.created BETWEEN vDatedFrom AND vDatedTo WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
AND gt.code = 'freightDifference' AND gt.code = 'freightDifference'
GROUP BY t.routeFk GROUP BY t.routeFk
) sub ON r.Id_Ruta = sub.routeFk ) sub ON r.Id_Ruta = sub.routeFk

View File

@ -26,7 +26,7 @@ BEGIN
DECLARE vCursor CURSOR FOR DECLARE vCursor CURSOR FOR
SELECT it.taxableBase, SELECT it.taxableBase,
CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)), CAST(SUM((( it.taxableBase / 100) * t.PorcentajeIva)) AS DECIMAL (10,2)),
t.PorcentajeIva, t.PorcentajeIva,
it.transactionTypeSageFk, it.transactionTypeSageFk,
it.taxTypeSageFk, it.taxTypeSageFk,
@ -39,7 +39,8 @@ BEGIN
JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk
LEFT JOIN vn.dua d ON d.id = vInvoiceInFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk
WHERE i.id = vInvoiceInFk WHERE i.id = vInvoiceInFk
AND d.id IS NULL; AND d.id IS NULL
GROUP BY it.taxTypeSageFk;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;

View File

@ -6,8 +6,7 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tValues; DROP TEMPORARY TABLE IF EXISTS tValues;
CREATE TEMPORARY TABLE tValues CREATE TEMPORARY TABLE tValues
ENGINE = MEMORY ENGINE = MEMORY
SELECT SELECT b.id buyFk,
b.id buyFk,
e.id entryFk, e.id entryFk,
t.id travelFk, t.id travelFk,
b.itemFk, b.itemFk,

View File

@ -26,7 +26,7 @@ BEGIN
JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk
WHERE friendship >= vSignificativeFriendship WHERE friendship >= vSignificativeFriendship
AND zf.zoneFk = vZoneFk AND zf.zoneFk = vZoneFk
AND r.created = vLanded AND r.dated = vLanded
ORDER BY friendship; ORDER BY friendship;
-- Se eliminan aquellas que superan el volumen máximo -- Se eliminan aquellas que superan el volumen máximo

View File

@ -26,7 +26,7 @@ BEGIN
JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk
WHERE friendship >= vSignificativeFriendship WHERE friendship >= vSignificativeFriendship
AND zf.zoneFk = vZoneFk AND zf.zoneFk = vZoneFk
AND r.created = vLanded AND r.dated = vLanded
ORDER BY friendship; ORDER BY friendship;
-- Se eliminan aquellas que superan el volumen máximo -- Se eliminan aquellas que superan el volumen máximo

View File

@ -1,65 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME)
RETURNS varchar(6) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Verifica la dirección de la fichada
* @param vUserFk Identificador del trabajador
* @param vTimed Hora de la fichada
* @return Retorna sentido de la fichada 'in, out, middle'
*/
DECLARE vPrevious DATETIME ;
DECLARE vNext DATETIME ;
DECLARE vPreviousDirection VARCHAR(3) ;
DECLARE vNextDirection VARCHAR(3) ;
DECLARE vDayStayMax INT;
DECLARE vTimedSeconds INT;
DECLARE vLastTimeIn INT;
SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds;
SELECT dayStayMax INTO vDayStayMax
FROM vn.workerTimeControlParams;
SELECT timed, direction INTO vNext,vNextDirection
FROM vn.workerTimeControl
WHERE userFk = vUserFk
AND direction IN ('in','out')
AND timed > vTimed
ORDER BY timed ASC
LIMIT 1;
SELECT timed, direction INTO vPrevious, vPreviousDirection
FROM vn.workerTimeControl
WHERE userFk = vUserFk
AND direction IN ('in','out')
AND timed < vTimed
ORDER BY timed DESC
LIMIT 1;
IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN
RETURN 'middle';
END IF;
IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN
IF vPreviousDirection = 'in' THEN
RETURN 'out';
ELSE
SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn
FROM vn.workerTimeControl
WHERE userFk = vUserFk
AND direction ='in'
AND timed < vPrevious;
IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN
RETURN 'out';
END IF;
END IF;
END IF;
RETURN 'in';
END$$
DELIMITER ;

View File

@ -9,16 +9,18 @@ BEGIN
* *
* @param vSelf Id de entrada * @param vSelf Id de entrada
*/ */
DECLARE vIsEditable BOOL; DECLARE vIsNotEditable BOOL DEFAULT FALSE;
SELECT e.isBooked INTO vIsEditable SELECT TRUE INTO vIsNotEditable
FROM `entry` e FROM `entry` e
JOIN entryType et ON et.code = e.typeFk LEFT JOIN entryType et ON et.code = e.typeFk
WHERE NOT et.isInformal WHERE e.id = vSelf
AND e.id = vSelf; AND e.isBooked
AND (e.typeFk IS NULL OR NOT et.isInformal);
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN IF vIsNotEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable')); CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -41,6 +41,6 @@ BEGIN
WHERE expeditionFk = e.id) WHERE expeditionFk = e.id)
LEFT JOIN expeditionState es2 ON es2.id = es.id LEFT JOIN expeditionState es2 ON es2.id = es.id
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
ORDER BY r.created, t.priority DESC; ORDER BY r.dated, t.priority DESC;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -219,7 +219,7 @@ BEGIN
) eWithheld ON TRUE ) eWithheld ON TRUE
WHERE tii.taxTypeSageFk IS NOT NULL WHERE tii.taxTypeSageFk IS NOT NULL
AND (tii.taxCode IS NULL OR tii.taxCode NOT IN ('import10', 'import21')) AND (tii.taxCode IS NULL OR tii.taxCode NOT IN ('import10', 'import21'))
GROUP BY tii.PorcentajeIva, tii.expenseFk; GROUP BY tii.CuentaIvaRepercutido;
-- Línea iva inversor sujeto pasivo -- Línea iva inversor sujeto pasivo
INSERT INTO XDiario( INSERT INTO XDiario(
@ -284,7 +284,7 @@ BEGIN
AND NOT(tii.isVies AND NOT(tii.isVies
AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk
AND tii.taxCode = 'nonTaxable') AND tii.taxCode = 'nonTaxable')
GROUP BY tii.PorcentajeIva, tii.expenseFk; GROUP BY tii.CuentaIvaRepercutido;
-- Actualización del registro original -- Actualización del registro original
UPDATE invoiceIn ii UPDATE invoiceIn ii

View File

@ -1,36 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(
vShelvingCode VARCHAR(10)
)
BEGIN
/**
* Devuelve el log de los item en cada carro
*
* @param vShelvingCode Matrícula del carro
*
*/
SELECT isl.itemShelvingFk,
isl.created,
isl.accion,
isl.itemFk,
isl.shelvingFk,
isl.quantity,
isl.visible,
isl.available,
isl.grouping,
isl.packing,
isl.stars,
item.longName,
item.size,
item.subName,
worker.code,
isl.accion
FROM item
JOIN itemShelvingLog isl ON item.id = isl.itemFk
JOIN worker ON isl.workerFk = worker.id
JOIN shelving sh ON sh.id = isl.shelvingFk
WHERE sh.code = vShelvingCode COLLATE utf8mb3_unicode_ci
OR isl.itemFk = vShelvingCode -- ?? Respeto porque ya estaba
ORDER BY isl.created DESC;
END$$
DELIMITER ;

View File

@ -27,7 +27,7 @@ BEGIN
rm.ticketFree = 0, rm.ticketFree = 0,
rm.ticketProduction = 0, rm.ticketProduction = 0,
rm.ticketPacked = 0, rm.ticketPacked = 0,
rm.dated = r.created; rm.dated = r.dated;
UPDATE routesMonitor rm UPDATE routesMonitor rm
JOIN ( JOIN (

View File

@ -14,7 +14,7 @@ BEGIN
DECLARE vIsKmTruckRate BOOL; DECLARE vIsKmTruckRate BOOL;
DECLARE vCountryFk INT; DECLARE vCountryFk INT;
SELECT r.created >= rc.cutoffDated INTO vIsUpdatable SELECT r.dated >= rc.cutoffDated INTO vIsUpdatable
FROM route r FROM route r
JOIN routeConfig rc JOIN routeConfig rc
WHERE r.id = vSelf; WHERE r.id = vSelf;

View File

@ -5,122 +5,122 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_splitItemPacki
) )
BEGIN BEGIN
/** /**
* Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado. * Separa en diferentes tickets según el tipo de empaquetado
* Respeta el id inicial para el tipo propuesto. * El ticket original conserva las líneas del tipo de empaquetado especificado
* Las líneas sin tipo de empaquetado se asignan al ticket del tipo por defecto.
* *
* @param vSelf Id ticket * @param vSelf Id del ticket original
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original * @param vOriginalItemPackingTypeFk Tipo de empaquetado a mantener en el ticket original
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk) * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/ */
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H'; DECLARE vIsDone BOOLEAN DEFAULT FALSE;
DECLARE vCurrentPackingType VARCHAR(1);
DECLARE vDefaultPackingType VARCHAR(1);
DECLARE vHasOriginalPackingType BOOLEAN;
DECLARE vNewTicketFk INT; DECLARE vNewTicketFk INT;
DECLARE vPackingTypesToSplit INT; DECLARE vTicketFk INT;
DECLARE vDone INT DEFAULT FALSE;
DECLARE vSaleGroup CURSOR FOR DECLARE vItemPackingTypes CURSOR FOR
SELECT itemPackingTypeFk SELECT DISTINCT itemPackingTypeFk FROM tSalesToMove;
FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
CREATE OR REPLACE TEMPORARY TABLE tSalesToMove (
ticketFk INT,
saleFk INT,
itemPackingTypeFk VARCHAR(1)
) ENGINE=MEMORY;
SELECT COALESCE(MAX(ic.defaultPackingTypeFk), MAX(i.itemPackingTypeFk)) INTO vDefaultPackingType
FROM vn.sale s
JOIN item i ON i.id = s.itemFk
LEFT JOIN itemConfig ic ON ic.defaultPackingTypeFk = i.itemPackingTypeFk
WHERE s.ticketFk = vSelf
GROUP BY s.ticketFk;
SELECT EXISTS (
SELECT TRUE
FROM sale s
JOIN item i ON i.id = s.itemFk
WHERE s.ticketFk = vSelf
AND i.itemPackingTypeFk = vOriginalItemPackingTypeFk
) INTO vHasOriginalPackingType;
IF vOriginalItemPackingTypeFk IS NULL OR NOT vHasOriginalPackingType THEN
SET vOriginalItemPackingTypeFk = vDefaultPackingType;
END IF;
START TRANSACTION; START TRANSACTION;
SELECT id SELECT t.id INTO vTicketFk
FROM sale FROM ticket t
WHERE ticketFk = vSelf JOIN sale s ON s.id = t.id
AND NOT quantity WHERE t.id = vSelf
FOR UPDATE; FOR UPDATE;
DELETE FROM sale INSERT INTO tSalesToMove (saleFk, itemPackingTypeFk)
WHERE NOT quantity SELECT s.id, i.itemPackingTypeFk
AND ticketFk = vSelf;
CREATE OR REPLACE TEMPORARY TABLE tSale
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT s.id, i.itemPackingTypeFk, IFNULL(sv.litros, 0) litros
FROM sale s FROM sale s
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
LEFT JOIN saleVolume sv ON sv.saleFk = s.id WHERE s.ticketFk = vSelf
WHERE s.ticketFk = vSelf; AND i.itemPackingTypeFk <> vOriginalItemPackingTypeFk;
CREATE OR REPLACE TEMPORARY TABLE tSaleGroup
ENGINE = MEMORY
SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tSale
GROUP BY itemPackingTypeFk;
SELECT COUNT(*) INTO vPackingTypesToSplit
FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT(
ticketFk INT,
itemPackingTypeFk VARCHAR(1)
) ENGINE = MEMORY;
CASE vPackingTypesToSplit
WHEN 0 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk);
WHEN 1 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
SELECT vSelf, itemPackingTypeFk
FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL;
ELSE
OPEN vSaleGroup;
FETCH vSaleGroup INTO vItemPackingTypeFk;
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vSelf, vItemPackingTypeFk);
OPEN vItemPackingTypes;
l: LOOP l: LOOP
SET vDone = FALSE; SET vIsDone = FALSE;
FETCH vSaleGroup INTO vItemPackingTypeFk; FETCH vItemPackingTypes INTO vCurrentPackingType;
IF vDone THEN IF vIsDone THEN
LEAVE l; LEAVE l;
END IF; END IF;
CALL ticket_Clone(vSelf, vNewTicketFk); CALL ticket_Clone(vSelf, vNewTicketFk);
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) SELECT id INTO vTicketFk
VALUES(vNewTicketFk, vItemPackingTypeFk); FROM ticket t
END LOOP; WHERE t.id = vNewTicketFk
CLOSE vSaleGroup;
SELECT s.id
FROM sale s
JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
FOR UPDATE; FOR UPDATE;
UPDATE tSalesToMove
SET ticketFk = vNewTicketFk
WHERE itemPackingTypeFk = vCurrentPackingType;
IF vCurrentPackingType = vDefaultPackingType THEN
INSERT INTO tSalesToMove (ticketFk, saleFk, itemPackingTypeFk)
SELECT vNewTicketFk, s.id, i.itemPackingTypeFk
FROM sale s
JOIN item i ON i.id = s.itemFk
WHERE s.ticketFk = vSelf
AND i.itemPackingTypeFk IS NULL;
END IF;
END LOOP;
CLOSE vItemPackingTypes;
UPDATE sale s UPDATE sale s
JOIN tSale ts ON ts.id = s.id JOIN tSalesToMove t ON t.saleFk = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
SET s.ticketFk = t.ticketFk; SET s.ticketFk = t.ticketFk;
SELECT itemPackingTypeFk INTO vItemPackingTypeFk CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT
FROM tSaleGroup sg ENGINE=MEMORY
WHERE sg.itemPackingTypeFk IS NOT NULL SELECT s.ticketFk, MAX(i.itemPackingTypeFk) itemPackingTypeFk
ORDER BY sg.itemPackingTypeFk FROM sale s
LIMIT 1; JOIN item i ON i.id = s.itemFk
WHERE s.ticketFk = vSelf
UPDATE sale s GROUP BY s.ticketFk
JOIN tSale ts ON ts.id = s.id UNION
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk SELECT ticketFk, MAX(itemPackingTypeFk)
SET s.ticketFk = t.ticketFk FROM tSalesToMove
WHERE ts.itemPackingTypeFk IS NULL; GROUP BY ticketFk;
END CASE;
COMMIT; COMMIT;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE tSalesToMove;
tSale,
tSaleGroup;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,168 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
proc: BEGIN
/**
* Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd
*
* @param vUserFk Identificador del trabajador
* @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ;
* En caso de tener algun problema retorna el primero que encuentra
*/
DECLARE vLastIn DATETIME ;
DECLARE vLastOut DATETIME ;
DECLARE vDayWorkMax INT;
DECLARE vDayBreak INT;
DECLARE vWeekBreak INT ;
DECLARE vWeekScope INT;
DECLARE vDayStayMax INT;
DECLARE vProblem VARCHAR(20) DEFAULT NULL;
DECLARE vTimedWorked INT;
DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL;
DECLARE vDepartmentFk INT;
DECLARE vTo VARCHAR(50) DEFAULT NULL;
DECLARE vUserName VARCHAR(50) DEFAULT NULL;
DECLARE vBody VARCHAR(255) DEFAULT NULL;
SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax
INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax
FROM workerTimeControlParams;
SELECT MAX(timed) INTO vLastIn
FROM workerTimeControl
WHERE userFk = vUserFk
AND direction = 'in';
SELECT MAX(timed) INTO vLastOut
FROM workerTimeControl
WHERE userFk = vUserFk
AND direction = 'out';
SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo
FROM account.user u
WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk);
SELECT CONCAT(firstName,' ',lastName) INTO vUserName
FROM worker w
WHERE w.id = vUserFk;
IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA
-- VERIFICAR DESCANSO DIARIO
IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN
SELECT "Descansos 12 h" AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
-- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ
IF (SELECT MOD(COUNT(*),2) -- <>0
FROM workerTimeControl
WHERE userFk = vUserFk
AND timed >= vLastIn
) THEN
SELECT "Dias con fichadas impares" AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
-- VERIFICAR VACACIONES
SELECT at2.name INTO vCalendarStateType
FROM calendar c
JOIN business b ON b.id = c.businessFk
JOIN absenceType at2 ON at2.id = c.dayOffTypeFk
WHERE c.dated = util.VN_CURDATE()
AND at2.isAllowedToWork = FALSE
AND b.workerFk = vUserFk
LIMIT 1;
IF(LENGTH(vCalendarStateType)) THEN
SELECT vCalendarStateType AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
-- VERIFICAR CONTRATO EN VIGOR
IF (SELECT COUNT(*)
FROM business b
WHERE b.workerFk = vUserFk
AND b.started <= vDated
AND IFNULL(b.ended, vDated) >= vDated
) = 0 THEN
SELECT "No hay un contrato en vigor" AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
-- VERIFICAR DESCANSO SEMANAL
SET @vHasBreakWeek:= FALSE;
SET @vLastTimed:= UNIX_TIMESTAMP((util.VN_NOW() - INTERVAL vWeekScope SECOND));
DROP TEMPORARY TABLE IF EXISTS tmp.trash;
CREATE TEMPORARY TABLE tmp.trash
SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias,
@vLastTimed:= UNIX_TIMESTAMP(timed)
FROM workerTimeControl
WHERE timed>= (util.VN_NOW() - INTERVAL vWeekScope SECOND)
AND userFk= vUserFk
AND direction IN ('in','out')
ORDER BY timed ASC;
IF UNIX_TIMESTAMP(util.VN_NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA
SELECT "Descansos 36 h" AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
DROP TEMPORARY TABLE tmp.trash;
ELSE -- DIA ACTUAL
-- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO
SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(util.VN_NOW()), 0) INTO vTimedWorked
FROM workerTimeControl wtc
WHERE userFk = vUserFk
AND timed >= vLastIn
ORDER BY timed;
IF vTimedWorked > vDayWorkMax THEN
SELECT "Jornadas" AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Jornadas") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
END IF;
-- VERIFICAR DEPARTAMENTO
/* IF vTabletFk IS NOT NULL THEN
SELECT wtcu.departmentFk INTO vDepartmentFk
FROM workerTimeControlUserInfo wtcu
WHERE wtcu.userFk = vUserFk;
IF (SELECT COUNT(td.tabletFk)
FROM tabletDepartment td
WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk
) = 0 THEN
SELECT "No perteneces a este departamento." AS problem;
-- ENVIAMOS CORREO AL BOSSFK
SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody;
CALL mail_insert(vTo,vTo,'error al fichar',vBody);
LEAVE proc;
END IF;
END IF;*/
END$$
DELIMITER ;

View File

@ -16,7 +16,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND ic.itemFk = NEW.itemFk AND ic.itemFk = NEW.itemFk
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN
CALL mail_insert( CALL mail_insert(

View File

@ -1,18 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterInsert`
AFTER INSERT ON `itemShelving`
FOR EACH ROW
BEGIN
INSERT INTO itemShelvingLog
SET itemShelvingFk = NEW.id,
workerFk = account.myUser_getId(),
accion = 'CREA REGISTRO',
itemFk = NEW.itemFk,
shelvingFk = NEW.shelvingFk,
visible = NEW.visible,
`grouping` = NEW.`grouping`,
packing = NEW.packing,
available = NEW.available;
END$$
DELIMITER ;

View File

@ -1,18 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterUpdate`
AFTER UPDATE ON `itemShelving`
FOR EACH ROW
BEGIN
INSERT INTO itemShelvingLog
SET itemShelvingFk = NEW.id,
workerFk = account.myUser_getId(),
accion = 'CAMBIO',
itemFk = NEW.itemFk,
shelvingFk = NEW.shelvingFk,
visible = NEW.visible,
`grouping` = NEW.`grouping`,
packing = NEW.packing,
available = NEW.available;
END$$
DELIMITER ;

View File

@ -1,15 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeDelete`
BEFORE DELETE ON `itemShelving`
FOR EACH ROW
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
workerFk,
accion,
shelvingFk,
itemFk)
VALUES( OLD.id,
account.myUser_getId(),
'ELIMINADO',
OLD.shelvingFk,
OLD.itemFk)$$
DELIMITER ;

View File

@ -14,7 +14,7 @@ BEGIN
SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk) SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk)
FROM vn.routeConfig r FROM vn.routeConfig r
LEFT JOIN vn.business b ON b.workerFk = vUserFk LEFT JOIN vn.business b ON b.workerFk = vUserFk
AND NEW.created BETWEEN b.started AND IFNULL(b.ended, NEW.created)); AND NEW.dated BETWEEN b.started AND IFNULL(b.ended, NEW.dated));
IF ISNULL(NEW.agencyModeFk) THEN IF ISNULL(NEW.agencyModeFk) THEN
SELECT r.agencyModeFk INTO vDefaultAgencyModeFk SELECT r.agencyModeFk INTO vDefaultAgencyModeFk

View File

@ -23,7 +23,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND s.id = NEW.id AND s.id = NEW.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
END IF; END IF;
END$$ END$$

View File

@ -54,7 +54,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND s.id = NEW.id AND s.id = NEW.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
END IF; END IF;

View File

@ -11,7 +11,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND s.id = OLD.id AND s.id = OLD.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
END IF; END IF;
END$$ END$$

View File

@ -8,7 +8,7 @@ BEGIN
FROM vn.route r FROM vn.route r
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND r.id = OLD.routeFk AND r.id = OLD.routeFk
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
DELETE FROM sale WHERE ticketFk = OLD.id; DELETE FROM sale WHERE ticketFk = OLD.id;

View File

@ -22,7 +22,7 @@ BEGIN
FROM `route` FROM `route`
WHERE NOT isOk WHERE NOT isOk
AND id IN (OLD.routeFk, NEW.routeFk) AND id IN (OLD.routeFk, NEW.routeFk)
AND created >= util.VN_CURDATE() AND dated >= util.VN_CURDATE()
GROUP BY id; GROUP BY id;
END IF; END IF;
@ -45,7 +45,7 @@ BEGIN
JOIN vn.route r ON r.id = t.routeFk JOIN vn.route r ON r.id = t.routeFk
WHERE r.isOk = FALSE WHERE r.isOk = FALSE
AND t.id = NEW.id AND t.id = NEW.id
AND r.created >= util.VN_CURDATE() AND r.dated >= util.VN_CURDATE()
GROUP BY r.id; GROUP BY r.id;
SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T');
SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T');

View File

@ -9,8 +9,8 @@ AS SELECT `rs2`.`description` AS `truck`,
`rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`, `rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`,
`t`.`warehouseFk` AS `warehouseFk`, `t`.`warehouseFk` AS `warehouseFk`,
IF( IF(
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, `r`.`dated` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
ucase(dayname(`r`.`created`)), ucase(dayname(`r`.`dated`)),
NULL NULL
) AS `nombreDia` ) AS `nombreDia`
FROM ( FROM (

View File

@ -6,7 +6,7 @@ AS SELECT `r`.`id` AS `routeFk`,
COUNT(DISTINCT `e`.`id`) AS `expeditions`, COUNT(DISTINCT `e`.`id`) AS `expeditions`,
COUNT(DISTINCT `es`.`id`) AS `scanned`, COUNT(DISTINCT `es`.`id`) AS `scanned`,
max(`e`.`created`) AS `lastPacked`, max(`e`.`created`) AS `lastPacked`,
`r`.`created` AS `created` `r`.`dated` AS `created`
FROM ( FROM (
( (
( (
@ -23,5 +23,5 @@ FROM (
) )
LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`expeditionFk` = `e`.`id`) LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`expeditionFk` = `e`.`id`)
) )
WHERE `r`.`created` >= `util`.`yesterday`() WHERE `r`.`dated` >= `util`.`yesterday`()
GROUP BY `r`.`id` GROUP BY `r`.`id`

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `vn2008`.`Rutas` VIEW `vn2008`.`Rutas`
AS SELECT `r`.`id` AS `Id_Ruta`, AS SELECT `r`.`id` AS `Id_Ruta`,
`r`.`workerFk` AS `Id_Trabajador`, `r`.`workerFk` AS `Id_Trabajador`,
`r`.`created` AS `Fecha`, `r`.`dated` AS `Fecha`,
`r`.`vehicleFk` AS `Id_Vehiculo`, `r`.`vehicleFk` AS `Id_Vehiculo`,
`r`.`agencyModeFk` AS `Id_Agencia`, `r`.`agencyModeFk` AS `Id_Agencia`,
`r`.`time` AS `Hora`, `r`.`time` AS `Hora`,

View File

@ -0,0 +1,23 @@
ALTER TABLE vn.workerRelatives DROP FOREIGN KEY workerRelatives_disabilityGradeFk;
ALTER TABLE vn.workerRelatives DROP FOREIGN KEY workerRelatives_workerFk;
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES
('WorkerRelative','updateAttributes','*','ALLOW','ROLE','hr'),
('WorkerRelative','crud','WRITE','ALLOW','ROLE','hr'),
('WorkerRelative','findById','*','ALLOW','ROLE','hr'),
('WorkerRelative','find','*','ALLOW','ROLE','hr'),
('WorkerRelative','upsert','*','ALLOW','ROLE','hr'),
('WorkerRelative','filter','*','ALLOW','ROLE','hr'),
('WorkerIrpf','updateAttributes','*','ALLOW','ROLE','hr'),
('WorkerIrpf','crud','*','ALLOW','ROLE','hr'),
('WorkerIrpf','findById','*','ALLOW','ROLE','hr'),
('WorkerIrpf','find','*','ALLOW','ROLE','hr'),
('WorkerIrpf','upsert','*','ALLOW','ROLE','hr'),
('WorkerIrpf','filter','*','ALLOW','ROLE','hr'),
('DisabilityGrade','updateAttributes','*','ALLOW','ROLE','hr'),
('DisabilityGrade','crud','*','ALLOW','ROLE','hr'),
('DisabilityGrade','findById','*','ALLOW','ROLE','hr'),
('DisabilityGrade','find','*','ALLOW','ROLE','hr'),
('DisabilityGrade','upsert','*','ALLOW','ROLE','hr');

View File

@ -0,0 +1,40 @@
-- Eliminar registros existentes donde property = '*'
DELETE FROM `salix`.ACL WHERE model = 'entry' AND property = '*';
-- Insertar permisos para los métodos solicitados en el modelo Entry
INSERT INTO `salix`.ACL (model, property, accessType, permission, principalType, principalId)
VALUES
-- Permisos para administrative
('Entry', 'upsert', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'isBooked', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'findById', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'filter', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'count', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'getEntry', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'getBuys', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'findOne', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'deleteBuys', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'editLatestBuys', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'importBuys', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'importBuysPreview', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'lastItemBuys', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Entry', 'latestBuysFilter', 'READ', 'ALLOW', 'ROLE', 'administrative'),
-- Permisos para buyer (excluyendo isBooked)
('Entry', 'upsert', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'findById', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'find', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'filter', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'count', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'getEntry', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'getBuys', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'findOne', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'deleteBuys', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'editLatestBuys', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'importBuys', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'importBuysPreview', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'lastItemBuys', 'READ', 'ALLOW', 'ROLE', 'buyer'),
('Entry', 'latestBuysFilter', 'READ', 'ALLOW', 'ROLE', 'buyer');

View File

@ -0,0 +1,4 @@
ALTER TABLE vn.travel ADD IF NOT EXISTS isRaid tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Redada';
ALTER TABLE vn.travel MODIFY COLUMN daysInForward int(10) unsigned DEFAULT NULL
COMMENT 'Cuando es una redada, indica el número de días que se añadirán a la fecha de hoy para establecer el landed. NULL si no es una redada';

View File

@ -0,0 +1,5 @@
ALTER TABLE vn.travel ADD IF NOT EXISTS isRaid tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Redada';
ALTER TABLE vn.travel MODIFY COLUMN daysInForward int(10) unsigned DEFAULT NULL
COMMENT 'Cuando es una redada, indica el número de días que se añadirán a la fecha de hoy para establecer el landed. NULL si no es una redada';

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.itemConfig ADD defaultPackingTypeFk VARCHAR(1) DEFAULT 'H' NULL;

View File

@ -0,0 +1,2 @@
RENAME TABLE vn.workerTimeControlParams TO vn.workerTimeControlParams__;
ALTER TABLE vn.workerTimeControlParams__ COMMENT='@deprecated 2024-11-19';

View File

@ -0,0 +1,8 @@
DELETE FROM vn.stateI18n
WHERE `name` IN ('Billed', 'Facturado', 'Assisted preparation', 'Preparación asistida', 'Shipped', 'Embarcado', 'Stowaway OK', 'Polizón OK');
UPDATE vn.`state` SET nextStateFk = 43
WHERE nextStateFk IN (11, 27, 30, 32, 41);
DELETE FROM vn.`state`
WHERE code IN ('INVOICED', 'ASSISTED_PREPARATION', 'BOARD', 'OK STOWAWAY', 'PARTIAL_PREPARATION');

View File

@ -0,0 +1,2 @@
RENAME TABLE vn.itemShelvingLog TO vn.itemShelvingLog__;
ALTER TABLE vn.itemShelvingLog__ COMMENT='@deprecated 2024-11-26';

View File

@ -0,0 +1,7 @@
ALTER TABLE `vn`.`creditInsurance` DROP COLUMN `creditClassification__`;
ALTER TABLE `vn`.`worker` DROP COLUMN `isF11Allowed__`;
ALTER TABLE `util`.`config` DROP COLUMN `dbVersion__`;
ALTER TABLE `util`.`config` DROP COLUMN `hasTriggersDisabled__`;
ALTER TABLE `vn`.`agencyMode` DROP COLUMN `showAgencyName__`;
DROP TABLE `account`.`accountLog__`;
DROP TABLE `vn`.`silexACL__`;

View File

@ -0,0 +1,5 @@
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaFk_UNIQUE;
ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaInvoiceIn_unique;
ALTER TABLE vn.duaInvoiceIn ADD CONSTRAINT duaInvoiceIn_unique
UNIQUE KEY (invoiceInFk);

View File

@ -0,0 +1 @@
ALTER TABLE vn.route ADD dated DATE;

View File

@ -0,0 +1 @@
UPDATE vn.route SET dated = created;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.route
MODIFY COLUMN dated DATE NOT NULL;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.route
MODIFY COLUMN created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;

View File

@ -791,7 +791,7 @@ export default {
}, },
createRouteView: { createRouteView: {
worker: 'vn-route-create vn-worker-autocomplete[ng-model="$ctrl.route.workerFk"]', worker: 'vn-route-create vn-worker-autocomplete[ng-model="$ctrl.route.workerFk"]',
createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]', createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.dated"]',
vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
description: 'vn-route-create [ng-model="$ctrl.route.description"]', description: 'vn-route-create [ng-model="$ctrl.route.description"]',

View File

@ -241,10 +241,11 @@
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm", "The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line", "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first", "There are tickets for this area, delete them first": "There are tickets for this area, delete them first",
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}", "You do not have permission to modify the booked field": "You do not have permission to modify the booked field",
"Invalid or expired verification code": "Invalid or expired verification code", "Invalid or expired verification code": "Invalid or expired verification code",
"Payment method is required": "Payment method is required", "ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
"The raid information is not correct": "The raid information is not correct", "The raid information is not correct": "The raid information is not correct",
"Payment method is required": "Payment method is required",
"Sales already moved": "Sales already moved", "Sales already moved": "Sales already moved",
"There are tickets to be invoiced": "There are tickets to be invoiced for this zone, please delete them first" "There are tickets to be invoiced": "There are tickets to be invoiced for this zone, please delete them first"
} }

View File

@ -385,9 +385,11 @@
"type cannot be blank": "Se debe rellenar el tipo", "type cannot be blank": "Se debe rellenar el tipo",
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
"You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada",
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
"The web user's email already exists": "El correo del usuario web ya existe", "The web user's email already exists": "El correo del usuario web ya existe",
"Sales already moved": "Ya han sido transferidas", "Sales already moved": "Ya han sido transferidas",
"The raid information is not correct": "La información de la redada no es correcta", "The raid information is not correct": "La información de la redada no es correcta",
"There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero" "There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero"
} }

View File

@ -364,6 +364,7 @@
"Cannot send mail": "Impossible d'envoyer le mail", "Cannot send mail": "Impossible d'envoyer le mail",
"Original invoice not found": "Facture originale introuvable", "Original invoice not found": "Facture originale introuvable",
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne", "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne",
"You do not have permission to modify the booked field": "Vous n'avez pas la permission de modifier le champ comptabilisé",
"ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}", "ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}",
"The web user's email already exists": "L'email de l'internaute existe déjà" "The web user's email already exists": "L'email de l'internaute existe déjà"
} }

View File

@ -1,3 +1,4 @@
const UserError = require('vn-loopback/util/user-error');
const LoopBackContext = require('loopback-context'); const LoopBackContext = require('loopback-context');
module.exports = Self => { module.exports = Self => {
require('../methods/entry/filter')(Self); require('../methods/entry/filter')(Self);
@ -19,11 +20,20 @@ module.exports = Self => {
const changes = ctx.data || ctx.instance; const changes = ctx.data || ctx.instance;
const orgData = ctx.currentInstance; const orgData = ctx.currentInstance;
const loopBackContext = LoopBackContext.getCurrentContext();
const accessToken = {req: loopBackContext.active};
const hasChanges = orgData && changes;
const isBookedChanged = changes.isBooked !== undefined && orgData.isBooked !== changes.isBooked;
if (isBookedChanged) {
const canEditIsBooked = await Self.app.models.ACL.checkAccessAcl(accessToken, 'Entry', 'isBooked', 'READ');
if (!canEditIsBooked)
throw new UserError('You do not have permission to modify the booked field');
}
const observation = changes.observation || orgData.observation; const observation = changes.observation || orgData.observation;
const hasChanges = orgData && changes; const observationChanged = hasChanges && orgData.observation != observation;
const observationChanged = hasChanges
&& orgData.observation != observation;
if (observationChanged) { if (observationChanged) {
let tx; let tx;
@ -38,8 +48,7 @@ module.exports = Self => {
} }
try { try {
const loopbackContext = LoopBackContext.getCurrentContext(); const userId = loopBackContext.active.accessToken.userId;
const userId = loopbackContext.active.accessToken.userId;
const id = changes.id || orgData.id; const id = changes.id || orgData.id;
const entry = await Self.app.models.Entry.findById(id, null, myOptions); const entry = await Self.app.models.Entry.findById(id, null, myOptions);
await entry.updateAttribute('observationEditorFk', userId, myOptions); await entry.updateAttribute('observationEditorFk', userId, myOptions);

View File

@ -0,0 +1,97 @@
const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('entry_isEditable trigger', () => {
const activeCtx = {
accessToken: {userId: 5},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {req: activeCtx};
const entryId = 1;
let tx;
let options;
let entry;
beforeEach(async() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: ctx.req});
tx = await models.Entry.beginTransaction({});
options = {transaction: tx};
entry = await models.Entry.findById(entryId, null, options);
});
afterEach(async() => {
await tx.rollback();
});
async function prepareEntry(isBooked, typeFk) {
let newCreated = Date.vnNew();
await entry.updateAttributes({isBooked, typeFk}, options);
await entry.updateAttributes({dated: newCreated}, options);
}
it('should throw an error when entry is booked and typeFk is null', async() => {
let error;
try {
await prepareEntry(true, null);
} catch (e) {
error = e;
}
expect(error.message).toContain(`Entry ${entryId} is not editable`);
});
it('should throw an error when entry is booked and typeFk is not informal', async() => {
let error;
try {
const type = await models.EntryType.findOne({where: {isInformal: false}}, options);
await prepareEntry(true, type.code);
} catch (e) {
error = e;
}
expect(error.message).toContain(`Entry ${entryId} is not editable`);
});
it('should not throw an error when entry is booked and typeFk is informal', async() => {
let error;
try {
const type = await models.EntryType.findOne({where: {isInformal: true}}, options);
await prepareEntry(true, type.code);
} catch (e) {
error = e;
}
expect(error).toBeUndefined();
});
it('should not throw an error when entry is not booked', async() => {
let error;
try {
const type = await models.EntryType.findOne({}, options);
await prepareEntry(false, type.code);
} catch (e) {
error = e;
}
expect(error).toBeUndefined();
});
it('should not throw an error when @isModeInventory is true', async() => {
let error;
try {
await models.Application.rawSql('SET @isModeInventory = TRUE;', null, options);
await prepareEntry(true, null);
} catch (e) {
error = e;
} finally {
await models.Application.rawSql('SET @isModeInventory = FALSE;', null, options);
}
expect(error).toBeUndefined();
});
});

View File

@ -56,9 +56,6 @@
"ItemShelving": { "ItemShelving": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ItemShelvingLog": {
"dataSource": "vn"
},
"ItemShelvingSale": { "ItemShelvingSale": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -1,52 +0,0 @@
{
"name": "ItemShelvingLog",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "itemShelvingLog"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"created": {
"type": "date"
},
"shelvingFk": {
"type": "string"
},
"itemFk": {
"type": "number"
},
"visible": {
"type": "number"
},
"accion": {
"type": "string"
}
},
"relations": {
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"shelving": {
"type": "belongsTo",
"model": "Shelving",
"foreignKey": "shelvingFk",
"primaryKey": "code"
}
}
}

View File

@ -342,7 +342,6 @@ module.exports = Self => {
'CHECKED', 'CHECKED',
'PACKING', 'PACKING',
'PACKED', 'PACKED',
'INVOICED',
'ON_DELIVERY', 'ON_DELIVERY',
'PREPARED', 'PREPARED',
'WAITING_FOR_PICKUP', 'WAITING_FOR_PICKUP',
@ -350,10 +349,7 @@ module.exports = Self => {
'PRINTED_BACK', 'PRINTED_BACK',
'LAST_CALL', 'LAST_CALL',
'PREVIOUS_PREPARATION', 'PREVIOUS_PREPARATION',
'ASSISTED_PREPARATION',
'BOARD',
'PRINTED STOWAWAY', 'PRINTED STOWAWAY',
'OK STOWAWAY',
'HALF_PACKED', 'HALF_PACKED',
'COOLER_PREPARATION' 'COOLER_PREPARATION'
]}}; ]}};

View File

@ -66,9 +66,9 @@ module.exports = Self => {
case 'agencyFk': case 'agencyFk':
return {'agencyFk': value}; return {'agencyFk': value};
case 'from': case 'from':
return {'created': {gte: value}}; return {'dated': {gte: value}};
case 'to': case 'to':
return {'created': {lte: value}}; return {'dated': {lte: value}};
} }
}); });
@ -81,7 +81,7 @@ module.exports = Self => {
`SELECT * `SELECT *
FROM ( FROM (
SELECT r.id routeFk, SELECT r.id routeFk,
r.created, r.dated,
r.agencyModeFk, r.agencyModeFk,
am.name agencyModeName, am.name agencyModeName,
am.agencyFk, am.agencyFk,
@ -103,7 +103,7 @@ module.exports = Self => {
LEFT JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id
LEFT JOIN vn.supplier s ON s.id = sat.supplierFk LEFT JOIN vn.supplier s ON s.id = sat.supplierFk
WHERE r.created > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL WHERE r.dated > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL
GROUP BY r.id GROUP BY r.id
) a` ) a`
, [date]); , [date]);

View File

@ -10,10 +10,10 @@ module.exports = Self => {
description: 'The routes ids to clone' description: 'The routes ids to clone'
}, },
{ {
arg: 'created', arg: 'dated',
type: 'date', type: 'date',
required: true, required: true,
description: 'The created date for all routes' description: 'The date for all routes'
} }
], ],
returns: { returns: {
@ -26,7 +26,7 @@ module.exports = Self => {
} }
}); });
Self.clone = async(ids, created) => { Self.clone = async(ids, dated) => {
const tx = await Self.beginTransaction({}); const tx = await Self.beginTransaction({});
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
@ -39,7 +39,7 @@ module.exports = Self => {
throw new Error(`The amount of routes found don't match`); throw new Error(`The amount of routes found don't match`);
const routes = originalRoutes.map(route => { const routes = originalRoutes.map(route => {
route.created = created; route.dated = dated;
return route; return route;
}); });

View File

@ -93,9 +93,9 @@ module.exports = Self => {
case 'search': case 'search':
return {'id': value}; return {'id': value};
case 'from': case 'from':
return {'created': {gte: value}}; return {'dated': {gte: value}};
case 'to': case 'to':
return {'created': {lte: value}}; return {'dated': {lte: value}};
case 'description': case 'description':
return {'description': {like: `%${value}%`}}; return {'description': {like: `%${value}%`}};
case 'isOk': case 'isOk':
@ -119,7 +119,7 @@ module.exports = Self => {
SELECT SELECT
r.id, r.id,
r.workerFk, r.workerFk,
r.created, r.dated,
r.vehicleFk, r.vehicleFk,
r.agencyModeFk, r.agencyModeFk,
r.time, r.time,

View File

@ -46,14 +46,14 @@ module.exports = Self => {
and: [ and: [
{ {
or: [ or: [
{'created': currentDate}, {'dated': currentDate},
{'created': nextDay} {'dated': nextDay}
] ]
} }
] ]
}, },
order: [ order: [
'created ASC', 'dated ASC',
'time ASC', 'time ASC',
'agencyName ASC' 'agencyName ASC'
] ]

View File

@ -43,10 +43,10 @@ module.exports = Self => {
for (let zoneAgencyMode of zoneAgencyModes) for (let zoneAgencyMode of zoneAgencyModes)
zoneIds.push(zoneAgencyMode.zoneFk); zoneIds.push(zoneAgencyMode.zoneFk);
const minDate = new Date(route.created); const minDate = new Date(route.dated);
minDate.setHours(0, 0, 0, 0); minDate.setHours(0, 0, 0, 0);
const maxDate = new Date(route.created); const maxDate = new Date(route.dated);
maxDate.setHours(23, 59, 59, 59); maxDate.setHours(23, 59, 59, 59);
let tickets = await Self.app.models.Ticket.find({ let tickets = await Self.app.models.Ticket.find({

View File

@ -42,10 +42,10 @@ module.exports = Self => {
try { try {
const route = await models.Route.findById(routeId, null, myOptions); const route = await models.Route.findById(routeId, null, myOptions);
const minDate = new Date(route.created); const minDate = new Date(route.dated);
minDate.setHours(0, 0, 0, 0); minDate.setHours(0, 0, 0, 0);
const maxDate = new Date(route.created); const maxDate = new Date(route.dated);
maxDate.setHours(23, 59, 59, 59); maxDate.setHours(23, 59, 59, 59);
const ticket = await models.Ticket.findOne({ const ticket = await models.Ticket.findOne({
where: { where: {

View File

@ -15,7 +15,7 @@
"id": true, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
"created": { "dated": {
"type": "date" "type": "date"
}, },
"time": { "time": {

View File

@ -32,7 +32,7 @@
<div class="attributes"> <div class="attributes">
<vn-label-value <vn-label-value
label="Date" label="Date"
value="{{$ctrl.route.created | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.route.dated | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Agency" label="Agency"

View File

@ -48,7 +48,7 @@ class Controller extends Descriptor {
'id', 'id',
'workerFk', 'workerFk',
'agencyModeFk', 'agencyModeFk',
'created', 'dated',
'm3', 'm3',
'warehouseFk', 'warehouseFk',
'description', 'description',

View File

@ -14,7 +14,7 @@
value="{{$ctrl.summary.route.id}}"> value="{{$ctrl.summary.route.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Date" <vn-label-value label="Date"
value="{{$ctrl.summary.route.created | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.summary.route.dated | date: 'dd/MM/yyyy'}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.summary.route.agencyMode.name}}"> value="{{$ctrl.summary.route.agencyMode.name}}">

View File

@ -15,7 +15,7 @@ module.exports = Self => {
Self.getWithPackaging = async options => { Self.getWithPackaging = async options => {
const models = Self.app.models; const models = Self.app.models;
const myOptions = {}; const myOptions = {};
const oneYearAgo = new Date(); const oneYearAgo = Date.vnNew();
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1); oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
if (typeof options == 'object') if (typeof options == 'object')

View File

@ -1,26 +1,12 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
describe('Supplier getWithPackaging()', () => { describe('Supplier getWithPackaging()', () => {
beforeAll.mockLoopBackContext();
it('should return a list of suppliers with an entry of type packaging', async() => { it('should return a list of suppliers with an entry of type packaging', async() => {
const typeFk = 'packaging';
const tx = await models.Supplier.beginTransaction({}); const tx = await models.Supplier.beginTransaction({});
const myOptions = {transaction: tx}; const myOptions = {transaction: tx};
try { try {
const entry = await models.Entry.findOne(
{
where: {
id: 1
},
myOptions
});
await entry.updateAttributes({
typeFk: typeFk,
created: new Date()
});
const result = await models.Supplier.getWithPackaging(myOptions); const result = await models.Supplier.getWithPackaging(myOptions);
expect(result.length).toEqual(1); expect(result.length).toEqual(1);

View File

@ -265,7 +265,8 @@ module.exports = Self => {
FROM sale s2 FROM sale s2
JOIN item i2 ON i2.id = s2.itemFk JOIN item i2 ON i2.id = s2.itemFk
WHERE s2.ticketFk = t.id WHERE s2.ticketFk = t.id
) AS packing ) AS packing,
c.credit
FROM ticket t FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref LEFT JOIN invoiceOut io ON t.refFk = io.ref
LEFT JOIN zone z ON z.id = t.zoneFk LEFT JOIN zone z ON z.id = t.zoneFk

View File

@ -154,8 +154,8 @@ module.exports = Self => {
t.landingHour, t.landingHour,
t.cargoSupplierFk, t.cargoSupplierFk,
t.totalEntries, t.totalEntries,
t.daysInForward,
t.isRaid, t.isRaid,
t.daysInForward,
am.name agencyModeName, am.name agencyModeName,
win.name warehouseInName, win.name warehouseInName,
wout.name warehouseOutName, wout.name warehouseOutName,

View File

@ -86,30 +86,30 @@ module.exports = Self => {
'Tipo Documento': 'description', 'Tipo Documento': 'description',
'Stored on': 'created', 'Stored on': 'created',
'Document ID': 'id', 'Document ID': 'id',
'URL': 'download', 'URL': 'url',
'Stored by': 'name', 'Stored by': 'name',
'Estado': 'state' 'Estado': 'state'
}; };
workerDocuware = workerDocuware =
await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? []; await models.Docuware.getById('hr', worker?.lastName + ' ' + worker?.firstName, docuwareParse) ?? [];
const url = (await Self.app.models.Url.getUrl('docuware')) + 'WebClient';
for (document of workerDocuware) { for (document of workerDocuware) {
const docuwareId = document.id; const {id: documentId, dmsFk} = document;
const defaultData = { const defaultData = {
id: docuwareId, id: documentId,
workerFk: id, workerFk: id,
dmsFk: docuwareId, dmsFk: dmsFk,
dms: { dms: {
id: docuwareId, id: documentId,
file: docuwareId + '.pdf', file: dmsFk + '.pdf',
isDocuware: true, isDocuware: true,
hasFile: false, hasFile: false,
reference: worker.fi, reference: worker?.fi,
dmsFk: docuwareId, dmsFk: dmsFk,
url, url: document.url,
download: `WorkerDms/${document.dmsFk}/docuwareDownload`,
description: document.description + ' - ' + document.state, description: document.description + ' - ' + document.state,
download: document.download,
created: document.created, created: document.created,
dmsType: {name: 'Docuware'}, dmsType: {name: 'Docuware'},
worker: {id: null, user: {name: document.name}}, worker: {id: null, user: {name: document.name}},

View File

@ -16,7 +16,7 @@ module.exports = Self => {
}); });
Self.checkInbox = async() => { Self.checkInbox = async() => {
let imapConfig = await Self.app.models.WorkerTimeControlParams.findOne(); let imapConfig = await Self.app.models.WorkerTimeControlConfig.findOne();
let imap = new Imap({ let imap = new Imap({
user: imapConfig.mailUser, user: imapConfig.mailUser,
password: imapConfig.mailPass, password: imapConfig.mailPass,

View File

@ -58,9 +58,8 @@ module.exports = Self => {
if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss)) if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss))
throw new UserError(`You don't have enough privileges`); throw new UserError(`You don't have enough privileges`);
const labour = await models.WorkerLabour.findById(args.businessFk, { const labour = await models.WorkerLabour.findById(args.businessFk,
include: {relation: 'department'} {fields: ['started', 'ended', 'businessFk']}, myOptions);
}, myOptions);
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended)) if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
throw new UserError(`The contract was not active during the selected date`); throw new UserError(`The contract was not active during the selected date`);
@ -87,7 +86,8 @@ module.exports = Self => {
`SELECT COUNT(*) halfHolidayCounter `SELECT COUNT(*) halfHolidayCounter
FROM vn.calendar c FROM vn.calendar c
JOIN vn.business b ON b.id = c.businessFk JOIN vn.business b ON b.id = c.businessFk
WHERE c.dayOffTypeFk = 6 JOIN vn.absenceType at ON at.id = c.dayOffTypeFk
WHERE at.code = 'halfHoliday'
AND b.workerFk = ? AND b.workerFk = ?
AND c.dated BETWEEN util.firstDayOfYear(?) AND c.dated BETWEEN util.firstDayOfYear(?)
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]); AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
@ -119,11 +119,10 @@ module.exports = Self => {
dated: args.dated dated: args.dated
}, myOptions); }, myOptions);
const department = labour.department();
if (department && department.notificationEmail) {
const absenceType = await models.AbsenceType.findById(args.absenceTypeId, null, myOptions);
const account = await models.VnUser.findById(userId, null, myOptions); const account = await models.VnUser.findById(userId, null, myOptions);
const subordinated = await models.VnUser.findById(id, null, myOptions); const subordinated = await models.VnUser.findById(id, null, myOptions);
const worker = await models.Worker.findById(subordinated.id, null, myOptions);
const departmentBoss = await models.VnUser.findById(worker.bossFk, null, myOptions);
const url = await Self.app.models.Url.getUrl(); const url = await Self.app.models.Url.getUrl();
const body = $t('Created absence', { const body = $t('Created absence', {
author: account.nickname, author: account.nickname,
@ -135,9 +134,8 @@ module.exports = Self => {
await models.Mail.create({ await models.Mail.create({
subject: $t('Absence change notification on the labour calendar'), subject: $t('Absence change notification on the labour calendar'),
body: body, body: body,
receiver: department.notificationEmail receiver: departmentBoss.email
}, myOptions); }, myOptions);
}
if (tx) await tx.commit(); if (tx) await tx.commit();

View File

@ -113,9 +113,6 @@
"WorkerTimeControlConfig": { "WorkerTimeControlConfig": {
"dataSource": "vn" "dataSource": "vn"
}, },
"WorkerTimeControlParams": {
"dataSource": "vn"
},
"WorkerTimeControlMail": { "WorkerTimeControlMail": {
"dataSource": "vn" "dataSource": "vn"
}, },
@ -125,6 +122,15 @@
"Locker": { "Locker": {
"dataSource": "vn" "dataSource": "vn"
}, },
"WorkerIrpf": {
"dataSource": "vn"
},
"DisabilityGrade": {
"dataSource": "vn"
},
"WorkerRelative": {
"dataSource": "vn"
},
"MedicalReview": { "MedicalReview": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,18 @@
{
"name": "DisabilityGrade",
"base": "VnModel",
"options": {
"mysql": {
"table": "disabilityGrade"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"description": {
"type": "string"
}
}
}

View File

@ -0,0 +1,55 @@
{
"name": "WorkerIrpf",
"description": "Model 145 IRPF",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerIrpf"
}
},
"properties": {
"workerFk": {
"type": "number",
"id": 1,
"description": "Identifier"
},
"spouseNif": {
"type": "string"
},
"geographicMobilityDate": {
"type": "date"
},
"disabilityGradeFk": {
"type" : "number"
},
"isDependend": {
"type" : "number"
},
"familySituation": {
"type" : "number"
},
"spousePension": {
"type" : "number"
},
"childPension": {
"type" : "number"
},
"hasHousingPaymentBefore": {
"type" : "number"
},
"hasHousingPaymentAfter": {
"type" : "number"
},
"updated": {
"type" : "date"
}
},
"relations": {
"disabilityGrade": {
"type": "belongsTo",
"model": "disabilityGrade",
"foreignKey": "disabilityGradeFk"
}
}
}

View File

@ -0,0 +1,53 @@
{
"name": "WorkerRelative",
"description": "Model 145 IRPF",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerRelatives"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"workerFk": {
"type": "number"
},
"isDescendant": {
"type": "number"
},
"disabilityGradeFk": {
"type" : "number"
},
"birthed": {
"type" : "number"
},
"adoptionYear": {
"type" : "number"
},
"isDependend": {
"type" : "boolean"
},
"isJointCustody": {
"type" : "boolean"
},
"updated": {
"type" : "date"
}
},
"relations": {
"disabilityGrade": {
"type": "belongsTo",
"model": "disabilityGrade",
"foreignKey": "disabilityGradeFk"
},
"worker": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "workerFK"
}
}
}

View File

@ -11,6 +11,15 @@
"id": true, "id": true,
"type": "number" "type": "number"
}, },
"mailPass": {
"type": "string"
},
"mailHost": {
"type": "string"
},
"mailUser": {
"type": "string"
},
"breakTime": { "breakTime": {
"type": "number" "type": "number"
}, },
@ -23,5 +32,13 @@
"teleworkingStartBreakTime": { "teleworkingStartBreakTime": {
"type": "number" "type": "number"
} }
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
} }
]
} }

View File

@ -1,35 +0,0 @@
{
"name": "WorkerTimeControlParams",
"description": "imap config",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerTimeControlParams"
}
},
"properties": {
"mailHost": {
"type": "string"
},
"mailUser": {
"type": "string"
},
"mailPass": {
"type": "string"
},
"mailSuccessFolder": {
"type": "string"
},
"mailErrorFolder": {
"type": "string"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -132,6 +132,16 @@
"type": "hasMany", "type": "hasMany",
"model": "WorkerTimeControlMail", "model": "WorkerTimeControlMail",
"foreignKey": "workerFk" "foreignKey": "workerFk"
},
"irpf": {
"type": "hasMany",
"model": "WorkerIrpf",
"foreignKey": "workerFk"
},
"workerRelative": {
"type": "hasMany",
"model": "WorkerRelative",
"foreignKey": "workerFK"
} }
}, },
"acls": [ "acls": [

View File

@ -258,7 +258,6 @@ localFixtures:
- itemFamily - itemFamily
- itemLog - itemLog
- itemShelving - itemShelving
- itemShelvingLog
- itemShelvingSale - itemShelvingSale
- itemTag - itemTag
- itemTaxCountry - itemTaxCountry
@ -385,7 +384,6 @@ localFixtures:
- workerTimeControl - workerTimeControl
- workerTimeControlConfig - workerTimeControlConfig
- workerTimeControlMail - workerTimeControlMail
- workerTimeControlParams
- zone - zone
- zoneAgencyMode - zoneAgencyMode
- zoneClosure - zoneClosure

View File

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

View File

@ -16,7 +16,7 @@
</tr> </tr>
<tr> <tr>
<th class="font gray align-right">{{$t('date')}}</th> <th class="font gray align-right">{{$t('date')}}</th>
<td>{{formatDate(route.created, '%d-%m-%Y')}}</td> <td>{{formatDate(route.dated, '%d-%m-%Y')}}</td>
<th class="font gray align-right">{{$t('vehicle')}}</th> <th class="font gray align-right">{{$t('vehicle')}}</th>
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td> <td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
</tr> </tr>

View File

@ -1,6 +1,6 @@
SELECT r.id, SELECT r.id,
r.m3, r.m3,
r.created, r.dated,
r.time, r.time,
u.nickName userNickName, u.nickName userNickName,
v.tradeMark vehicleTradeMark, v.tradeMark vehicleTradeMark,

View File

@ -4,7 +4,7 @@ SELECT ep.id palletFk,
r.description `zone`, r.description `zone`,
COUNT(es.id) labels, COUNT(es.id) labels,
t.warehouseFk warehouseFk, t.warehouseFk warehouseFk,
dayname(r.created) `dayName`, dayname(r.dated) `dayName`,
rs.id <=> rm.roadmapStopFk isMatch rs.id <=> rm.roadmapStopFk isMatch
FROM vn.roadmapStop rs FROM vn.roadmapStop rs
JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id