7729-devToTest_2430 #2739

Merged
alexm merged 339 commits from 7729-devToTest_2430 into test 2024-07-16 07:11:37 +00:00
22 changed files with 137 additions and 91 deletions
Showing only changes of commit 61265a45e3 - Show all commits

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_afterDelete`
AFTER DELETE ON `mailAliasAccount`
FOR EACH ROW
BEGIN
INSERT INTO userLog
SET `action` = 'delete',
`changedModel` = 'MailAliasAccount',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeInsert`
BEFORE INSERT ON `mailAliasAccount`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeUpdate`
BEFORE UPDATE ON `mailAliasAccount`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -117,7 +117,7 @@ proc: BEGIN
)sub )sub
GROUP BY sub.itemFk; GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange; DROP TEMPORARY TABLE tmp.itemCalc, tItemRange, tmp.itemList;
CALL cache_calc_end (vCalc); CALL cache_calc_end (vCalc);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -121,7 +121,7 @@ proc: BEGIN
)sub )sub
GROUP BY sub.itemFk; GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, itemRange; DROP TEMPORARY TABLE tmp.itemCalc, itemRange, tmp.itemList;
CALL cache_calc_end (vCalc); CALL cache_calc_end (vCalc);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -30,6 +30,7 @@ BEGIN
tmp.ticketComponentPrice, tmp.ticketComponentPrice,
tmp.ticketComponent, tmp.ticketComponent,
tmp.ticketLot, tmp.ticketLot,
tmp.zoneGetShipped; tmp.zoneGetShipped,
tmp.item;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -16,9 +16,9 @@ BEGIN
SET @order = 0; SET @order = 0;
DROP TEMPORARY TABLE IF EXISTS tmp.newSaleList; DROP TEMPORARY TABLE IF EXISTS tNewSaleList;
CREATE TEMPORARY TABLE tmp.newSaleList CREATE TEMPORARY TABLE tNewSaleList
SELECT id as saleFk, @order := @order + 1 as orden SELECT id as saleFk, @order := @order + 1 as orden
FROM vn.sale FROM vn.sale
WHERE ticketFk = vTargetTicketFk WHERE ticketFk = vTargetTicketFk
@ -28,7 +28,8 @@ BEGIN
SELECT ns.saleFk, sc.componentFk, sc.value SELECT ns.saleFk, sc.componentFk, sc.value
FROM vn.saleComponent sc FROM vn.saleComponent sc
JOIN tmp.saleList s ON s.saleFk = sc.saleFk JOIN tmp.saleList s ON s.saleFk = sc.saleFk
JOIN tmp.newSaleList ns ON ns.orden = s.orden; JOIN tNewSaleList ns ON ns.orden = s.orden;
DROP TEMPORARY TABLE tNewSaleList;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -8,7 +8,6 @@ BEGIN
*/ */
DECLARE vTaxRowLimit INT; DECLARE vTaxRowLimit INT;
DECLARE vLines INT; DECLARE vLines INT;
DECLARE vHasDistinctTransactions INT;
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig; SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
@ -20,17 +19,5 @@ BEGIN
IF vLines >= vTaxRowLimit THEN IF vLines >= vTaxRowLimit THEN
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit)); CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
END IF; END IF;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vInvoiceInFk
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -13,6 +13,19 @@ BEGIN
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo * @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
*/ */
DECLARE vFiscalYear INT; DECLARE vFiscalYear INT;
DECLARE vHasDistinctTransactions INT;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vSelf
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
ENGINE = MEMORY ENGINE = MEMORY

View File

@ -59,5 +59,7 @@ BEGIN
WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo
AND p.sectorFk = vSectorFk AND p.sectorFk = vSectorFk
ORDER BY p.pickingOrder; ORDER BY p.pickingOrder;
DROP TEMPORARY TABLE tmp.stockMisfit;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -76,5 +76,7 @@ BEGIN
i.quantity amount i.quantity amount
FROM tmp.itemAtp i FROM tmp.itemAtp i
HAVING amount != 0; HAVING amount != 0;
DROP TEMPORARY TABLE tmp.itemAtp;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -15,14 +15,13 @@ BEGIN
* @param vDated Fecha * @param vDated Fecha
* @param vShowType Mostrar tipos * @param vShowType Mostrar tipos
*/ */
DECLARE vCalcFk INT; DECLARE vAvailableCalcFk INT;
DECLARE vVisibleCalcFk INT;
DECLARE vTypeFk INT; DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1; DECLARE vPriority INT DEFAULT 1;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
-- Añadido temporalmente para que no se cuelgue la db
SET vShowType = TRUE;
WITH itemTags AS ( WITH itemTags AS (
SELECT i.id, SELECT i.id,
@ -65,21 +64,21 @@ BEGIN
WHEN b.groupingMode = 'packing' THEN b.packing WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1 ELSE 1
END AS minQuantity, END AS minQuantity,
iss.visible located, v.visible located,
b.price2 b.price2
FROM vn.item i FROM vn.item i
JOIN cache.available a ON a.item_id = i.id JOIN cache.available a ON a.item_id = i.id
AND a.calc_id = vCalcFk AND a.calc_id = vAvailableCalcFk
LEFT JOIN cache.visible v ON v.item_id = i.id
AND v.calc_id = vVisibleCalcFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf AND ip.itemFk = vSelf
LEFT JOIN vn.itemTag it ON it.itemFk = i.id LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk LEFT JOIN vn.tag t ON t.id = it.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
AND iss.warehouseFk = vWarehouseFk
JOIN itemTags its JOIN itemTags its
WHERE a.available > 0 WHERE a.available > 0
AND (i.typeFk = its.typeFk OR NOT vShowType) AND (i.typeFk = its.typeFk OR NOT vShowType)

View File

@ -104,5 +104,6 @@ BEGIN
) sub; ) sub;
DROP TEMPORARY TABLE tmp.whiteTicket; DROP TEMPORARY TABLE tmp.whiteTicket;
DROP TEMPORARY TABLE tmp.sectorTypeTicket; DROP TEMPORARY TABLE tmp.sectorTypeTicket;
DROP TEMPORARY TABLE tmp.productionBuffer;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -22,40 +22,42 @@ proc: BEGIN
CALL util.throw('parkingNotExist'); CALL util.throw('parkingNotExist');
LEAVE proc; LEAVE proc;
END IF; END IF;
IF vParam REGEXP '^[0-9]+$' THEN
-- Se comprueba si es una preparación previa
SELECT COUNT(*) INTO vIsSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vParam;
-- Se comprueba si es una preparación previa IF vIsSaleGroup THEN
SELECT COUNT(*) INTO vIsSaleGroup CALL vn.saleGroup_setParking(vParam, vParkingFk);
FROM vn.saleGroup sg LEAVE proc;
WHERE sg.id = vParam; END IF;
IF vIsSaleGroup THEN -- Se comprueba si es un ticket
CALL vn.saleGroup_setParking(vParam, vParkingFk); SELECT COUNT(*) INTO vIsTicket
LEAVE proc; FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
ELSE
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END IF; END IF;
-- Se comprueba si es un ticket
SELECT COUNT(*) INTO vIsTicket
FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -3,14 +3,14 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(
BEGIN BEGIN
DECLARE done INT DEFAULT FALSE; DECLARE done INT DEFAULT FALSE;
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket; DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
CALL vn.productionControl(vWarehouserFk,0) ; CALL vn.productionControl(vWarehouserFk,0) ;
DROP TEMPORARY TABLE IF EXISTS tmp.ticket; DROP TEMPORARY TABLE IF EXISTS tTicket;
CREATE TEMPORARY TABLE tmp.ticket CREATE TEMPORARY TABLE tTicket
SELECT ticketFk SELECT ticketFk
FROM tmp.productionBuffer FROM tmp.productionBuffer
JOIN alertLevel al ON al.code = 'FREE' JOIN alertLevel al ON al.code = 'FREE'
@ -31,5 +31,6 @@ BEGIN
END LOOP; END LOOP;
CLOSE cur1; CLOSE cur1;
DROP TEMPORARY TABLE tTicket, tmp.productionBuffer;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -65,6 +65,8 @@ BEGIN
IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN
CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS');
END IF; END IF;
DROP TEMPORARY TABLE tmp.zoneGetShipped;
END IF; END IF;
INSERT INTO ticket ( INSERT INTO ticket (

View File

@ -213,6 +213,6 @@ BEGIN
END; END;
END LOOP; END LOOP;
CLOSE rsTicket; CLOSE rsTicket;
DROP TEMPORARY TABLE IF EXISTS tmp.time; DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -44,7 +44,6 @@ BEGIN
WHERE s.ticketFk = vTicketFk; WHERE s.ticketFk = vTicketFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
(PRIMARY KEY (itemPackingTypeFk))
ENGINE = MEMORY ENGINE = MEMORY
SELECT itemPackingTypeFk, SUM(litros) totalLitros SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tmp.sale FROM tmp.sale
@ -56,8 +55,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT ( CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
ticketFk INT, ticketFk INT,
itemPackingTypeFk VARCHAR(1), itemPackingTypeFk VARCHAR(1)
PRIMARY KEY (ticketFk)
) ENGINE = MEMORY; ) ENGINE = MEMORY;
CASE vPackingTypesToSplit CASE vPackingTypesToSplit

View File

@ -103,6 +103,7 @@ BEGIN
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
geoCollision, geoCollision,
tmp.zone, tmp.zone,
tmp.zoneNodes; tmp.zoneNodes,
tmp.zoneOption;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,4 @@
ALTER TABLE account.mailAliasAccount
ADD editorFk INT(10) UNSIGNED DEFAULT NULL,
ADD CONSTRAINT mailAliasAccount_editorFk FOREIGN KEY (editorFk)
REFERENCES account.`user`(id);

View File

@ -26,29 +26,33 @@
}, },
"labelerFk": { "labelerFk": {
"type": "number" "type": "number"
},
"isOnReservationMode": {
"type": "boolean",
"required": true
} }
}, },
"relations": { "relations": {
"sector": { "sector": {
"type": "belongsTo", "type": "belongsTo",
"model": "Sector", "model": "Sector",
"foreignKey": "sectorFk" "foreignKey": "sectorFk"
}, },
"train": { "train": {
"type": "belongsTo", "type": "belongsTo",
"model": "Train", "model": "Train",
"foreignKey": "trainFk" "foreignKey": "trainFk"
}, },
"printer": { "printer": {
"type": "belongsTo", "type": "belongsTo",
"model": "Printer", "model": "Printer",
"foreignKey": "labelerFk" "foreignKey": "labelerFk"
}, },
"itemPackingType": { "itemPackingType": {
"type": "belongsTo", "type": "belongsTo",
"model": "ItemPackingType", "model": "ItemPackingType",
"foreignKey": "itemPackingTypeFk", "foreignKey": "itemPackingTypeFk",
"primaryKey": "code" "primaryKey": "code"
} }
} }
} }

View File

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