test #2504
|
@ -12,12 +12,15 @@ BEGIN
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
(INDEX(saleFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT s.id saleFk, sale_hasComponentLack(s.id) hasProblem
|
||||
SELECT saleFk, sale_hasComponentLack(saleFk)hasProblem
|
||||
FROM (
|
||||
SELECT s.id saleFk
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE t.shipped >= util.midnight()
|
||||
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk);
|
||||
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
|
||||
GROUP BY s.id) sub;
|
||||
|
||||
CALL sale_setProblem('hasComponentLack');
|
||||
|
||||
|
|
|
@ -20,15 +20,15 @@ BEGIN
|
|||
|
||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
SELECT vSelf saleFk, MOD(vQuantity, bu.`grouping`) hasProblem
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
SELECT vSelf saleFk, MOD(vQuantity, b.`grouping`) hasProblem
|
||||
FROM tmp.buyUltimate bu
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
WHERE bu.itemFk = vItemFk;
|
||||
|
||||
CALL sale_setProblem('hasRounding');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -22,7 +22,7 @@ BEGIN
|
|||
SET t.hasProblem = TRUE
|
||||
WHERE c.isFreezed;
|
||||
|
||||
CALL ticket_setProblem('hasTicketRequest');
|
||||
CALL ticket_setProblem('isFreezed');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
|
|
|
@ -19,7 +19,7 @@ BEGIN
|
|||
WHERE t.id = vSelf;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
SELECT vSelf ticketFk, vRisk hasProblem;
|
||||
SELECT vSelf ticketFk, vHasRisk hasProblem;
|
||||
|
||||
CALL ticket_setProblem('hasRisk');
|
||||
|
||||
|
|
|
@ -18,17 +18,17 @@ BEGIN
|
|||
|
||||
CALL buyUltimate(vWarehouseFk, vDated);
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||
SELECT s.id saleFk , MOD(s.quantity, b.`grouping`) hasProblem
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = tl.ticketFk
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
WHERE t.id = vSelf;
|
||||
|
||||
CALL sale_setProblem('hasRounding');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -15,7 +15,7 @@ BEGIN
|
|||
WITH tickets AS(
|
||||
SELECT t.id ticketFk
|
||||
FROM vn.ticket t
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||
WHERE t.shipped >= util.midnight()
|
||||
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
GROUP BY t.id
|
||||
|
|
|
@ -226,5 +226,6 @@
|
|||
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
||||
"They're not your subordinate": "They're not your subordinate",
|
||||
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
||||
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency"
|
||||
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
|
||||
"You can only have one PDA": "You can only have one PDA"
|
||||
}
|
|
@ -357,6 +357,7 @@
|
|||
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
||||
"Select ticket or client": "Elija un ticket o un client",
|
||||
"It was not able to create the invoice": "No se pudo crear la factura",
|
||||
"This PDA is already assigned to another user": "This PDA is already assigned to another user",
|
||||
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)"
|
||||
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
|
||||
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
||||
"You can only have one PDA": "Solo puedes tener un PDA"
|
||||
}
|
|
@ -3,6 +3,9 @@ module.exports = Self => {
|
|||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(`This PDA is already assigned to another user`);
|
||||
|
||||
if (err.code === 'ER_SIGNAL_EXCEPTION' && err.sqlMessage === 'You can only have one active PDA')
|
||||
return new UserError(err.sqlMessage);
|
||||
return err;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue