Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7019_fix_createManualInvoice
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
b9de2b3ce6
|
@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [24.20.01] - 2024-05-14
|
## [24.20.01] - 2024-05-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- (Worker -> time-control) Corrección de errores
|
||||||
|
|
||||||
## [24.18.01] - 2024-05-07
|
## [24.18.01] - 2024-05-07
|
||||||
|
|
||||||
## [24.16.01] - 2024-04-18
|
## [24.16.01] - 2024-04-18
|
||||||
|
|
|
@ -121,15 +121,17 @@ BEGIN
|
||||||
CALL util.throw(vErrorCode);
|
CALL util.throw(vErrorCode);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
-- DIRECCION CORRECTA
|
-- DIRECCION CORRECTA
|
||||||
CALL workerTimeControl_direction(vWorkerFk, vTimed);
|
CALL workerTimeControl_direction(vWorkerFk, vTimed);
|
||||||
IF (SELECT
|
IF (SELECT
|
||||||
IF(IF(option1 IN ('inMiddle', 'outMiddle'),
|
IF((IF(option1 IN ('inMiddle', 'outMiddle'),
|
||||||
'middle',
|
'middle',
|
||||||
option1) <> vDirection
|
option1) <> vDirection
|
||||||
AND IF(option2 IN ('inMiddle', 'outMiddle'),
|
AND IF(option2 IN ('inMiddle', 'outMiddle'),
|
||||||
'middle',
|
'middle',
|
||||||
IFNULL(option2, '')) <> vDirection,
|
IFNULL(option2, '')) <> vDirection)
|
||||||
|
OR (option1 IS NULL AND option2 IS NULL),
|
||||||
TRUE ,
|
TRUE ,
|
||||||
FALSE)
|
FALSE)
|
||||||
FROM tmp.workerTimeControlDirection
|
FROM tmp.workerTimeControlDirection
|
||||||
|
@ -137,12 +139,17 @@ BEGIN
|
||||||
SET vIsError = TRUE;
|
SET vIsError = TRUE;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
|
|
||||||
IF vIsError THEN
|
IF vIsError THEN
|
||||||
SET vErrorCode = 'WRONG_DIRECTION';
|
SET vErrorCode = 'WRONG_DIRECTION';
|
||||||
|
IF(SELECT option1 IS NULL AND option2 IS NULL
|
||||||
|
FROM tmp.workerTimeControlDirection) THEN
|
||||||
|
|
||||||
|
SET vErrorCode = 'DAY_MAX_TIME';
|
||||||
|
END IF;
|
||||||
CALL util.throw(vErrorCode);
|
CALL util.throw(vErrorCode);
|
||||||
END IF;
|
END IF;
|
||||||
|
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
|
||||||
-- FICHADAS IMPARES
|
-- FICHADAS IMPARES
|
||||||
SELECT timed INTO vLastIn
|
SELECT timed INTO vLastIn
|
||||||
FROM workerTimeControl
|
FROM workerTimeControl
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.claimBeginning MODIFY COLUMN quantity double DEFAULT 0 NULL;
|
|
@ -83,7 +83,6 @@ module.exports = Self => {
|
||||||
const newClaimBeginning = models.ClaimBeginning.create({
|
const newClaimBeginning = models.ClaimBeginning.create({
|
||||||
saleFk: sale.id,
|
saleFk: sale.id,
|
||||||
claimFk: newClaim.id,
|
claimFk: newClaim.id,
|
||||||
quantity: sale.quantity
|
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
promises.push(newClaimBeginning);
|
promises.push(newClaimBeginning);
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe('Claim createFromSales()', () => {
|
||||||
let claimBeginning = await models.ClaimBeginning.findOne({where: {claimFk: claim.id}}, options);
|
let claimBeginning = await models.ClaimBeginning.findOne({where: {claimFk: claim.id}}, options);
|
||||||
|
|
||||||
expect(claimBeginning.saleFk).toEqual(newSale[0].id);
|
expect(claimBeginning.saleFk).toEqual(newSale[0].id);
|
||||||
expect(claimBeginning.quantity).toEqual(newSale[0].quantity);
|
expect(claimBeginning.quantity).toEqual(0);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -67,7 +67,7 @@ describe('Claim createFromSales()', () => {
|
||||||
const claimBeginning = await models.ClaimBeginning.findOne({where: {claimFk: claim.id}}, options);
|
const claimBeginning = await models.ClaimBeginning.findOne({where: {claimFk: claim.id}}, options);
|
||||||
|
|
||||||
expect(claimBeginning.saleFk).toEqual(newSale[0].id);
|
expect(claimBeginning.saleFk).toEqual(newSale[0].id);
|
||||||
expect(claimBeginning.quantity).toEqual(newSale[0].quantity);
|
expect(claimBeginning.quantity).toEqual(0);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"quantity": {
|
"quantity": {
|
||||||
"type": "number",
|
"type": "number"
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -99,6 +99,32 @@ describe('workerTimeControl clockIn()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should throw an error trying to add an "in" entry if the last clockIn is not out', async() => {
|
||||||
|
activeCtx.accessToken.userId = HHRRId;
|
||||||
|
const workerId = teamBossId;
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
ctx.args = {timed: "2000-12-25T21:00:00.000Z", direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
ctx.args = {timed: "2000-12-25T22:00:00.000Z", direction: 'middle'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
ctx.args = {timed: "2000-12-25T22:30:00.000Z", direction: 'middle'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
ctx.args = {timed: "2000-12-26T01:00:00.000Z", direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
expect(e.message).toBe('Dirección incorrecta');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
describe('as Role errors', () => {
|
describe('as Role errors', () => {
|
||||||
it('should add if the current user is team boss and the target user is himself', async() => {
|
it('should add if the current user is team boss and the target user is himself', async() => {
|
||||||
activeCtx.accessToken.userId = teamBossId;
|
activeCtx.accessToken.userId = teamBossId;
|
||||||
|
|
Loading…
Reference in New Issue