Fix: 1. Save proc architecture update for records saved with subrecords / linked records, such as Order has Items. \n 2. Style improvements for Product Category, Product, Product Permutation pages.

This commit is contained in:
2024-11-15 08:58:37 +00:00
parent 8fc3d8a803
commit 51d991ba42
41 changed files with 1931 additions and 413 deletions

View File

@@ -858,7 +858,8 @@ class Parameters_Product(Get_Many_Parameters_Base):
class Product_Temp(db.Model, Store_Base): class Product_Temp(db.Model, Store_Base):
__tablename__ = 'Shop_Product_Temp' __tablename__ = 'Shop_Product_Temp'
__table_args__ = { 'extend_existing': True } __table_args__ = { 'extend_existing': True }
id_product: int = db.Column(db.Integer, primary_key=True) id_temp: int = db.Column(db.Integer, primary_key=True, autoincrement=True)
id_product: int = db.Column(db.Integer)
id_category: int = db.Column(db.Integer) id_category: int = db.Column(db.Integer)
name: str = db.Column(db.String(255)) name: str = db.Column(db.String(255))
has_variations: bool = db.Column(db.Boolean) has_variations: bool = db.Column(db.Boolean)
@@ -868,7 +869,8 @@ class Product_Temp(db.Model, Store_Base):
guid: str = db.Column(db.BINARY(36)) guid: str = db.Column(db.BINARY(36))
# created_on: datetime = db.Column(db.DateTime) # created_on: datetime = db.Column(db.DateTime)
# created_by: int = db.Column(db.Integer) # created_by: int = db.Column(db.Integer)
def __init__(self):
self.id_temp = None
@classmethod @classmethod
def from_product(cls, product): def from_product(cls, product):
row = cls() row = cls()

View File

@@ -479,7 +479,8 @@ class Table_Shop_Product_Category(db.Model):
class Product_Category_Temp(db.Model, Store_Base): class Product_Category_Temp(db.Model, Store_Base):
__tablename__ = 'Shop_Product_Category_Temp' __tablename__ = 'Shop_Product_Category_Temp'
__table_args__ = { 'extend_existing': True } __table_args__ = { 'extend_existing': True }
id_category: int = db.Column(db.Integer, primary_key=True) id_temp: int = db.Column(db.Integer, primary_key=True, autoincrement=True)
id_category: int = db.Column(db.Integer)
code: str = db.Column(db.String(50)) code: str = db.Column(db.String(50))
name: str = db.Column(db.String(255)) name: str = db.Column(db.String(255))
description: str = db.Column(db.String(4000)) description: str = db.Column(db.String(4000))
@@ -489,7 +490,9 @@ class Product_Category_Temp(db.Model, Store_Base):
guid: str = db.Column(db.String(36)) guid: str = db.Column(db.String(36))
# created_on: datetime = db.Column(db.DateTime) # created_on: datetime = db.Column(db.DateTime)
# created_by: int = db.Column(db.Integer) # created_by: int = db.Column(db.Integer)
def __init__(self):
super().__init__()
self.id_temp = None
@classmethod @classmethod
def from_product_category(cls, product_category): def from_product_category(cls, product_category):
row = cls() row = cls()

View File

@@ -67,6 +67,7 @@ class Product_Permutation(db.Model, Store_Base):
id_permutation = db.Column(db.Integer, primary_key=True) id_permutation = db.Column(db.Integer, primary_key=True)
id_product = db.Column(db.Integer) id_product = db.Column(db.Integer)
id_category = db.Column(db.Integer) id_category = db.Column(db.Integer)
csv_id_pairs_variation = db.Column(db.String(4000))
# name = db.Column(db.String(255)) # name = db.Column(db.String(255))
description = db.Column(db.String(4000)) description = db.Column(db.String(4000))
# price_GBP_full = db.Column(db.Float) # price_GBP_full = db.Column(db.Float)
@@ -222,7 +223,7 @@ class Product_Permutation(db.Model, Store_Base):
permutation.id_product = json[cls.ATTR_ID_PRODUCT] permutation.id_product = json[cls.ATTR_ID_PRODUCT]
permutation.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY] permutation.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY]
permutation.description = json[cls.FLAG_DESCRIPTION] permutation.description = json[cls.FLAG_DESCRIPTION]
permutation.cost_local_VAT_excl = json[cls.FLAG_COST_UNIT_LOCAL_VAT_EXCL] permutation.cost_local_VAT_excl = json.get(cls.FLAG_COST_UNIT_LOCAL_VAT_EXCL, None)
permutation.cost_local_VAT_incl = json.get(cls.FLAG_COST_UNIT_LOCAL_VAT_INCL, None) permutation.cost_local_VAT_incl = json.get(cls.FLAG_COST_UNIT_LOCAL_VAT_INCL, None)
permutation.currency_cost = Currency.from_json(json, '_cost') permutation.currency_cost = Currency.from_json(json, '_cost')
permutation.profit_local_min = json[cls.FLAG_PROFIT_LOCAL_MIN] permutation.profit_local_min = json[cls.FLAG_PROFIT_LOCAL_MIN]
@@ -254,7 +255,8 @@ class Product_Permutation(db.Model, Store_Base):
permutation.has_variations = json[cls.FLAG_HAS_VARIATIONS] permutation.has_variations = json[cls.FLAG_HAS_VARIATIONS]
permutation.active = 1 if av.input_bool(json[cls.FLAG_ACTIVE], cls.FLAG_ACTIVE, _m) else 0 permutation.active = 1 if av.input_bool(json[cls.FLAG_ACTIVE], cls.FLAG_ACTIVE, _m) else 0
if permutation.has_variations: if permutation.has_variations:
permutation.variation_tree = Product_Variation_Tree.from_json_str(json[cls.FLAG_PRODUCT_VARIATIONS]) permutation.csv_id_pairs_variation = json[cls.FLAG_PRODUCT_VARIATIONS]
permutation.variation_tree = Product_Variation_Tree.from_json_str(permutation.csv_id_pairs_variation)
""" """
for jsonProductVariation in json[cls.FLAG_PRODUCT_VARIATIONS]: for jsonProductVariation in json[cls.FLAG_PRODUCT_VARIATIONS]:
variation = Product_Variation.from_json(jsonProductVariation) variation = Product_Variation.from_json(jsonProductVariation)
@@ -383,6 +385,7 @@ class Product_Permutation(db.Model, Store_Base):
name_plural_unit_measurement_interval_expiration_unsealed: {self.name_plural_unit_measurement_interval_expiration_unsealed} name_plural_unit_measurement_interval_expiration_unsealed: {self.name_plural_unit_measurement_interval_expiration_unsealed}
count_interval_expiration_unsealed: {self.count_interval_expiration_unsealed} count_interval_expiration_unsealed: {self.count_interval_expiration_unsealed}
has_variations: {self.has_variations} has_variations: {self.has_variations}
csv_id_pairs_variation: {self.csv_id_pairs_variation}
can_view: {self.can_view} can_view: {self.can_view}
can_edit: {self.can_edit} can_edit: {self.can_edit}
can_admin: {self.can_admin} can_admin: {self.can_admin}
@@ -505,8 +508,10 @@ class Permutation_Product_Variation_Link(db.Model):
class Product_Permutation_Temp(db.Model, Store_Base): class Product_Permutation_Temp(db.Model, Store_Base):
__tablename__: ClassVar[str] = 'Shop_Product_Permutation_Temp' __tablename__: ClassVar[str] = 'Shop_Product_Permutation_Temp'
__table_args__ = { 'extend_existing': True } __table_args__ = { 'extend_existing': True }
id_permutation: int = db.Column(db.Integer, primary_key=True) id_temp: int = db.Column(db.Integer, primary_key=True, autoincrement=True)
id_permutation: int = db.Column(db.Integer)
id_product: int = db.Column(db.Integer) id_product: int = db.Column(db.Integer)
csv_id_pairs_variation: str = db.Column(db.String(4000))
description: str = db.Column(db.String(4000)) description: str = db.Column(db.String(4000))
cost_local_VAT_excl: float = db.Column(db.Float) cost_local_VAT_excl: float = db.Column(db.Float)
cost_local_VAT_incl: float = db.Column(db.Float) cost_local_VAT_incl: float = db.Column(db.Float)
@@ -527,13 +532,16 @@ class Product_Permutation_Temp(db.Model, Store_Base):
count_interval_expiration_unsealed: int = db.Column(db.Integer) count_interval_expiration_unsealed: int = db.Column(db.Integer)
active: bool = db.Column(db.Boolean) active: bool = db.Column(db.Boolean)
guid: str = db.Column(db.String(36)) guid: str = db.Column(db.String(36))
def __init__(self):
super().__init__()
self.id_temp = None
@classmethod @classmethod
def from_product_permutation(cls, product_permutation): def from_product_permutation(cls, product_permutation):
Helper_App.console_log(f'Product_Permutation_Temp.from_product_permutation: {product_permutation}\ntype(cost local): {str(type(product_permutation.cost_local_VAT_excl))}') Helper_App.console_log(f'Product_Permutation_Temp.from_product_permutation: {product_permutation}\ntype(cost local): {str(type(product_permutation.cost_local_VAT_excl))}')
row = cls() row = cls()
row.id_permutation = product_permutation.id_permutation row.id_permutation = product_permutation.id_permutation
row.id_product = product_permutation.id_product row.id_product = product_permutation.id_product
row.csv_id_pairs_variation = product_permutation.csv_id_pairs_variation
row.description = product_permutation.description row.description = product_permutation.description
row.cost_local_VAT_excl = product_permutation.cost_local_VAT_excl if product_permutation.cost_local_VAT_excl != 'None' else None row.cost_local_VAT_excl = product_permutation.cost_local_VAT_excl if product_permutation.cost_local_VAT_excl != 'None' else None
row.cost_local_VAT_incl = product_permutation.cost_local_VAT_incl if product_permutation.cost_local_VAT_incl != 'None' else None row.cost_local_VAT_incl = product_permutation.cost_local_VAT_incl if product_permutation.cost_local_VAT_incl != 'None' else None
@@ -558,6 +566,7 @@ class Product_Permutation_Temp(db.Model, Store_Base):
return f''' return f'''
id_permutation: {self.id_permutation} id_permutation: {self.id_permutation}
id_product: {self.id_product} id_product: {self.id_product}
csv_id_pairs_variation: {self.csv_id_pairs_variation}
description: {self.description} description: {self.description}
cost_local_VAT_excl: {self.cost_local_VAT_excl} cost_local_VAT_excl: {self.cost_local_VAT_excl}
cost_local_VAT_incl: {self.cost_local_VAT_incl} cost_local_VAT_incl: {self.cost_local_VAT_incl}

View File

@@ -101,5 +101,6 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
'a_id_user': user.id_user, 'a_id_user': user.id_user,
'a_debug': 0, 'a_debug': 0,
} }
cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list) results = cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list)
DataStore_Store_Base.db_cursor_clear(results.cursor)
Helper_App.console_log('saved product permutations') Helper_App.console_log('saved product permutations')

View File

@@ -18,6 +18,7 @@ DROP TABLE IF EXISTS tmp_Shop_Order;
DROP TABLE IF EXISTS tmp_Shop_Product; DROP TABLE IF EXISTS tmp_Shop_Product;
DROP TABLE IF EXISTS tmp_Product; DROP TABLE IF EXISTS tmp_Product;
DROP TABLE IF EXISTS tmp_Product_Permutation; DROP TABLE IF EXISTS tmp_Product_Permutation;
DROP TABLE IF EXISTS tmp_Permutation_Variation_Link;
DROP TABLE IF EXISTS tmp_Permutation; DROP TABLE IF EXISTS tmp_Permutation;
DROP TABLE IF EXISTS tmp_Shop_Product_p_shop_calc_user; DROP TABLE IF EXISTS tmp_Shop_Product_p_shop_calc_user;
DROP TABLE IF EXISTS tmp_Shop_Product_p_Shop_Calc_User; DROP TABLE IF EXISTS tmp_Shop_Product_p_Shop_Calc_User;
@@ -51,6 +52,7 @@ DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS tmp_Shop_Customer; DROP TABLE IF EXISTS tmp_Shop_Customer;
DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order_Product_Link; DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order; DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order;
DROP TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations;
# Delete old tables # Delete old tables
@@ -165,6 +167,7 @@ DROP TABLE IF EXISTS Shop_Product_Currency_Link;
DROP TABLE IF EXISTS Shop_Product_Variation_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Variation_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Variation_Link; DROP TABLE IF EXISTS Shop_Product_Variation_Link;
DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp;
DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Audit; DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link; DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link;
@@ -304,6 +307,8 @@ DROP PROCEDURE IF EXISTS p_shop_save_product_variation;
DROP PROCEDURE IF EXISTS p_shop_save_product_variation_test; DROP PROCEDURE IF EXISTS p_shop_save_product_variation_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation; DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation;
DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list; DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list;
DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list;
DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv;
DROP PROCEDURE IF EXISTS p_shop_save_stock_item; DROP PROCEDURE IF EXISTS p_shop_save_stock_item;
DROP PROCEDURE IF EXISTS p_shop_save_stock_item_test; DROP PROCEDURE IF EXISTS p_shop_save_stock_item_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item; DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item;

View File

@@ -6,7 +6,8 @@
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category_Temp'; SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp ( CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp (
id_category INT NOT NULL id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_category INT NOT NULL
, code VARCHAR(50) NOT NULL , code VARCHAR(50) NOT NULL
, name VARCHAR(255) NOT NULL , name VARCHAR(255) NOT NULL
, description VARCHAR(4000) NULL , description VARCHAR(4000) NULL

View File

@@ -6,7 +6,8 @@
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Temp'; SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Temp ( CREATE TABLE IF NOT EXISTS Shop_Product_Temp (
id_product INT NOT NULL id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_product INT NOT NULL
, name VARCHAR(255) NOT NULL , name VARCHAR(255) NOT NULL
, id_category INT NOT NULL , id_category INT NOT NULL
, has_variations BIT NOT NULL , has_variations BIT NOT NULL

View File

@@ -7,6 +7,7 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation ( CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
id_permutation INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id_permutation INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permutation_temp INT NOT NULL,
id_product INT NOT NULL, id_product INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_id_product CONSTRAINT FK_Shop_Product_Permutation_id_product
FOREIGN KEY (id_product) FOREIGN KEY (id_product)

View File

@@ -6,8 +6,10 @@
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Temp'; SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp ( CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp (
id_permutation INT NOT NULL id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_permutation INT NOT NULL
, id_product INT NOT NULL , id_product INT NOT NULL
, csv_id_pairs_variation VARCHAR(4000) NULL
, description VARCHAR(4000) NOT NULL , description VARCHAR(4000) NOT NULL
, cost_local_VAT_excl FLOAT NULL , cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL , cost_local_VAT_incl FLOAT NULL

View File

@@ -0,0 +1,16 @@
# Product Permutation Variation Link
-- DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Variation_Link_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link_Temp (
id_temp INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_link INT NOT NULL
, id_permutation INT NOT NULL
, id_variation INT NOT NULL
, active BIT NOT NULL
, display_order INT NOT NULL
, GUID BINARY(36) NOT NULL
);

View File

@@ -23,6 +23,8 @@ CREATE TRIGGER before_update_Shop_Product_Permutation
BEFORE UPDATE ON Shop_Product_Permutation BEFORE UPDATE ON Shop_Product_Permutation
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
DECLARE v_msg VARCHAR(4000);
IF OLD.id_change_set <=> NEW.id_change_set THEN IF OLD.id_change_set <=> NEW.id_change_set THEN
SIGNAL SQLSTATE '45000' SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'New change Set ID must be provided.'; SET MESSAGE_TEXT = 'New change Set ID must be provided.';
@@ -40,8 +42,10 @@ BEGIN
NEW.id_unit_measurement_interval_expiration_unsealed IS NULL 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 NOT IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)
)) THEN )) 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' SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Unsealed expiration interval ID must be a unit of time.'; SET MESSAGE_TEXT = v_msg
;
END IF; END IF;
INSERT INTO Shop_Product_Permutation_Audit ( INSERT INTO Shop_Product_Permutation_Audit (

View File

@@ -1,49 +1,44 @@
DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv; DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_name;
DELIMITER // DELIMITER //
CREATE FUNCTION fn_shop_get_product_permutation_variations_csv(id_product_permutation INT) CREATE FUNCTION fn_shop_get_product_permutation_name(id_product_permutation INT)
RETURNS VARCHAR(4000) RETURNS VARCHAR(4000)
DETERMINISTIC DETERMINISTIC
BEGIN BEGIN
DECLARE csv VARCHAR(4000); DECLARE name VARCHAR(4000);
SET csv := ( SET name := (
SELECT SELECT
CASE WHEN P.has_variations = 0 THEN CONCAT(
'' IFNULL(PC.name, '(No Category)')
ELSE , ' - '
GROUP_CONCAT( , IFNULL(P.name, '(No Product)')
CONCAT( , CASE WHEN P.has_variations = 1 THEN
PV.id_type CONCAT(' - ', GROUP_CONCAT(CONCAT(VT.name, ': ', V.name) SEPARATOR ', '))
, ':' ELSE '' END
, PV.id_variation )
) FROM Shop_Product_Permutation PP
SEPARATOR ',' LEFT JOIN Shop_Product P ON PP.id_product = P.id_product
) LEFT JOIN Shop_Product_Category PC ON P.id_category = PC.id_category
END LEFT JOIN Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation
FROM partsltd_prod.Shop_Product_Permutation PP LEFT JOIN Shop_Variation V ON PPVL.id_variation = V.id_variation
LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product LEFT JOIN Shop_Variation_Type VT ON V.id_type = VT.id_type
LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation
LEFT JOIN partsltd_prod.Shop_Variation PV ON PPVL.id_variation = PV.id_variation
LEFT JOIN partsltd_prod.Shop_Variation_Type PVT ON PV.id_type = PVT.id_type
WHERE PP.id_permutation = id_product_permutation WHERE PP.id_permutation = id_product_permutation
GROUP BY P.id_product, P.has_variations, PVT.display_order, PVT.name, PV.display_order, PV.name GROUP BY PC.id_category, PC.name, P.id_product, P.name, P.has_variations, VT.display_order, VT.name, V.display_order, V.name
LIMIT 1 LIMIT 1
); );
RETURN csv; RETURN name;
END // END //
DELIMITER ; DELIMITER ;
/*
SELECT SELECT
fn_shop_get_product_permutation_variations_csv( fn_shop_get_product_permutation_name(
3 -- id_product_permutation 3 -- id_product_permutation
) )
, fn_shop_get_product_permutation_variations_csv(
1 -- id_product_permutation
)
; ;
/*
*/ */

View File

@@ -0,0 +1,102 @@
DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list;
DELIMITER //
CREATE FUNCTION fn_shop_get_product_variations_from_id_csv_list (
a_id_permutation INT
, a_variation_csv TEXT
, a_guid BINARY(36)
)
RETURNS INT
DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE v_csv_pairs VARCHAR(4000);
DECLARE v_current_pair VARCHAR(50);
DECLARE v_id_variation_type INT;
DECLARE v_id_variation INT;
DECLARE v_rank_counter INT;
CALL p_validate_guid( a_guid );
SET v_csv_pairs := a_variation_csv;
SET v_rank_counter := 1;
DROP TEMPORARY TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations;
CREATE TEMPORARY TABLE tmp_Get_Variation_From_Csv_Variations (
id_variation_type INT NULL
, id_variation INT NOT NULL
);
WHILE LENGTH(v_csv_pairs) > 0 DO
IF LOCATE(',', v_csv_pairs) > 0 THEN
SET v_current_pair := SUBSTRING_INDEX(v_csv_pairs, ',', 1);
SET v_csv_pairs := SUBSTRING(v_csv_pairs, LOCATE(',', v_csv_pairs) + 1);
ELSE
SET v_current_pair := v_csv_pairs;
SET v_csv_pairs := '';
END IF;
SET v_id_variation_type := SUBSTRING_INDEX(v_current_pair, ':', 1);
SET v_id_variation := SUBSTRING_INDEX(v_current_pair, ':', -1);
IF NOT ISNULL(v_id_variation) THEN
INSERT INTO tmp_Get_Variation_From_Csv_Variations (
id_variation_type
, id_variation
)
SELECT
v_id_variation_type AS id_variation_type
, v_id_variation AS id_variation
;
SET v_rank_counter := v_rank_counter + 1;
END IF;
END WHILE;
INSERT INTO partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp (
id_link
, id_permutation
, id_variation
, display_order
, active
, GUID
)
SELECT
IFNULL(PPVL.id_link, -v_rank_counter) AS id_link
, a_id_permutation
, t_V.id_variation
, v_rank_counter AS display_order
, 1 AS active
, a_guid
FROM tmp_Get_Variation_From_Csv_Variations t_V
LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON t_V.id_variation = PPVL.id_variation
;
DROP TEMPORARY TABLE tmp_Get_Variation_From_Csv_Variations;
RETURN v_rank_counter;
END //
DELIMITER ;
/*
SELECT
partsltd_prod.fn_shop_get_product_variations_from_id_csv_list(
1 -- a_id_permutation
, '1:1' -- a_variation_csv
, 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE' -- a_guid
)
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp
WHERE GUID = 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE'
;
DELETE
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp
WHERE GUID = 'NIPPLENIPPLENIPPLENIPPLENIPPLENIPPLE'
;
*/

View File

@@ -0,0 +1,49 @@
DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv;
DELIMITER //
CREATE FUNCTION fn_shop_get_product_permutation_variations_csv(id_product_permutation INT)
RETURNS VARCHAR(4000)
DETERMINISTIC
BEGIN
DECLARE csv VARCHAR(4000);
SET csv := (
SELECT
CASE WHEN P.has_variations = 0 THEN
''
ELSE
GROUP_CONCAT(
CONCAT(
PV.id_type
, ':'
, PV.id_variation
)
SEPARATOR ','
)
END
FROM partsltd_prod.Shop_Product_Permutation PP
LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product
LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PP.id_permutation = PPVL.id_permutation
LEFT JOIN partsltd_prod.Shop_Variation PV ON PPVL.id_variation = PV.id_variation
LEFT JOIN partsltd_prod.Shop_Variation_Type PVT ON PV.id_type = PVT.id_type
WHERE PP.id_permutation = id_product_permutation
GROUP BY P.id_product, P.has_variations, PVT.display_order, PVT.name, PV.display_order, PV.name
LIMIT 1
);
RETURN csv;
END //
DELIMITER ;
SELECT
fn_shop_get_product_permutation_variations_csv(
3 -- id_product_permutation
)
, fn_shop_get_product_permutation_variations_csv(
1 -- id_product_permutation
)
;
/*
*/

View File

@@ -67,11 +67,14 @@ BEGIN
CALL p_validate_guid ( a_guid ); CALL p_validate_guid ( a_guid );
DROP TABLE IF EXISTS tmp_Permutation; DROP TEMPORARY TABLE IF EXISTS tmp_Permutation_Variation_Link;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation;
CREATE TEMPORARY TABLE tmp_Permutation ( CREATE TEMPORARY TABLE tmp_Permutation (
id_permutation INT NOT NULL id_permutation INT NOT NULL
, id_permutation_temp INT NOT NULL
, id_product INT NOT NULL , id_product INT NOT NULL
, csv_id_pairs_variation VARCHAR(4000) NULL
, description VARCHAR(4000) NOT NULL , description VARCHAR(4000) NOT NULL
, cost_local_VAT_excl FLOAT NULL , cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL , cost_local_VAT_incl FLOAT NULL
@@ -97,6 +100,15 @@ BEGIN
, name_error VARCHAR(255) NOT NULL , name_error VARCHAR(255) NOT NULL
, is_new BIT NOT NULL , is_new BIT NOT NULL
); );
CREATE TEMPORARY TABLE tmp_Permutation_Variation_Link (
id_link INT NOT NULL
, id_permutation INT NOT NULL
, id_variation INT NOT NULL
, active BIT NOT NULL
, display_order INT NOT NULL
, is_new BIT NOT NULL
);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
@@ -109,7 +121,9 @@ BEGIN
-- Get data from Temp table -- Get data from Temp table
INSERT INTO tmp_Permutation ( INSERT INTO tmp_Permutation (
id_permutation id_permutation
, id_permutation_temp
, id_product , id_product
, csv_id_pairs_variation
, description , description
, cost_local_VAT_excl , cost_local_VAT_excl
, cost_local_VAT_incl , cost_local_VAT_incl
@@ -134,7 +148,9 @@ BEGIN
) )
SELECT SELECT
PP_T.id_permutation PP_T.id_permutation
, PP_T.id_permutation
, IFNULL(PP_T.id_product, PP.id_product) AS id_product , IFNULL(PP_T.id_product, PP.id_product) AS id_product
, PP_T.csv_id_pairs_variation
, IFNULL(PP_T.description, PP.description) AS description , IFNULL(PP_T.description, PP.description) AS description
, IFNULL(PP_T.cost_local_VAT_excl, PP.cost_local_VAT_excl) AS cost_local_VAT_excl , IFNULL(PP_T.cost_local_VAT_excl, PP.cost_local_VAT_excl) AS cost_local_VAT_excl
, IFNULL(PP_T.cost_local_VAT_incl, PP.cost_local_VAT_incl) AS cost_local_VAT_incl , IFNULL(PP_T.cost_local_VAT_incl, PP.cost_local_VAT_incl) AS cost_local_VAT_incl
@@ -161,6 +177,46 @@ BEGIN
WHERE PP_T.guid = a_guid WHERE PP_T.guid = a_guid
; ;
SELECT
partsltd_prod.fn_shop_get_product_variations_from_id_csv_list(
t_PP.id_permutation -- a_id_permutation
, t_PP.csv_id_pairs_variation -- a_variation_csv
, a_guid -- a_guid
)
FROM tmp_Permutation t_PP
WHERE NOT ISNULL(t_PP.csv_id_pairs_variation)
;
INSERT INTO tmp_Permutation_Variation_Link (
id_link
, id_permutation
, id_variation
, display_order
, active
, is_new
)
SELECT
PPVL_T.id_link
, PPVL_T.id_permutation
, PPVL_T.id_variation
, PPVL_T.display_order
, NOT ISNULL(PPVL_T.id_link) AS active
, IFNULL(PPVL_T.id_link, 0) < 1 AS is_new
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp PPVL_T
LEFT JOIN partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL ON PPVL_T.id_link = PPVL.id_variation
LEFT JOIN tmp_Permutation t_PP ON PPVL_T.id_permutation = t_PP.id_permutation
WHERE PPVL_T.GUID = a_guid
;
IF a_debug = 1 THEN
SELECT *
FROM tmp_Permutation
;
SELECT *
FROM tmp_Permutation_Variation_Link
;
END IF;
-- Validation -- Validation
-- Missing mandatory fields -- Missing mandatory fields
-- id_product -- id_product
@@ -224,8 +280,6 @@ BEGIN
; ;
END IF; END IF;
SELECT 'NIPS';
-- latency_manufacture -- latency_manufacture
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.latency_manufacture) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.latency_manufacture) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -376,6 +430,17 @@ BEGIN
, t_P.can_admin = UE_T.can_admin , t_P.can_admin = UE_T.can_admin
; ;
IF a_debug = 1 THEN
SELECT *
FROM partsltd_prod.Shop_Calc_User_Temp
WHERE GUID = a_guid
;
SELECT *
FROM tmp_Permutation t_PP
LEFT JOIN Shop_Product P ON t_PP.id_product = P.id_product
;
END IF;
CALL p_shop_clear_calc_user( CALL p_shop_clear_calc_user(
a_guid a_guid
, 0 -- a_debug , 0 -- a_debug
@@ -392,20 +457,84 @@ BEGIN
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.can_edit) WHERE
ISNULL(t_P.can_edit)
; ;
END IF; END IF;
IF a_debug = 1 THEN
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp
WHERE GUID = a_guid
;
END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION; START TRANSACTION;
IF NOT ISNULL(v_ids_product_permission) THEN
INSERT INTO Shop_Product_Change_Set ( comment ) INSERT INTO Shop_Product_Change_Set ( comment )
VALUES ( a_comment ) VALUES ( a_comment )
; ;
SET v_id_change_set := LAST_INSERT_ID(); SET v_id_change_set := LAST_INSERT_ID();
INSERT INTO Shop_Product_Permutation (
id_permutation_temp
, id_product
, description
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
, id_unit_measurement_quantity
, count_unit_measurement_per_quantity_step
, quantity_min
, quantity_max
, quantity_stock
, is_subscription
, id_unit_measurement_interval_recurrence
, count_interval_recurrence
, id_stripe_product
, does_expire_faster_once_unsealed
, id_unit_measurement_interval_expiration_unsealed
, count_interval_expiration_unsealed
, active
, created_by
, created_on
, id_change_set
)
SELECT
t_P.id_permutation
, t_P.id_product AS id_product
, t_P.description AS description
, t_P.cost_local_VAT_excl AS cost_local_VAT_excl
, t_P.cost_local_VAT_incl AS cost_local_VAT_incl
, t_P.id_currency_cost AS id_currency_cost
, t_P.profit_local_min AS profit_local_min
, t_P.latency_manufacture AS latency_manufacture
, t_P.id_unit_measurement_quantity AS id_unit_measurement_quantity
, t_P.count_unit_measurement_per_quantity_step AS count_unit_measurement_per_quantity_step
, t_P.quantity_min AS quantity_min
, t_P.quantity_max AS quantity_max
, t_P.quantity_stock AS quantity_stock
, t_P.is_subscription AS is_subscription
, t_P.id_unit_measurement_interval_recurrence AS id_unit_measurement_interval_recurrence
, t_P.count_interval_recurrence AS count_interval_recurrence
, t_P.id_stripe_product AS id_stripe_product
, t_P.does_expire_faster_once_unsealed AS does_expire_faster_once_unsealed
, t_P.id_unit_measurement_interval_expiration_unsealed AS id_unit_measurement_interval_expiration_unsealed
, t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed
, t_P.active AS active
, a_id_user AS created_by
, v_time_start AS created_on
, v_id_change_set AS id_change_set
FROM tmp_Permutation t_P
WHERE
is_new = 1
AND active = 1
;
UPDATE Shop_Product_Permutation PP UPDATE Shop_Product_Permutation PP
INNER JOIN tmp_Permutation t_P ON PP.id_permutation = t_P.id_permutation INNER JOIN tmp_Permutation t_P ON PP.id_permutation = t_P.id_permutation
SET SET
@@ -431,66 +560,60 @@ BEGIN
, PP.active = t_P.active , PP.active = t_P.active
, PP.id_change_set = v_id_change_set , PP.id_change_set = v_id_change_set
; ;
UPDATE tmp_Permutation t_PP
INNER JOIN partsltd_prod.Shop_Product_Permutation PP
ON t_PP.id_permutation_temp = PP.id_permutation_temp
AND PP.id_change_set = v_id_change_set
SET
t_PP.id_permutation = PP.id_permutation
;
UPDATE tmp_Permutation_Variation_Link t_PPVL
INNER JOIN tmp_Permutation t_PP ON t_PPVL.id_permutation = t_PP.id_permutation_temp
SET
t_PPVL.id_permutation = t_PP.id_permutation
;
INSERT INTO partsltd_prod.Shop_Product_Permutation_Variation_Link (
id_permutation
, id_variation
, display_order
, active
)
SELECT
t_PPVL.id_permutation
, t_PPVL.id_variation
, t_PPVL.display_order
, t_PPVL.active
FROM tmp_Permutation_Variation_Link t_PPVL
WHERE
t_PPVL.is_new = 1
AND t_PPVL.active = 1
;
UPDATE partsltd_prod.Shop_Product_Permutation_Variation_Link PPVL
INNER JOIN tmp_Permutation_Variation_Link t_PPVL
ON PPVL.id_link = t_PPVL.id_link
AND t_PPVL.is_new = 1
SET
PPVL.id_permutation = t_PPVL.id_permutation
, PPVL.id_variation = t_PPVL.id_variation
, PPVL.display_order = t_PPVL.display_order
, PPVL.active = t_PPVL.active
, PPVL.id_change_set = v_id_change_set
;
END IF; END IF;
INSERT INTO Shop_Product_Permutation (
id_product
, description
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
, id_unit_measurement_quantity
, count_unit_measurement_per_quantity_step
, quantity_min
, quantity_max
, quantity_stock
, is_subscription
, id_unit_measurement_interval_recurrence
, count_interval_recurrence
, id_stripe_product
, does_expire_faster_once_unsealed
, id_unit_measurement_interval_expiration_unsealed
, count_interval_expiration_unsealed
, active
, created_by
, created_on
)
SELECT
t_P.id_product AS id_product
, t_P.description AS description
, t_P.cost_local_VAT_excl AS cost_local_VAT_excl
, t_P.cost_local_VAT_incl AS cost_local_VAT_incl
, t_P.id_currency_cost AS id_currency_cost
, t_P.profit_local_min AS profit_local_min
, t_P.latency_manufacture AS latency_manufacture
, t_P.id_unit_measurement_quantity AS id_unit_measurement_quantity
, t_P.count_unit_measurement_per_quantity_step AS count_unit_measurement_per_quantity_step
, t_P.quantity_min AS quantity_min
, t_P.quantity_max AS quantity_max
, t_P.quantity_stock AS quantity_stock
, t_P.is_subscription AS is_subscription
, t_P.id_unit_measurement_interval_recurrence AS id_unit_measurement_interval_recurrence
, t_P.count_interval_recurrence AS count_interval_recurrence
, t_P.id_stripe_product AS id_stripe_product
, t_P.does_expire_faster_once_unsealed AS does_expire_faster_once_unsealed
, t_P.id_unit_measurement_interval_expiration_unsealed AS id_unit_measurement_interval_expiration_unsealed
, t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed
, t_P.active AS active
, a_id_user AS created_by
, v_time_start AS created_on
FROM tmp_Permutation t_P
WHERE
is_new = 1
AND active = 1
;
DELETE FROM Shop_Product_Permutation_Temp DELETE FROM Shop_Product_Permutation_Temp
WHERE GUID = a_guid; WHERE GUID = a_guid
;
COMMIT;
END IF; DELETE FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp
WHERE GUID = a_guid
;
COMMIT;
# Errors # Errors
SELECT * SELECT *
@@ -499,9 +622,11 @@ BEGIN
; ;
IF a_debug = 1 THEN IF a_debug = 1 THEN
SELECT * from tmp_Permutation; SELECT * FROM tmp_Permutation;
SELECT * FROM tmp_Permutation_Variation_Link;
END IF; END IF;
DROP TEMPORARY TABLE tmp_Permutation_Variation_Link;
DROP TEMPORARY TABLE tmp_Permutation; DROP TEMPORARY TABLE tmp_Permutation;
DROP TEMPORARY TABLE tmp_Msg_Error; DROP TEMPORARY TABLE tmp_Msg_Error;
@@ -590,5 +715,7 @@ DELETE FROM Shop_Product_Permutation_Temp
WHERE id_permutation = 1; WHERE id_permutation = 1;
select * from shop_unit_measurement;
*/ */

View File

@@ -18,6 +18,9 @@ BEGIN
FROM partsltd_prod.Shop_Product_Permutation FROM partsltd_prod.Shop_Product_Permutation
; ;
SELECT * SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp FROM partsltd_prod.Shop_Product_Permutation_Temp
; ;
@@ -26,6 +29,7 @@ BEGIN
INSERT INTO partsltd_prod.Shop_Product_Permutation_Temp ( INSERT INTO partsltd_prod.Shop_Product_Permutation_Temp (
id_permutation id_permutation
, id_product , id_product
, csv_id_pairs_variation
, description , description
, cost_local_VAT_excl , cost_local_VAT_excl
, cost_local_VAT_incl , cost_local_VAT_incl
@@ -48,10 +52,11 @@ BEGIN
, guid , guid
) )
VALUES VALUES
/* Test 1 - Insert */ /* Test 1 - Insert
( (
-1 -- id_permutation -1 -- id_permutation
, 5 -- id_product , 5 -- id_product
, '' -- csv_id_pairs_variation
, 'Hair clip' -- description , 'Hair clip' -- description
, NULL -- cost_local_VAT_excl , NULL -- cost_local_VAT_excl
, NULL -- cost_local_VAT_incl , NULL -- cost_local_VAT_incl
@@ -73,6 +78,7 @@ BEGIN
, 1 -- active , 1 -- active
, v_guid , v_guid
) )
*/
/* Test 2 - Update /* Test 2 - Update
( (
4 -- id_product 4 -- id_product
@@ -85,6 +91,32 @@ BEGIN
, v_guid , v_guid
) )
*/ */
/* Test 3 - Insert with Variations */
(
-1 -- id_permutation
, 1 -- id_product
, '1:3' -- csv_id_pairs_variation
, 'Test with variations' -- description
, NULL -- cost_local_VAT_excl
, NULL -- cost_local_VAT_incl
, 1 -- id_currency_cost
, NULL -- profit_local_min
, 1 -- latency_manufacture
, 3 -- id_unit_measurement_quantity
, 1 -- count_unit_measurement_per_quantity_step
, 0 -- quantity_min
, 0 -- quantity_max
, 2 -- quantity_stock
, FALSE -- is_subscription
, NULL -- id_unit_measurement_interval_recurrence
, NULL -- count_interval_recurrence
, NULL -- id_stripe_product
, TRUE -- does_expire_faster_once_unsealed
, 8 -- id_unit_measurement_interval_expiration_unsealed
, 2 -- count_interval_expiration_unsealed
, 1 -- active
, v_guid
)
; ;
COMMIT; COMMIT;
@@ -105,6 +137,9 @@ BEGIN
FROM partsltd_prod.Shop_Product_Permutation FROM partsltd_prod.Shop_Product_Permutation
; ;
SELECT * SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp FROM partsltd_prod.Shop_Product_Permutation_Temp
; ;
@@ -112,6 +147,7 @@ BEGIN
END // END //
DELIMITER ;; DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_product_permutation_test (); CALL partsltd_prod.p_shop_save_product_permutation_test ();
DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp; DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp;
@@ -119,7 +155,17 @@ DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error; DROP TABLE IF EXISTS tmp_Msg_Error;
/* DELETE FROM partsltd_prod.Shop_Product_Permutation_Variation_Link
SELECT * FROM partsltd_prod.Shop_Product WHERE id_link >= 3
Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_product_permutation`, CONSTRAINT `FK_Shop_Product_Permutation_id_product` FOREIGN KEY (`id_product`) REFERENCES `shop_product` (`id_product`) ON UPDATE RESTRICT) ;
DELETE FROM partsltd_prod.Shop_Product_Permutation
WHERE id_permutation >= 7
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp
;
SELECT *
FROM partsltd_prod.Shop_Variation
;
*/ */

View File

@@ -683,7 +683,9 @@ BEGIN
UPDATE tmp_Supplier_Purchase_Order t_SPO UPDATE tmp_Supplier_Purchase_Order t_SPO
INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO ON t_SPO.id_order_temp = SPO.id_order_temp INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO
ON t_SPO.id_order_temp = SPO.id_order_temp
AND SPO.id_change_set = v_id_change_set
SET SET
t_SPO.id_order = SPO.id_order t_SPO.id_order = SPO.id_order
WHERE t_SPO.is_new = 1 WHERE t_SPO.is_new = 1

View File

@@ -58,7 +58,6 @@ BEGIN
WHERE id_order = 6 WHERE id_order = 6
*/ */
; ;
/*
INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp ( INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp (
id_link id_link
, id_order , id_order
@@ -73,8 +72,7 @@ BEGIN
, cost_total_local_VAT_incl , cost_total_local_VAT_incl
, GUID , GUID
) )
; /* Test 1 - Insert */
/ Test 1 - Insert
VALUES ( VALUES (
-1 -1
, -1 , -1
@@ -89,7 +87,6 @@ BEGIN
, 6 , 6
, v_guid , v_guid
) )
*/
/* Test 2 - Update /* Test 2 - Update
SELECT SELECT
id_link id_link
@@ -107,7 +104,7 @@ BEGIN
FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link
WHERE id_order = 6 WHERE id_order = 6
*/ */
;
COMMIT; COMMIT;

View File

@@ -146,4 +146,5 @@ DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error; DROP TABLE IF EXISTS tmp_Msg_Error;
select * from partsltd_prod.Shop_User; select * from partsltd_prod.Shop_User;
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'partsltd_prod.t_MPOPL.name_error' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
*/ */

View File

@@ -581,13 +581,14 @@ BEGIN
END IF; END IF;
-- Duplicates -- Duplicates
/*
IF EXISTS ( IF EXISTS (
SELECT SELECT
id_permutation t_MPOPL.id_permutation
, name_error , t_MPOPL.name_error
, COUNT(*) , COUNT(*)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
GROUP BY id_permutation GROUP BY t_MPOPL.id_permutation, t_MPOPL.name_error
HAVING COUNT(*) > 1 HAVING COUNT(*) > 1
) THEN ) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -599,15 +600,16 @@ BEGIN
CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', ')) CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', '))
FROM ( FROM (
SELECT SELECT
id_permutation t_MPOPL.id_permutation
, name_error , t_MPOPL.name_error
, COUNT(*) , COUNT(*)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
GROUP BY id_permutation GROUP BY t_MPOPL.id_permutation, t_MPOPL.name_error
HAVING COUNT(*) > 1 HAVING COUNT(*) > 1
) t_MPOPLC ) t_MPOPLC
; ;
END IF; END IF;
*/
-- Empty Manufacturing Purchase Order -- Empty Manufacturing Purchase Order
IF EXISTS ( SELECT * FROM tmp_Manufacturing_Purchase_Order t_MPO LEFT JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order WHERE ISNULL(t_MPOPL.id_order) ) THEN IF EXISTS ( SELECT * FROM tmp_Manufacturing_Purchase_Order t_MPO LEFT JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order WHERE ISNULL(t_MPOPL.id_order) ) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -829,7 +831,9 @@ BEGIN
; ;
UPDATE tmp_Manufacturing_Purchase_Order t_MPO UPDATE tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order_temp = MPO.id_order_temp INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO
ON t_MPO.id_order_temp = MPO.id_order_temp
AND MPO.id_change_set = v_id_change_set
SET SET
t_MPO.id_order = MPO.id_order t_MPO.id_order = MPO.id_order
WHERE t_MPO.is_new = 1 WHERE t_MPO.is_new = 1

View File

@@ -282,7 +282,7 @@ BEGIN
VALUES ( VALUES (
v_id_type_error_no_permission v_id_type_error_no_permission
, v_code_type_error_no_permission , v_code_type_error_no_permission
, CONCAT('You do not have view permissions for ', IFNULL((SELECT IFNULL(name, '(No Permission Name)') FROM partsltd_prod.Shop_Permission WHERE id_permission LIKE CONCAT('%', v_ids_permission_manufacturing_purchase_order, '%') LIMIT 1), '(No Permissions Found)')) , CONCAT('You do not have view permissions for ', IFNULL((SELECT IFNULL(name, '(No Permission Name)') FROM partsltd_prod.Shop_Permission WHERE FIND_IN_SET(id_permission, v_ids_permission_manufacturing_purchase_order) > 0 LIMIT 1), '(No Permissions Found)'))
) )
; ;
END IF; END IF;

View File

@@ -363,6 +363,7 @@ VALUES
# Product Permutations # Product Permutations
INSERT INTO Shop_Product_Permutation ( INSERT INTO Shop_Product_Permutation (
-- display_order, -- display_order,
id_permutation_temp,
id_product, id_product,
description, description,
cost_local_VAT_excl, cost_local_VAT_excl,
@@ -387,7 +388,8 @@ INSERT INTO Shop_Product_Permutation (
) )
VALUES VALUES
( (
-- 1, -- 1,
-1,
1, 1,
'Good Red', 'Good Red',
5, 5,
@@ -412,6 +414,7 @@ VALUES
), ),
( (
-- 2, -- 2,
-2,
1, 1,
'Good Blue', 'Good Blue',
6, 6,
@@ -436,6 +439,7 @@ VALUES
), ),
( (
-- 3, -- 3,
-3,
2, 2,
'Test product describes good', 'Test product describes good',
10, 10,
@@ -460,6 +464,7 @@ VALUES
), ),
( (
-- 4, -- 4,
-4,
3, 3,
'Phone describes good', 'Phone describes good',
10, 10,
@@ -484,6 +489,7 @@ VALUES
), ),
( (
-- 5, -- 5,
-5,
4, 4,
'Laptop describes good', 'Laptop describes good',
10, 10,
@@ -508,6 +514,7 @@ VALUES
), ),
( (
-- 6, -- 6,
-6,
5, 5,
'Smart watch describes good', 'Smart watch describes good',
10, 10,
@@ -548,6 +555,9 @@ INSERT INTO Shop_Variation (
VALUES VALUES
(1, 1, 'RED', 'Red', NULL, NULL) (1, 1, 'RED', 'Red', NULL, NULL)
, (2, 1, 'BLUE', 'Blue', NULL, NULL) , (2, 1, 'BLUE', 'Blue', NULL, NULL)
, (3, 1, 'GREEN', 'Green', NULL, NULL)
, (4, 1, 'White', 'White', NULL, NULL)
, (5, 1, 'BLACK', 'Black', NULL, NULL)
, (1, 2, '400ml', '400 millilitres', 6, 400) , (1, 2, '400ml', '400 millilitres', 6, 400)
, (2, 2, '400g', '400 grams', 4, 400) , (2, 2, '400g', '400 grams', 4, 400)
, (3, 2, '410g', '410 grams', 4, 410) , (3, 2, '410g', '410 grams', 4, 410)

View File

@@ -57,6 +57,7 @@
1214_tbl_Shop_Variation_Temp.sql 1214_tbl_Shop_Variation_Temp.sql
1215_tbl_Shop_Product_Permutation_Variation_Link.sql 1215_tbl_Shop_Product_Permutation_Variation_Link.sql
1216_tbl_Shop_Product_Permutation_Variation_Link_Audit.sql 1216_tbl_Shop_Product_Permutation_Variation_Link_Audit.sql
1217_tbl_Shop_Product_Permutation_Variation_Link_Temp.sql
1218_tbl_Shop_Stock_Item.sql 1218_tbl_Shop_Stock_Item.sql
1219_tbl_Shop_Stock_Item_Audit.sql 1219_tbl_Shop_Stock_Item_Audit.sql
1220_tbl_Shop_Stock_Item_Temp.sql 1220_tbl_Shop_Stock_Item_Temp.sql
@@ -172,6 +173,7 @@
6004_p_clear_split_key_value_pair_csv_temp.sql 6004_p_clear_split_key_value_pair_csv_temp.sql
6206_fn_shop_get_product_permutation_name.sql 6206_fn_shop_get_product_permutation_name.sql
6210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql 6210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql
6211_fn_shop_get_product_variations_from_id_csv_list.sql
6500_p_shop_calc_user.sql 6500_p_shop_calc_user.sql
6501_p_shop_clear_calc_user.sql 6501_p_shop_clear_calc_user.sql
7003_p_shop_get_many_access_level.sql 7003_p_shop_get_many_access_level.sql

View File

@@ -1,7 +1,6 @@
@echo off @echo off
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
:: set "test=C:\C:\ \"
set dir_parent=C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\MySQL set dir_parent=C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\MySQL
:: set dir_parent=C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\PostgreSQL :: set dir_parent=C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\PostgreSQL
set "f_list=file_list.txt" set "f_list=file_list.txt"
@@ -19,14 +18,12 @@ set "strs_delete_6=600_p_shop_save_product.sql"
set "strs_delete_7=170_ish_tbl_ERP_Order.sql" set "strs_delete_7=170_ish_tbl_ERP_Order.sql"
set "strs_delete_7=dump.sql" set "strs_delete_7=dump.sql"
set strs_n_max=8 set strs_n_max=8
set strs_list =%strs_delete_0% %strs_delete_1% %strs_delete_2% %strs_delete_3% %strs_delete_4%
set "str_true=true"
set "str_replace="
set "str_list=" set "str_list="
set max_length=8191
set threshold=1000
:: report constants
echo temp = %f_tmp% echo temp = %f_tmp%
echo dir_parent = !%dir_parent%! echo dir_parent = !%dir_parent%!
echo dir_current = !%dir_current%! echo dir_current = !%dir_current%!
@@ -34,49 +31,43 @@ echo file_list = %f_list%
echo file = %f_combine% echo file = %f_combine%
echo n strings = !strs_n_max! echo n strings = !strs_n_max!
:: begin
cd %dir_parent% cd %dir_parent%
::echo current directory: %cd%
del %f_tmp% del %f_tmp%
del %f_list% del %f_list%
del %f_combine% del %f_combine%
:: colate dir files dir /b *.sql > %f_list%
dir /b > %f_list%
::type %f_list%
echo loopy echo loopy
:: Remove blacklist files
:: grep -v '920_edit_permissions.sql' %f_list% > %f_list%
:: grep -v '910_anal.sql' %f_list% > %f_list%
(for /f "delims=" %%a in (%f_list%) do ( (for /f "delims=" %%a in (%f_list%) do (
::if %verbose% gtr 0 ( echo new line )
set "line=%%a" set "line=%%a"
::if %verbose% gtr 0 ( echo new line = !line! )
::if !line! neq %strs_delete_0% if !line! neq %strs_delete_1% if !line! neq %strs_delete_2% if !line! neq %strs_delete_3% if !line! neq %strs_delete_4% if !line! neq %strs_delete_5% if !line! neq %strs_delete_6% (
:: echo !line!
:: set "str_list=!str_list! !line!"
::)
set include_line=1 set include_line=1
for /L %%i in (0, 1, %strs_n_max%) do ( for /L %%i in (0, 1, %strs_n_max%) do (
::set "str_delete=!strs_delete_%%i!"
if !line! equ !strs_delete_%%i! ( if !line! equ !strs_delete_%%i! (
set include_line=0 set include_line=0
) )
::set "include_line=!include_line!"
set "line=!line!" set "line=!line!"
) )
if !include_line! gtr 0 ( if !include_line! gtr 0 (
echo !line! echo !line!
set "str_list=!str_list! !line!" ::set "str_list=!str_list! !line!"
::set length=0
::for %%i in (!str_list!) do (
:: set /a length+=1
::)
::if !length! geq !threshold! (
:: echo !str_list!
:: echo !str_list! > %f_combine%
:: set "str_list="
::)
type !line! >> %f_combine%
) )
set "line=!line!" set "line=!line!"
)) > %f_tmp% )) > %f_tmp%
:: Combine files
echo output list: echo output list:
type %f_tmp% type %f_tmp%
@@ -84,12 +75,15 @@ del %f_list%
echo file_tmp: %f_tmp% echo file_tmp: %f_tmp%
echo file_list: %f_list% echo file_list: %f_list%
echo combining files echo combining files
::type %f_tmp% | type > %f_list% echo !str_list!
::
::type %f_list%
echo cmd: echo cmd:
echo "type !str_list! > %f_combine%" ::echo "type !str_list! > %f_combine%"
type !str_list! > %f_combine% ::type !str_list! > %f_combine%
::(for %%f in (!str_list!) do (
:: echo %%f
:: type "%%f" >> %f_combine%
::))
cd %dir_current% cd %dir_current%

View File

@@ -0,0 +1,43 @@
# Combine-SqlFiles.ps1
param(
[string]$sourceFolder = "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\static\MySQL\",
[string]$outputFileName = "0000_combined.sql",
[string]$filePattern = "*.sql",
[string[]]$excludeFiles = @("920_edit_permissions.sql", "910_anal.sql", "701_p_shop_get_many_role_permission.sql", "600_p_shop_save_product.sql", "dump.sql") # Array of filenames to exclude
)
$outputFile = Join-Path $sourceFolder $outputFileName
$outputDir = Split-Path -Parent $outputFile
# Remove output file if it exists
if (Test-Path $outputFile) {
Remove-Item $outputFile -Force
}
# Create directory if needed
if (!(Test-Path -Path $outputDir)) {
New-Item -ItemType Directory -Force -Path $outputDir
}
# Create a StringBuilder for efficiency
$output = New-Object System.Text.StringBuilder
# Process each file
Get-ChildItem -Path $sourceFolder -Filter $filePattern -File |
Where-Object { $_.Name -notin $excludeFiles -and $_.Name -ne $outputFileName } |
ForEach-Object {
[void]$output.AppendLine("-- File: $($_.Name)")
# Read file content and remove BOM if present
$content = [System.IO.File]::ReadAllBytes($_.FullName)
if ($content[0] -eq 0xEF -and $content[1] -eq 0xBB -and $content[2] -eq 0xBF) {
$content = $content[3..($content.Length-1)]
}
[void]$output.AppendLine([System.Text.Encoding]::UTF8.GetString($content))
[void]$output.AppendLine()
}
# Write final output
[System.IO.File]::WriteAllText($outputFile, $output.ToString(), [System.Text.UTF8Encoding]::new($false))
Write-Host "Files combined successfully into $outputFile"

View File

@@ -67,6 +67,28 @@
} }
/* Page Filters */ /* Page Filters */
#formFilters * {
font-size: 12px;
}
#formFilters .container {
max-width: fit-content;
}
#formFilters .container-input {
padding: 0 0.5vh;
}
#formFilters .container-input input {
max-width: 5vh;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#formFilters .container-input.filter.is_not_empty {
width: 12vh;
}
button.collapsed { button.collapsed {
display: block; display: block;
opacity: 0; opacity: 0;
@@ -79,11 +101,4 @@ form.filter button.save, form.filter button.button-cancel {
form.filter button.save, form.filter button.button-cancel { form.filter button.save, form.filter button.button-cancel {
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#formFilters .container-input.filter.is_not_empty {
width: 12vh;
} }

View File

@@ -1,13 +1,8 @@
#formFilters { #formFilters {
width: 50vh; width: 95vh;
} }
#formFilters .container {
max-width: fit-content;
}
#tableMain { #tableMain {
max-width: 90vw; max-width: 90vw;
} }

View File

@@ -15,11 +15,10 @@
width: 8vh; width: 8vh;
} }
/*
#tableMain { #tableMain {
max-width: min(calc(1vh * 79), calc(1vw * 90)); max-width: min(calc(1vh * 65), calc(1vw * 90));
} }
*/
#tableMain tbody tr td.display_order, #tableMain thead tr th.display_order { #tableMain tbody tr td.display_order, #tableMain thead tr th.display_order {
width: 5vh; width: 5vh;

View File

@@ -563,6 +563,28 @@ table div {
} }
/* Page Filters */ /* Page Filters */
#formFilters * {
font-size: 12px;
}
#formFilters .container {
max-width: fit-content;
}
#formFilters .container-input {
padding: 0 0.5vh;
}
#formFilters .container-input input {
max-width: 5vh;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#formFilters .container-input.filter.is_not_empty {
width: 12vh;
}
button.collapsed { button.collapsed {
display: block; display: block;
opacity: 0; opacity: 0;
@@ -577,13 +599,6 @@ form.filter button.save, form.filter button.button-cancel {
margin-bottom: 0; margin-bottom: 0;
} }
#formFilters .container-input.filter.active {
width: 8vh;
}
#formFilters .container-input.filter.is_not_empty {
width: 12vh;
}
/* Footer */ /* Footer */
.footer { .footer {
padding: 1vh; padding: 1vh;

View File

@@ -57,14 +57,9 @@
#formFilters { #formFilters {
width: 50vh; width: 95vh;
} }
#formFilters .container {
max-width: fit-content;
}
#tableMain { #tableMain {
max-width: 90vw; max-width: 90vw;
} }

View File

@@ -2792,7 +2792,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
key: "handleChangeProductCategoryDdl", key: "handleChangeProductCategoryDdl",
value: function handleChangeProductCategoryDdl(event, ddlCategory) { value: function handleChangeProductCategoryDdl(event, ddlCategory) {
this.handleChangeNestedElementCellTable(event, ddlCategory); this.handleChangeNestedElementCellTable(event, ddlCategory);
var idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory); var idProductCategorySelected = DOM.getElementAttributeValueCurrent(ddlCategory);
var row = DOM.getRowFromElement(ddlCategory); var row = DOM.getRowFromElement(ddlCategory);
var tdProduct = row.querySelector('td.' + flagProduct); var tdProduct = row.querySelector('td.' + flagProduct);
tdProduct.dispatchEvent(new Event('click')); tdProduct.dispatchEvent(new Event('click'));
@@ -4646,8 +4646,8 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
var tdProduct = row.querySelector('td.' + flagProduct); var tdProduct = row.querySelector('td.' + flagProduct);
var tdProductVariations = row.querySelector('td.' + flagProductVariations); var tdProductVariations = row.querySelector('td.' + flagProductVariations);
var inputDescription = row.querySelector('td.' + flagDescription + ' textarea'); var inputDescription = row.querySelector('td.' + flagDescription + ' textarea');
var inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input'); // let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input');
var inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input'); // let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input');
var tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost); var tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost);
var inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input'); var inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input');
var inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input'); var inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input');
@@ -4671,8 +4671,8 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent); jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent);
jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != ''; jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent); jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent); // jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent); // jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent);
jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent); jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent);
jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent); jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent);
jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent); jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent);
@@ -4694,6 +4694,15 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
}, { }, {
key: "initialiseRowNew", key: "initialiseRowNew",
value: function initialiseRowNew(tbody, row) { value: function initialiseRowNew(tbody, row) {
this.initialiseRowNewDdlsProductCategoryAndProduct(row);
var checkboxIsSubscription = row.querySelector('td.' + flagIsSubscription + ' input');
var checkboxDoesExpireFasterOnceUnsealed = row.querySelector('td.' + flagDoesExpireFasterOnceUnsealed + ' input');
this.handleChangeCheckboxDoesExpireFasterOnceUnsealed(null, checkboxDoesExpireFasterOnceUnsealed);
this.handleChangeCheckboxIsSubscription(null, checkboxIsSubscription);
}
}, {
key: "initialiseRowNewDdlsProductCategoryAndProduct",
value: function initialiseRowNewDdlsProductCategoryAndProduct(row) {
var ddlCategoryFilter = document.querySelector(idFormFilters + ' #' + attrIdProductCategory); var ddlCategoryFilter = document.querySelector(idFormFilters + ' #' + attrIdProductCategory);
var idProductCategoryFilter = DOM.getElementValueCurrent(ddlCategoryFilter); var idProductCategoryFilter = DOM.getElementValueCurrent(ddlCategoryFilter);
var hasCategoryFilter = !(validation_Validation.isEmpty(idProductCategoryFilter) || idProductCategoryFilter == '0'); var hasCategoryFilter = !(validation_Validation.isEmpty(idProductCategoryFilter) || idProductCategoryFilter == '0');
@@ -4842,22 +4851,27 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
value: function hookupIsSubscriptionFields() { value: function hookupIsSubscriptionFields() {
var _this3 = this; var _this3 = this;
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagIsSubscription + ' input', function (event, element) { this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagIsSubscription + ' input', function (event, element) {
_this3.handleChangeNestedElementCellTable(event, element); _this3.handleChangeCheckboxIsSubscription(event, element);
var isSubscription = DOM.getElementValueCurrent(element);
var row = DOM.getRowFromElement(element);
var inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input');
var divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence);
if (isSubscription) {
inputCountIntervalRecurrence.classList.remove(flagCollapsed);
divOrDdlIntervalRecurrence.classList.remove(flagCollapsed);
var tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td');
tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click'));
} else {
inputCountIntervalRecurrence.classList.add(flagCollapsed);
divOrDdlIntervalRecurrence.classList.add(flagCollapsed);
}
}); });
} }
}, {
key: "handleChangeCheckboxIsSubscription",
value: function handleChangeCheckboxIsSubscription(event, element) {
this.handleChangeNestedElementCellTable(event, element);
var isSubscription = DOM.getElementValueCurrent(element);
var row = DOM.getRowFromElement(element);
var inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input');
var divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence);
if (isSubscription) {
inputCountIntervalRecurrence.classList.remove(flagCollapsed);
divOrDdlIntervalRecurrence.classList.remove(flagCollapsed);
var tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td');
tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click'));
} else {
inputCountIntervalRecurrence.classList.add(flagCollapsed);
divOrDdlIntervalRecurrence.classList.add(flagCollapsed);
}
}
}, { }, {
key: "hookupIntervalRecurrenceFields", key: "hookupIntervalRecurrenceFields",
value: function hookupIntervalRecurrenceFields() { value: function hookupIntervalRecurrenceFields() {
@@ -4885,22 +4899,27 @@ var PageStoreProductPermutations = /*#__PURE__*/function (_TableBasePage) {
value: function hookupDoesExpireFasterOnceUnsealedCheckboxes() { value: function hookupDoesExpireFasterOnceUnsealedCheckboxes() {
var _this4 = this; var _this4 = this;
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', function (event, element) { this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', function (event, element) {
_this4.handleChangeNestedElementCellTable(event, element); _this4.handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element);
var doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element);
var row = DOM.getRowFromElement(element);
var inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input');
var divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed);
if (doesExpireFasterOnceUnsealed) {
inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed);
var tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td');
tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click'));
} else {
inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed);
}
}); });
} }
}, {
key: "handleChangeCheckboxDoesExpireFasterOnceUnsealed",
value: function handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element) {
this.handleChangeNestedElementCellTable(event, element);
var doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element);
var row = DOM.getRowFromElement(element);
var inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input');
var divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed);
if (doesExpireFasterOnceUnsealed) {
inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed);
var tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td');
tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click'));
} else {
inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed);
}
}
}, { }, {
key: "hookupIntervalExpirationUnsealedFields", key: "hookupIntervalExpirationUnsealedFields",
value: function hookupIntervalExpirationUnsealedFields() { value: function hookupIntervalExpirationUnsealedFields() {

View File

@@ -615,7 +615,7 @@ export default class TableBasePage extends BasePage {
} }
handleChangeProductCategoryDdl(event, ddlCategory) { handleChangeProductCategoryDdl(event, ddlCategory) {
this.handleChangeNestedElementCellTable(event, ddlCategory); this.handleChangeNestedElementCellTable(event, ddlCategory);
let idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory); let idProductCategorySelected = DOM.getElementAttributeValueCurrent(ddlCategory);
let row = DOM.getRowFromElement(ddlCategory); let row = DOM.getRowFromElement(ddlCategory);
let tdProduct = row.querySelector('td.' + flagProduct); let tdProduct = row.querySelector('td.' + flagProduct);
tdProduct.dispatchEvent(new Event('click')); tdProduct.dispatchEvent(new Event('click'));

View File

@@ -129,8 +129,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
let tdProduct = row.querySelector('td.' + flagProduct); let tdProduct = row.querySelector('td.' + flagProduct);
let tdProductVariations = row.querySelector('td.' + flagProductVariations); let tdProductVariations = row.querySelector('td.' + flagProductVariations);
let inputDescription = row.querySelector('td.' + flagDescription + ' textarea'); let inputDescription = row.querySelector('td.' + flagDescription + ' textarea');
let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input'); // let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input');
let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input'); // let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input');
let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost); let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost);
let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input'); let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input');
let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input'); let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input');
@@ -155,8 +155,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent); jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent);
jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != ''; jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent); jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent); // jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent); // jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent);
jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent); jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent);
jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent); jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent);
jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent); jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent);
@@ -176,6 +176,14 @@ export default class PageStoreProductPermutations extends TableBasePage {
return jsonRow; return jsonRow;
} }
initialiseRowNew(tbody, row) { initialiseRowNew(tbody, row) {
this.initialiseRowNewDdlsProductCategoryAndProduct(row);
let checkboxIsSubscription = row.querySelector('td.' + flagIsSubscription + ' input');
let checkboxDoesExpireFasterOnceUnsealed = row.querySelector('td.' + flagDoesExpireFasterOnceUnsealed + ' input');
this.handleChangeCheckboxDoesExpireFasterOnceUnsealed(null, checkboxDoesExpireFasterOnceUnsealed);
this.handleChangeCheckboxIsSubscription(null, checkboxIsSubscription);
}
initialiseRowNewDdlsProductCategoryAndProduct(row) {
let ddlCategoryFilter = document.querySelector(idFormFilters + ' #' + attrIdProductCategory); let ddlCategoryFilter = document.querySelector(idFormFilters + ' #' + attrIdProductCategory);
let idProductCategoryFilter = DOM.getElementValueCurrent(ddlCategoryFilter); let idProductCategoryFilter = DOM.getElementValueCurrent(ddlCategoryFilter);
let hasCategoryFilter = !(Validation.isEmpty(idProductCategoryFilter) || idProductCategoryFilter == '0'); let hasCategoryFilter = !(Validation.isEmpty(idProductCategoryFilter) || idProductCategoryFilter == '0');
@@ -283,22 +291,25 @@ export default class PageStoreProductPermutations extends TableBasePage {
} }
hookupIsSubscriptionFields(){ hookupIsSubscriptionFields(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagIsSubscription + ' input', (event, element) => { this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagIsSubscription + ' input', (event, element) => {
this.handleChangeNestedElementCellTable(event, element); this.handleChangeCheckboxIsSubscription(event, element);
let isSubscription = DOM.getElementValueCurrent(element);
let row = DOM.getRowFromElement(element);
let inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input');
let divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence);
if (isSubscription) {
inputCountIntervalRecurrence.classList.remove(flagCollapsed);
divOrDdlIntervalRecurrence.classList.remove(flagCollapsed);
let tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td');
tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click'));
} else {
inputCountIntervalRecurrence.classList.add(flagCollapsed);
divOrDdlIntervalRecurrence.classList.add(flagCollapsed);
}
}); });
} }
handleChangeCheckboxIsSubscription(event, element) {
this.handleChangeNestedElementCellTable(event, element);
let isSubscription = DOM.getElementValueCurrent(element);
let row = DOM.getRowFromElement(element);
let inputCountIntervalRecurrence = row.querySelector('td.' + flagCountUnitMeasurementIntervalRecurrence + ' input');
let divOrDdlIntervalRecurrence = row.querySelector('td.' + flagUnitMeasurementIntervalRecurrence + ' .' + flagUnitMeasurementIntervalRecurrence);
if (isSubscription) {
inputCountIntervalRecurrence.classList.remove(flagCollapsed);
divOrDdlIntervalRecurrence.classList.remove(flagCollapsed);
let tdUnitMeasurementIntervalRecurrence = divOrDdlIntervalRecurrence.closest('td');
tdUnitMeasurementIntervalRecurrence.dispatchEvent(new Event('click'));
} else {
inputCountIntervalRecurrence.classList.add(flagCollapsed);
divOrDdlIntervalRecurrence.classList.add(flagCollapsed);
}
}
hookupIntervalRecurrenceFields(){ hookupIntervalRecurrenceFields(){
this.hookupTableCellDDlPreviewsWhenNotCollapsed(idTableMain + ' td.' + flagUnitMeasurementIntervalRecurrence, Utils.getListFromDict(unitMeasurementsTime)); this.hookupTableCellDDlPreviewsWhenNotCollapsed(idTableMain + ' td.' + flagUnitMeasurementIntervalRecurrence, Utils.getListFromDict(unitMeasurementsTime));
} }
@@ -314,23 +325,26 @@ export default class PageStoreProductPermutations extends TableBasePage {
this.hookupCountIntervalExpirationUnsealedInputs(); this.hookupCountIntervalExpirationUnsealedInputs();
} }
hookupDoesExpireFasterOnceUnsealedCheckboxes(){ hookupDoesExpireFasterOnceUnsealedCheckboxes(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', (event, element) => { this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDoesExpireFasterOnceUnsealed + ' input', (event, element) => {
this.handleChangeNestedElementCellTable(event, element); this.handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element);
let doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element);
let row = DOM.getRowFromElement(element);
let inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input');
let divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed);
if (doesExpireFasterOnceUnsealed) {
inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed);
let tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td');
tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click'));
} else {
inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed);
}
}); });
} }
handleChangeCheckboxDoesExpireFasterOnceUnsealed(event, element) {
this.handleChangeNestedElementCellTable(event, element);
let doesExpireFasterOnceUnsealed = DOM.getElementValueCurrent(element);
let row = DOM.getRowFromElement(element);
let inputCountIntervalExpirationUnsealed = row.querySelector('td.' + flagCountUnitMeasurementIntervalExpirationUnsealed + ' input');
let divOrDdlIntervalExpirationUnsealed = row.querySelector('td.' + flagUnitMeasurementIntervalExpirationUnsealed + ' .' + flagUnitMeasurementIntervalExpirationUnsealed);
if (doesExpireFasterOnceUnsealed) {
inputCountIntervalExpirationUnsealed.classList.remove(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.remove(flagCollapsed);
let tdUnitMeasurementIntervalExpirationUnsealed = divOrDdlIntervalExpirationUnsealed.closest('td');
tdUnitMeasurementIntervalExpirationUnsealed.dispatchEvent(new Event('click'));
} else {
inputCountIntervalExpirationUnsealed.classList.add(flagCollapsed);
divOrDdlIntervalExpirationUnsealed.classList.add(flagCollapsed);
}
}
hookupIntervalExpirationUnsealedFields(){ hookupIntervalExpirationUnsealedFields(){
this.hookupTableCellDDlPreviewsWhenNotCollapsed(idTableMain + ' td.' + flagUnitMeasurementIntervalExpirationUnsealed, Utils.getListFromDict(unitMeasurementsTime)); this.hookupTableCellDDlPreviewsWhenNotCollapsed(idTableMain + ' td.' + flagUnitMeasurementIntervalExpirationUnsealed, Utils.getListFromDict(unitMeasurementsTime));
} }

View File

@@ -56,12 +56,12 @@
<!-- <!--
<input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" step="0.01" <input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" step="0.01"
--> -->
<div {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}> <div class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
0 0
</div> </div>
</td> </td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}"> <td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<div {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}> <div class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
0 0
</div> </div>
</td> </td>
@@ -111,7 +111,11 @@
{% include 'components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html' %} {% include 'components/store/_preview_DDL_product_permutation_unit_measurement_quantity.html' %}
</td> </td>
<td class="{{ model.FLAG_IS_SUBSCRIPTION }}"> <td class="{{ model.FLAG_IS_SUBSCRIPTION }}">
<input class="{{ model.FLAG_IS_SUBSCRIPTION }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.is_subscription | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.is_subscription | lower }}"> <input type="checkbox" {% if permutation.is_subscription %}checked{% endif %}
class="{{ model.FLAG_IS_SUBSCRIPTION }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ permutation.is_subscription | lower }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.is_subscription | lower }}"
/>
</td> </td>
<td class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}"> <td class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}">
{% set value = permutation.count_interval_recurrence if permutation.count_interval_recurrence is not none else 1 %} {% set value = permutation.count_interval_recurrence if permutation.count_interval_recurrence is not none else 1 %}
@@ -132,7 +136,11 @@
<input class="{{ model.FLAG_ID_STRIPE_PRODUCT }}" type="text" value="{{ value }}" {{ model.ATTR_VALUE_CURRENT }}="{{ value }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ value }}"> <input class="{{ model.FLAG_ID_STRIPE_PRODUCT }}" type="text" value="{{ value }}" {{ model.ATTR_VALUE_CURRENT }}="{{ value }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ value }}">
</td> </td>
<td class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}"> <td class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}">
<input class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.does_expire_faster_once_unsealed | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.does_expire_faster_once_unsealed | lower }}"> <input type="checkbox" {% if permutation.does_expire_faster_once_unsealed %}checked{% endif %}
class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ permutation.does_expire_faster_once_unsealed | lower }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.does_expire_faster_once_unsealed | lower }}"
/>
</td> </td>
<td class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}"> <td class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">
{% set value = permutation.count_interval_expiration_unsealed if permutation.count_interval_expiration_unsealed is not none else 1 %} {% set value = permutation.count_interval_expiration_unsealed if permutation.count_interval_expiration_unsealed is not none else 1 %}
@@ -149,10 +157,14 @@
{% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %} {% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %}
</td> </td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}"> <td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" type="number" min="0" value="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_excl }}"> <div class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_excl }}">
{{ permutation.cost_local_VAT_excl }}
</div>
</td> </td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}"> <td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}" type="number" min="0" value="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_incl }}"> <div class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_incl }}">
{{ permutation.cost_local_VAT_incl }}
</div>
</td> </td>
{% set currency = permutation.currency_cost %} {% set currency = permutation.currency_cost %}

View File

@@ -103,15 +103,17 @@ var flagUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_UNIT_MEASUREM
var flagUnitMeasurementIntervalRecurrence = "{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}"; var flagUnitMeasurementIntervalRecurrence = "{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
var flagUnitMeasurementLatencyManufacture = "{{ model.FLAG_UNIT_MEASUREMENT_LATENCY_MANUFACTURE }}"; var flagUnitMeasurementLatencyManufacture = "{{ model.FLAG_UNIT_MEASUREMENT_LATENCY_MANUFACTURE }}";
var flagUnitMeasurementQuantity = "{{ model.FLAG_UNIT_MEASUREMENT_QUANTITY }}"; var flagUnitMeasurementQuantity = "{{ model.FLAG_UNIT_MEASUREMENT_QUANTITY }}";
var hashGetStoreCustomerSalesOrder = "{{ model.HASH_GET_STORE_CUSTOMER_SALES_ORDER }}"; {#
var hashGetStoreManufacturingPurchaseOrder = "{{ model.HASH_GET_STORE_MANUFACTURING_PURCHASE_ORDER }}"; var hashGetStoreCustomerSalesOrder = "{{ model.HASH_GET_STORE_CUSTOMER_SALES_ORDER }}";
var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}"; var hashGetStoreManufacturingPurchaseOrder = "{{ model.HASH_GET_STORE_MANUFACTURING_PURCHASE_ORDER }}";
var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}"; var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}";
var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}"; var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}";
var hashGetStoreProductVariation = "{{ model.HASH_GET_STORE_PRODUCT_VARIATION }}"; var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}";
var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}"; var hashGetStoreProductVariation = "{{ model.HASH_GET_STORE_PRODUCT_VARIATION }}";
var hashGetStoreSupplier = "{{ model.HASH_GET_STORE_SUPPLIER }}"; var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}";
var hashGetStoreSupplierPurchaseOrder = "{{ model.HASH_GET_STORE_SUPPLIER_PURCHASE_ORDER }}"; var hashGetStoreSupplier = "{{ model.HASH_GET_STORE_SUPPLIER }}";
var hashGetStoreSupplierPurchaseOrder = "{{ model.HASH_GET_STORE_SUPPLIER_PURCHASE_ORDER }}";
#}
var hashSaveStoreCustomerSalesOrder = "{{ model.HASH_SAVE_STORE_CUSTOMER_SALES_ORDER }}"; var hashSaveStoreCustomerSalesOrder = "{{ model.HASH_SAVE_STORE_CUSTOMER_SALES_ORDER }}";
var hashSaveStoreManufacturingPurchaseOrder = "{{ model.HASH_SAVE_STORE_MANUFACTURING_PURCHASE_ORDER }}"; var hashSaveStoreManufacturingPurchaseOrder = "{{ model.HASH_SAVE_STORE_MANUFACTURING_PURCHASE_ORDER }}";
var hashSaveStoreProduct = "{{ model.HASH_SAVE_STORE_PRODUCT }}"; var hashSaveStoreProduct = "{{ model.HASH_SAVE_STORE_PRODUCT }}";

View File

@@ -273,64 +273,66 @@
<a class="{{ model.FLAG_NAV_CONTACT }}">Contact</a> <a class="{{ model.FLAG_NAV_CONTACT }}">Contact</a>
</div> </div>
{% if model.is_page_store and model.user.can_admin_store %} {#
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}"> {% if model.is_page_store and model.user.can_admin_store %}
<a class="{{ model.FLAG_NAV_STORE_PRODUCT_PERMUTATIONS }}">Product Permutations</a>
</div>
{% if model.user.can_admin_store %}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}"> <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<a class="{{ model.FLAG_NAV_STORE_STOCK_ITEMS }}">Stock Items</a> <a class="{{ model.FLAG_NAV_STORE_PRODUCT_PERMUTATIONS }}">Product Permutations</a>
</div> </div>
{% endif %} {% if model.user.can_admin_store %}
<!-- <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}"> <a class="{{ model.FLAG_NAV_STORE_STOCK_ITEMS }}">Stock Items</a>
<!-- <a href="{ url_ for('create_price_dummy') }">Create template price</a> --
<form id="{{ model.ID_FORM_IS_INCLUDED_VAT }}" class="{{ model.FLAG_CONTAINER }}" action="{ { url_ for('set_is_included_VAT') } }" method="POST">
{ { model.form_is_included_VAT.hidden_tag() }}
<div class="container-input">
{ { model.form_is_included_VAT.is_included.label }}
{ { model.form_is_included_VAT.is_included( checked = model.is_included_VAT ) }}
{ % for error in model.form_is_included_VAT.is_included.errors %}
<p class="error">{{ error }}</p>
{ % endfor %}
</div> </div>
</form> {% endif %}
</div> <!--
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<form id="{{ model.ID_FORM_DELIVERY_REGION }}" class="{{ model.FLAG_CONTAINER }}" action="{ { url_ for('set_delivery_region') } }" method="POST">
{ { model.form_delivery_region.hidden_tag() }}
<div class="container-input">
{ { model.form_delivery_region.id_region_delivery.label }}
{ { model.form_delivery_region.id_region_delivery() }}
{ % for error in model.form_delivery_region.id_region_delivery.errors %}
<p class="error">{{ error }}</p>
{ % endfor %}
</div>
</form>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<form id="{{ model.ID_FORM_CURRENCY }}" class="{{ model.FLAG_CONTAINER }}" action="{ { url_ for('set_currency') } }" method="POST">
{ { model.form_currency.hidden_tag() }}
<div class="container-input">
{ { model.form_currency.id_currency.label }}
{ { model.form_currency.id_currency() }}
{ % for error in model.form_currency.id_currency.errors %}
<p class="error">{{ error }}</p>
{ % endfor %}
</div>
</form>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<a href="{ { url_for('routes_user.logout') if model.is_user_logged_in else url_for('routes_user.login') }}" style="float:right">{{ 'Logout' if model.is_user_logged_in else 'Login' }}</a>
</div>
-->
{% else %}
{% if model.user.can_admin_store %}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}"> <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<a class="{{ model.FLAG_NAV_STORE_HOME }}">Shop</a> <!-- <a href="{ url_ for('create_price_dummy') }">Create template price</a> --
<form id="{{ model.ID_FORM_IS_INCLUDED_VAT }}" class="{{ model.FLAG_CONTAINER }}" action="{ { url_ for('set_is_included_VAT') } }" method="POST">
{ { model.form_is_included_VAT.hidden_tag() }}
<div class="container-input">
{ { model.form_is_included_VAT.is_included.label }}
{ { model.form_is_included_VAT.is_included( checked = model.is_included_VAT ) }}
{ % for error in model.form_is_included_VAT.is_included.errors %}
<p class="error">{{ error }}</p>
{ % endfor %}
</div>
</form>
</div> </div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<form id="{{ model.ID_FORM_DELIVERY_REGION }}" class="{{ model.FLAG_CONTAINER }}" action="{ { url_ for('set_delivery_region') } }" method="POST">
{ { model.form_delivery_region.hidden_tag() }}
<div class="container-input">
{ { model.form_delivery_region.id_region_delivery.label }}
{ { model.form_delivery_region.id_region_delivery() }}
{ % for error in model.form_delivery_region.id_region_delivery.errors %}
<p class="error">{{ error }}</p>
{ % endfor %}
</div>
</form>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<form id="{{ model.ID_FORM_CURRENCY }}" class="{{ model.FLAG_CONTAINER }}" action="{ { url_ for('set_currency') } }" method="POST">
{ { model.form_currency.hidden_tag() }}
<div class="container-input">
{ { model.form_currency.id_currency.label }}
{ { model.form_currency.id_currency() }}
{ % for error in model.form_currency.id_currency.errors %}
<p class="error">{{ error }}</p>
{ % endfor %}
</div>
</form>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<a href="{ { url_for('routes_user.logout') if model.is_user_logged_in else url_for('routes_user.login') }}" style="float:right">{{ 'Logout' if model.is_user_logged_in else 'Login' }}</a>
</div>
-->
{% else %}
{% if model.user.can_admin_store %}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<a class="{{ model.FLAG_NAV_STORE_HOME }}">Shop</a>
</div>
{% endif %}
{% endif %} {% endif %}
{% endif %} #}
{% if model.user.can_admin_store %} {% if model.user.can_admin_store %}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}"> <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<a class="{{ model.FLAG_NAV_ADMIN_HOME }}">Admin</a> <a class="{{ model.FLAG_NAV_ADMIN_HOME }}">Admin</a>