feat: Turn issues into calculated columns refs#7213
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:
parent
27e3ae897a
commit
e28a5eb478
|
@ -1,17 +1,19 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`(vSelf INT)
|
||||
RETURNS tinyint(1)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`(
|
||||
vSelf INT
|
||||
)RETURNS tinyint(1)
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si la línea de sale tiene todos lo componentes obligatorios
|
||||
* Check if a sales line has all the required components.
|
||||
*
|
||||
* @param vSelf Id de sale
|
||||
* @return BOOL
|
||||
*/
|
||||
DECLARE vHasComponentLack TINYINT(1);
|
||||
|
||||
WITH componentRequired AS(
|
||||
SELECT COUNT(*)total
|
||||
SELECT COUNT(*) total
|
||||
FROM vn.component
|
||||
WHERE isRequired
|
||||
)SELECT SUM(IF(c.isRequired, TRUE, FALSE)) <> cr.total INTO vHasComponentLack
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(vSelf INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(
|
||||
vSelf INT
|
||||
)
|
||||
RETURNS tinyint(1)
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si el ticket es pequeño en función de los parámtros de configuración
|
||||
* teniendo en cuenta el volumen y el importe
|
||||
* Check if the ticket is small based on the volume and amount parameters.
|
||||
*
|
||||
* @return BOOL
|
||||
*/
|
||||
|
|
|
@ -4,9 +4,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getRoundingProb
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de redondeo para las líneas de venta relacionadas con un buy
|
||||
* Update the rounding problems for sales lines related to a buy.
|
||||
*
|
||||
* @param vSelf Id de ticket
|
||||
* @param vSelf Id ticket
|
||||
*/
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vDated DATE;
|
||||
|
|
|
@ -3,9 +3,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_risk`(
|
|||
vSelf INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza el riesgo de los tickets pendientes de un cliente
|
||||
* Update the risk for a client with pending tickets
|
||||
*
|
||||
* @param vSelf Id del cliente
|
||||
* @param vSelf Id cliente
|
||||
*/
|
||||
DECLARE vHasDebt BOOL;
|
||||
|
||||
|
@ -45,7 +45,7 @@ BEGIN
|
|||
AND status = 'ok'
|
||||
) sub
|
||||
), uninvoiced AS(
|
||||
SELECT DATE(t.shipped) dated, SUM(t.totalWithVat)amount
|
||||
SELECT DATE(t.shipped) dated, SUM(t.totalWithVat) amount
|
||||
FROM vn.ticket t
|
||||
JOIN dated d
|
||||
WHERE t.clientFk = vSelf
|
||||
|
|
|
@ -2,7 +2,7 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_riskAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza el riesgo todos los clientes
|
||||
* Update the risk for all clients with pending tickets
|
||||
*
|
||||
*/
|
||||
DECLARE vDone BOOL;
|
||||
|
@ -10,7 +10,7 @@ BEGIN
|
|||
|
||||
DECLARE cClients CURSOR FOR
|
||||
SELECT id
|
||||
FROM vn.client;
|
||||
FROM client;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
|
@ -20,7 +20,7 @@ BEGIN
|
|||
SET vDone = FALSE;
|
||||
FETCH cClients INTO vClientFk;
|
||||
IF vDone THEN LEAVE myLoop; END IF;
|
||||
CALL vn.client_risk(vClientFk);
|
||||
CALL client_risk(vClientFk);
|
||||
END LOOP;
|
||||
CLOSE cClients;
|
||||
END$$
|
||||
|
|
|
@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getComponentLa
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas para las líneas de ventas que tienen o dejan de tener problemas
|
||||
* con los componentes, verifica que esten o no todos los componenetes obligatorios
|
||||
* Update the problems for sales lines that have or no longer have problems with components,
|
||||
* verify whether all mandatory components are present or not
|
||||
*
|
||||
* @param vSelf Id del sale
|
||||
*/
|
||||
|
|
|
@ -2,10 +2,9 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getComponentLackProblemAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas para las líneas de ventas que tienen o dejan de tener problemas
|
||||
* con los componentes, verifica que esten o no todos los componenetes obligatorios
|
||||
* Update the problems for all pending sales lines that have or no longer have problems
|
||||
* with components, verify whether all mandatory components are present or not
|
||||
*
|
||||
* @param vSelf Id del sale
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
(INDEX(saleFk))
|
||||
|
|
|
@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getComponentLa
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas para las líneas de ventas que tienen o dejan de tener problemas
|
||||
* con los componentes que derivan de cambios en la tabla vn.component
|
||||
* Update the issues for sales lines that have or no longer have problems with components, verify
|
||||
* whether all mandatory components are present or not resulting from changes in the table vn.component
|
||||
*
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
|
|
|
@ -4,9 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getRoundingPro
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de redondeo para las líneas de venta
|
||||
*
|
||||
* @param vSelf Id de sale
|
||||
* Update the rounding problem for a sales line
|
||||
* @param vSelf Id sale
|
||||
*/
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vWarehouseFk INT;
|
||||
|
|
|
@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblem`(
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza en la tabla sale la columna problema
|
||||
* @table tmp.sale(saleFk, hasProblem) Identificadores de los sales a actualizar
|
||||
* Update column sale.problem with a problem code
|
||||
* @table tmp.sale(saleFk, hasProblem)
|
||||
*/
|
||||
UPDATE sale s
|
||||
JOIN tmp.sale ts ON ts.saleFk = s.id
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblem`()
|
||||
proc: BEGIN
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente
|
||||
* se encuentra congelado o deja de estarlo
|
||||
* Update the problem of tickets whose client is frozen or unfrozen
|
||||
*
|
||||
* @table tmp.ticket(ticketFk, hasProblem)
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblemAll`()
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente
|
||||
* se encuentra congelado o deja de estarlo
|
||||
* Update the problem of all tickets whose client is frozen or unfrozen
|
||||
*
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
|
|
|
@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezePro
|
|||
)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente
|
||||
* se encuentra congelado o deja de estarlo
|
||||
* Update the problem of all client tickets whose client is frozen or unfrozen
|
||||
* @param vClientFk Id client
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
|
|
|
@ -2,8 +2,8 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRequestProblem`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de tickets que tienen una petición de compra pendiente o
|
||||
* deja de tenerla
|
||||
* Update the problems of tickets that have a pending ticketRequest or no longer have it
|
||||
*
|
||||
* @table tmp.ticket(ticketFk, hasProblem)
|
||||
*/
|
||||
UPDATE tmp.ticket t
|
||||
|
|
|
@ -2,8 +2,7 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRequestProblemAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de tickets pendientes de preparar que tiene una petición
|
||||
* de compra pendiente o deja de tenerla
|
||||
* Update the problems of all tickets that have a pending ticketRequest or no longer have it
|
||||
*/
|
||||
DECLARE vHasProblem BOOL;
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRiskProbl
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problema de riesgo para un ticket en concreto
|
||||
* Update the risk problem for a specific ticket
|
||||
*
|
||||
* @param vSelf Id del ticket
|
||||
* @param vSelf Id ticket
|
||||
*/
|
||||
DECLARE vHasRisk BOOL;
|
||||
DECLARE vHasHighRisk BOOL;
|
||||
|
|
|
@ -2,9 +2,8 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRiskProblemAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problema de riesgo para un ticket en concreto
|
||||
* Update the risk problem for all tickets
|
||||
*
|
||||
* @param vSelf Id del ticket
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tRisk
|
||||
(KEY (ticketFk))
|
||||
|
|
|
@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRoundingP
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de redondeo para las líneas de venta de un ticket
|
||||
* Update the rounding problem for the sales lines of a ticket
|
||||
*
|
||||
* @param vSelf Id de ticket
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTaxDataCheckedProblem`()
|
||||
proc: BEGIN
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
PROCEDURE `vn`.`ticket_getTaxDataCheckedProblem`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de los ticket de hoy y a fututo
|
||||
* cuyo cliente tenga o no los datos comprobados
|
||||
* Update the problem of tickets, depending on whether
|
||||
* the client taxDataCheched is verified or not
|
||||
*
|
||||
*/
|
||||
|
||||
UPDATE tmp.ticket t
|
||||
JOIN ticket ti ON ti.id = t.ticketFk
|
||||
JOIN client c ON c.id = ti.clientFk
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTaxDataCheckedProblemAll`()
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
PROCEDURE `vn`.`ticket_getTaxDataCheckedProblemAll`()
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de los tickets de hoy y a futuro
|
||||
* cuyos clientes tengan o no los datos comprobados
|
||||
* Update the problem of all tickets, depending on whether
|
||||
* the client taxDataCheched is verified or not
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
|
|
|
@ -4,12 +4,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTaxDataCh
|
|||
)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de los ticket de hoy y a futuro
|
||||
* cuyo cliente tenga o no los datos comprobados
|
||||
* Update the problem of tickets for a specific client, depending on whether
|
||||
* the client taxDataCheched is verified or not
|
||||
*
|
||||
* @param vClientFk Id del cliente
|
||||
* @param vClientFk Id cliente
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
|
|
|
@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittle
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas cuando el ticket es demasiado pequeño o deja de serlo
|
||||
* Update the problems when the ticket is too small or is no longer so
|
||||
*
|
||||
* @param vSelf Id del ticket
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittleProblemAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas cuando un ticket es demasiado pequeño o deja de serlo
|
||||
* Update the problems for all tickets when the ticket is too small or is no longer so
|
||||
*
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
|
|
|
@ -2,8 +2,8 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittleProblemConfig`()
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas cuando el ticket es demasiado pequeño o deja de serlo, que derivan
|
||||
* del cambio en la tabla vn.volumeConfig
|
||||
* Update the problems when the ticket is too small or is no longer so,
|
||||
* derived from changes in the volumeConfig table
|
||||
*
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
|
|
|
@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittle
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas cuando el ticket es demasiado pequeño o deja de serlo, que derivan
|
||||
* del cambio en la tabla vn.itemCost
|
||||
* Update the problems when the ticket is too small or is no longer so,
|
||||
* derived from changes in the itemCost table
|
||||
*
|
||||
* @param vItemFk Id del item
|
||||
*/
|
||||
|
|
|
@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblem`(
|
|||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza en la tabla ticket la columna problema
|
||||
* @table tmp.ticket(ticketFk, hasProblem) Identificadores de los tickets a actualizar
|
||||
* Update column ticket.problem with a problem code
|
||||
* @table tmp.ticket(ticketFk, hasProblem)
|
||||
*/
|
||||
UPDATE ticket t
|
||||
JOIN tmp.ticket tt ON tt.ticketFk = t.id
|
||||
|
|
Loading…
Reference in New Issue