From 7fbc1cef341e2be2e6ccc7b840a24cd47f1a1267 Mon Sep 17 00:00:00 2001 From: teddy Date: Mon, 18 Nov 2024 18:46:50 +0000 Subject: [PATCH] Fix: Product Category, Product, and Product Permutation save and filter. --- app.log.1 | 148 ++--- app.log.2 | 176 +++-- app.log.3 | 176 +++-- .../store/__pycache__/product.cpython-312.pyc | Bin 29614 -> 29972 bytes business_objects/store/product.py | 11 +- .../product_permutation.cpython-312.pyc | Bin 5470 -> 5446 bytes controllers/store/product_permutation.py | 3 +- .../product_permutation.cpython-312.pyc | Bin 3855 -> 4256 bytes forms/store/product_permutation.py | 3 + static/MySQL/6500_p_shop_calc_user.sql | 629 ++++++++++-------- .../7200_p_shop_save_product_category.sql | 51 +- static/MySQL/7203_p_shop_save_product.sql | 130 ++-- .../7206_p_shop_save_product_permutation.sql | 40 +- .../pages/store/_product_permutations.html | 9 + 14 files changed, 781 insertions(+), 595 deletions(-) diff --git a/app.log.1 b/app.log.1 index 6569f8a3..5478ae66 100644 --- a/app.log.1 +++ b/app.log.1 @@ -1,110 +1,50 @@ -User.from_json -json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} -user: - id_user: 1 - id_user_auth0: auth0|6582b95c895d09a70ba10fef - firstname: Teddy - surname: Middleton-Smith - email: edward.middletonsmith@gmail.com - is_email_verified: False - is_super_user: True - id_currency_default: None - id_region_default: None - is_included_VAT_default: True - can_admin_store: True - can_admin_user: True - -argument_dict: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -executing p_get_many_user -DataStore_Base.db_procedure_execute -proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug) -args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -result: -data received -raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),) +raw units of measurement: ((1, 'metre', 'metres', 'm', b'\x01', b'\x01', b'\x01', b'\x00', b'\x00', b'\x00', b'\x01'), (2, 'millimetre', 'millimetres', 'mm', b'\x01', b'\x00', b'\x01', b'\x00', b'\x00', b'\x00', b'\x01'), (3, 'kilogram', 'kilograms', 'kg', b'\x01', b'\x01', b'\x00', b'\x01', b'\x00', b'\x00', b'\x01'), (4, 'gram', 'grams', 'g', b'\x01', b'\x00', b'\x00', b'\x01', b'\x00', b'\x00', b'\x01'), (5, 'litre', 'litres', 'L', b'\x01', b'\x00', b'\x00', b'\x00', b'\x00', b'\x01', b'\x01'), (6, 'millilitre', 'millilitres', 'mL', b'\x01', b'\x00', b'\x00', b'\x00', b'\x00', b'\x01', b'\x01'), (7, 'item', 'items', 'x', b'\x01', b'\x00', b'\x00', b'\x00', b'\x00', b'\x00', b'\x01'), (8, 'hour', 'hours', 'h', b'\x01', b'\x01', b'\x00', b'\x00', b'\x01', b'\x00', b'\x01'), (9, 'day', 'days', 'd', b'\x01', b'\x00', b'\x00', b'\x00', b'\x01', b'\x00', b'\x01')) raw errors: () +executing p_shop_get_many_currency +DataStore_Base.db_procedure_execute +proc_string: CALL p_shop_get_many_currency(:a_get_inactive_currency) +args: {'a_get_inactive_currency': 0} +result: +data received +currencies: [ + id: 1 + name: Great British Pound + code: GBP + symbol: £ + factor from GBP: 1.0 + display_order: 1 + active: True + , + id: 2 + name: Euro + code: EUR + symbol: € + factor from GBP: 1.17 + display_order: 2 + active: True + ] new result set: () -model_view_base init end - model.user: - id_user: 1 - id_user_auth0: auth0|6582b95c895d09a70ba10fef - firstname: Teddy - surname: Middleton-Smith - email: edward.middletonsmith@gmail.com - is_email_verified: False - is_super_user: True - id_currency_default: None - id_region_default: None - is_included_VAT_default: True - can_admin_store: True - can_admin_user: True - -argument_dict: {'active': 1} -executing p_shop_get_many_access_level -DataStore_Base.db_procedure_execute -proc_string: CALL p_shop_get_many_access_level(:active) -args: {'active': 1} -result: -data received -raw access levels: ((1, 'VIEW', 'View', 3, 1, b'\x01'), (2, 'EDIT', 'Edit', 2, 2, b'\x01'), (3, 'ADMIN', 'Admin', 1, 3, b'\x01')) -raw errors: () -DataStore_Base.get_user_session -User.from_json -json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} -user: - id_user: 1 - id_user_auth0: auth0|6582b95c895d09a70ba10fef - firstname: Teddy - surname: Middleton-Smith - email: edward.middletonsmith@gmail.com - is_email_verified: False - is_super_user: True - id_currency_default: None - id_region_default: None - is_included_VAT_default: True - can_admin_store: True - can_admin_user: True - -User.from_json -json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} -user: - id_user: 1 - id_user_auth0: auth0|6582b95c895d09a70ba10fef - firstname: Teddy - surname: Middleton-Smith - email: edward.middletonsmith@gmail.com - is_email_verified: False - is_super_user: True - id_currency_default: None - id_region_default: None - is_included_VAT_default: True - can_admin_store: True - can_admin_user: True - -argument_dict: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -executing p_get_many_user -DataStore_Base.db_procedure_execute -proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug) -args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -result: -data received -raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),) -raw errors: () -new result set: () -argument_dict: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} -executing p_shop_get_many_product -DataStore_Base.db_procedure_execute -proc_string: CALL p_shop_get_many_product(:a_id_user, :a_get_all_product_category, :a_get_inactive_product_category, :a_ids_product_category, :a_get_all_product, :a_get_inactive_product, :a_ids_product, :a_get_all_permutation, :a_get_inactive_permutation, :a_ids_permutation, :a_get_all_image, :a_get_inactive_image, :a_ids_image, :a_get_products_quantity_stock_below_min, :a_debug) -args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} -result: -data received -initial category_list: categories: [] -raw categories: () -category-loaded category_list: categories: [] -raw products: () -raw errors: () -new result set: () -get many category_list: categories: [] +{1: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 1, 'name_singular': 'metre', 'name_plural': 'metres', 'symbol': 'm', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': True, 'is_unit_of_distance': True, 'is_unit_of_mass': False, 'is_unit_of_time': False, 'is_unit_of_volume': False, 'active': True}, 2: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 2, 'name_singular': 'millimetre', 'name_plural': 'millimetres', 'symbol': 'mm', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': True, 'is_unit_of_mass': False, 'is_unit_of_time': False, 'is_unit_of_volume': False, 'active': True}, 3: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 3, 'name_singular': 'kilogram', 'name_plural': 'kilograms', 'symbol': 'kg', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': True, 'is_unit_of_distance': False, 'is_unit_of_mass': True, 'is_unit_of_time': False, 'is_unit_of_volume': False, 'active': True}, 4: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 4, 'name_singular': 'gram', 'name_plural': 'grams', 'symbol': 'g', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': False, 'is_unit_of_mass': True, 'is_unit_of_time': False, 'is_unit_of_volume': False, 'active': True}, 5: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 5, 'name_singular': 'litre', 'name_plural': 'litres', 'symbol': 'L', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': False, 'is_unit_of_volume': True, 'active': True}, 6: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 6, 'name_singular': 'millilitre', 'name_plural': 'millilitres', 'symbol': 'mL', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': False, 'is_unit_of_volume': True, 'active': True}, 7: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 7, 'name_singular': 'item', 'name_plural': 'items', 'symbol': 'x', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': False, 'is_unit_of_volume': False, 'active': True}, 8: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 8, 'name_singular': 'hour', 'name_plural': 'hours', 'symbol': 'h', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': True, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': True, 'is_unit_of_volume': False, 'active': True}, 9: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 9, 'name_singular': 'day', 'name_plural': 'days', 'symbol': 'd', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': True, 'is_unit_of_volume': False, 'active': True}} +{8: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 8, 'name_singular': 'hour', 'name_plural': 'hours', 'symbol': 'h', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': True, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': True, 'is_unit_of_volume': False, 'active': True}, 9: {'NAME_ATTR_OPTION_TEXT': 'name_singular', 'NAME_ATTR_OPTION_VALUE': 'id_unit_measurement', 'id_unit_measurement': 9, 'name_singular': 'day', 'name_plural': 'days', 'symbol': 'd', 'symbol_is_suffix_not_prefix': True, 'is_base_unit': False, 'is_unit_of_distance': False, 'is_unit_of_mass': False, 'is_unit_of_time': True, 'is_unit_of_volume': False, 'active': True}} Model_View_Store.__init__ starting session: DataStore_Base.get_user_session +User.from_json +json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} +user: + id_user: 1 + id_user_auth0: auth0|6582b95c895d09a70ba10fef + firstname: Teddy + surname: Middleton-Smith + email: edward.middletonsmith@gmail.com + is_email_verified: False + is_super_user: True + id_currency_default: None + id_region_default: None + is_included_VAT_default: True + can_admin_store: True + can_admin_user: True + +User.from_json +json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} diff --git a/app.log.2 b/app.log.2 index 90e7a1db..dde08f22 100644 --- a/app.log.2 +++ b/app.log.2 @@ -1,4 +1,123 @@ -session: +User.from_json +json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} +user: + id_user: 1 + id_user_auth0: auth0|6582b95c895d09a70ba10fef + firstname: Teddy + surname: Middleton-Smith + email: edward.middletonsmith@gmail.com + is_email_verified: False + is_super_user: True + id_currency_default: None + id_region_default: None + is_included_VAT_default: True + can_admin_store: True + can_admin_user: True + +argument_dict: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} +executing p_get_many_user +DataStore_Base.db_procedure_execute +proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug) +args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} +result: +data received +raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),) +raw errors: () +new result set: () +argument_dict: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} +executing p_shop_get_many_product +DataStore_Base.db_procedure_execute +proc_string: CALL p_shop_get_many_product(:a_id_user, :a_get_all_product_category, :a_get_inactive_product_category, :a_ids_product_category, :a_get_all_product, :a_get_inactive_product, :a_ids_product, :a_get_all_permutation, :a_get_inactive_permutation, :a_ids_permutation, :a_get_all_image, :a_get_inactive_image, :a_ids_image, :a_get_products_quantity_stock_below_min, :a_debug) +args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} +result: +data received +initial category_list: categories: [] +raw categories: ((4, 'CHOCOLATE', 'Chocolates and sweets', 'Confectionery', 1, 'View', 1, b'\x01', None, None, None),) +new_category: + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery + access_level: View + display_order: 1 + active: True + products: [] + +category-loaded category_list: categories: [ + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery + access_level: View + display_order: 1 + active: True + products: [] + ] +raw products: ((6, 4, 'Digestives', b'\x01', 1, 'View', b'\x01', 1, None, None, None),) +row: (6, 4, 'Digestives', b'\x01', 1, 'View', b'\x01', 1, None, None, None) +new_product: Product + id_product: 6 + id_category: 4 + name: Digestives + display_order: 1 + can_view: False + can_edit: False + can_admin: False + has_variations: True + permutations: [] + variation trees: [] + active: True + +raw errors: () +product with id:6 has variations +new result set: () +get many category_list: categories: [ + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery + access_level: View + display_order: 1 + active: True + products: [Product + id_product: 6 + id_category: 4 + name: Digestives + display_order: 1 + can_view: False + can_edit: False + can_admin: False + has_variations: True + permutations: [] + variation trees: [] + active: True + ] + ] +category filters: [ + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery + access_level: View + display_order: 1 + active: True + products: [Product + id_product: 6 + id_category: 4 + name: Digestives + display_order: 1 + can_view: False + can_edit: False + can_admin: False + has_variations: True + permutations: [] + variation trees: [] + active: True + ] + ] +category options: [('', ''), ('4', 'Chocolates and sweets')] +product options: [{'value': 6, 'text': 'Digestives', 'id_category': 4}] +DataStore_Store_Base.get_many_product_variation DataStore_Base.get_user_session User.from_json json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} @@ -37,47 +156,22 @@ executing p_get_many_user DataStore_Base.db_procedure_execute proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug) args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -result: +result: data received raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),) raw errors: () new result set: () -model_view_base init end - model.user: - id_user: 1 - id_user_auth0: auth0|6582b95c895d09a70ba10fef - firstname: Teddy - surname: Middleton-Smith - email: edward.middletonsmith@gmail.com - is_email_verified: False - is_super_user: True - id_currency_default: None - id_region_default: None - is_included_VAT_default: True - can_admin_store: True - can_admin_user: True - -config_env: development -categories -form_filters=Filters_Product_Category(is_not_empty=False, active=True) -Model_View_Store_Product_Category.__init__ -starting... -Model_View_Store.__init__ -starting -session: -DataStore_Base.get_user_session -User.from_json -json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} -user: - id_user: 1 - id_user_auth0: auth0|6582b95c895d09a70ba10fef - firstname: Teddy - surname: Middleton-Smith - email: edward.middletonsmith@gmail.com - is_email_verified: False - is_super_user: True - id_currency_default: None - id_region_default: None - is_included_VAT_default: True - can_admin_store: True - can_admin_user: True - +DataStore_Base.db_procedure_execute +proc_string: CALL p_shop_get_many_product_variation(:a_id_user, :a_get_all_variation_type, :a_get_inactive_variation_type, :a_ids_variation_type, :a_get_all_variation, :a_get_inactive_variation, :a_ids_variation, :a_debug) +args: {'a_id_user': 1, 'a_get_all_variation_type': True, 'a_get_inactive_variation_type': False, 'a_ids_variation_type': '', 'a_get_all_variation': True, 'a_get_inactive_variation': False, 'a_ids_variation': '', 'a_debug': 0} +result: +index_variation_type: {1: 0, 2: 1} +raw errors: () +new result set: () +argument_dict: {'active': True} +executing p_shop_get_many_unit_measurement +DataStore_Base.db_procedure_execute +proc_string: CALL p_shop_get_many_unit_measurement(:active) +args: {'active': True} +result: +data received diff --git a/app.log.3 b/app.log.3 index d9b10a64..aa268209 100644 --- a/app.log.3 +++ b/app.log.3 @@ -1,3 +1,17 @@ +user: + id_user: 1 + id_user_auth0: auth0|6582b95c895d09a70ba10fef + firstname: Teddy + surname: Middleton-Smith + email: edward.middletonsmith@gmail.com + is_email_verified: False + is_super_user: True + id_currency_default: None + id_region_default: None + is_included_VAT_default: True + can_admin_store: True + can_admin_user: True + User.from_json json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} user: @@ -19,7 +33,7 @@ executing p_get_many_user DataStore_Base.db_procedure_execute proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug) args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -result: +result: data received raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),) raw errors: () @@ -38,15 +52,11 @@ model_view_base init end - model.user: can_admin_store: True can_admin_user: True -argument_dict: {'active': 1} -executing p_shop_get_many_access_level -DataStore_Base.db_procedure_execute -proc_string: CALL p_shop_get_many_access_level(:active) -args: {'active': 1} -result: -data received -raw access levels: ((1, 'VIEW', 'View', 3, 1, b'\x01'), (2, 'EDIT', 'Edit', 2, 2, b'\x01'), (3, 'ADMIN', 'Admin', 1, 3, b'\x01')) -raw errors: () +form question: +bool interpretted: False +form question: +get_inactive:False +type form: DataStore_Base.get_user_session User.from_json json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} @@ -85,108 +95,94 @@ executing p_get_many_user DataStore_Base.db_procedure_execute proc_string: CALL p_get_many_user(:a_id_user, :a_id_user_auth0, :get_all_user, :get_inactive_user, :ids_user, :ids_user_auth0, :a_debug) args: {'a_id_user': 1, 'a_id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'get_all_user': False, 'get_inactive_user': False, 'ids_user': 1, 'ids_user_auth0': '', 'a_debug': 0} -result: +result: data received raw users: ((1, 'auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', b'\x00', None, None, b'\x01', b'\x01', b'\x01', b'\x01', b'\x00'),) raw errors: () new result set: () -argument_dict: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': True, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} +argument_dict: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} executing p_shop_get_many_product DataStore_Base.db_procedure_execute proc_string: CALL p_shop_get_many_product(:a_id_user, :a_get_all_product_category, :a_get_inactive_product_category, :a_ids_product_category, :a_get_all_product, :a_get_inactive_product, :a_ids_product, :a_get_all_permutation, :a_get_inactive_permutation, :a_ids_permutation, :a_get_all_image, :a_get_inactive_image, :a_ids_image, :a_get_products_quantity_stock_below_min, :a_debug) -args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': True, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} -result: +args: {'a_id_user': 1, 'a_get_all_product_category': True, 'a_get_inactive_product_category': False, 'a_ids_product_category': '', 'a_get_all_product': True, 'a_get_inactive_product': False, 'a_ids_product': '', 'a_get_all_permutation': True, 'a_get_inactive_permutation': False, 'a_ids_permutation': '', 'a_get_all_image': False, 'a_get_inactive_image': False, 'a_ids_image': '', 'a_get_products_quantity_stock_below_min': False, 'a_debug': 0} +result: data received initial category_list: categories: [] -raw categories: ((1, 'ASS', 'Assistive Devices', 'Braille product line and other assistive devices', 1, 'View', 1, b'\x00', None, None, None), (3, 'TECH', 'Technology', 'Technological devices', 1, 'View', 2, b'\x00', None, None, None), (2, 'MISC', 'Miscellaneous', 'Not category allocated products', 1, 'View', 99, b'\x00', None, None, None)) +raw categories: ((4, 'CHOCOLATE', 'Chocolates and sweets', 'Confectionery', 1, 'View', 1, b'\x01', None, None, None),) new_category: - id: 1 - code: ASS - name: Assistive Devices - description: Braille product line and other assistive devices + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery access_level: View display_order: 1 - active: False - products: [] - -new_category: - id: 3 - code: TECH - name: Technology - description: Technological devices - access_level: View - display_order: 2 - active: False - products: [] - -new_category: - id: 2 - code: MISC - name: Miscellaneous - description: Not category allocated products - access_level: View - display_order: 99 - active: False + active: True products: [] category-loaded category_list: categories: [ - id: 1 - code: ASS - name: Assistive Devices - description: Braille product line and other assistive devices + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery access_level: View display_order: 1 - active: False - products: [] - , - id: 3 - code: TECH - name: Technology - description: Technological devices - access_level: View - display_order: 2 - active: False - products: [] - , - id: 2 - code: MISC - name: Miscellaneous - description: Not category allocated products - access_level: View - display_order: 99 - active: False + active: True products: [] ] -raw products: () +raw products: ((6, 4, 'Digestives', b'\x01', 1, 'View', b'\x01', 1, None, None, None),) +row: (6, 4, 'Digestives', b'\x01', 1, 'View', b'\x01', 1, None, None, None) +new_product: Product + id_product: 6 + id_category: 4 + name: Digestives + display_order: 1 + can_view: False + can_edit: False + can_admin: False + has_variations: True + permutations: [] + variation trees: [] + active: True + raw errors: () +product with id:6 has variations new result set: () get many category_list: categories: [ - id: 1 - code: ASS - name: Assistive Devices - description: Braille product line and other assistive devices + id: 4 + code: CHOCOLATE + name: Chocolates and sweets + description: Confectionery access_level: View display_order: 1 - active: False - products: [] - , - id: 3 - code: TECH - name: Technology - description: Technological devices - access_level: View - display_order: 2 - active: False - products: [] - , - id: 2 - code: MISC - name: Miscellaneous - description: Not category allocated products - access_level: View - display_order: 99 - active: False - products: [] + active: True + products: [Product + id_product: 6 + id_category: 4 + name: Digestives + display_order: 1 + can_view: False + can_edit: False + can_admin: False + has_variations: True + permutations: [] + variation trees: [] + active: True ] -Model_View_Store.__init__ -starting + ] +DataStore_Base.get_user_session +User.from_json +json: {'can_admin_store': True, 'can_admin_user': True, 'email': 'edward.middletonsmith@gmail.com', 'firstname': 'Teddy', 'id_currency_default': None, 'id_region_default': None, 'id_user': 1, 'id_user_auth0': 'auth0|6582b95c895d09a70ba10fef', 'is_email_verified': False, 'is_included_VAT_default': True, 'is_super_user': True, 'surname': 'Middleton-Smith'} +user: + id_user: 1 + id_user_auth0: auth0|6582b95c895d09a70ba10fef + firstname: Teddy + surname: Middleton-Smith + email: edward.middletonsmith@gmail.com + is_email_verified: False + is_super_user: True + id_currency_default: None + id_region_default: None + is_included_VAT_default: True + can_admin_store: True + can_admin_user: True + diff --git a/business_objects/store/__pycache__/product.cpython-312.pyc b/business_objects/store/__pycache__/product.cpython-312.pyc index 6d5ec76711293a79af28bcd6bf638f44bc37a33f..45216788d8335f2c1f29aaea4841ce4f35bee99f 100644 GIT binary patch delta 769 zcmYjLOH30{6n&p*DZ`YH1!DunvLM(>z(y9O0-*uis7ODw{Om_s+EG3_9R->i;z|=2 zgj|gw#JErs4Jw*(VIn53+_12&Bn=DV!r#J_K!OWne2=Q}PIAt<=broKKK+bue#6E! zqftbxZe2T;`1#z}=fPt`rJw-I=%_QM;0mA2+fV%U=cCo&@Z3<>J_sGGV=VDV|d0sY#bLT`DHxYFM6(j;iwI zxGOD*>g#OGg2tKS?T1ei$gbuBJMf4;-@Qq4(~X8WMI=Nh|P1R zWHc2XjjC~I4!RHKr2qez(y^eGm(s*kt{xm-Gb{#A5Jccp@P*?n*+!^wlw=KuHmWUm z+ZWp(R<2Y(s{UYWeQ#@h>CE=bu|SQR`Xkaq)ggt9#!J;OUM4RNxDd7?N%H_GbP z4|il6I@TMVn{A!o@YTVQ!6MuY&cOzJ6e5GG*sNKGRta`#xsfEs6uLsQcvyQKGGIIo zZ^J>XgWAZevU;7kO_6?Io-mc~)xJbZ1$^$_Zj9n_?MEU&aYj3R-cRri?fyg*;}K0i Wl@==4_!Q2X9Xn`GY2ZQL)JfLPR&84$ffY;00*~g2{M=ZEPt0Yw&s#mS~{qyU*9vW9sL z=W3{3!3>&Qenm`^rNbqeix?Rv7lvzj@^F<@7Njbqn7uhJGmM$B sdh^zt5GKa1&0P73jEvEna|)_h1e2K=eHkxE8h&8_vp#rD{$3&r0EPpEr~m)} diff --git a/business_objects/store/product.py b/business_objects/store/product.py index 03d2c9e2..4888216d 100644 --- a/business_objects/store/product.py +++ b/business_objects/store/product.py @@ -500,19 +500,20 @@ class Parameters_Product(Get_Many_Parameters_Base): # av.val_instance(form, 'form', 'Parameters_Product.from_form', Filters_Product_Permutation) has_category_filter = not (form.id_category.data == '0' or form.id_category.data == '' or form.id_category.data is None) has_product_filter = not (form.id_product.data == '0' or form.id_product.data == '' or form.id_product.data is None) - get_permutations_stock_below_min = av.input_bool(form.is_out_of_stock.data, "is_out_of_stock", "Parameters_Product.from_form") - Helper_App.console_log(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\ntype form: {type(form)}') + get_permutations_stock_below_min = av.input_bool(form.is_out_of_stock.data, "is_out_of_stock", "Parameters_Product.from_form_filters_product_permutation") + get_inactive = not av.input_bool(form.active.data, "active", "Parameters_Product.from_form_filters_product_permutation") + Helper_App.console_log(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\nform question: {type(form.active)}\nget_inactive:{get_inactive}\ntype form: {type(form)}') return Parameters_Product( get_all_product_category = not has_category_filter, - get_inactive_product_category = False, + get_inactive_product_category = get_inactive, # get_first_product_category_only = False, ids_product_category = form.id_category.data if form.id_category.data is not None else '', get_all_product = not has_product_filter, - get_inactive_product = False, + get_inactive_product = get_inactive, # get_first_product_only = False, ids_product = form.id_product.data if form.id_product.data is not None else '', get_all_permutation = not get_permutations_stock_below_min, - get_inactive_permutation = False, + get_inactive_permutation = get_inactive, # get_first_permutation_only = False, ids_permutation = '', get_all_image = False, diff --git a/controllers/store/__pycache__/product_permutation.cpython-312.pyc b/controllers/store/__pycache__/product_permutation.cpython-312.pyc index 946c74fcbe346cc1ceed52121048c7b386a18441..09bc7ab512ca4bfc7c3340c889a489a6b8c47e78 100644 GIT binary patch delta 182 zcmcbobxe!zG%qg~0}#Y@Tc?KzZ{+*K!q_pHo7F&^1tbarS!@s*LT*lBJ;KOc#0%uz zVo5AYFP?1A{*iI%WJ3;7PN9CAPMZdo4=j_zIQqqwi#qWz9OB`0W@J7js^nzDe8`5? znQ`-Pjt17r8tgKgyZ8bbSzUqV7;k>SU&q4eIyqiMiZOa}mBlwoZdL^wg60qSV6D)Z&u(l*E$6B3_`H$%^bB)z$zR4Gd3M_^z`^U1X7(VRwZ^>khZ* zb#Aqb+-gh8FLUcRxO`xmY{=0swn5ZMl;Mylr!yDxAvq;yR_4R3tj=7UuW>Z6vKFZV z&Dos67tP4(0%RF&KEYqdA_HQsWcUmu8H#j(#4iq;-29Z%oK(A_sL4qpQ-pXKLl{3Z XGcdU@eP9ByKPXJ*5Vc~71gZr91+6{2 diff --git a/controllers/store/product_permutation.py b/controllers/store/product_permutation.py index 66fbed19..65448ba1 100644 --- a/controllers/store/product_permutation.py +++ b/controllers/store/product_permutation.py @@ -33,7 +33,8 @@ routes_store_product_permutation = Blueprint('routes_store_product_permutation', @routes_store_product_permutation.route(Model_View_Store_Product_Permutation.HASH_PAGE_STORE_PRODUCT_PERMUTATIONS, methods=['GET']) def permutations(): Helper_App.console_log('permutations') - data = Helper_App.get_request_data(request) + data = request.args + # Helper_App.console_log(f'data={data}\nrequest.args={request.args}\nrequest.form={request.form}\nrequest.data={request.data}\nrequest.values={request.values}\nrequest.headers={request.headers}') try: form_filters = Filters_Product_Permutation.from_json(data) except Exception as e: diff --git a/forms/store/__pycache__/product_permutation.cpython-312.pyc b/forms/store/__pycache__/product_permutation.cpython-312.pyc index a03cfe0f545e66bf9eb4329887f32ad6beb09425..14d4c745e15f96c75f9b5965bc711082e3fb964a 100644 GIT binary patch delta 681 zcmZ8e&ubGw6rN2syV;$Yq}4P{^Q+OeCabkpQHrLq1lxpQTM(mYpw^@t)Q~o?X$whn z@K8`sfj&WtNDE$+^kC7yK)s2OU?CE`dXXMlf*@XWHvMt%G4GrA&HLu#4O8~6AETcs zl@SZ^QSjdOCjD*T-h*JwPKc_gnm441L2n|IkPIj-t8#_g=eWi3Atw@2$udgNv_+-M zsIn(R32VWkSfOIfcaZSR{DZ}`FE^JhjKmdAb2ANi_#RAIVPx5Kb8wa4=1V9;V3Suw z@g=>E6f=ZOWv{c}C;R@3WXmyB?CytMlM8;D&T%4mgtMZs*MSM)i*SZH=bwR39Pe;^ zbGX;=Dy};MHAkS@sq7%`BxJ?G6IOE@*+FKBG?^OB?7v#Ck-)Mw-Kg>12hnbT^U^8! zA$3AS^1@Te4}YZ;cx1x);I3rnONPwx71;wx`6zb;7UUwqk@0YJI(#J_yEz6Nw!34K zS}!wgw6_}9ZiFY}vH0!jiSRA04_vsL^Ft6{5H2!JJ^_n(`_gxpXDzfEdTrat)CWdu zY$;=(iuLGJEjm?ArR%A=T57JE%vE!R>U8m|Yw0mx#!v8;*#S$$2_@o{6y`Rmv}uFz ziVR137}JOj`XpMP4gm%YJd;i4^Rwys`#Dt`Vkd8qreD?kI@k|D|GRtvd~^iUuIB@9 zd$;J&!wB4=t}e+$c5Fy!-!;f4Thn+@X$q{+CGIp>EH9iv-RIEuk9l}Dr!HjEm$e9d Rw1lhy&bF@nLTqb^{sDkKrpEvP delta 437 zcmX|(O-lk%6o&7NdgtTb>sXqQgnekH5M_acV1>}4MMPAK5L%ccwNQkaTvV&Vy}`ki zL~dG$tB7_%>!@GQZ;+ahAj(B|EIn|abIyC;^EM`{LH5j;ig;B!^iaKJU!u?e>?kA^ zU1|yT2SOQDM0rJ*2Rl)au2fKl=9#WmQ0vczGVT)+qwwf3Vcj`J2$voFb>0w^oo#$Y zc2G=$nyU&~9E5$mC}6n63-E+r@EkXq7f_crpew~AO!80*Neb=Q**VeXe_`Hxu?_KV zTlR~vMHt+xUa({d-qi!B5wGBZCOL%!^+KGEIMaJZ7_xL+h`>2b;3b}5PQU|g!w(BU zmj#t5mo{UXF%KbkDoy!jglvRu%y7JtTp??k#r*M6NjDN)X(GeEG9otoeT?zJEW(X@ z6)bmPRCZBo7~!E0QE~Y?j{amsA*7uNvv94|14;XK5cMsmiY2{V$gdb{u v_id_type_error_no_permission + ; + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + VALUES ( + v_id_type_error_no_permission + , v_code_type_error_no_permission + , 'You do not have permission to edit Product Catogories.' + ) + ; + END IF; - CALL p_shop_clear_calc_user( + CALL partsltd_prod.p_shop_clear_calc_user( a_guid , 0 -- a_debug ); diff --git a/static/MySQL/7203_p_shop_save_product.sql b/static/MySQL/7203_p_shop_save_product.sql index b26f0f74..01ff95c7 100644 --- a/static/MySQL/7203_p_shop_save_product.sql +++ b/static/MySQL/7203_p_shop_save_product.sql @@ -216,60 +216,90 @@ BEGIN -- Permissions - IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN - SET v_ids_product_permission := (SELECT GROUP_CONCAT(id_product SEPARATOR ',') FROM tmp_Product WHERE is_new = 0); - IF NOT ISNULL(v_ids_product_permission) THEN - SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1); - - CALL partsltd_prod.p_shop_calc_user( - a_guid - , a_id_user - , FALSE -- get_inactive_users - , v_id_permission_product - , v_id_access_level_edit - , v_ids_product_permission - , 0 -- debug - ); - - UPDATE tmp_Product t_P - INNER JOIN Shop_Calc_User_Temp UE_T - ON t_P.id_product = UE_T.id_product - AND UE_T.GUID = a_guid - SET - t_P.can_view = UE_T.can_view - , t_P.can_edit = UE_T.can_edit - , t_P.can_admin = UE_T.can_admin - ; - - CALL partsltd_prod.p_shop_clear_calc_user( - a_guid - , 0 -- debug - ); - END IF; + SET v_ids_product_permission := (SELECT GROUP_CONCAT(id_product SEPARATOR ',') FROM tmp_Product WHERE is_new = 0); + + SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1); + + CALL partsltd_prod.p_shop_calc_user( + a_guid + , a_id_user + , FALSE -- get_inactive_users + , v_id_permission_product + , v_id_access_level_edit + , v_ids_product_permission + , 0 -- debug + ); + + UPDATE tmp_Product t_P + INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T + ON t_P.id_product = UE_T.id_product + AND UE_T.GUID = a_guid + SET + t_P.can_view = UE_T.can_view + , t_P.can_edit = UE_T.can_edit + , t_P.can_admin = UE_T.can_admin + ; + + IF EXISTS (SELECT * FROM tmp_Product WHERE IFNULL(can_edit, 0) = 0 AND is_new = 0 LIMIT 1) THEN + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + SELECT + v_id_type_error_no_permission + , v_code_type_error_no_permission + , CONCAT('You do not have permission to edit the following Product(s): ', IFNULL(GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', '), 'NULL')) + FROM tmp_Product t_P + WHERE + IFNULL(can_edit, 0) = 0 + AND is_new = 0 + ; END IF; + IF EXISTS (SELECT * FROM partsltd_prod.Shop_Calc_User_Temp WHERE ISNULL(id_product) AND GUID = a_guid AND can_edit = 0) THEN + DELETE t_ME + FROM tmp_Msg_Error t_ME + WHERE t_ME.id_type <> v_id_type_error_no_permission + ; + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + VALUES ( + v_id_type_error_no_permission + , v_code_type_error_no_permission + , 'You do not have permission to edit Products' + ) + ; + END IF; + + CALL partsltd_prod.p_shop_clear_calc_user( + a_guid + , 0 -- debug + ); IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN START TRANSACTION; - IF NOT ISNULL(v_ids_product_permission) THEN - INSERT INTO partsltd_prod.Shop_Product_Change_Set ( comment ) - VALUES ( a_comment ) - ; - - SET v_id_change_set := LAST_INSERT_ID(); - - UPDATE partsltd_prod.Shop_Product P - INNER JOIN tmp_Product t_P ON P.id_product = t_P.id_product - SET - P.id_category = t_P.id_category - , P.name = t_P.name - , P.has_variations = t_P.has_variations - , P.id_access_level_required = t_P.id_access_level_required - , P.display_order = t_P.display_order - , P.active = t_P.active - , P.id_change_set = v_id_change_set - ; - END IF; + + INSERT INTO partsltd_prod.Shop_Product_Change_Set ( comment ) + VALUES ( a_comment ) + ; + + SET v_id_change_set := LAST_INSERT_ID(); + + UPDATE partsltd_prod.Shop_Product P + INNER JOIN tmp_Product t_P ON P.id_product = t_P.id_product + SET + P.id_category = t_P.id_category + , P.name = t_P.name + , P.has_variations = t_P.has_variations + , P.id_access_level_required = t_P.id_access_level_required + , P.display_order = t_P.display_order + , P.active = t_P.active + , P.id_change_set = v_id_change_set + ; INSERT INTO partsltd_prod.Shop_Product ( id_category @@ -297,7 +327,7 @@ BEGIN START TRANSACTION; - DELETE FROM partsltd_prod.Shop_Product_Category_Temp + DELETE FROM partsltd_prod.Shop_Product_Temp WHERE GUID = a_guid; COMMIT; diff --git a/static/MySQL/7206_p_shop_save_product_permutation.sql b/static/MySQL/7206_p_shop_save_product_permutation.sql index ea78182b..aa61e81c 100644 --- a/static/MySQL/7206_p_shop_save_product_permutation.sql +++ b/static/MySQL/7206_p_shop_save_product_permutation.sql @@ -440,11 +440,6 @@ BEGIN LEFT JOIN Shop_Product P ON t_PP.id_product = P.id_product ; END IF; - - CALL p_shop_clear_calc_user( - a_guid - , 0 -- a_debug - ); IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.can_edit) LIMIT 1) THEN INSERT INTO tmp_Msg_Error ( @@ -461,13 +456,36 @@ BEGIN ISNULL(t_P.can_edit) ; END IF; + + IF EXISTS (SELECT * FROM partsltd_prod.Shop_User_Eval_Temp WHERE ISNULL(id_product) AND GUID = a_guid AND can_edit = 0) THEN + DELETE FROM tmp_Msg_Error + WHERE id_type <> v_id_type_error_no_permission + ; - IF a_debug = 1 THEN - SELECT * - FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp - WHERE GUID = a_guid - ; - END IF; + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + VALUES ( + v_id_type_error_bad_data + , v_code_type_error_bad_data + , 'You do not have permission to edit Product Permutations' + ) + ; + END IF; + + CALL p_shop_clear_calc_user( + a_guid + , 0 -- a_debug + ); + + 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 START TRANSACTION; diff --git a/templates/pages/store/_product_permutations.html b/templates/pages/store/_product_permutations.html index 493154bc..07eef05c 100644 --- a/templates/pages/store/_product_permutations.html +++ b/templates/pages/store/_product_permutations.html @@ -40,6 +40,15 @@ {% endfor %} +
+
+ {{ model.form_filters.active.label }} + {{ model.form_filters.active() }} + {% for error in model.form_filters.active.errors %} +

{{ error }}

+ {% endfor %} +
+
{{ model.form_filters.quantity_min.label }}