Fix: Product Category, Product, and Product Permutation save and filter.

This commit is contained in:
2024-11-18 18:46:50 +00:00
parent fd4dae0f8f
commit 7fbc1cef34
14 changed files with 781 additions and 595 deletions

148
app.log.1
View File

@@ -1,110 +1,50 @@
User.from_json 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'))
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: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A270>
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: () 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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B689D1550>
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: () new result set: ()
model_view_base init end - model.user: {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}}
id_user: 1 {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}}
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: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A270>
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: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A200>
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: <sqlalchemy.engine.cursor.CursorResult object at 0x000001721A32A200>
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: []
Model_View_Store.__init__ Model_View_Store.__init__
starting starting
session: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'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'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5BAtEkhXCy_eMEOnKY0y9mlYs-koIhF-dT2WA_c_K8reOq1NjIZBjJLAJ88xr7AVd5jsEMsPr-aEIW7wHcUOeawa3Kfnh9NfNMZaHoBjFAv6g4aP3y9bkbMpK.3-McrmK7ITgjpNPlJefLNQ', 'expires_at': 1731923381, 'expires_in': 86400, 'id_token': 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVveXZURk44bjJvZHg1VkFLMFh1RyJ9.eyJuaWNrbmFtZSI6ImVkd2FyZC5taWRkbGV0b25zbWl0aCIsIm5hbWUiOiJlZHdhcmQubWlkZGxldG9uc21pdGhAZ21haWwuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyLzUzZDNmMjQ0MDdkNTI1N2Y4NGYyN2NhMDc4NzRiZDY0P3M9NDgwJnI9cGcmZD1odHRwcyUzQSUyRiUyRmNkbi5hdXRoMC5jb20lMkZhdmF0YXJzJTJGZWQucG5nIiwidXBkYXRlZF9hdCI6IjIwMjQtMTEtMTdUMDk6NDk6NDEuNzIyWiIsImVtYWlsIjoiZWR3YXJkLm1pZGRsZXRvbnNtaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIiwiYXVkIjoiZ0dqeXRxTk1XQ2hTaXhxTzcyUlF6VkhXQWFlSkp6UmkiLCJpYXQiOjE3MzE4MzY5ODIsImV4cCI6MTczMTg3Mjk4Miwic3ViIjoiYXV0aDB8NjU4MmI5NWM4OTVkMDlhNzBiYTEwZmVmIiwic2lkIjoiTXBlbFE4cEtSOWhOOVg0bUlsZkJxM1JaR3p4WExBeGkiLCJub25jZSI6ImxJUVNIS1lzZW9sMjVhN3NFTFBPIn0.oB687ksKRtGbZQYXO4GS5GskJq0SmKofO-BaQftxowZmqIYMwzFumG8mVfm4l7-YI19tc8ik7jXiNGgAI3XpXQH5Ieud8h_TGsh3jNfmVIp4zjxO45Y39kaNHZQgnU2N6ckKD1W0pONirwKLD2Drdj9zVvdcYywQHPmhPHXoz06P8k4UvkdjST_AGgt-RAfpT-j5Nnbh3vqadv95ZGzJPHy3_q0lFS1PRUksYG9YGIMSrSpevC_sVgD3Qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}> session: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'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'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5BAtEkhXCy_eMEOnKY0y9mlYs-koIhF-dT2WA_c_K8reOq1NjIZBjJLAJ88xr7AVd5jsEMsPr-aEIW7wHcUOeawa3Kfnh9NfNMZaHoBjFAv6g4aP3y9bkbMpK.3-McrmK7ITgjpNPlJefLNQ', 'expires_at': 1731923381, 'expires_in': 86400, 'id_token': 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVveXZURk44bjJvZHg1VkFLMFh1RyJ9.eyJuaWNrbmFtZSI6ImVkd2FyZC5taWRkbGV0b25zbWl0aCIsIm5hbWUiOiJlZHdhcmQubWlkZGxldG9uc21pdGhAZ21haWwuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyLzUzZDNmMjQ0MDdkNTI1N2Y4NGYyN2NhMDc4NzRiZDY0P3M9NDgwJnI9cGcmZD1odHRwcyUzQSUyRiUyRmNkbi5hdXRoMC5jb20lMkZhdmF0YXJzJTJGZWQucG5nIiwidXBkYXRlZF9hdCI6IjIwMjQtMTEtMTdUMDk6NDk6NDEuNzIyWiIsImVtYWlsIjoiZWR3YXJkLm1pZGRsZXRvbnNtaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIiwiYXVkIjoiZ0dqeXRxTk1XQ2hTaXhxTzcyUlF6VkhXQWFlSkp6UmkiLCJpYXQiOjE3MzE4MzY5ODIsImV4cCI6MTczMTg3Mjk4Miwic3ViIjoiYXV0aDB8NjU4MmI5NWM4OTVkMDlhNzBiYTEwZmVmIiwic2lkIjoiTXBlbFE4cEtSOWhOOVg0bUlsZkJxM1JaR3p4WExBeGkiLCJub25jZSI6ImxJUVNIS1lzZW9sMjVhN3NFTFBPIn0.oB687ksKRtGbZQYXO4GS5GskJq0SmKofO-BaQftxowZmqIYMwzFumG8mVfm4l7-YI19tc8ik7jXiNGgAI3XpXQH5Ieud8h_TGsh3jNfmVIp4zjxO45Y39kaNHZQgnU2N6ckKD1W0pONirwKLD2Drdj9zVvdcYywQHPmhPHXoz06P8k4UvkdjST_AGgt-RAfpT-j5Nnbh3vqadv95ZGzJPHy3_q0lFS1PRUksYG9YGIMSrSpevC_sVgD3Qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}>
DataStore_Base.get_user_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'}

176
app.log.2
View File

@@ -1,4 +1,123 @@
session: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'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'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5BAtEkhXCy_eMEOnKY0y9mlYs-koIhF-dT2WA_c_K8reOq1NjIZBjJLAJ88xr7AVd5jsEMsPr-aEIW7wHcUOeawa3Kfnh9NfNMZaHoBjFAv6g4aP3y9bkbMpK.3-McrmK7ITgjpNPlJefLNQ', 'expires_at': 1731923381, 'expires_in': 86400, 'id_token': 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVveXZURk44bjJvZHg1VkFLMFh1RyJ9.eyJuaWNrbmFtZSI6ImVkd2FyZC5taWRkbGV0b25zbWl0aCIsIm5hbWUiOiJlZHdhcmQubWlkZGxldG9uc21pdGhAZ21haWwuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyLzUzZDNmMjQ0MDdkNTI1N2Y4NGYyN2NhMDc4NzRiZDY0P3M9NDgwJnI9cGcmZD1odHRwcyUzQSUyRiUyRmNkbi5hdXRoMC5jb20lMkZhdmF0YXJzJTJGZWQucG5nIiwidXBkYXRlZF9hdCI6IjIwMjQtMTEtMTdUMDk6NDk6NDEuNzIyWiIsImVtYWlsIjoiZWR3YXJkLm1pZGRsZXRvbnNtaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIiwiYXVkIjoiZ0dqeXRxTk1XQ2hTaXhxTzcyUlF6VkhXQWFlSkp6UmkiLCJpYXQiOjE3MzE4MzY5ODIsImV4cCI6MTczMTg3Mjk4Miwic3ViIjoiYXV0aDB8NjU4MmI5NWM4OTVkMDlhNzBiYTEwZmVmIiwic2lkIjoiTXBlbFE4cEtSOWhOOVg0bUlsZkJxM1JaR3p4WExBeGkiLCJub25jZSI6ImxJUVNIS1lzZW9sMjVhN3NFTFBPIn0.oB687ksKRtGbZQYXO4GS5GskJq0SmKofO-BaQftxowZmqIYMwzFumG8mVfm4l7-YI19tc8ik7jXiNGgAI3XpXQH5Ieud8h_TGsh3jNfmVIp4zjxO45Y39kaNHZQgnU2N6ckKD1W0pONirwKLD2Drdj9zVvdcYywQHPmhPHXoz06P8k4UvkdjST_AGgt-RAfpT-j5Nnbh3vqadv95ZGzJPHy3_q0lFS1PRUksYG9YGIMSrSpevC_sVgD3Qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}> 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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897A660>
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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897A660>
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 DataStore_Base.get_user_session
User.from_json 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'} 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 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) 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} 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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF3919B0> result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897A900>
data received 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 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: () raw errors: ()
new result set: () new result set: ()
model_view_base init end - model.user: DataStore_Base.db_procedure_execute
id_user: 1 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)
id_user_auth0: auth0|6582b95c895d09a70ba10fef 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}
firstname: Teddy result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897A900>
surname: Middleton-Smith index_variation_type: {1: 0, 2: 1}
email: edward.middletonsmith@gmail.com raw errors: ()
is_email_verified: False new result set: ()
is_super_user: True argument_dict: {'active': True}
id_currency_default: None executing p_shop_get_many_unit_measurement
id_region_default: None DataStore_Base.db_procedure_execute
is_included_VAT_default: True proc_string: CALL p_shop_get_many_unit_measurement(:active)
can_admin_store: True args: {'active': True}
can_admin_user: True result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B689D1710>
data received
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: <SecureCookieSession {'_permanent': True, 'authorisedUser': {'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'}, 'csrf_token': '62a72bf881c6405d538a3e29f81249c4b05b8139', 'user': {'access_token': 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIn0..U5ygDcfqoeoGTLgA.CSpBOxXywtwjmGGVQH9h2MDcYueJhBoblhO0MBYMk120anymk-mioySgkGJBiIRGWM_7P4-AMf-7bxlO1mMQBG84-da_XziygHVTHtZdi5hD0tp7osa6RNjUpHG4CAnZ3q0Hj_EaSMPTz3-XhWsR5izqOALDsBp69kliXzjbHBkvnzJGPgeQZcP1-FkXlTQYkCm-A9oOzdCqI9mbGaQVzvxDWfYeSnW5BAtEkhXCy_eMEOnKY0y9mlYs-koIhF-dT2WA_c_K8reOq1NjIZBjJLAJ88xr7AVd5jsEMsPr-aEIW7wHcUOeawa3Kfnh9NfNMZaHoBjFAv6g4aP3y9bkbMpK.3-McrmK7ITgjpNPlJefLNQ', 'expires_at': 1731923381, 'expires_in': 86400, 'id_token': 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InVveXZURk44bjJvZHg1VkFLMFh1RyJ9.eyJuaWNrbmFtZSI6ImVkd2FyZC5taWRkbGV0b25zbWl0aCIsIm5hbWUiOiJlZHdhcmQubWlkZGxldG9uc21pdGhAZ21haWwuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyLzUzZDNmMjQ0MDdkNTI1N2Y4NGYyN2NhMDc4NzRiZDY0P3M9NDgwJnI9cGcmZD1odHRwcyUzQSUyRiUyRmNkbi5hdXRoMC5jb20lMkZhdmF0YXJzJTJGZWQucG5nIiwidXBkYXRlZF9hdCI6IjIwMjQtMTEtMTdUMDk6NDk6NDEuNzIyWiIsImVtYWlsIjoiZWR3YXJkLm1pZGRsZXRvbnNtaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6Ly9kZXYtbndhazIwNjZlZjZoOGl4bi51cy5hdXRoMC5jb20vIiwiYXVkIjoiZ0dqeXRxTk1XQ2hTaXhxTzcyUlF6VkhXQWFlSkp6UmkiLCJpYXQiOjE3MzE4MzY5ODIsImV4cCI6MTczMTg3Mjk4Miwic3ViIjoiYXV0aDB8NjU4MmI5NWM4OTVkMDlhNzBiYTEwZmVmIiwic2lkIjoiTXBlbFE4cEtSOWhOOVg0bUlsZkJxM1JaR3p4WExBeGkiLCJub25jZSI6ImxJUVNIS1lzZW9sMjVhN3NFTFBPIn0.oB687ksKRtGbZQYXO4GS5GskJq0SmKofO-BaQftxowZmqIYMwzFumG8mVfm4l7-YI19tc8ik7jXiNGgAI3XpXQH5Ieud8h_TGsh3jNfmVIp4zjxO45Y39kaNHZQgnU2N6ckKD1W0pONirwKLD2Drdj9zVvdcYywQHPmhPHXoz06P8k4UvkdjST_AGgt-RAfpT-j5Nnbh3vqadv95ZGzJPHy3_q0lFS1PRUksYG9YGIMSrSpevC_sVgD3Qum_E35mZyJtwJMyNFzRj3kJHcpMKJH5qAZ2CTMbGLh5iHrUA9_KgOyMRGZTcooHSQnwemq_Sh3lNXJE0fUXzf99FMfaBw', 'scope': 'openid profile email', 'token_type': 'Bearer', 'userinfo': {'aud': 'gGjytqNMWChSixqO72RQzVHWAaeJJzRi', 'email': 'edward.middletonsmith@gmail.com', 'email_verified': False, 'exp': 1731872982, 'iat': 1731836982, 'iss': 'https://dev-nwak2066ef6h8ixn.us.auth0.com/', 'name': 'edward.middletonsmith@gmail.com', 'nickname': 'edward.middletonsmith', 'nonce': 'lIQSHKYseol25a7sELPO', 'picture': 'https://s.gravatar.com/avatar/53d3f24407d5257f84f27ca07874bd64?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fed.png', 'sid': 'MpelQ8pKR9hN9X4mIlfBq3RZGzxXLAxi', 'sub': 'auth0|6582b95c895d09a70ba10fef', 'updated_at': '2024-11-17T09:49:41.722Z'}}}>
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

176
app.log.3
View File

@@ -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 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'} 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: user:
@@ -19,7 +33,7 @@ executing p_get_many_user
DataStore_Base.db_procedure_execute 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) 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} 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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E0B0> result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897A660>
data received 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 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: () raw errors: ()
@@ -38,15 +52,11 @@ model_view_base init end - model.user:
can_admin_store: True can_admin_store: True
can_admin_user: True can_admin_user: True
argument_dict: {'active': 1} form question: <class 'wtforms.fields.simple.BooleanField'>
executing p_shop_get_many_access_level bool interpretted: False
DataStore_Base.db_procedure_execute form question: <class 'wtforms.fields.simple.BooleanField'>
proc_string: CALL p_shop_get_many_access_level(:active) get_inactive:False
args: {'active': 1} type form: <class 'forms.store.product_permutation.Filters_Product_Permutation'>
result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E0B0>
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 DataStore_Base.get_user_session
User.from_json 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'} 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 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) 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} 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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E040> result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897B0E0>
data received 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 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: () raw errors: ()
new result set: () 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 executing p_shop_get_many_product
DataStore_Base.db_procedure_execute 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) 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} 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: <sqlalchemy.engine.cursor.CursorResult object at 0x0000020ABF85E040> result: <sqlalchemy.engine.cursor.CursorResult object at 0x0000026B6897B0E0>
data received data received
initial category_list: categories: [] 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: new_category:
id: 1 id: 4
code: ASS code: CHOCOLATE
name: Assistive Devices name: Chocolates and sweets
description: Braille product line and other assistive devices description: Confectionery
access_level: View access_level: View
display_order: 1 display_order: 1
active: False active: True
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
products: [] products: []
category-loaded category_list: categories: [ category-loaded category_list: categories: [
id: 1 id: 4
code: ASS code: CHOCOLATE
name: Assistive Devices name: Chocolates and sweets
description: Braille product line and other assistive devices description: Confectionery
access_level: View access_level: View
display_order: 1 display_order: 1
active: False active: True
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: [] 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: () raw errors: ()
product with id:6 has variations
new result set: () new result set: ()
get many category_list: categories: [ get many category_list: categories: [
id: 1 id: 4
code: ASS code: CHOCOLATE
name: Assistive Devices name: Chocolates and sweets
description: Braille product line and other assistive devices description: Confectionery
access_level: View access_level: View
display_order: 1 display_order: 1
active: False active: True
products: [] products: [Product
, id_product: 6
id: 3 id_category: 4
code: TECH name: Digestives
name: Technology display_order: 1
description: Technological devices can_view: False
access_level: View can_edit: False
display_order: 2 can_admin: False
active: False has_variations: True
products: [] permutations: []
, variation trees: []
id: 2 active: True
code: MISC
name: Miscellaneous
description: Not category allocated products
access_level: View
display_order: 99
active: False
products: []
] ]
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

View File

@@ -500,19 +500,20 @@ class Parameters_Product(Get_Many_Parameters_Base):
# av.val_instance(form, 'form', 'Parameters_Product.from_form', Filters_Product_Permutation) # 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_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) 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") 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")
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_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( return Parameters_Product(
get_all_product_category = not has_category_filter, 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, # get_first_product_category_only = False,
ids_product_category = form.id_category.data if form.id_category.data is not None else '', ids_product_category = form.id_category.data if form.id_category.data is not None else '',
get_all_product = not has_product_filter, get_all_product = not has_product_filter,
get_inactive_product = False, get_inactive_product = get_inactive,
# get_first_product_only = False, # get_first_product_only = False,
ids_product = form.id_product.data if form.id_product.data is not None else '', 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_all_permutation = not get_permutations_stock_below_min,
get_inactive_permutation = False, get_inactive_permutation = get_inactive,
# get_first_permutation_only = False, # get_first_permutation_only = False,
ids_permutation = '', ids_permutation = '',
get_all_image = False, get_all_image = False,

View File

@@ -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']) @routes_store_product_permutation.route(Model_View_Store_Product_Permutation.HASH_PAGE_STORE_PRODUCT_PERMUTATIONS, methods=['GET'])
def permutations(): def permutations():
Helper_App.console_log('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: try:
form_filters = Filters_Product_Permutation.from_json(data) form_filters = Filters_Product_Permutation.from_json(data)
except Exception as e: except Exception as e:

View File

@@ -29,6 +29,7 @@ class Filters_Product_Permutation(Form_Base):
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')], default='') id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')], default='')
id_product = SelectField('Product', validators=[Optional()], choices=[('', 'All')], default='') id_product = SelectField('Product', validators=[Optional()], choices=[('', 'All')], default='')
is_out_of_stock = BooleanField('Out of stock only?') is_out_of_stock = BooleanField('Out of stock only?')
active = BooleanField('Active only?', default=True)
quantity_min = FloatField('Min stock') quantity_min = FloatField('Min stock')
quantity_max = FloatField('Max stock') quantity_max = FloatField('Max stock')
# submit = SubmitField('Submit') # submit = SubmitField('Submit')
@@ -49,6 +50,7 @@ class Filters_Product_Permutation(Form_Base):
id_category={self.id_category.data}, id_category={self.id_category.data},
id_product={self.id_product.data}, id_product={self.id_product.data},
is_out_of_stock={self.is_out_of_stock.data}, is_out_of_stock={self.is_out_of_stock.data},
active={self.active.data},
quantity_min={self.quantity_min.data}, quantity_min={self.quantity_min.data},
quantity_max={self.quantity_max.data}) quantity_max={self.quantity_max.data})
''' '''
@@ -60,6 +62,7 @@ class Filters_Product_Permutation(Form_Base):
form.id_product.choices = [(json[Store_Base.ATTR_ID_PRODUCT], json[Store_Base.ATTR_ID_PRODUCT])] form.id_product.choices = [(json[Store_Base.ATTR_ID_PRODUCT], json[Store_Base.ATTR_ID_PRODUCT])]
form.id_product.data = json[Store_Base.ATTR_ID_PRODUCT] form.id_product.data = json[Store_Base.ATTR_ID_PRODUCT]
form.is_out_of_stock.data = av.input_bool(json[Store_Base.FLAG_IS_OUT_OF_STOCK], Store_Base.FLAG_IS_OUT_OF_STOCK, f'{cls.__name__}.from_json') form.is_out_of_stock.data = av.input_bool(json[Store_Base.FLAG_IS_OUT_OF_STOCK], Store_Base.FLAG_IS_OUT_OF_STOCK, f'{cls.__name__}.from_json')
form.active.data = av.input_bool(json[Store_Base.FLAG_ACTIVE], Store_Base.FLAG_ACTIVE, f'{cls.__name__}.from_json')
form.quantity_min.data = json[Store_Base.FLAG_QUANTITY_MIN] form.quantity_min.data = json[Store_Base.FLAG_QUANTITY_MIN]
form.quantity_max.data = json[Store_Base.FLAG_QUANTITY_MAX] form.quantity_max.data = json[Store_Base.FLAG_QUANTITY_MAX]
return form return form

View File

@@ -65,10 +65,9 @@ BEGIN
-- Clear previous proc results -- Clear previous proc results
DROP TABLE IF EXISTS tmp_Calc_User; DROP TABLE IF EXISTS tmp_Calc_User;
DROP TABLE IF EXISTS tmp_Shop_Calc_User; DROP TABLE IF EXISTS tmp_User_Calc_User;
DROP TABLE IF EXISTS tmp_Product_Calc_User; DROP TABLE IF EXISTS tmp_Product_Calc_User;
DROP TABLE IF EXISTS tmp_Product_p_Shop_User_Eval_Temp; DROP TABLE IF EXISTS tmp_Split;
-- DROP TABLE IF EXISTS tmp_Split;
-- Permanent Table -- Permanent Table
CREATE TEMPORARY TABLE tmp_Calc_User ( CREATE TEMPORARY TABLE tmp_Calc_User (
@@ -92,7 +91,14 @@ BEGIN
-- guid BINARY(36) NOT NULL, -- guid BINARY(36) NOT NULL,
-- rank_product INT NOT NULL -- rank_product INT NOT NULL
); );
CREATE TEMPORARY TABLE tmp_User_Calc_User (
id_user INT NOT NULL
, is_super_user BIT NOT NULL
-- , id_access_level INT
, priority_access_level INT 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,
-- guid BINARY(36) NOT NULL, -- guid BINARY(36) NOT NULL,
@@ -131,122 +137,314 @@ BEGIN
; ;
END IF; END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN # Access levels
IF v_has_filter_access_level THEN IF v_has_filter_access_level THEN
CALL partsltd_prod.p_split(a_guid, a_ids_access_level, ',', a_debug); CALL partsltd_prod.p_split(a_guid, a_ids_access_level, ',', a_debug);
INSERT INTO tmp_Split ( INSERT INTO tmp_Split (
substring substring
, as_int , as_int
)
SELECT
substring
, CONVERT(substring, DECIMAL(10,0)) -- AS as_int
FROM Split_Temp
WHERE 1=1
AND GUID = a_guid
AND NOT ISNULL(substring)
AND substring != ''
;
CALL partsltd_prod.p_clear_split_temp( a_guid );
# Invalid IDs
IF EXISTS (
SELECT t_S.substring
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Access_Level AL ON t_S.as_int = AL.id_access_level
WHERE
ISNULL(t_S.as_int)
OR ISNULL(AL.id_access_level)
OR AL.active = 0
) THEN
INSERT INTO tmp_Msg_Error (
-- guid,
id_type,
code,
msg
) )
SELECT SELECT
substring -- a_guid,
, CONVERT(substring, DECIMAL(10,0)) -- AS as_int v_id_type_error_bad_data,
FROM Split_Temp v_code_type_error_bad_data,
WHERE 1=1 CONCAT('Invalid or inactive access level IDs: ', GROUP_CONCAT(t_S.substring SEPARATOR ', '))
AND GUID = a_guid FROM tmp_Split t_S
AND NOT ISNULL(substring) LEFT JOIN partsltd_prod.Shop_Access_Level AL ON t_S.as_int = AL.id_access_level
AND substring != '' WHERE
; ISNULL(t_S.as_int)
OR ISNULL(AL.id_access_level)
CALL partsltd_prod.p_clear_split_temp( a_guid ); OR AL.active = 0
;
# Invalid IDs ELSE
IF EXISTS ( IF v_has_filter_access_level THEN
SELECT t_S.substring SET v_id_access_level := (
FROM tmp_Split t_S SELECT AL.id_access_level
LEFT JOIN partsltd_prod.Shop_Access_Level AL ON t_S.as_int = AL.id_access_level FROM tmp_Split t_S
WHERE INNER JOIN partsltd_prod.Shop_Access_Level AL
ISNULL(t_S.as_int) ON t_S.as_int = AL.id_access_level
OR ISNULL(AL.id_access_level) AND AL.active
OR AL.active = 0 ORDER BY AL.priority ASC
) THEN LIMIT 1
INSERT INTO tmp_Msg_Error ( );
-- guid, ELSE
id_type, SET v_id_access_level = v_id_access_level_view;
code,
msg
)
SELECT
-- a_guid,
v_id_type_error_bad_data,
v_code_type_error_bad_data,
CONCAT('Invalid or inactive access level IDs: ', GROUP_CONCAT(t_S.substring SEPARATOR ', '))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Access_Level AL ON t_S.as_int = AL.id_access_level
WHERE
ISNULL(t_S.as_int)
OR ISNULL(AL.id_access_level)
OR AL.active = 0
;
END IF; END IF;
SET v_priority_access_level := (SELECT priority FROM partsltd_prod.Shop_Access_Level WHERE id_access_level = v_id_access_level LIMIT 1);
END IF; END IF;
END IF; END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
IF v_has_filter_access_level THEN
SET v_id_access_level := (
SELECT AL.id_access_level
FROM tmp_Split t_S
INNER JOIN partsltd_prod.Shop_Access_Level AL
ON t_S.as_int = AL.id_access_level
AND AL.active
ORDER BY AL.priority ASC
LIMIT 1
);
ELSE
SET v_id_access_level = v_id_access_level_view;
END IF;
SET v_priority_access_level := (SELECT priority FROM partsltd_prod.Shop_Access_Level WHERE id_access_level = v_id_access_level LIMIT 1);
END IF;
DELETE FROM tmp_Split; DELETE FROM tmp_Split;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN -- Permission IDs
IF v_has_filter_product = 1 THEN IF v_has_filter_permission THEN
CALL partsltd_prod.p_split(a_guid, a_ids_product, ',', a_debug); CALL partsltd_prod.p_split(a_guid, a_ids_permission, ',', a_debug);
INSERT INTO tmp_Split ( INSERT INTO tmp_Split (
substring substring
, as_int , as_int
)
SELECT
substring
, CONVERT(substring, DECIMAL(10,0)) AS as_int
FROM Split_Temp
WHERE 1=1
AND GUID = a_guid
AND NOT ISNULL(substring)
AND substring != ''
;
CALL partsltd_prod.p_clear_split_temp( a_guid );
# Invalid or inactive
IF EXISTS (SELECT PERM.id_permission FROM tmp_Split t_S LEFT JOIN partsltd_prod.Shop_Permission PERM ON t_S.as_int = PERM.id_permission WHERE ISNULL(t_S.as_int) OR ISNULL(PERM.id_permission) OR PERM.active = 0) THEN
INSERT INTO tmp_Msg_Error (
-- guid,
id_type,
code,
msg
) )
SELECT SELECT
substring -- a_guid,
, CONVERT(substring, DECIMAL(10,0)) AS as_int v_id_type_error_bad_data,
FROM Split_Temp v_code_type_error_bad_data,
WHERE 1=1 CONCAT('Invalid or inactive permission IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
AND GUID = a_guid FROM tmp_Split t_S
AND NOT ISNULL(substring) LEFT JOIN partsltd_prod.Shop_Permission PERM ON t_S.as_int = PERM.id_permission
AND substring != '' WHERE
; ISNULL(t_S.as_int)
OR ISNULL(PERM.id_permission)
CALL partsltd_prod.p_clear_split_temp( a_guid ); OR PERM.active = 0
;
# Invalid product IDs ELSE
IF EXISTS (SELECT * FROM tmp_Split t_S LEFT JOIN partsltd_prod.Shop_Product P ON t_S.as_int = P.id_product WHERE ISNULL(t_S.as_int) OR ISNULL(P.id_product) OR P.active = 0) THEN SET v_id_permission_required := (
INSERT INTO tmp_Msg_Error ( SELECT PERM.id_permission
-- guid, FROM partsltd_prod.Shop_Permission PERM
id_type, INNER JOIN partsltd_prod.Shop_Access_Level AL ON PERM.id_access_level_required = AL.id_access_level
code, ORDER BY AL.priority ASC
msg LIMIT 1
) );
SELECT
-- a_guid,
v_id_type_error_bad_data,
v_code_type_error_bad_data,
CONCAT('Invalid or inactive product IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Product P ON t_S.as_int = P.id_product
WHERE
ISNULL(t_S.as_int)
OR ISNULL(P.id_product)
OR P.active = 0
;
END IF;
END IF; END IF;
END IF; END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN DELETE FROM tmp_Split;
IF (v_has_filter_product = 1 AND EXISTS (SELECT * FROM tmp_Split)) THEN
# Users
CALL partsltd_prod.p_split(a_guid, a_ids_user, ',', a_debug);
INSERT INTO tmp_Split (
substring
, as_int
)
SELECT
substring
, CONVERT(substring, DECIMAL(10,0)) AS as_int
FROM Split_Temp
WHERE 1=1
AND GUID = a_guid
AND NOT ISNULL(substring)
AND substring != ''
;
CALL partsltd_prod.p_clear_split_temp( a_guid );
# Invalid or inactive
IF EXISTS (SELECT U.id_user FROM tmp_Split t_S LEFT JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user WHERE ISNULL(t_S.as_int) OR ISNULL(U.id_user) OR (a_get_inactive_user = 0 AND U.active = 0)) THEN
INSERT INTO tmp_Msg_Error (
-- guid,
id_type,
code,
msg
)
SELECT
-- a_guid,
v_id_type_error_bad_data,
v_code_type_error_bad_data,
CONCAT('Invalid or inactive user IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user
WHERE
ISNULL(t_S.as_int)
OR ISNULL(U.id_user)
OR (
a_get_inactive_user = 0
AND U.active = 0
)
;
ELSE
/*
SET a_ids_user = (
SELECT U.id_user
FROM tmp_Split t_S
INNER JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user
);
SET v_has_filter_user = ISNULL(a_ids_user);
*/
IF NOT EXISTS (SELECT * FROM tmp_Split) THEN
INSERT INTO tmp_Split (substring, as_int)
VALUES ( '', NULL );
END IF;
IF a_debug = 1 THEN
SELECT *
FROM tmp_Split;
END IF;
INSERT INTO tmp_User_Calc_User (
id_user
-- , id_access_level
, is_super_user
, priority_access_level
)
SELECT
U.id_user
, U.is_super_user
-- , IFNULL(AL_U.id_access_level, v_id_access_level_view) AS id_access_level
, IFNULL(MIN(AL_U.priority), v_priority_access_level_view) AS priority_access_level
FROM tmp_Split t_S
INNER JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user
LEFT JOIN partsltd_prod.Shop_User_Role_Link URL
ON U.id_user = URL.id_user
AND URL.active
LEFT JOIN partsltd_prod.Shop_Role_Permission_Link RPL
ON URL.id_role = RPL.id_role
AND RPL.active
LEFT JOIN partsltd_prod.Shop_Access_Level AL_U
ON RPL.id_access_level = AL_U.id_access_level
AND AL_U.active
GROUP BY U.id_user
;
INSERT INTO tmp_Calc_User (
id_user
, id_permission_required
, priority_access_level_required
, id_product
, is_super_user
, priority_access_level_user
)
SELECT
t_UCU.id_user
, v_id_permission_required
, v_priority_access_level AS priority_access_level_required
, NULL
, t_UCU.priority_access_level AS priority_access_level_user
, t_UCU.is_super_user AS is_super_user
FROM tmp_User_Calc_User t_UCU
;
/*
INSERT INTO tmp_Calc_User (
id_user
, id_permission_required
, priority_access_level_required
-- , id_product
, priority_access_level_user
, is_super_user
)
SELECT
U.id_user
, v_id_permission_required
, v_priority_access_level AS priority_access_level_required
-- , t_P.id_product
, CASE WHEN MIN(IFNULL(AL_U.priority, 0)) = 0 THEN v_priority_access_level_view ELSE MIN(IFNULL(AL_U.priority, 0)) END AS priority_access_level_user
, IFNULL(U.is_super_user, 0) AS is_super_user
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_User U
ON t_S.as_int = U.id_user
AND U.active
LEFT JOIN partsltd_prod.Shop_User_Role_Link URL
ON U.id_user = URL.id_user
AND URL.active
LEFT JOIN partsltd_prod.Shop_Role_Permission_Link RPL
ON URL.id_role = RPL.id_role
AND RPL.active
LEFT JOIN partsltd_prod.Shop_Access_Level AL_U
ON RPL.id_access_level = AL_U.id_access_level
AND AL_U.active
*
CROSS JOIN tmp_Product_Calc_User t_P
LEFT JOIN partsltd_prod.Shop_Access_Level AL_P
ON t_P.id_access_level_required = AL_P.id_access_level
AND AL_P.active
*
GROUP BY t_S.as_int, U.id_user
;
*/
# SET v_has_filter_user = EXISTS ( SELECT * FROM tmp_User_Calc_User LIMIT 1 );
END IF;
DELETE FROM tmp_Split;
# Products
IF v_has_filter_product = 1 THEN
CALL partsltd_prod.p_split(a_guid, a_ids_product, ',', a_debug);
INSERT INTO tmp_Split (
substring
, as_int
)
SELECT
substring
, CONVERT(substring, DECIMAL(10,0)) AS as_int
FROM Split_Temp
WHERE 1=1
AND GUID = a_guid
AND NOT ISNULL(substring)
AND substring != ''
;
CALL partsltd_prod.p_clear_split_temp( a_guid );
# Invalid product IDs
IF EXISTS (SELECT * FROM tmp_Split t_S LEFT JOIN partsltd_prod.Shop_Product P ON t_S.as_int = P.id_product WHERE ISNULL(t_S.as_int) OR ISNULL(P.id_product)) THEN
INSERT INTO tmp_Msg_Error (
-- guid,
id_type,
code,
msg
)
SELECT
-- a_guid,
v_id_type_error_bad_data,
v_code_type_error_bad_data,
CONCAT('Invalid Product IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Product P ON t_S.as_int = P.id_product
WHERE
ISNULL(t_S.as_int)
OR ISNULL(P.id_product)
OR P.active = 0
;
END IF;
IF (EXISTS (SELECT * FROM tmp_Split)) THEN
INSERT INTO tmp_Product_Calc_User ( INSERT INTO tmp_Product_Calc_User (
id_product, id_product,
-- id_permutation, -- id_permutation,
@@ -294,177 +492,35 @@ BEGIN
); );
END IF; END IF;
END IF; END IF;
DELETE FROM tmp_Split; DELETE FROM tmp_Split;
-- Permission IDs INSERT INTO tmp_Calc_User (
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN id_user
IF v_has_filter_permission THEN , id_permission_required
CALL partsltd_prod.p_split(a_guid, a_ids_permission, ',', a_debug); , priority_access_level_required
, id_product
INSERT INTO tmp_Split ( , is_super_user
substring , priority_access_level_user
, as_int )
) SELECT
SELECT t_U.id_user
substring , v_id_permission_required
, CONVERT(substring, DECIMAL(10,0)) AS as_int , CASE WHEN AL.priority < v_priority_access_level THEN AL.priority ELSE v_priority_access_level END AS priority_access_level_required
FROM Split_Temp , t_P.id_product
WHERE 1=1 , t_U.priority_access_level AS priority_access_level_user
AND GUID = a_guid , t_U.is_super_user AS is_super_user
AND NOT ISNULL(substring) FROM tmp_User_Calc_User t_U
AND substring != '' CROSS JOIN tmp_Product_Calc_User t_P
; LEFT JOIN partsltd_prod.Shop_Access_Level AL ON t_P.id_access_level_required = AL.id_access_level
;
CALL partsltd_prod.p_clear_split_temp( a_guid );
# Invalid or inactive
IF EXISTS (SELECT PERM.id_permission FROM tmp_Split t_S LEFT JOIN partsltd_prod.Shop_Permission PERM ON t_S.as_int = PERM.id_permission WHERE ISNULL(t_S.as_int) OR ISNULL(PERM.id_permission) OR PERM.active = 0) THEN
INSERT INTO tmp_Msg_Error (
-- guid,
id_type,
code,
msg
)
SELECT
-- a_guid,
v_id_type_error_bad_data,
v_code_type_error_bad_data,
CONCAT('Invalid or inactive permission IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Permission PERM ON t_S.as_int = PERM.id_permission
WHERE
ISNULL(t_S.as_int)
OR ISNULL(PERM.id_permission)
OR PERM.active = 0
;
ELSE
SET v_id_permission_required := (
SELECT PERM.id_permission
FROM partsltd_prod.Shop_Permission PERM
INNER JOIN partsltd_prod.Shop_Access_Level AL ON PERM.id_access_level_required = AL.id_access_level
ORDER BY AL.priority ASC
LIMIT 1
);
END IF;
END IF;
END IF;
DELETE FROM tmp_Split;
IF a_debug = 1 THEN
SELECT * FROM tmp_Product_Calc_User;
END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
-- Invalid user ID
CALL partsltd_prod.p_split(a_guid, a_ids_user, ',', a_debug);
INSERT INTO tmp_Split (
substring
, as_int
)
SELECT
substring
, CONVERT(substring, DECIMAL(10,0)) AS as_int
FROM Split_Temp
WHERE 1=1
AND GUID = a_guid
AND NOT ISNULL(substring)
AND substring != ''
;
CALL partsltd_prod.p_clear_split_temp( a_guid );
# Invalid or inactive
IF EXISTS (SELECT U.id_user FROM tmp_Split t_S LEFT JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user WHERE ISNULL(t_S.as_int) OR ISNULL(U.id_user) OR U.active = 0) THEN
INSERT INTO tmp_Msg_Error (
-- guid,
id_type,
code,
msg
)
SELECT
-- a_guid,
v_id_type_error_bad_data,
v_code_type_error_bad_data,
CONCAT('Invalid or inactive user IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user
WHERE
ISNULL(t_S.as_int)
OR ISNULL(U.id_user)
OR U.active = 0
;
ELSE
/*
SET a_ids_user = (
SELECT U.id_user
FROM tmp_Split t_S
INNER JOIN partsltd_prod.Shop_User U ON t_S.as_int = U.id_user
);
SET v_has_filter_user = ISNULL(a_ids_user);
*/
IF NOT EXISTS (SELECT * FROM tmp_Split) THEN
INSERT INTO tmp_Split (substring, as_int)
VALUES ( '', NULL );
END IF;
IF a_debug = 1 THEN
SELECT *
FROM tmp_Split;
END IF;
INSERT INTO tmp_Calc_User (
id_user
, id_permission_required
, priority_access_level_required
, id_product
, priority_access_level_user
, is_super_user
)
SELECT
U.id_user
, v_id_permission_required
, CASE WHEN v_priority_access_level < AL_P.priority THEN v_priority_access_level ELSE AL_P.priority END AS priority_access_level_required
, t_P.id_product
, CASE WHEN MIN(IFNULL(AL_U.priority, 0)) = 0 THEN v_priority_access_level_view ELSE MIN(IFNULL(AL_U.priority, 0)) END AS priority_access_level_user
, IFNULL(U.is_super_user, 0) AS is_super_user
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_User U
ON t_S.as_int = U.id_user
AND U.active
LEFT JOIN partsltd_prod.Shop_User_Role_Link URL
ON U.id_user = URL.id_user
AND URL.active
LEFT JOIN partsltd_prod.Shop_Role_Permission_Link RPL
ON URL.id_role = RPL.id_role
AND RPL.active
LEFT JOIN partsltd_prod.Shop_Access_Level AL_U
ON RPL.id_access_level = AL_U.id_access_level
AND AL_U.active
CROSS JOIN tmp_Product_Calc_User t_P
LEFT JOIN partsltd_prod.Shop_Access_Level AL_P
ON t_P.id_access_level_required = AL_P.id_access_level
AND AL_P.active
GROUP BY t_S.as_int, U.id_user, t_P.id_product, AL_P.priority
;
SET v_has_filter_user = EXISTS ( SELECT * FROM tmp_Calc_User LIMIT 1 );
END IF;
END IF;
DELETE FROM tmp_Split;
-- Calculated fields -- Calculated fields
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN UPDATE tmp_Calc_User t_CU
UPDATE tmp_Calc_User t_U SET
SET t_CU.can_view = t_CU.is_super_user = 1 OR (t_CU.priority_access_level_user <= v_priority_access_level_view AND t_CU.priority_access_level_user <= t_CU.priority_access_level_required)
t_U.can_view = t_U.is_super_user = 1 OR (t_U.priority_access_level_user <= v_priority_access_level_view AND t_U.priority_access_level_user <= t_U.priority_access_level_required) , t_CU.can_edit = t_CU.is_super_user = 1 OR (t_CU.priority_access_level_user <= v_priority_access_level_edit AND t_CU.priority_access_level_user <= t_CU.priority_access_level_required)
, t_U.can_edit = t_U.is_super_user = 1 OR (t_U.priority_access_level_user <= v_priority_access_level_edit AND t_U.priority_access_level_user <= t_U.priority_access_level_required) , t_CU.can_admin = t_CU.is_super_user = 1 OR (t_CU.priority_access_level_user <= v_priority_access_level_admin AND t_CU.priority_access_level_user <= t_CU.priority_access_level_required)
, t_U.can_admin = t_U.is_super_user = 1 OR (t_U.priority_access_level_user <= v_priority_access_level_admin AND t_U.priority_access_level_user <= t_U.priority_access_level_required) ;
;
END IF;
-- Export data to staging table -- Export data to staging table
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
@@ -500,6 +556,7 @@ BEGIN
IF a_debug = 1 THEN IF a_debug = 1 THEN
SELECT * FROM tmp_Msg_Error; SELECT * FROM tmp_Msg_Error;
SELECT * FROM tmp_Calc_User; SELECT * FROM tmp_Calc_User;
SELECT * FROM tmp_User_Calc_User;
SELECT * FROM tmp_Product_Calc_User; SELECT * FROM tmp_Product_Calc_User;
SELECT * FROM partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid; SELECT * FROM partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid;
CALL partsltd_prod.p_shop_clear_calc_user ( a_guid, a_debug ); CALL partsltd_prod.p_shop_clear_calc_user ( a_guid, a_debug );
@@ -507,10 +564,11 @@ BEGIN
-- Clean up -- Clean up
DROP TABLE IF EXISTS tmp_Calc_User; DROP TABLE IF EXISTS tmp_Calc_User;
DROP TABLE IF EXISTS tmp_Shop_Calc_User; DROP TABLE IF EXISTS tmp_User_Calc_User;
DROP TABLE IF EXISTS tmp_Product_Calc_User; DROP TABLE IF EXISTS tmp_Product_Calc_User;
DROP TABLE IF EXISTS tmp_Product_p_Shop_User_Eval_Temp; # Don't destroy common tables in nested Stored Procedures!
-- DROP TABLE IF EXISTS tmp_Split; -- DROP TABLE IF EXISTS tmp_Split;
DELETE FROM tmp_Split;
IF a_debug = 1 THEN IF a_debug = 1 THEN
CALL partsltd_prod.p_debug_timing_reporting( v_time_start ); CALL partsltd_prod.p_debug_timing_reporting( v_time_start );
@@ -518,19 +576,20 @@ BEGIN
END // END //
DELIMITER ;; DELIMITER ;;
/* /*
CALL partsltd_prod.p_shop_calc_user ( CALL partsltd_prod.p_shop_calc_user (
'chips ' 'chips '
, NULL , 1
, 0 , 0
, '2' , '2'
, '1' , '1'
, '1,2,3,4,5' , '1,2,3,4,5'
, 0 , 0
); );
SELECT * FROM partsltd_prod.Shop_Calc_User_Temp WHERE GUID = 'chips ';
DELETE FROM partsltd_prod.Shop_Calc_User_Temp WHERE GUID = 'chips ';
-- SELECT * FROM partsltd_prod.Shop_Calc_User_Temp; -- SELECT * FROM partsltd_prod.Shop_Calc_User_Temp;
SELECT * FROM partsltd_prod.Shop_Calc_User_Temp WHERE GUID = 'chips '; SELECT * FROM partsltd_prod.Shop_Calc_User_Temp WHERE GUID = 'chips ';

View File

@@ -126,7 +126,7 @@ BEGIN
SELECT SELECT
v_id_type_error_bad_data v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg , CONCAT('The following Product Category(s) do not have a code: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C FROM tmp_Category t_C
WHERE ISNULL(t_C.code) WHERE ISNULL(t_C.code)
; ;
@@ -141,7 +141,7 @@ BEGIN
SELECT SELECT
v_id_type_error_bad_data v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg , CONCAT('The following Product Category(s) do not have a name: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C FROM tmp_Category t_C
WHERE ISNULL(t_C.name) WHERE ISNULL(t_C.name)
; ;
@@ -156,7 +156,7 @@ BEGIN
SELECT SELECT
v_id_type_error_bad_data v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg , CONCAT('The following Product Category(s) do not have a display order: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C FROM tmp_Category t_C
WHERE ISNULL(t_C.display_order) WHERE ISNULL(t_C.display_order)
; ;
@@ -165,7 +165,7 @@ BEGIN
-- Permissions -- Permissions
SET v_ids_product_permission := ( SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',') SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P FROM partsltd_prod.Shop_Product P
INNER JOIN tmp_Category t_C INNER JOIN tmp_Category t_C
ON P.id_category = t_C.id_category ON P.id_category = t_C.id_category
AND t_C.is_new = 0 AND t_C.is_new = 0
@@ -185,7 +185,7 @@ BEGIN
; ;
END IF; END IF;
CALL p_shop_calc_user( CALL partsltd_prod.p_shop_calc_user(
a_guid a_guid
, a_id_user , a_id_user
, FALSE -- a_get_inactive_user , FALSE -- a_get_inactive_user
@@ -196,8 +196,8 @@ BEGIN
); );
UPDATE tmp_Category t_C UPDATE tmp_Category t_C
INNER JOIN Shop_Product P ON t_C.id_category = P.id_product INNER JOIN partsltd_prod.Shop_Product P ON t_C.id_category = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid AND UE_T.GUID = a_guid
SET SET
@@ -205,8 +205,43 @@ BEGIN
, t_C.can_edit = UE_T.can_edit , t_C.can_edit = UE_T.can_edit
, t_C.can_admin = UE_T.can_admin , t_C.can_admin = UE_T.can_admin
; ;
IF EXISTS (SELECT * FROM tmp_Category 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 Catogory(s): ', IFNULL(GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', '), 'NULL'))
FROM tmp_Category t_C
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 LIMIT 1) 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 Product Catogories.'
)
;
END IF;
CALL p_shop_clear_calc_user( CALL partsltd_prod.p_shop_clear_calc_user(
a_guid a_guid
, 0 -- a_debug , 0 -- a_debug
); );

View File

@@ -216,60 +216,90 @@ BEGIN
-- Permissions -- 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);
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);
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
CALL partsltd_prod.p_shop_calc_user(
CALL partsltd_prod.p_shop_calc_user( a_guid
a_guid , a_id_user
, a_id_user , FALSE -- get_inactive_users
, FALSE -- get_inactive_users , v_id_permission_product
, v_id_permission_product , v_id_access_level_edit
, v_id_access_level_edit , v_ids_product_permission
, v_ids_product_permission , 0 -- debug
, 0 -- debug );
);
UPDATE tmp_Product t_P
UPDATE tmp_Product t_P INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T
INNER JOIN Shop_Calc_User_Temp UE_T ON t_P.id_product = UE_T.id_product
ON t_P.id_product = UE_T.id_product AND UE_T.GUID = a_guid
AND UE_T.GUID = a_guid SET
SET t_P.can_view = UE_T.can_view
t_P.can_view = UE_T.can_view , t_P.can_edit = UE_T.can_edit
, t_P.can_edit = UE_T.can_edit , t_P.can_admin = UE_T.can_admin
, 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
CALL partsltd_prod.p_shop_clear_calc_user( INSERT INTO tmp_Msg_Error (
a_guid id_type
, 0 -- debug , code
); , msg
END IF; )
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; 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 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 partsltd_prod.Shop_Product_Change_Set ( comment ) INSERT INTO partsltd_prod.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();
UPDATE partsltd_prod.Shop_Product P UPDATE partsltd_prod.Shop_Product P
INNER JOIN tmp_Product t_P ON P.id_product = t_P.id_product INNER JOIN tmp_Product t_P ON P.id_product = t_P.id_product
SET SET
P.id_category = t_P.id_category P.id_category = t_P.id_category
, P.name = t_P.name , P.name = t_P.name
, P.has_variations = t_P.has_variations , P.has_variations = t_P.has_variations
, P.id_access_level_required = t_P.id_access_level_required , P.id_access_level_required = t_P.id_access_level_required
, P.display_order = t_P.display_order , P.display_order = t_P.display_order
, P.active = t_P.active , P.active = t_P.active
, P.id_change_set = v_id_change_set , P.id_change_set = v_id_change_set
; ;
END IF;
INSERT INTO partsltd_prod.Shop_Product ( INSERT INTO partsltd_prod.Shop_Product (
id_category id_category
@@ -297,7 +327,7 @@ BEGIN
START TRANSACTION; START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Product_Category_Temp DELETE FROM partsltd_prod.Shop_Product_Temp
WHERE GUID = a_guid; WHERE GUID = a_guid;
COMMIT; COMMIT;

View File

@@ -440,11 +440,6 @@ BEGIN
LEFT JOIN Shop_Product P ON t_PP.id_product = P.id_product LEFT JOIN Shop_Product P ON t_PP.id_product = P.id_product
; ;
END IF; 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 IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.can_edit) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -461,13 +456,36 @@ BEGIN
ISNULL(t_P.can_edit) ISNULL(t_P.can_edit)
; ;
END IF; 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 INSERT INTO tmp_Msg_Error (
SELECT * id_type
FROM partsltd_prod.Shop_Product_Permutation_Variation_Link_Temp , code
WHERE GUID = a_guid , msg
; )
END IF; 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 IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION; START TRANSACTION;

View File

@@ -40,6 +40,15 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.active.label }}
{{ model.form_filters.active() }}
{% for error in model.form_filters.active.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
</div>
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}"> <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}"> <div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_ROW }} {{ model.FLAG_FILTER }}">
{{ model.form_filters.quantity_min.label }} {{ model.form_filters.quantity_min.label }}