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
|
||||
|
||||
14
static/dist/js/main.bundle.js
vendored
14
static/dist/js/main.bundle.js
vendored
@@ -324,6 +324,8 @@ var DOM = /*#__PURE__*/function () {
|
||||
returnVal = element.value;
|
||||
} else if (element.tagName === 'BUTTON' && element.classList.contains(flagActive)) {
|
||||
returnVal = element.classList.contains(flagDelete);
|
||||
} else if (element.tagName === 'TD') {
|
||||
returnVal = DOM.getElementAttributeValueCurrent(element);
|
||||
} else {
|
||||
returnVal = element.textContent;
|
||||
}
|
||||
@@ -2470,9 +2472,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
wasDirtyParentRows: wasDirtyParentRows
|
||||
});
|
||||
}
|
||||
var td = DOM.getCellFromElement(element);
|
||||
DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
|
||||
if (isDirtyElement != wasDirtyElement) {
|
||||
var td = DOM.getCellFromElement(element);
|
||||
DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
|
||||
DOM.handleDirtyElement(td, isDirtyElement);
|
||||
this.updateAndToggleShowButtonsSaveCancel();
|
||||
this.cascadeChangedIsDirtyNestedElementCellTable(element, isDirtyElement, wasDirtyParentRows);
|
||||
@@ -3025,14 +3027,14 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "handleChangeDdlProductVariationOrVariationType",
|
||||
value: function handleChangeDdlProductVariationOrVariationType(event, element) {
|
||||
this.updateProductPermutationVariations(element);
|
||||
this.handleChangeNestedElementCellTable(event, element);
|
||||
this.updateProductPermutationVariations(element);
|
||||
}
|
||||
}, {
|
||||
key: "hookupDdlsProductPermutationVariation",
|
||||
value: function hookupDdlsProductPermutationVariation() {
|
||||
var _this22 = this;
|
||||
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation, function (event, ddlVariation) {
|
||||
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation + ' select', function (event, ddlVariation) {
|
||||
_this22.handleChangeDdlProductVariationOrVariationType(event, ddlVariation);
|
||||
});
|
||||
}
|
||||
@@ -3073,7 +3075,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
var variationsCell = element.closest('td.' + flagProductVariations);
|
||||
var variationPairsString = this.getProductPermutationVariationsText(variationsCell);
|
||||
DOM.setElementAttributeValueCurrent(variationsCell, variationPairsString);
|
||||
DOM.isElementDirty(variationsCell);
|
||||
this.handleChangeNestedElementCellTable(null, variationsCell);
|
||||
}
|
||||
}, {
|
||||
key: "getProductPermutationVariationsText",
|
||||
@@ -4739,6 +4741,7 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
|
||||
this.hookupFieldsProductPermutationVariation();
|
||||
this.hookupDescriptionTextareas();
|
||||
this.hookupCostFields();
|
||||
this.hookupProfitFields();
|
||||
this.hookupLatencyManufactureInputs();
|
||||
this.hookupQuantityFields();
|
||||
this.hookupSubscriptionFields();
|
||||
@@ -4797,6 +4800,7 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
|
||||
}, {
|
||||
key: "hookupProfitInputs",
|
||||
value: function hookupProfitInputs() {
|
||||
debugger;
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagProfitLocalMin + ' input');
|
||||
}
|
||||
}, {
|
||||
|
||||
@@ -123,6 +123,9 @@ export default class DOM {
|
||||
else if (element.tagName === 'BUTTON' && element.classList.contains(flagActive)) {
|
||||
returnVal = element.classList.contains(flagDelete);
|
||||
}
|
||||
else if (element.tagName === 'TD') {
|
||||
returnVal = DOM.getElementAttributeValueCurrent(element);
|
||||
}
|
||||
else {
|
||||
returnVal = element.textContent;
|
||||
}
|
||||
|
||||
@@ -362,9 +362,9 @@ export default class TableBasePage extends BasePage {
|
||||
let wasDirtyElement = element.classList.contains(flagDirty);
|
||||
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
|
||||
if (_verbose) { console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); }
|
||||
let td = DOM.getCellFromElement(element);
|
||||
DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
|
||||
if (isDirtyElement != wasDirtyElement) {
|
||||
let td = DOM.getCellFromElement(element);
|
||||
DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
|
||||
DOM.handleDirtyElement(td, isDirtyElement);
|
||||
this.updateAndToggleShowButtonsSaveCancel();
|
||||
this.cascadeChangedIsDirtyNestedElementCellTable(element, isDirtyElement, wasDirtyParentRows);
|
||||
@@ -849,11 +849,11 @@ export default class TableBasePage extends BasePage {
|
||||
);
|
||||
}
|
||||
handleChangeDdlProductVariationOrVariationType(event, element) {
|
||||
this.updateProductPermutationVariations(element);
|
||||
this.handleChangeNestedElementCellTable(event, element);
|
||||
this.updateProductPermutationVariations(element);
|
||||
}
|
||||
hookupDdlsProductPermutationVariation() {
|
||||
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation, (event, ddlVariation) => { this.handleChangeDdlProductVariationOrVariationType(event, ddlVariation); });
|
||||
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation + ' select', (event, ddlVariation) => { this.handleChangeDdlProductVariationOrVariationType(event, ddlVariation); });
|
||||
}
|
||||
hookupButtonsProductPermutationVariationAddDelete() {
|
||||
let selectorButton = idTableMain + ' td.' + flagProductVariations + ' tr.' + flagProductVariation + ' button';
|
||||
@@ -884,7 +884,7 @@ export default class TableBasePage extends BasePage {
|
||||
let variationsCell = element.closest('td.' + flagProductVariations);
|
||||
let variationPairsString = this.getProductPermutationVariationsText(variationsCell);
|
||||
DOM.setElementAttributeValueCurrent(variationsCell, variationPairsString);
|
||||
DOM.isElementDirty(variationsCell);
|
||||
this.handleChangeNestedElementCellTable(null, variationsCell);
|
||||
}
|
||||
getProductPermutationVariationsText(variationsTd) {
|
||||
let rows = variationsTd.querySelectorAll(':scope tbody tr');
|
||||
|
||||
@@ -213,6 +213,7 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
this.hookupFieldsProductPermutationVariation();
|
||||
this.hookupDescriptionTextareas();
|
||||
this.hookupCostFields();
|
||||
this.hookupProfitFields();
|
||||
this.hookupLatencyManufactureInputs();
|
||||
this.hookupQuantityFields();
|
||||
this.hookupSubscriptionFields();
|
||||
@@ -256,7 +257,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
|
||||
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrency, Utils.getListFromDict(currencies));
|
||||
}
|
||||
*/
|
||||
hookupProfitInputs(){
|
||||
hookupProfitInputs() {
|
||||
debugger;
|
||||
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagProfitLocalMin + ' input');
|
||||
}
|
||||
hookupLatencyManufactureInputs(){
|
||||
|
||||
Reference in New Issue
Block a user