Merge branch 'dev' into 7207-showPbx
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-10-07 06:31:14 +00:00
commit 53f590af61
8 changed files with 54 additions and 23 deletions

View File

@ -98,22 +98,8 @@ BEGIN
SELECT employeeFk INTO vUserFk FROM orderConfig; SELECT employeeFk INTO vUserFk FROM orderConfig;
END IF; END IF;
START TRANSACTION;
CALL order_checkEditable(vSelf);
CALL orderRow_updateOverstocking(vSelf); CALL orderRow_updateOverstocking(vSelf);
-- Check order is not empty
SELECT COUNT(*) > 0 INTO vHasRows
FROM orderRow
WHERE orderFk = vSelf
AND amount > 0;
IF NOT vHasRows THEN
CALL util.throw('ORDER_EMPTY');
END IF;
-- Check if any product has a quantity of 0 -- Check if any product has a quantity of 0
SELECT EXISTS ( SELECT EXISTS (
SELECT id SELECT id
@ -126,6 +112,20 @@ BEGIN
CALL util.throw('Remove lines with quantity = 0 before confirming'); CALL util.throw('Remove lines with quantity = 0 before confirming');
END IF; END IF;
START TRANSACTION;
CALL order_checkEditable(vSelf);
-- Check order is not empty
SELECT COUNT(*) > 0 INTO vHasRows
FROM orderRow
WHERE orderFk = vSelf
AND amount > 0;
IF NOT vHasRows THEN
CALL util.throw('ORDER_EMPTY');
END IF;
-- Crea los tickets del pedido -- Crea los tickets del pedido
OPEN vDates; OPEN vDates;
lDates: LOOP lDates: LOOP

View File

@ -23,6 +23,13 @@ BEGIN
DELETE FROM messageInbox WHERE sendDate < v2Months; DELETE FROM messageInbox WHERE sendDate < v2Months;
DELETE FROM messageInbox WHERE sendDate < v2Months; DELETE FROM messageInbox WHERE sendDate < v2Months;
DELETE FROM workerTimeControl WHERE timed < v4Years; DELETE FROM workerTimeControl WHERE timed < v4Years;
DELETE FROM itemShelvingSale
WHERE itemShelvingFk IN (
SELECT id
FROM itemShelving
WHERE created < util.VN_CURDATE()
AND visible = 0
);
DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0; DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0;
DELETE FROM ticketDown WHERE created < util.yesterday(); DELETE FROM ticketDown WHERE created < util.yesterday();
DELETE IGNORE FROM expedition WHERE created < v26Months; DELETE IGNORE FROM expedition WHERE created < v26Months;

View File

@ -45,6 +45,12 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Si hay colecciones sin terminar, sale del proceso -- Si hay colecciones sin terminar, sale del proceso
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime
@ -118,9 +124,19 @@ BEGIN
IF vCollectionFk IS NULL THEN IF vCollectionFk IS NULL THEN
CALL collection_new(vUserFk, vCollectionFk); CALL collection_new(vUserFk, vCollectionFk);
START TRANSACTION;
SELECT workerFk INTO vCollectionWorker
FROM `collection`
WHERE id = vCollectionFk FOR UPDATE;
IF vCollectionWorker IS NULL THEN
UPDATE `collection` UPDATE `collection`
SET workerFk = vUserFk SET workerFk = vUserFk
WHERE id = vCollectionFk; WHERE id = vCollectionFk;
END IF; END IF;
COMMIT;
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -40,7 +40,7 @@ BEGIN
isTooLittle BOOL DEFAULT FALSE, isTooLittle BOOL DEFAULT FALSE,
isVip BOOL DEFAULT FALSE, isVip BOOL DEFAULT FALSE,
PRIMARY KEY (ticketFk, saleFk) PRIMARY KEY (ticketFk, saleFk)
) ENGINE = MEMORY; ); -- No memory
INSERT INTO tmp.sale_problems(ticketFk, INSERT INTO tmp.sale_problems(ticketFk,
saleFk, saleFk,

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2;
ALTER TABLE vn.itemShelving ADD CONSTRAINT itemShelving_fk2
FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(code) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -66,15 +66,15 @@ export default class App {
]} ]}
}; };
const hasId = !isNaN(parseInt(route.split('/')[1]));
if (this.logger.$params.q) { if (this.logger.$params.q) {
let tableValue = this.logger.$params.q; let tableValue = this.logger.$params.q;
const q = JSON.parse(tableValue); const q = JSON.parse(tableValue);
if (typeof q === 'number') if (typeof q === 'number')
tableValue = JSON.stringify({id: tableValue}); tableValue = JSON.stringify({id: tableValue});
newRoute = newRoute.concat(`?table=${tableValue}`); newRoute = newRoute.concat(`?table=${tableValue}`);
} } else if (!hasId && this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0)
if (this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0)
newRoute = newRoute.concat(`${this.logger.$params.id}`); newRoute = newRoute.concat(`${this.logger.$params.id}`);
return this.logger.$http.get('Urls/findOne', {filter}) return this.logger.$http.get('Urls/findOne', {filter})

View File

@ -34,6 +34,11 @@ module.exports = Self => {
try { try {
const promises = []; const promises = [];
for (let itemShelvingId of itemShelvingIds) { for (let itemShelvingId of itemShelvingIds) {
const itemShelvingSaleToDelete = models.ItemShelvingSale.destroyAll({
itemShelvingFk: itemShelvingId
}, myOptions);
promises.push(itemShelvingSaleToDelete);
const itemShelvingToDelete = models.ItemShelving.destroyById(itemShelvingId, myOptions); const itemShelvingToDelete = models.ItemShelving.destroyById(itemShelvingId, myOptions);
promises.push(itemShelvingToDelete); promises.push(itemShelvingToDelete);
} }

View File

@ -10,7 +10,7 @@ describe('ItemShelving deleteItemShelvings()', () => {
const itemShelvingIds = [1, 2]; const itemShelvingIds = [1, 2];
const result = await models.ItemShelving.deleteItemShelvings(itemShelvingIds, options); const result = await models.ItemShelving.deleteItemShelvings(itemShelvingIds, options);
expect(result.length).toEqual(2); expect(result.length).toEqual(4);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {