Merge branch 'master' of https: refs #6404//gitea.verdnatura.es/verdnatura/salix into 6404-fixrefernce
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Pablo Natek 2024-05-30 19:13:27 +02:00
commit 81e1179ce0
4 changed files with 19 additions and 47 deletions

View File

@ -48,7 +48,7 @@ BEGIN
-- Marcamos para no repetir
UPDATE vn.claimEnd ce
JOIN vn.claim c ON c.id = ce.claimFk
SET c.isChargedToMana = TRUE
SET ce.isGreuge = TRUE
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3;

View File

@ -13,28 +13,12 @@ BEGIN
* @param vCollectionFk Id de colección
*/
DECLARE vHasTooMuchCollections BOOL;
DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vWarehouseFk INT;
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 30;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
END IF;
RESIGNAL;
END;
-- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
collection_assign_lockname
INTO vHasTooMuchCollections,
vLockName
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
INTO vHasTooMuchCollections
FROM productionConfig pc
LEFT JOIN tCollection ON TRUE;
@ -44,21 +28,6 @@ BEGIN
CALL util.throw('Hay colecciones pendientes');
END IF;
SELECT warehouseFk, itemPackingTypeFk
INTO vWarehouseFk, vItemPackingTypeFk
FROM operator
WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);
IF NOT GET_LOCK(vLockName, vLockTime) THEN
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
END IF;
-- Se eliminan las colecciones sin asignar que estan obsoletas
INSERT INTO ticketTracking(stateFk, ticketFk)
SELECT s.id, tc.ticketFk
@ -80,8 +49,7 @@ BEGIN
VALUES(vUserFk);
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
SELECT MIN(c.id)
INTO vCollectionFk
SELECT MIN(c.id) INTO vCollectionFk
FROM `collection` c
JOIN operator o
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
@ -107,7 +75,5 @@ BEGIN
UPDATE `collection`
SET workerFk = vUserFk
WHERE id = vCollectionFk;
DO RELEASE_LOCK(vLockName);
END$$
DELIMITER ;

View File

@ -85,8 +85,12 @@ exports.translateValues = async(instance, changes, options = {}) => {
exports.getChanges = (original, changes) => {
const oldChanges = {};
const newChanges = {};
const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
for (let property in changes) {
if (dateRegex.test(original[property]))
original[property] = new Date(Date.parse(original[property]));
const firstChar = property.substring(0, 1);
const isPrivate = firstChar == '$';
if (isPrivate) return;

View File

@ -88,7 +88,8 @@ module.exports = Self => {
const updatedClaim = await claim.updateAttributes(args, myOptions);
// When pickup has been changed
if (salesPerson && changedPickup && updatedClaim.pickup)
if (salesPerson) {
if (changedPickup && updatedClaim.pickup)
await notifyPickUp(ctx, salesPerson.id, claim);
// When claimState has been changed
@ -98,6 +99,7 @@ module.exports = Self => {
if (newState.code == 'canceled')
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
}
}
if (tx) await tx.commit();