Fix: Product Permutations save on production.
This commit is contained in:
@@ -4569,7 +4569,7 @@ BEGIN
|
||||
|
||||
IF (NOT (
|
||||
NEW.id_unit_measurement_interval_recurrence IS NULL
|
||||
OR NEW.id_unit_measurement_interval_recurrence NOT IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)
|
||||
OR NEW.id_unit_measurement_interval_recurrence IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)
|
||||
)) THEN
|
||||
SIGNAL SQLSTATE '45000'
|
||||
SET MESSAGE_TEXT = 'Recurrence interval ID must be a unit of time.';
|
||||
@@ -4577,7 +4577,7 @@ BEGIN
|
||||
|
||||
IF (NOT (
|
||||
NEW.id_unit_measurement_interval_expiration_unsealed IS NULL
|
||||
OR NEW.id_unit_measurement_interval_expiration_unsealed NOT IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)
|
||||
OR NEW.id_unit_measurement_interval_expiration_unsealed IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)
|
||||
)) THEN
|
||||
SET v_msg := CONCAT('Unsealed expiration interval ID must be a unit of time. Invalid value: ', CAST(NEW.id_unit_measurement_interval_expiration_unsealed AS CHAR));
|
||||
SIGNAL SQLSTATE '45000'
|
||||
@@ -24028,50 +24028,49 @@ INSERT INTO partsltd_prod.Shop_Product_Change_Set (
|
||||
)
|
||||
VALUES ( 'Update Variation Display Orders' )
|
||||
;
|
||||
WITH RECURSIVE RANKED AS (
|
||||
UPDATE partsltd_prod.Shop_Variation V
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
V.id_variation,
|
||||
RANK() OVER (ORDER BY
|
||||
CONCAT(
|
||||
CASE WHEN V.count_unit_measurement = FLOOR(V.count_unit_measurement) THEN
|
||||
LPAD(CAST(V.count_unit_measurement AS CHAR), 25, '0')
|
||||
ELSE
|
||||
CONCAT(
|
||||
LPAD(
|
||||
CAST(FLOOR(V.count_unit_measurement) AS CHAR)
|
||||
, 25
|
||||
, '0'
|
||||
)
|
||||
, SUBSTRING(
|
||||
CAST(V.count_unit_measurement AS CHAR)
|
||||
FROM LOCATE('.', CAST(V.count_unit_measurement AS CHAR))
|
||||
)
|
||||
)
|
||||
END
|
||||
CONCAT(
|
||||
CASE WHEN V.count_unit_measurement = FLOOR(V.count_unit_measurement) THEN
|
||||
LPAD(CAST(V.count_unit_measurement AS CHAR), 25, '0')
|
||||
ELSE
|
||||
CONCAT(
|
||||
LPAD(
|
||||
CAST(FLOOR(V.count_unit_measurement) AS CHAR)
|
||||
, 25
|
||||
, '0'
|
||||
)
|
||||
, SUBSTRING(
|
||||
CAST(V.count_unit_measurement AS CHAR)
|
||||
FROM LOCATE('.', CAST(V.count_unit_measurement AS CHAR))
|
||||
)
|
||||
)
|
||||
END
|
||||
, ' '
|
||||
, IFNULL(IFNULL(UM.symbol, UM.name_singular), '(No Unit of Measurement)')
|
||||
)
|
||||
) as new_order
|
||||
)
|
||||
) as new_order
|
||||
FROM partsltd_prod.Shop_Variation V
|
||||
INNER JOIN partsltd_prod.Shop_Unit_Measurement UM
|
||||
ON V.id_unit_measurement = UM.id_unit_measurement
|
||||
ON V.id_unit_measurement = UM.id_unit_measurement
|
||||
AND UM.active = 1
|
||||
WHERE
|
||||
V.id_type = 2
|
||||
)
|
||||
UPDATE partsltd_prod.Shop_Variation V
|
||||
INNER JOIN RANKED ON V.id_variation = RANKED.id_variation
|
||||
V.id_type = 2
|
||||
) AS RANKED ON V.id_variation = RANKED.id_variation
|
||||
JOIN (
|
||||
SELECT CS.id_change_set
|
||||
SELECT CS.id_change_set
|
||||
FROM partsltd_prod.Shop_Product_Change_Set CS
|
||||
ORDER BY CS.id_change_set DESC
|
||||
LIMIT 1
|
||||
) AS CS
|
||||
SET
|
||||
V.display_order = RANKED.new_order
|
||||
V.display_order = RANKED.new_order
|
||||
, V.id_change_set = CS.id_change_set
|
||||
WHERE
|
||||
V.id_type = 2
|
||||
V.id_type = 2
|
||||
;
|
||||
|
||||
# Product Permutation Variation Links
|
||||
|
||||
Reference in New Issue
Block a user