8093-devToTest_2442_3 #3100
|
@ -98,22 +98,8 @@ BEGIN
|
|||
SELECT employeeFk INTO vUserFk FROM orderConfig;
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
CALL order_checkEditable(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
|
||||
SELECT EXISTS (
|
||||
SELECT id
|
||||
|
@ -125,6 +111,20 @@ BEGIN
|
|||
IF vHas0Amount THEN
|
||||
CALL util.throw('Remove lines with quantity = 0 before confirming');
|
||||
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
|
||||
OPEN vDates;
|
||||
|
|
|
@ -23,6 +23,13 @@ BEGIN
|
|||
DELETE FROM messageInbox WHERE sendDate < v2Months;
|
||||
DELETE FROM messageInbox WHERE sendDate < v2Months;
|
||||
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 ticketDown WHERE created < util.yesterday();
|
||||
DELETE IGNORE FROM expedition WHERE created < v26Months;
|
||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_assign`(
|
|||
vUserFk INT,
|
||||
OUT vCollectionFk INT
|
||||
)
|
||||
BEGIN
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si existen colecciones libres que se ajustan
|
||||
* al perfil del usuario y le asigna la más antigua.
|
||||
|
@ -45,6 +45,12 @@ BEGIN
|
|||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
-- Si hay colecciones sin terminar, sale del proceso
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
CALL collection_get(vUserFk);
|
||||
|
||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, pc.maxNotAssignedCollectionLifeTime
|
||||
|
@ -118,9 +124,19 @@ BEGIN
|
|||
IF vCollectionFk IS NULL THEN
|
||||
CALL collection_new(vUserFk, vCollectionFk);
|
||||
|
||||
UPDATE `collection`
|
||||
SET workerFk = vUserFk
|
||||
WHERE id = vCollectionFk;
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT workerFk INTO vCollectionWorker
|
||||
FROM `collection`
|
||||
WHERE id = vCollectionFk FOR UPDATE;
|
||||
|
||||
IF vCollectionWorker IS NULL THEN
|
||||
UPDATE `collection`
|
||||
SET workerFk = vUserFk
|
||||
WHERE id = vCollectionFk;
|
||||
END IF;
|
||||
|
||||
COMMIT;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -40,7 +40,7 @@ BEGIN
|
|||
isTooLittle BOOL DEFAULT FALSE,
|
||||
isVip BOOL DEFAULT FALSE,
|
||||
PRIMARY KEY (ticketFk, saleFk)
|
||||
) ENGINE = MEMORY;
|
||||
); -- No memory
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk,
|
||||
saleFk,
|
||||
|
|
|
@ -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;
|
|
@ -66,15 +66,15 @@ export default class App {
|
|||
]}
|
||||
};
|
||||
|
||||
const hasId = !isNaN(parseInt(route.split('/')[1]));
|
||||
|
||||
if (this.logger.$params.q) {
|
||||
let tableValue = this.logger.$params.q;
|
||||
const q = JSON.parse(tableValue);
|
||||
if (typeof q === 'number')
|
||||
tableValue = JSON.stringify({id: tableValue});
|
||||
newRoute = newRoute.concat(`?table=${tableValue}`);
|
||||
}
|
||||
|
||||
if (this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0)
|
||||
} else if (!hasId && this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0)
|
||||
newRoute = newRoute.concat(`${this.logger.$params.id}`);
|
||||
|
||||
return this.logger.$http.get('Urls/findOne', {filter})
|
||||
|
|
|
@ -34,6 +34,11 @@ module.exports = Self => {
|
|||
try {
|
||||
const promises = [];
|
||||
for (let itemShelvingId of itemShelvingIds) {
|
||||
const itemShelvingSaleToDelete = models.ItemShelvingSale.destroyAll({
|
||||
itemShelvingFk: itemShelvingId
|
||||
}, myOptions);
|
||||
promises.push(itemShelvingSaleToDelete);
|
||||
|
||||
const itemShelvingToDelete = models.ItemShelving.destroyById(itemShelvingId, myOptions);
|
||||
promises.push(itemShelvingToDelete);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('ItemShelving deleteItemShelvings()', () => {
|
|||
const itemShelvingIds = [1, 2];
|
||||
const result = await models.ItemShelving.deleteItemShelvings(itemShelvingIds, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(result.length).toEqual(4);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue