From 197f6ec5bc1c62c4d494c3ea00a23ea9f49b1c2d Mon Sep 17 00:00:00 2001 From: teddy Date: Sun, 17 Nov 2024 15:17:57 +0000 Subject: [PATCH] Fix: Removal of filter methods from controllers. --- app.log.1 | 166 ++++++ app.log.2 | 146 +++++ app.log.3 | 112 ++++ app.py | 19 - .../unit_measurement.cpython-312.pyc | Bin 7295 -> 7289 bytes .../__pycache__/user.cpython-312.pyc | Bin 12837 -> 14200 bytes .../store/__pycache__/product.cpython-312.pyc | Bin 29559 -> 29609 bytes .../product_variation.cpython-312.pyc | Bin 11531 -> 11523 bytes business_objects/store/product.py | 1 + business_objects/store/product_variation.py | 63 -- business_objects/unit_measurement.py | 51 -- business_objects/user.py | 71 ++- controllers/__pycache__/user.cpython-312.pyc | Bin 10605 -> 11208 bytes .../store/manufacturing_purchase_order.py | 32 -- controllers/store/product.py | 95 ---- controllers/store/product_category.py | 26 - controllers/store/product_permutation.py | 22 - controllers/store/product_variation.py | 22 - controllers/store/stock_item.py | 36 -- controllers/store/supplier.py | 32 -- controllers/store/supplier_purchase_order.py | 32 -- controllers/user.py | 19 +- .../datastore_base.cpython-312.pyc | Bin 12100 -> 15555 bytes .../datastore_store_base.cpython-312.pyc | Bin 16909 -> 15736 bytes .../datastore_user.cpython-312.pyc | Bin 7565 -> 7581 bytes datastores/datastore_base.py | 98 +++- datastores/datastore_store_base.py | 27 - datastores/datastore_user.py | 11 +- .../__pycache__/helper_app.cpython-312.pyc | Bin 1772 -> 1770 bytes .../model_view_base.cpython-312.pyc | Bin 20496 -> 20582 bytes .../model_view_user.cpython-312.pyc | Bin 1459 -> 2012 bytes models/model_view_base.py | 7 +- models/model_view_user.py | 18 +- static/MySQL/0000_combined.sql | 538 ++++++++++++------ static/MySQL/0001_destroy.sql | 1 + static/MySQL/1312_tbl_Shop_User.sql | 6 +- static/MySQL/1314_tbl_Shop_User_Temp.sql | 22 + .../7200_p_shop_save_product_category.sql | 11 +- static/MySQL/7203_p_shop_save_product.sql | 1 + .../7206_p_shop_save_product_permutation.sql | 4 +- static/MySQL/7312_p_shop_save_user.sql | 399 ++++++++----- static/MySQL/7313_p_get_many_user.sql | 64 ++- static/MySQL/9000_populate.sql | 22 +- templates/pages/user/_user.html | 70 ++- 44 files changed, 1317 insertions(+), 927 deletions(-) create mode 100644 app.log.1 create mode 100644 app.log.2 create mode 100644 app.log.3 create mode 100644 static/MySQL/1314_tbl_Shop_User_Temp.sql diff --git a/app.log.1 b/app.log.1 new file mode 100644 index 00000000..38a6b00c --- /dev/null +++ b/app.log.1 @@ -0,0 +1,166 @@ +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': 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} +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: +data received +initial category_list: categories: [] +raw categories: ((1, 'ASS', 'Assistive Devices', 'Braille product line and other assistive devices', 1, 'View', 1, b'\x01', None, None, None), (3, 'TECH', 'Technology', 'Technological devices', 1, 'View', 2, b'\x01', None, None, None), (2, 'MISC', 'Miscellaneous', 'Not category allocated products', 1, 'View', 99, b'\x01', None, None, None)) +new_category: + id: 1 + code: ASS + name: Assistive Devices + description: Braille product line and other assistive devices + access_level: View + display_order: 1 + active: True + products: [] + +new_category: + id: 3 + code: TECH + name: Technology + description: Technological devices + access_level: View + display_order: 2 + active: True + products: [] + +new_category: + id: 2 + code: MISC + name: Miscellaneous + description: Not category allocated products + access_level: View + display_order: 99 + active: True + products: [] + +category-loaded category_list: categories: [ + id: 1 + code: ASS + name: Assistive Devices + description: Braille product line and other assistive devices + access_level: View + display_order: 1 + active: True + products: [] + , + id: 3 + code: TECH + name: Technology + description: Technological devices + access_level: View + display_order: 2 + active: True + products: [] + , + id: 2 + code: MISC + name: Miscellaneous + description: Not category allocated products + access_level: View + display_order: 99 + active: True + products: [] + ] +raw products: () +raw errors: () +new result set: () +get many category_list: categories: [ + id: 1 + code: ASS + name: Assistive Devices + description: Braille product line and other assistive devices + access_level: View + display_order: 1 + active: True + products: [] + , + id: 3 + code: TECH + name: Technology + description: Technological devices + access_level: View + display_order: 2 + active: True + products: [] + , + id: 2 + code: MISC + name: Miscellaneous + description: Not category allocated products + access_level: View + display_order: 99 + active: True + products: [] + ] +Model_View_Store.__init__ +starting diff --git a/app.log.2 b/app.log.2 new file mode 100644 index 00000000..b4780e43 --- /dev/null +++ b/app.log.2 @@ -0,0 +1,146 @@ +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: +data received +initial category_list: categories: [] +raw categories: ((1, 'ASS', 'Assistive Devices', 'Braille product line and other assistive devices', 1, 'View', 1, b'\x01', None, None, None), (3, 'TECH', 'Technology', 'Technological devices', 1, 'View', 2, b'\x01', None, None, None), (2, 'MISC', 'Miscellaneous', 'Not category allocated products', 1, 'View', 99, b'\x01', None, None, None)) +new_category: + id: 1 + code: ASS + name: Assistive Devices + description: Braille product line and other assistive devices + access_level: View + display_order: 1 + active: True + products: [] + +new_category: + id: 3 + code: TECH + name: Technology + description: Technological devices + access_level: View + display_order: 2 + active: True + products: [] + +new_category: + id: 2 + code: MISC + name: Miscellaneous + description: Not category allocated products + access_level: View + display_order: 99 + active: True + products: [] + +category-loaded category_list: categories: [ + id: 1 + code: ASS + name: Assistive Devices + description: Braille product line and other assistive devices + access_level: View + display_order: 1 + active: True + products: [] + , + id: 3 + code: TECH + name: Technology + description: Technological devices + access_level: View + display_order: 2 + active: True + products: [] + , + id: 2 + code: MISC + name: Miscellaneous + description: Not category allocated products + access_level: View + display_order: 99 + active: True + products: [] + ] +raw products: () +raw errors: () +new result set: () +get many category_list: categories: [ + id: 1 + code: ASS + name: Assistive Devices + description: Braille product line and other assistive devices + access_level: View + display_order: 1 + active: True + products: [] + , + id: 3 + code: TECH + name: Technology + description: Technological devices + access_level: View + display_order: 2 + active: True + products: [] + , + id: 2 + code: MISC + name: Miscellaneous + description: Not category allocated products + access_level: View + display_order: 99 + active: True + products: [] + ] +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 + +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: () diff --git a/app.log.3 b/app.log.3 new file mode 100644 index 00000000..385ca1ba --- /dev/null +++ b/app.log.3 @@ -0,0 +1,112 @@ +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'} +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: () +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': 0} +executing p_shop_get_many_access_level +DataStore_Base.db_procedure_execute +proc_string: CALL p_shop_get_many_access_level(:active) +args: {'active': 0} +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': 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} +executing p_shop_get_many_product diff --git a/app.py b/app.py index 57bd3e38..410246ac 100644 --- a/app.py +++ b/app.py @@ -17,25 +17,6 @@ Initializes the Flask application, sets the configuration based on the environme # IMPORTS # internal from config import app_config, Config -# from routes import bp_home -""" -from forms import Form_Contact, Form_Supplier, Form_Filters_Permutation, Filters_Stock_Item -from models.model_view_base import Model_View_Base -from models.model_view_admin import Model_View_Admin -from models.model_view_home import Model_View_Home -from models.model_view_contact import Model_View_Contact -from models.model_view_services import Model_View_Services -from models.Model_View_Store_Stock_Item import Model_View_Store_Stock_Item -from models.model_view_store_supplier import Model_View_Store_Supplier -from models.model_view_store_product_permutation import Model_View_Store_Product_Permutations -from models.model_view_user import Model_View_User -from business_objects.store.product import Product, Parameters_Product, Product_Permutation # , Product_Image_Filters, Resolution_Level_Enum -from business_objects.store.stock_item import Stock_Item -from business_objects.user import User, User_Filters -from datastores.datastore_store_base import DataStore_Store -from helpers.helper_app import Helper_App -import lib.argument_validation as av -""" from controllers.core import routes_core from controllers.legal import routes_legal from controllers.store.store import routes_store diff --git a/business_objects/__pycache__/unit_measurement.cpython-312.pyc b/business_objects/__pycache__/unit_measurement.cpython-312.pyc index 67f8f6dfabe978e92e4b4cfc42e106ca26f5195f..aba33d16ef90e909b1a0eb8069478c8b476491d7 100644 GIT binary patch delta 41 ucmexw@za9uG%qg~0}$*#XqoOQvXReFhS6}cgNz>cSB3~iMu8$rpd0`JJPK0) delta 47 zcmexq@!x{)G%qg~0}yDfQb-q<-pFSt!)QL)K}JvT3qu4Wqris}CPPM+B1@nO04<~o A3IG5A diff --git a/business_objects/__pycache__/user.cpython-312.pyc b/business_objects/__pycache__/user.cpython-312.pyc index cca3d1189a0cb3bdf0eb3e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(ua>3Y1E`S)jk(s;rWHi%qlT&YU3BbQ|8*XyR`_gHi z4^2LCe(RfCFC4uOe^l_Hh0`uh@O>_9;^BG%fI1a?3v8(KDlgtY4j6hT{LA>y;{W7; HWD)ugIuvuM diff --git a/business_objects/store/__pycache__/product.cpython-312.pyc b/business_objects/store/__pycache__/product.cpython-312.pyc index af8e70191f0dc9cc0f6698bf25c6765e879879ca..662673a72204c85aefbea0b6bf1474e901112f2b 100644 GIT binary patch delta 1249 zcmZvbduUr#7{K%0BxR<#ZKO-mG+hlF>tn0Q+?sZc>FCqryLNtrtd^vBZ&Ic^q=CZwQirG)P_n4|= z-u|!`Dx5aoKfdUI9v@LdzD4<8>Z*J^v(O=^8j3EEEj|$MuTghf-eML1o(*DF5z2s6|j+Cs}q5jNpl4w^a6ZyTI|4p?vH1b=twl4jP@thAWuE|I6#(V5H(PAbbXvr+F#=7+CJ59v zyF|D`$P%a*c8x&Q*e$}RgwOfC)+w;cR>xc^zrJgY74Nl$Ykwruh(HDee9TX>(Pv3V zltojjuCk1>qU8_y?)L8`n8a{oCoJKS$oe9)2xnU`d^5Ch!b6>3|{(5gG z6j5;Na!6#n>JIaa%LpZ8zh<`yT?h52A{hF3!QzYLZ&~#4k$$zdCe@J-XX`VOqJ6PGfA~BYxytVI9h06a6p!asz z`RBzeooZ^>uP96%W{PqQQ>oK=%d=x~y0YO*%JLPVOr*-0<7s_)6^*3ZPM9V%5sdYG zO{a2#8%NXLI-}=Gl8v>LQ%A=8HJ<&7wUm&R(8F)1Hv^P#Y51J9k+zkywrMdnX;@cm kb8%HTCH|mEbsKBJY1ZRtw?fg;^c#r<6P*_NaaShr2cv;nP5=M^ delta 1237 zcmZvbe{54#6vumB+fCbbZJcc>b3fQJw&G~D&Tb59_5)a0LgVIeVNM>8^|`fc`|9nZ zW=)L5Xd*H34^Bk?5luh>gvsWOM1#g)GGc_F*r-?qS4}kjR~S)4LhznfNtF1K_j&hx z&$;KGdvf0K-{8+*q4vDPVKa&6qBlHUnqRDK>$JIrX%_EF4Ucr%q3SL76DEHRpIKiI zE{Co8Uyt90CjyV48g=5ez#4cDkEFVBIH=w0D7)=0SJ`CeUj;h=j^WjApEIYhxT43k zw5-o%)YW{=!#cpp17Q!$<9w(Q8u^9La{#AESrCe^DxOlN)fT)E@^S1+0=!Qyj^1!H ztmQr7*8n~s<+MoO4(oVTkJ$d9P%Iyb@^Sr!RS>|%4evOP3ezvKQSo6ds6^}V+1^eF z;i2BY>OT=;{{F|A7TY_e2jW>-$tm%qvL~r_@x_fh05MF11)!Q1ZmY;=;t34Nn7oab|+UdsbOF_(n9=oGit_Uf|sjGWcAsaa;i zlTY?WZqZg7>!&nk3htxTAYn71nlu_3Hb%HeCS7M3QmQ_q#h8`Kw-ag!S1C*<+()LH z;2;D^3lK_ouwUreqOe{zEjP9lEG?H?+Y6Rhc=k4U^X~urbIOz+&#Ar57){lO z4^t)W|CfSBF7N(lT;(w}l?li)Q!`AK_v72CcdIHr!r^pBgl@ooAT)?nMRPo@S6bFb zT0h}O!T`Z&;}u%1C3x^uy1v`EMF-hN``V}?V}y;#zpH&d@)9OEXdwU}@5(Gl50=FC vqIJ6#QJ>2z9XFhz>{1g=K{k3vqdF20s_VWvw$bB0RqqfvoR?O0RgnL VJStoQ0c4YzEI|YGZUU3zEGY7_Cs6NlUgL_0s;ZELnS!^0tErHekZR10uKSRFDVKE e0rRsuDqI2qYLk~NK?(3~0zLr*^nL-8+bk$z&n9~S diff --git a/business_objects/store/product.py b/business_objects/store/product.py index 880cffb8..2f06f41b 100644 --- a/business_objects/store/product.py +++ b/business_objects/store/product.py @@ -261,6 +261,7 @@ class Product(SQLAlchemy_ABC, Store_Base): has_variations: {self.has_variations} permutations: {self.permutations} variation trees: {self.variation_trees} + active: {self.active} ''' """ def get_index_permutation_from_id(self, id_permutation): diff --git a/business_objects/store/product_variation.py b/business_objects/store/product_variation.py index 20dacee0..e5ae26a8 100644 --- a/business_objects/store/product_variation.py +++ b/business_objects/store/product_variation.py @@ -118,69 +118,6 @@ class Product_Variation(db.Model, Store_Base): 'text': self.name } -""" -@dataclass -class Product_Variation_Filters(): - get_all_variation_type: bool - get_inactive_variation_type: bool - # get_first_variation_type: bool - ids_variation_type: str - get_all_variation: bool - get_inactive_variation: bool - # get_first_variation: bool - ids_variation: str - - def to_json(self): - return { - 'a_get_all_variation_type': self.get_all_variation_type, - 'a_get_inactive_variation_type': self.get_inactive_variation_type, - # 'a_get_first_variation_type': self.get_first_variation_type, - 'a_ids_variation_type': self.ids_variation_type, - 'a_get_all_variation': self.get_all_variation, - 'a_get_inactive_variation': self.get_inactive_variation, - # 'a_get_first_variation': self.get_first_variation, - 'a_ids_variation': self.ids_variation, - - } - "" - @staticmethod - def from_form(form): - av.val_instance(form, 'form', 'User_Filters.from_form', Filters_Product_Variation) - get_inactive = av.input_bool(form.active.data, "active", "User_Filters.from_form") - id_user = form.id_user.data - return User_Filters( - get_all_user = (id_user is None), - get_inactive_user = get_inactive, - get_first_user_only = False, - ids_user = id_user, - ids_user_auth0 = '', - ) - - @staticmethod - def from_user(user): - av.val_instance(user, 'user', 'User_Filters.from_user', User) - return User_Filters( - get_all_user = (user.id_user is None and user.id_user_auth0 is None), - get_inactive_user = False, - get_first_user_only = False, - ids_user = user.id_user, - ids_user_auth0 = user.id_user_auth0, - ) - "" - - @staticmethod - def get_default(): - return Product_Variation_Filters( - get_all_variation_type = True, - get_inactive_variation_type = False, - # get_first_variation_type = False, - ids_variation_type = '', - get_all_variation = True, - get_inactive_variation = False, - # get_first_variation = False, - ids_variation = '' - ) -""" class Parameters_Product_Variation(Get_Many_Parameters_Base): a_get_all_variation_type: bool a_get_inactive_variation_type: bool diff --git a/business_objects/unit_measurement.py b/business_objects/unit_measurement.py index a0b10b11..372026ff 100644 --- a/business_objects/unit_measurement.py +++ b/business_objects/unit_measurement.py @@ -108,54 +108,3 @@ class Unit_Measurement(SQLAlchemy_ABC, Base): is_unit_of_volume: {self.is_unit_of_volume}, active: {self.active} ''' - -""" -@dataclass -class Filters_Unit_Measurement(): - active_only: bool = False - - def to_json(self): - return { - **self.get_shared_json_attributes(self), - 'a_get_all_user': self.get_all_user, - 'a_get_inactive_user': self.get_inactive_user, - 'a_get_first_user_only': self.get_first_user_only, - 'a_ids_user': self.ids_user, - 'a_ids_user_auth0': self.ids_user_auth0, - } - - @staticmethod - def from_form(form): - av.val_instance(form, 'form', 'User_Filters.from_form', Form_Filters_User) - get_inactive = av.input_bool(form.active.data, "active", "User_Filters.from_form") - id_user = form.id_user.data - return User_Filters( - get_all_user = (id_user is None), - get_inactive_user = get_inactive, - get_first_user_only = False, - ids_user = id_user, - ids_user_auth0 = '', - ) - - @staticmethod - def from_user(user): - av.val_instance(user, 'user', 'User_Filters.from_user', User) - return User_Filters( - get_all_user = (user.id_user is None and user.id_user_auth0 is None), - get_inactive_user = False, - get_first_user_only = False, - ids_user = user.id_user, - ids_user_auth0 = user.id_user_auth0, - ) - - @staticmethod - def get_default(datastore_store): - user = datastore_store.get_login_user() - return User_Filters( - get_all_user = False, - get_inactive_user = False, - get_first_user_only = False, - ids_user = user.id_user, - ids_user_auth0 = '', - ) -""" \ No newline at end of file diff --git a/business_objects/user.py b/business_objects/user.py index 6364fda1..35f5c4c2 100644 --- a/business_objects/user.py +++ b/business_objects/user.py @@ -9,6 +9,7 @@ Feature: User Business Object # internal from business_objects.base import Base +from business_objects.db_base import Get_Many_Parameters_Base import lib.argument_validation as av from forms.forms import Form_Filters_User from extensions import db @@ -22,6 +23,9 @@ class User(db.Model, Base): NAME_ATTR_OPTION_VALUE: ClassVar[str] = Base.ATTR_ID_USER NAME_ATTR_OPTION_TEXT: ClassVar[str] = 'email' + __tablename__ = 'Shop_User' + __table_args__ = { 'extend_existing': True } + id_user = db.Column(db.Integer, primary_key=True) id_user_auth0 = db.Column(db.String(255)) firstname = db.Column(db.String(255)) @@ -34,13 +38,16 @@ class User(db.Model, Base): is_included_VAT_default = db.Column(db.Boolean) can_admin_store = db.Column(db.Boolean) can_admin_user = db.Column(db.Boolean) - + is_new = db.Column(db.Boolean) # is_logged_in: bool def __init__(self): self.id_user = 0 self.is_logged_in = False + self.is_new = False super().__init__() + self.currency_default = None + self.region_default = None def from_DB_user(query_row): _m = 'User.from_DB_user' @@ -58,6 +65,7 @@ class User(db.Model, Base): user.can_admin_store = av.input_bool(query_row[10], 'can_admin_store', _m) user.can_admin_user = av.input_bool(query_row[11], 'can_admin_user', _m) user.is_logged_in = (user.id_user is not None and user.id_user > 0) + user.is_new = av.input_bool(query_row[12], 'is_new', _m) return user @staticmethod @@ -140,58 +148,42 @@ class User(db.Model, Base): can_admin_user: {self.can_admin_user} ''' - - -@dataclass -class User_Filters(): + +class Parameters_User(Get_Many_Parameters_Base): get_all_user: bool get_inactive_user: bool - get_first_user_only: bool ids_user: str ids_user_auth0: str - def to_json(self): - return { - 'a_get_all_user': self.get_all_user, - 'a_get_inactive_user': self.get_inactive_user, - 'a_get_first_user_only': self.get_first_user_only, - 'a_ids_user': self.ids_user, - 'a_ids_user_auth0': self.ids_user_auth0, - } - @staticmethod def from_form(form): - av.val_instance(form, 'form', 'User_Filters.from_form', Form_Filters_User) - get_inactive = av.input_bool(form.active.data, "active", "User_Filters.from_form") + av.val_instance(form, 'form', 'Parameters_User.from_form', Form_Filters_User) + get_inactive = av.input_bool(form.active.data, "active", "Parameters_User.from_form") id_user = form.id_user.data - return User_Filters( + return Parameters_User( get_all_user = (id_user is None), get_inactive_user = get_inactive, - get_first_user_only = False, ids_user = id_user, ids_user_auth0 = '', ) @staticmethod def from_user(user): - av.val_instance(user, 'user', 'User_Filters.from_user', User) - return User_Filters( - get_all_user = (user.id_user is None and user.id_user_auth0 is None), + av.val_instance(user, 'user', 'Parameters_User.from_user', User) + return Parameters_User( + get_all_user = ((user.id_user is None or user.id_user == 0) and user.id_user_auth0 is None), get_inactive_user = False, - get_first_user_only = False, ids_user = user.id_user, ids_user_auth0 = user.id_user_auth0, ) @staticmethod - def get_default(datastore_store): - user = datastore_store.get_user_session() - return User_Filters( + def get_default(): + return Parameters_User( get_all_user = False, get_inactive_user = False, - get_first_user_only = False, - ids_user = user.id_user, - ids_user_auth0 = '', + ids_user = '', + ids_user_auth0 = '' ) """ User_Eval @dataclass @@ -278,3 +270,24 @@ class User_Permission_Evaluation(db.Model): can_edit: {self.can_edit} can_admin: {self.can_admin} ''' + + +class User_Temp(db.Model, Base): + __tablename__ = 'Shop_User_Temp' + __table_args__ = { 'extend_existing': True } + id_user = db.Column(db.Integer, primary_key=True) + id_user_auth0 = db.Column(db.String(255)) + firstname = db.Column(db.String(255)) + surname = db.Column(db.String(255)) + email = db.Column(db.String(255)) + is_email_verified = db.Column(db.Boolean) + is_super_user = db.Column(db.Boolean) + id_currency_default = db.Column(db.Integer) + id_region_default = db.Column(db.Integer) + is_included_VAT_default = db.Column(db.Boolean) + # is_logged_in: bool + + def __init__(self): + self.id_user = 0 + self.is_logged_in = False + super().__init__() \ No newline at end of file diff --git a/controllers/__pycache__/user.cpython-312.pyc b/controllers/__pycache__/user.cpython-312.pyc index cd73e808436bcc3b40717977b1376b998b3cf4d6..39b3bf261b3b77e12f839bbd571edcfe4d5d9ded 100644 GIT binary patch delta 1410 zcmYjRT}&fY6ux(U=uDY*x-IPtl(v+XZTShXP-H>eQVWP6#<($r7^y5REJ(pji|dlI z7@le*5i&7gHfFnt2F;qlru*RA23SoOR@0^=QyVb*s1L@jl4!Co-k~k*Je>2L?>qOq zH)rn5pKm9I)dwn-5}=1W?wH)FyRUwRYuLBOgt1^C91udjcR~Rn&JZjKY4JC@D&9$t z!}uNL=a_!;V|)bMfHnZZ6j%f!U=^<1k9$=NzU0CH_ypvL9!U1UBT6e#<`iY#xN%51 z&Z-#qJ-224&YW~!PFgw+sm>gxpqZRTK^u;A73*DVUD2K#hN~)$IJ3k#Qk)~r)vgjJ zN}bmR39w`Dvmhox5dEcif+|5mLQVAR@r1Sn@#2=&4L9O{X}=)t;fwNg<>xl=mqwJg z!B@mRm}g*qYBn*(x5FRf8NL*U3h@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^P!v8UY{x=XFV8`Q}dxI4pvVuB$ z6C*DptN>VWwD^B9)5Mo{H1YPqZt*XnGC6pa1Uasu0GSBCv8#VE0is=Nm2xFDuhY_; zSzylX#?T(jYdOohYd!`RHjVHS!dnPe0ql^XIB|KZX^H}4rVXslm>F~GvvF;_J9dio z0l=Tj!Y!}cTAWwq$yL?}E zfOPQ}v;F*wY{Kh?WOkCD%Wj4{nEBI+TB17h@X&DQE-(7x(`8FFuw%{XQ}D{Hetf_T z2MY5c_%SL#&y=WP;hbXut_?Q^@MYMWW=y8@0@KB53OhOj zJe^jo=d_%bpQHK$3p-h>3^>$nuT^4dk=mkZ*&b&Ni-O%5XRHn*e8q)A&VX95dUW7m zw!Ni=>7r`PvN)PHAvlfHj1rCCLdY#KK-_l{0_j*4 nM%ElLM+dkKYmS@1*_*`c>bc diff --git a/datastores/__pycache__/datastore_store_base.cpython-312.pyc b/datastores/__pycache__/datastore_store_base.cpython-312.pyc index 1c69cf606ff9f96348c75cd106354e567534acca..90a724f0e11e49edda3671991d3bd9b78333f3c1 100644 GIT binary patch delta 1839 zcmZ`(O>7%Q6y9-@b?{%4)OKtqu~R#?0%W_RmY?Am5_ z9h!>PJwyl)MQul_kSHfOAc`R16F(9lBtSq9AbRM6M3E}EfrNyFiiDWAHc1qfJ$(E2 zoA14O^UdsB*g$`saeeJ{+8Fx0@8Ehn~F@|E!4^2}!+5SdDNIGwxGH)hHJ= z<9;Qk#<{o|?^DLq1eY*lw=%9Kxuh9;lzY_!+=Ll>m4oUeH)+NLN=i+0>5gWKo1*i0 zlxc37zJ1Ceb%vW!XSw@l)eM(0MSdl#=D3`i=kn%vKq;tm+?*K?Dn+%(6%k`$jxy5F z1|tp2(QA8PJq*LmuX_@~*5~LZYJI!Mf>4fp-*qeMlzKMMwYG%edS!>?lI>(Nlt{4%VPgX*4 z^dWg6L{PdF90^&P=RshhaK|Q}mc@o%sg_4@1~Pi;icrwKjuhST0v;)dY)A5;-*)5}?v+AhEVbG>zRVNv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*M z3?GlaZOiJX4U3MXraKUww@A~TV{YXI=S)kk<~i%KnaQnwx8bb=9}g_2nS9v`mdZO8 zCadtKrEJks_GZ!i-ucKvdGB>gXvt>3Y4b1I{PPV9-3PAO9wB?G>V^yKbD2wp<+mAA zR@L0lcaGwlj=-WLFyDU7(L6W2WGy_q|E2xsJ8xLM%NaD~j(MZDXTEFRzfc~$Zs{O> zb)F38TpsQqBMtMp?@*EW0}6gKjuKmAOR)gV+W_xVP|Xz9)=i#hJcOFbrN%zm8^#GXbyO4)TSpOD3AUonWJ5>Pgk0p+u7KGOX+Cnft7s+w zVLdoKYky$}-3K z5pJifO8c1UHyS==Q5}=TFvb%TA}6}P-sZ}1{hr2{ZObMaEw>S0k3Xjaih`s59m&Uf z%qFj6G@(i{QB}G4=qWL(sZ9xbsbV|iIRKpGSg6SiJB8ikY^eQV4-IvXz-v4ltfJbq z9&)2Rom&LY>Gh_#fl}Y#D#<`M)1!JlgWUo>eFN;97-QqWJXAPU(hz3f!fbU{$SwW GnE4;7gLx4E diff --git a/datastores/__pycache__/datastore_user.cpython-312.pyc b/datastores/__pycache__/datastore_user.cpython-312.pyc index 2b9600aaf2762a1279dc0ece7ef69515fa72c143..6ed0f14109d04cbbb0f59cb3b6934afb4673a21f 100644 GIT binary patch delta 145 zcmeCRo@>o}nwOW00SFTBSf=mT$ScAmz#ouUl$e`Zl3G+8A6lGRG+B>Ho?FBvu_Q6L zB)=#%esd7h2S!Hi&CV=Rtc-e_<2c1Q8OtY^3hA=wU*YiDyiCZHgK_udJ5oiA>XZGY xA27;KHjojWY%lYMF>11otQ33jMTX#~3=WfhWsUhRh-!Xi2xDfHEs_Je0RV0LDro=! delta 146 zcmbPh-D}NznwOW00SN9yD5j@w 0: + errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1]) + for error in errors: + Helper_App.console_log(f"Error [{error.code}]: {error.msg}") + + DataStore_Base.db_cursor_clear(cursor) + cursor.close() + + return users, errors @staticmethod def upload_bulk(permanent_table_name, records, batch_size): _m = 'DataStore_Base.upload_bulk' @@ -282,4 +316,30 @@ class DataStore_Base(BaseModel): DataStore_Base.db_cursor_clear(cursor) cursor.close() - return units, errors \ No newline at end of file + return units, errors + + @classmethod + def get_many_region(cls, get_inactive = False): + _m = 'DataStore_Store_Base.get_many_region' + _m_db_region = 'p_shop_get_many_region' + + argument_dict_list_region = { + 'a_get_inactive_region': 1 if get_inactive else 0 + } + + Helper_App.console_log(f'executing {_m_db_region}') + result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region) + cursor = result.cursor + Helper_App.console_log('data received') + + # cursor.nextset() + result_set_1 = cursor.fetchall() + regions = [] + for row in result_set_1: + region = Region.from_DB_region(row) + regions.append(region) + Helper_App.console_log(f'regions: {regions}') + DataStore_Base.db_cursor_clear(cursor) + cursor.close() + + return regions \ No newline at end of file diff --git a/datastores/datastore_store_base.py b/datastores/datastore_store_base.py index d9a8e5b9..235fd74e 100644 --- a/datastores/datastore_store_base.py +++ b/datastores/datastore_store_base.py @@ -25,7 +25,6 @@ from business_objects.store.product import Product, Product_Permutation, Paramet from business_objects.sql_error import SQL_Error from business_objects.store.stock_item import Stock_Item from business_objects.store.storage_location import Storage_Location -from business_objects.user import User, User_Filters, User_Permission_Evaluation from business_objects.store.product_variation import Product_Variation, Parameters_Product_Variation from business_objects.store.product_variation_type import Product_Variation_Type from datastores.datastore_base import DataStore_Base @@ -274,32 +273,6 @@ class DataStore_Store_Base(DataStore_Base): return currencies - @classmethod - def get_many_region(cls, get_inactive = False): - _m = 'DataStore_Store_Base.get_many_region' - _m_db_region = 'p_shop_get_many_region' - - argument_dict_list_region = { - 'a_get_inactive_region': 1 if get_inactive else 0 - } - - Helper_App.console_log(f'executing {_m_db_region}') - result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region) - cursor = result.cursor - Helper_App.console_log('data received') - - # cursor.nextset() - result_set_1 = cursor.fetchall() - regions = [] - for row in result_set_1: - region = Region.from_DB_region(row) - regions.append(region) - Helper_App.console_log(f'regions: {regions}') - DataStore_Store_Base.db_cursor_clear(cursor) - cursor.close() - - return regions - @classmethod def get_many_region_and_currency(cls, get_inactive_currency = False, get_inactive_region = False): _m = 'DataStore_Store_Base.get_many_region_and_currency' diff --git a/datastores/datastore_user.py b/datastores/datastore_user.py index b9e98b61..42e1a523 100644 --- a/datastores/datastore_user.py +++ b/datastores/datastore_user.py @@ -15,8 +15,9 @@ Datastore for Users import lib.argument_validation as av from business_objects.sql_error import SQL_Error from business_objects.store.stock_item import Stock_Item -from business_objects.user import User, User_Filters, User_Permission_Evaluation -from datastores.datastore_base import DataStore_Base +from business_objects.user import User, Parameters_User, User_Permission_Evaluation +# from datastores.datastore_base import DataStore_Base +from datastores.datastore_store_base import DataStore_Store_Base from helpers.helper_app import Helper_App from helpers.helper_db_mysql import Helper_DB_MySQL # from models.model_view_store_checkout import Model_View_Store_Checkout # circular! @@ -35,7 +36,7 @@ from datetime import datetime db = SQLAlchemy() -class DataStore_User(DataStore_Base): +class DataStore_User(DataStore_Store_Base): # Global constants # Attributes @@ -120,7 +121,7 @@ class DataStore_User(DataStore_Base): Helper_App.console_log(_m) # av.val_str(user_filters, 'user_filters', _m) # av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1) - av.val_instance(user_filters, 'user_filters', _m, User_Filters) + av.val_instance(user_filters, 'user_filters', _m, Parameters_User) guid = Helper_DB_MySQL.create_guid() # now = datetime.now() @@ -188,7 +189,7 @@ class DataStore_User(DataStore_Base): Helper_App.console_log(_m) # av.val_str(user_filters, 'user_filters', _m) # av.val_list(permutations, 'list_permutations', _m, Product_Permutation, 1) - av.val_instance(user_filters, 'user_filters', _m, User_Filters) + av.val_instance(user_filters, 'user_filters', _m, Parameters_User) guid = Helper_DB_MySQL.create_guid() # now = datetime.now() diff --git a/helpers/__pycache__/helper_app.cpython-312.pyc b/helpers/__pycache__/helper_app.cpython-312.pyc index 1900ccb8f63271a86183e1c08685e5e89377e307..03d538fcd1d32b1f0e5b8867117b90eed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cJXc&^DG&|@X=0rM8 z`ds2vDG%RPXXEx(9Y5Th%Xc?)lFj@=!}PLDo!z*p1BK^*q4k;2LVl@n74gdt8%@Mp zgT5k)!8T{q>CKJtzJWj}7L+9A9i^HSo7;G-c@24<&ouYLL5f;tTN;4MrDu)E*o2}G zFTL)u4OlaLKE}B`!#PAk{9tPYxbC*T?#y(q7K$K=^FSMG!_iQJd6fkGblV0JmH%v8 zLe`5@=iruR+!CwCc7lMXA_{66W^^P7QTNf&=@MJ05~ zxfLF=kAJrUo7w9VHZRhR<~W}7I0ikA@FvIF<&F((9e^&9GKPZ*8c0M3>0CeYy&X;D z6@IRxB17?eM+vlDZl?|CU7e++uVOaYaFqS3A1wLF#DSNtXB9IepiI>B6TYLfkyz!) zP7lc)o~sYTi)RwQ)iqc+f$9+ylPHd%IF8~34|h9rWmNHPuo)ER`JryN{!>&x<5#;w zytb!+e9PDMbhX_@@GlhiP~1m>gM%$Zk)Cg$rL;JQ#6)8_>6nUN?QxG~VahnqSU!qE z6gWJ@n`UL8rLrY>Ez!^*O>B>cStT0rtufKhqUT!ib2*9*6su6IMX>=zFA5xWOpBT* zk{BD%wAty_tpKZZNFG}`qLH<08g$y5THn`l`;&JFG0Lu|J|~5bhu+Wf4aUQ}Vzh$| aa(%CzG;(LJ+Zxu9l4Nw!`iBZNvD3dam^s1# diff --git a/models/__pycache__/model_view_user.cpython-312.pyc b/models/__pycache__/model_view_user.cpython-312.pyc index 4f2a389ef4abd4a1d7de491d2013b6ced265c7a7..5bd2c9680917ef99b5d8b8d13517c3d5a026bd5d 100644 GIT binary patch delta 1293 zcmYjRO-~y~7@k?r+G~St9Kc^BDoqGviy&$n)D)q%Zb~3ga43cx+)5+YyEcyefo9gF zuBhw-2S;ioyH-{H1HJVJ^jfJGBUi;5afqt+4x*@4Pn~yd6Xx)|A2aW}^E~rve;PXR z`+oI$JxH$IllQaN)uu0uKW@&vIc;ErBLAuE67myk>NDSp#u&hlyp^Gy4L*S zkDIBh-_gx4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m)sF922X<<7AwRNHAMESmv?{oc|JKNvHga_Tn~_fAmx~h$0=p%eO1j+@r!c4a zH_gnIIjqE|s%2iUD@R0xUxM$sF_AZsfPflu&EGe3&f?NYpWUmzl!J};`qJUPmE5}a z(Oo@oSAPOE3P%W`r;xbfnt{cb*DNy@oY}yp%8OxOkFmE8N|FnFa$vT*ty-fZ^naSd z!4)cpW`5gw#p~30K`f{ox|CT3-?e!{$PtYaeVhhzX>0 a_id_user + )) THEN + DELETE FROM tmp_Msg_Error; + 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 other Users.' + ) + ; + END IF; + + CALL p_shop_clear_calc_user(a_guid); + + IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN + START TRANSACTION; + + INSERT INTO Shop_User_Change_Set ( comment ) + VALUES ( a_comment ) + ; + + SET v_id_change_set := LAST_INSERT_ID(); + + UPDATE Shop_User U + INNER JOIN tmp_User t_U ON U.id_user = t_U.id_user + SET + U.id_user_auth0 = t_U.id_user_auth0 + , U.firstname = t_U.firstname + , U.surname = t_U.surname + , U.email = t_U.email + , U.is_email_verified = t_U.is_email_verified + , U.is_super_user = t_U.is_super_user + , U.id_currency_default = t_U.id_currency_default + , U.id_region_default = t_U.id_region_default + , U.is_included_VAT_default = t_U.is_included_VAT_default + , U.active = t_U.active + , U.id_change_set = v_id_change_set + ; + + DELETE FROM Shop_User_Temp + WHERE GUID = a_guid; + + COMMIT; + END IF; # Errors SELECT * - FROM tmp_Msg_Error - ; + FROM tmp_Msg_Error t_ME + INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type + ; - /* - # Return arguments for test - SELECT a_id_user, - a_name, - a_email, - a_email_verified - ; - */ - - -- Clean up + IF a_debug = 1 THEN + SELECT * from tmp_User; + END IF; + DROP TABLE IF EXISTS tmp_Msg_Error; - DROP TABLE IF EXISTS tmp_Shop_User; + DROP TABLE IF EXISTS tmp_User; + + IF a_debug = 1 THEN + CALL partsltd_prod.p_debug_timing_reporting ( v_time_start ); + END IF; END // DELIMITER ;; -/* - -CALL p_shop_edit_user ( - '', - '', - '', - 0 -) - -*/ - - -- File: 7313_p_get_many_user.sql @@ -16014,7 +16132,6 @@ CREATE PROCEDURE p_get_many_user ( , IN a_id_user_auth0 VARCHAR(200) , IN a_get_all_user BIT , IN a_get_inactive_user BIT - , IN a_get_first_user_only BIT , IN a_ids_user LONGTEXT , IN a_ids_user_auth0 LONGTEXT , IN a_debug BIT @@ -16026,7 +16143,6 @@ BEGIN DECLARE v_id_permission_user INT; DECLARE v_id_permission_user_admin INT; DECLARE v_ids_permission_required VARCHAR(4000); - DECLARE v_now DATETIME; DECLARE v_id_minimum INT; DECLARE v_code_error_bad_data VARCHAR(50); DECLARE v_id_type_error_bad_data INT; @@ -16035,6 +16151,7 @@ BEGIN DECLARE v_guid BINARY(36); DECLARE v_rank_max INT; DECLARE v_time_start TIMESTAMP(6); + DECLARE v_is_new BIT; SET v_time_start := CURRENT_TIMESTAMP(6); SET v_guid := UUID(); @@ -16046,10 +16163,11 @@ BEGIN SET v_code_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1); SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_error_bad_data LIMIT 1); SET v_ids_permission_required := CONCAT(v_id_permission_user, ',', v_id_permission_user_admin, ',', v_id_permission_store_admin); + SET v_is_new := FALSE; SET a_get_all_user := IFNULL(a_get_all_user, 1); SET a_get_inactive_user := IFNULL(a_get_inactive_user, 0); - SET a_get_first_user_only := IFNULL(a_get_first_user_only, 0); + -- SET a_get_first_user_only := IFNULL(a_get_first_user_only, 0); SET a_ids_user := TRIM(IFNULL(a_ids_user, '')); SET a_ids_user_auth0 := TRIM(IFNULL(a_ids_user_auth0, '')); SET a_debug := IFNULL(a_debug, 0); @@ -16060,7 +16178,7 @@ BEGIN , a_id_user_auth0 , a_get_all_user , a_get_inactive_user - , a_get_first_user_only + -- , a_get_first_user_only , a_ids_user , a_ids_user_auth0 , a_debug @@ -16095,17 +16213,33 @@ BEGIN END IF; IF ISNULL(a_id_user) THEN - INSERT INTO tmp_Msg_Error ( - id_type, - code, - msg - ) - VALUES ( - v_id_type_error_bad_data, - v_code_error_bad_data, - CONCAT('User ID required for authorisation.') - ) - ; + IF NOT ISNULL(a_id_user_auth0) THEN + INSERT INTO partsltd_prod.Shop_User ( + id_user_auth0 + , is_super_user + , active + ) + VALUES ( + a_id_user_auth0 + , 0 -- is_super_user + , 1 -- active + ) + ; + SET a_id_user := (SELECT U.id_user FROM partsltd_prod.Shop_User U WHERE U.id_user_auth0 = a_id_user_auth0 LIMIT 1); + SET v_is_new := TRUE; + ELSE + INSERT INTO tmp_Msg_Error ( + id_type, + code, + msg + ) + VALUES ( + v_id_type_error_bad_data, + v_code_error_bad_data, + CONCAT('User ID required for authorisation.') + ) + ; + END IF; END IF; SET v_has_filter_user := CASE WHEN a_ids_user = '' THEN 0 ELSE 1 END; @@ -16272,6 +16406,7 @@ BEGIN SELECT * FROM tmp_User; END IF; + /* IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN IF a_get_first_user_only THEN DELETE t_U @@ -16280,6 +16415,7 @@ BEGIN ; END IF; END IF; + */ IF a_debug = 1 THEN SELECT * FROM tmp_User; @@ -16444,6 +16580,7 @@ BEGIN , U.is_super_user , t_U.can_admin_store , t_U.can_admin_user + , v_is_new AS is_new FROM tmp_User t_U INNER JOIN partsltd_prod.Shop_User U ON t_U.id_user = U.id_user ; @@ -16482,13 +16619,22 @@ DELIMITER ;; -CALL p_get_many_user (NULL, 'google-oauth2|109567376920138999933', False, False, False, NULL, 'google-oauth2|109567376920138999933', 0); +CALL p_get_many_user ( + NULL + , 'google-oauth2|109567376920138999933' + , False + , False + -- , False + , NULL + , 'google-oauth2|109567376920138999933' + , 0 +); /* NULL # a_id_user , 'auth0|6582b95c895d09a70ba10fef' # a_id_user_auth0 , 0 # a_get_all_user , 0 # a_get_inactive_user - , 0 # a_get_first_user_only + -- , 0 # a_get_first_user_only , NULL # a_ids_user , 'auth0|6582b95c895d09a70ba10fef' # a_ids_user_auth0 , 0 -- a_debug @@ -16506,7 +16652,7 @@ CALL p_get_many_user( , 'auth0|6582b95c895d09a70ba10fef' -- :a_id_user_auth0, , 1 -- :a_get_all_user, , 0 -- :a_get_inactive_user, - , 0 -- :a_get_first_user_only, + -- , 0 -- :a_get_first_user_only, , NULL -- :a_ids_user, , 'auth0|6582b95c895d09a70ba10fef' -- :a_ids_user_auth0 ); @@ -24265,12 +24411,34 @@ INSERT INTO Shop_User ( , firstname , surname , email - # email_verified , is_super_user + , active ) VALUES - ('auth0|6582b95c895d09a70ba10fef', 'Teddy', 'Middleton-Smith', 'edward.middletonsmith@gmail.com', 1), - ('parts_guest', 'Guest', '', '', 0) + ( + 'auth0|6582b95c895d09a70ba10fef' -- id_user_auth0 + , 'Teddy' -- firstname + , 'Middleton-Smith' -- surname + , 'edward.middletonsmith@gmail.com' -- email + , 1 -- is_super_user + , 1 -- active + ), + ( + 'parts_guest' -- id_user_auth0 + , 'Guest' -- firstname + , '' -- surname + , '' -- email + , 0 -- is_super_user + , 1 -- active + ), + ( + 'auth0|672659014296b7f94a9bab45' -- id_user_auth0 + , 'Tierney' -- firstname + , 'Gullen' -- surname + , 'tierneybailey13@gmail.com' -- email + , 1 -- is_super_user + , 1 -- active + ) ; # User Role link diff --git a/static/MySQL/0001_destroy.sql b/static/MySQL/0001_destroy.sql index b9a69b75..bf589c9a 100644 --- a/static/MySQL/0001_destroy.sql +++ b/static/MySQL/0001_destroy.sql @@ -117,6 +117,7 @@ DROP TABLE IF EXISTS Shop_User_Address; DROP TABLE IF EXISTS Shop_User_Role_Link_Audit; DROP TABLE IF EXISTS Shop_User_Role_Link; +DROP TABLE IF EXISTS Shop_User_Temp; DROP TABLE IF EXISTS Shop_User_Audit; DROP TABLE IF EXISTS Shop_User; diff --git a/static/MySQL/1312_tbl_Shop_User.sql b/static/MySQL/1312_tbl_Shop_User.sql index 629ac72c..7a10e89a 100644 --- a/static/MySQL/1312_tbl_Shop_User.sql +++ b/static/MySQL/1312_tbl_Shop_User.sql @@ -8,9 +8,9 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning CREATE TABLE IF NOT EXISTS Shop_User ( id_user INT NOT NULL AUTO_INCREMENT PRIMARY KEY, id_user_auth0 VARCHAR(200) NOT NULL, - firstname VARCHAR(255) NOT NULL, - surname VARCHAR(255) NOT NULL, - email VARCHAR(254) NOT NULL, + firstname VARCHAR(255) NULL, + surname VARCHAR(255) NULL, + email VARCHAR(254) NULL, is_email_verified BIT NOT NULL DEFAULT 0, is_super_user BIT NOT NULL DEFAULT 0, id_currency_default INT NULL, diff --git a/static/MySQL/1314_tbl_Shop_User_Temp.sql b/static/MySQL/1314_tbl_Shop_User_Temp.sql new file mode 100644 index 00000000..b9728a76 --- /dev/null +++ b/static/MySQL/1314_tbl_Shop_User_Temp.sql @@ -0,0 +1,22 @@ + +# Users Temp + +-- DROP TABLE IF EXISTS Shop_User_Temp; + +SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_User_Temp'; + +CREATE TABLE IF NOT EXISTS Shop_User_Temp ( + id_temp INT NOT NULL AUTO_INCREMENT PRIMARY KEY + , id_user INT NOT NULL + , id_user_auth0 VARCHAR(200) NOT NULL + , firstname VARCHAR(255) + , surname VARCHAR(255) + , email VARCHAR(254) + , is_email_verified BIT + , is_super_user BIT + , id_currency_default INT + , id_region_default INT + , is_included_VAT_default BIT + , active BIT + , guid BINARY(36) NOT NULL +); diff --git a/static/MySQL/7200_p_shop_save_product_category.sql b/static/MySQL/7200_p_shop_save_product_category.sql index e98199dc..1a00e9c5 100644 --- a/static/MySQL/7200_p_shop_save_product_category.sql +++ b/static/MySQL/7200_p_shop_save_product_category.sql @@ -24,19 +24,14 @@ BEGIN DECLARE exit handler for SQLEXCEPTION BEGIN - -- Get diagnostic information GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE , @errno = MYSQL_ERRNO , @text = MESSAGE_TEXT ; - -- Rollback the transaction ROLLBACK; - -- Select the error information - -- SELECT 'Error' AS status, @errno AS error_code, @sqlstate AS sql_state, @text AS message; - CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT , id_type INT NULL @@ -131,7 +126,7 @@ BEGIN SELECT v_id_type_error_bad_data , v_code_type_error_bad_data - , CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg + , CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg FROM tmp_Category t_C WHERE ISNULL(t_C.code) ; @@ -146,7 +141,7 @@ BEGIN SELECT v_id_type_error_bad_data , v_code_type_error_bad_data - , CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg + , CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg FROM tmp_Category t_C WHERE ISNULL(t_C.name) ; @@ -161,7 +156,7 @@ BEGIN SELECT v_id_type_error_bad_data , v_code_type_error_bad_data - , CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg + , CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg FROM tmp_Category t_C WHERE ISNULL(t_C.display_order) ; diff --git a/static/MySQL/7203_p_shop_save_product.sql b/static/MySQL/7203_p_shop_save_product.sql index 3f9d1dfd..30693e1c 100644 --- a/static/MySQL/7203_p_shop_save_product.sql +++ b/static/MySQL/7203_p_shop_save_product.sql @@ -266,6 +266,7 @@ BEGIN , 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; diff --git a/static/MySQL/7206_p_shop_save_product_permutation.sql b/static/MySQL/7206_p_shop_save_product_permutation.sql index 37c58cb2..82dc3414 100644 --- a/static/MySQL/7206_p_shop_save_product_permutation.sql +++ b/static/MySQL/7206_p_shop_save_product_permutation.sql @@ -536,7 +536,9 @@ BEGIN ; UPDATE Shop_Product_Permutation PP - INNER JOIN tmp_Permutation t_P ON PP.id_permutation = t_P.id_permutation + INNER JOIN tmp_Permutation t_P + ON PP.id_permutation = t_P.id_permutation + AND t_P.is_new = 0 SET PP.id_product = t_P.id_product , PP.description = t_P.description diff --git a/static/MySQL/7312_p_shop_save_user.sql b/static/MySQL/7312_p_shop_save_user.sql index fe964f7b..18d2c707 100644 --- a/static/MySQL/7312_p_shop_save_user.sql +++ b/static/MySQL/7312_p_shop_save_user.sql @@ -1,180 +1,275 @@ - - -/* - -CALL p_shop_edit_user ( - 'auth0|6582b95c895d09a70ba10fef', # a_id_user - '', # a_name - '', # a_email - 0 # a_email_verified -) - -*/ - - --- Clear previous proc -DROP PROCEDURE IF EXISTS p_shop_edit_user; + +DROP PROCEDURE IF EXISTS p_shop_save_user; DELIMITER // -CREATE PROCEDURE p_shop_edit_user ( - IN a_id_user INT, - IN a_name VARCHAR(255), - IN a_email VARCHAR(254), - IN a_email_verified BIT +CREATE PROCEDURE p_shop_save_user ( + IN a_comment VARCHAR(500), + IN a_guid BINARY(36), + IN a_id_user INT, + IN a_debug BIT ) BEGIN - -- Argument redeclaration - -- Variable declaration - DECLARE v_has_filter_user BIT; - -- DECLARE v_now DATETIME; + DECLARE v_code_type_error_bad_data VARCHAR(100); + DECLARE v_id_type_error_bad_data INT; + DECLARE v_id_permission_product INT; + DECLARE v_id_permission_user_admin LONGTEXT; + DECLARE v_id_change_set INT; + DECLARE v_id_access_level_edit INT; + DECLARE v_can_admin_user BIT; + DECLARE v_time_start TIMESTAMP(6); + DECLARE exit handler for SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 + @sqlstate = RETURNED_SQLSTATE + , @errno = MYSQL_ERRNO + , @text = MESSAGE_TEXT + ; + + ROLLBACK; + + CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( + display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT + , id_type INT NULL + , code VARCHAR(50) NOT NULL + , msg VARCHAR(4000) NOT NULL + ); + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + SELECT + MET.id_type + , @errno + , @text + FROM partsltd_prod.Shop_Msg_Error_Type MET + WHERE MET.code = 'MYSQL_ERROR' + ; + SELECT * + FROM tmp_Msg_Error; + DROP TABLE IF EXISTS tmp_Msg_Error; + END; - -- Argument validation + default values - IF a_id_user IS NULL THEN - SET a_id_user = ''; - ELSE - SET a_id_user = TRIM(a_id_user); - END IF; - IF a_name IS NULL THEN - SET a_name = ''; - ELSE - SET a_name = TRIM(a_name); - END IF; - IF a_email IS NULL THEN - SET a_email = ''; - ELSE - SET a_email = TRIM(a_email); - END IF; - IF a_email_verified IS NULL THEN - SET a_email_verified = 0; - END IF; + SET v_time_start := CURRENT_TIMESTAMP(6); + SET v_code_type_error_bad_data := 'BAD_DATA'; + SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1); + SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1); + SET v_id_permission_user_admin := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM Shop_Permission WHERE code = 'STORE_USER_ADMIN' LIMIT 1); + CALL p_validate_guid ( a_guid ); - -- Temporary tables DROP TABLE IF EXISTS tmp_Msg_Error; - DROP TABLE IF EXISTS tmp_Shop_User; + DROP TABLE IF EXISTS tmp_User; - CREATE TABLE tmp_Shop_User ( - id_user INT NOT NULL, - CONSTRAINT FK_tmp_Shop_User_id_user - FOREIGN KEY (id_user) - REFERENCES Shop_User(id_user), - active BIT NOT NULL + CREATE TABLE tmp_User ( + id_user INT NOT NULL + , id_user_auth0 VARCHAR(200) NOT NULL + , firstname VARCHAR(255) + , surname VARCHAR(255) + , email VARCHAR(254) + , is_email_verified BIT NOT NULL + , is_super_user BIT NOT NULL + , id_currency_default INT + , id_region_default INT + , is_included_VAT_default BIT + , active BIT NOT NULL + , name_error VARCHAR(1000) ); CREATE TABLE tmp_Msg_Error ( display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT, id_type INT NOT NULL, - # code VARCHAR(50) NOT NULL, - # CONSTRAINT chk_tmp_Msg_Error_code CHECK (code IN (SELECT code FROM Shop_Msg_Error_Type)), - CONSTRAINT FK_tmp_Msg_Error_id_type - FOREIGN KEY (id_type) - REFERENCES Shop_Msg_Error_Type(id_type), + code VARCHAR(50) NOT NULL, msg VARCHAR(4000) NOT NULL ); - - -- Parse filters - SET v_has_filter_user = CASE WHEN a_id_user = '' THEN 0 ELSE 1 END; - - - -- User - IF v_has_filter_user THEN - INSERT INTO tmp_Shop_User ( - id_user, - active - ) - SELECT id_user, - active - FROM Shop_User - WHERE id_user LIKE CONCAT('%', a_id_user, '%') - AND active - LIMIT 1 - ; - - IF NOT EXISTS (SELECT id_user FROM tmp_Shop_User LIMIT 1) THEN - INSERT INTO Shop_User ( - id_user, - name, - email, - email_verified - ) - VALUES ( - a_id_user, - a_name, - a_email, - a_email_verified - ); - - INSERT INTO tmp_Shop_User ( - id_user, - active - ) - SELECT id_user, - active - FROM Shop_User - WHERE id_user LIKE CONCAT('%', a_id_user, '%') - AND active - LIMIT 1 - ; - END IF; - - SET a_id_user := (SELECT id_user FROM tmp_Shop_User LIMIT 1); - ELSE - INSERT INTO tmp_Msg_Error ( - id_type, - msg - ) - VALUES ( - (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1), - 'No user ID provided.' - ) - ; - END IF; - - - /* - IF NOT EXISTS (SELECT msg FROM tmp_Msg_Error LIMIT 1) THEN - END IF; - */ - - - -- Returns - # User - SELECT * - FROM tmp_Shop_User + -- Get data from Temp table + INSERT INTO tmp_User ( + id_user + , id_user_auth0 + , firstname + , surname + , email + , is_email_verified + , is_super_user + , id_currency_default + , id_region_default + , is_included_VAT_default + , active + ) + SELECT + U_T.id_user + , U_T.id_user_auth0 + , IFNULL(U_T.firstname, U.firstname) AS firstname + , IFNULL(U_T.surname, U.surname) AS surname + , IFNULL(U_T.email, U.email) AS email + , IFNULL(U_T.is_email_verified, U.is_email_verified) AS is_email_verified + , IFNULL(U_T.is_super_user, U.is_super_user) AS is_super_user + , IFNULL(U_T.id_currency_default, U.id_currency_default) AS id_currency_default + , IFNULL(U_T.id_region_default, U.id_region_default) AS id_region_default + , IFNULL(U_T.is_included_VAT_default, U.is_included_VAT_default) AS is_included_VAT_default + , IFNULL(IFNULL(U_T.active, U.active), 1) AS active + , IFNULL(U_T.display_order, PC.display_order) AS display_order + FROM partsltd_prod.Shop_User_Temp U_T + LEFT JOIN Shop_User U ON U_T.id_user = U.id_user + WHERE U_T.guid = a_guid ; + + UPDATE tmp_User t_U + SET + t_U.name_error = IFNULL(t_U.email, t_U.id_user_auth0) + ; + + -- Validation + -- Missing mandatory fields + -- email + IF EXISTS (SELECT * FROM tmp_User t_U WHERE ISNULL(t_U.email) LIMIT 1) THEN + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + SELECT + v_id_type_error_bad_data + , v_code_type_error_bad_data + , CONCAT('The following User(s) do not have an email: ', GROUP_CONCAT(t_U.name_error SEPARATOR ', ')) AS msg + FROM tmp_User t_U + WHERE ISNULL(t_U.email) + ; + END IF; + -- is_super_user + IF EXISTS (SELECT * FROM tmp_User t_U WHERE ISNULL(t_U.is_super_user) LIMIT 1) THEN + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + SELECT + v_id_type_error_bad_data + , v_code_type_error_bad_data + , CONCAT('The following User(s) do not have an is super user field: ', GROUP_CONCAT(t_U.name_error SEPARATOR ', ')) AS msg + FROM tmp_User t_U + WHERE ISNULL(t_U.is_super_user) + ; + END IF; + -- is_email_verified + IF EXISTS (SELECT * FROM tmp_User t_U WHERE ISNULL(t_U.is_email_verified) LIMIT 1) THEN + INSERT INTO tmp_Msg_Error ( + id_type + , code + , msg + ) + SELECT + v_id_type_error_bad_data + , v_code_type_error_bad_data + , CONCAT('The following User(s) do not have an is email verified: ', GROUP_CONCAT(t_U.name_error SEPARATOR ', ')) AS msg + FROM tmp_User t_U + WHERE ISNULL(t_U.is_email_verified) + ; + END IF; + + + -- Permissions + IF a_debug = 1 THEN + SELECT + a_guid -- GUID + , a_id_user -- ID User + , FALSE -- get inactive Users + , v_id_permission_user_admin -- IDs Permission + , v_id_access_level_edit -- ID Access Level + , NULL -- IDs Product + ; + END IF; + + CALL p_shop_calc_user( + a_guid -- GUID + , a_id_user -- ID User + , FALSE -- get inactive Users + , v_id_permission_user_admin -- IDs Permission + , v_id_access_level_edit -- ID Access Level + , NULL -- IDs Product + ); + + SET v_can_admin_user := ( + SELECT IFNULL(UE_T.can_edit, 0) = 1 + FROM partsltd_prod.Shop_User_Eval_Temp UE_T + WHERE + UE_T.GUID = a_guid + AND UE_T.id_user = a_id_user + AND UE_T.id_permission = v_id_permission_user_admin + ); + + IF (v_can_admin_user = 0 AND EXISTS ( + SELECT * + FROM tmp_User t_U + WHERE + t_U.id_user <> a_id_user + )) THEN + DELETE FROM tmp_Msg_Error; + 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 other Users.' + ) + ; + END IF; + + CALL p_shop_clear_calc_user(a_guid); + + IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN + START TRANSACTION; + + INSERT INTO Shop_User_Change_Set ( comment ) + VALUES ( a_comment ) + ; + + SET v_id_change_set := LAST_INSERT_ID(); + + UPDATE Shop_User U + INNER JOIN tmp_User t_U ON U.id_user = t_U.id_user + SET + U.id_user_auth0 = t_U.id_user_auth0 + , U.firstname = t_U.firstname + , U.surname = t_U.surname + , U.email = t_U.email + , U.is_email_verified = t_U.is_email_verified + , U.is_super_user = t_U.is_super_user + , U.id_currency_default = t_U.id_currency_default + , U.id_region_default = t_U.id_region_default + , U.is_included_VAT_default = t_U.is_included_VAT_default + , U.active = t_U.active + , U.id_change_set = v_id_change_set + ; + + DELETE FROM Shop_User_Temp + WHERE GUID = a_guid; + + COMMIT; + END IF; # Errors SELECT * - FROM tmp_Msg_Error - ; + FROM tmp_Msg_Error t_ME + INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type + ; - /* - # Return arguments for test - SELECT a_id_user, - a_name, - a_email, - a_email_verified - ; - */ - - -- Clean up + IF a_debug = 1 THEN + SELECT * from tmp_User; + END IF; + DROP TABLE IF EXISTS tmp_Msg_Error; - DROP TABLE IF EXISTS tmp_Shop_User; + DROP TABLE IF EXISTS tmp_User; + + IF a_debug = 1 THEN + CALL partsltd_prod.p_debug_timing_reporting ( v_time_start ); + END IF; END // DELIMITER ;; - - -/* - -CALL p_shop_edit_user ( - '', - '', - '', - 0 -) - -*/ diff --git a/static/MySQL/7313_p_get_many_user.sql b/static/MySQL/7313_p_get_many_user.sql index 165f31d3..61d10ba1 100644 --- a/static/MySQL/7313_p_get_many_user.sql +++ b/static/MySQL/7313_p_get_many_user.sql @@ -10,7 +10,6 @@ CREATE PROCEDURE p_get_many_user ( , IN a_id_user_auth0 VARCHAR(200) , IN a_get_all_user BIT , IN a_get_inactive_user BIT - , IN a_get_first_user_only BIT , IN a_ids_user LONGTEXT , IN a_ids_user_auth0 LONGTEXT , IN a_debug BIT @@ -22,7 +21,6 @@ BEGIN DECLARE v_id_permission_user INT; DECLARE v_id_permission_user_admin INT; DECLARE v_ids_permission_required VARCHAR(4000); - DECLARE v_now DATETIME; DECLARE v_id_minimum INT; DECLARE v_code_error_bad_data VARCHAR(50); DECLARE v_id_type_error_bad_data INT; @@ -31,6 +29,7 @@ BEGIN DECLARE v_guid BINARY(36); DECLARE v_rank_max INT; DECLARE v_time_start TIMESTAMP(6); + DECLARE v_is_new BIT; SET v_time_start := CURRENT_TIMESTAMP(6); SET v_guid := UUID(); @@ -42,10 +41,11 @@ BEGIN SET v_code_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1); SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_error_bad_data LIMIT 1); SET v_ids_permission_required := CONCAT(v_id_permission_user, ',', v_id_permission_user_admin, ',', v_id_permission_store_admin); + SET v_is_new := FALSE; SET a_get_all_user := IFNULL(a_get_all_user, 1); SET a_get_inactive_user := IFNULL(a_get_inactive_user, 0); - SET a_get_first_user_only := IFNULL(a_get_first_user_only, 0); + -- SET a_get_first_user_only := IFNULL(a_get_first_user_only, 0); SET a_ids_user := TRIM(IFNULL(a_ids_user, '')); SET a_ids_user_auth0 := TRIM(IFNULL(a_ids_user_auth0, '')); SET a_debug := IFNULL(a_debug, 0); @@ -56,7 +56,7 @@ BEGIN , a_id_user_auth0 , a_get_all_user , a_get_inactive_user - , a_get_first_user_only + -- , a_get_first_user_only , a_ids_user , a_ids_user_auth0 , a_debug @@ -91,17 +91,33 @@ BEGIN END IF; IF ISNULL(a_id_user) THEN - INSERT INTO tmp_Msg_Error ( - id_type, - code, - msg - ) - VALUES ( - v_id_type_error_bad_data, - v_code_error_bad_data, - CONCAT('User ID required for authorisation.') - ) - ; + IF NOT ISNULL(a_id_user_auth0) THEN + INSERT INTO partsltd_prod.Shop_User ( + id_user_auth0 + , is_super_user + , active + ) + VALUES ( + a_id_user_auth0 + , 0 -- is_super_user + , 1 -- active + ) + ; + SET a_id_user := (SELECT U.id_user FROM partsltd_prod.Shop_User U WHERE U.id_user_auth0 = a_id_user_auth0 LIMIT 1); + SET v_is_new := TRUE; + ELSE + INSERT INTO tmp_Msg_Error ( + id_type, + code, + msg + ) + VALUES ( + v_id_type_error_bad_data, + v_code_error_bad_data, + CONCAT('User ID required for authorisation.') + ) + ; + END IF; END IF; SET v_has_filter_user := CASE WHEN a_ids_user = '' THEN 0 ELSE 1 END; @@ -268,6 +284,7 @@ BEGIN SELECT * FROM tmp_User; END IF; + /* IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN IF a_get_first_user_only THEN DELETE t_U @@ -276,6 +293,7 @@ BEGIN ; END IF; END IF; + */ IF a_debug = 1 THEN SELECT * FROM tmp_User; @@ -440,6 +458,7 @@ BEGIN , U.is_super_user , t_U.can_admin_store , t_U.can_admin_user + , v_is_new AS is_new FROM tmp_User t_U INNER JOIN partsltd_prod.Shop_User U ON t_U.id_user = U.id_user ; @@ -478,13 +497,22 @@ DELIMITER ;; -CALL p_get_many_user (NULL, 'google-oauth2|109567376920138999933', False, False, False, NULL, 'google-oauth2|109567376920138999933', 0); /* +CALL p_get_many_user ( + NULL + , 'google-oauth2|109567376920138999933' + , False + , False + -- , False + , NULL + , 'google-oauth2|109567376920138999933' + , 0 +); NULL # a_id_user , 'auth0|6582b95c895d09a70ba10fef' # a_id_user_auth0 , 0 # a_get_all_user , 0 # a_get_inactive_user - , 0 # a_get_first_user_only + -- , 0 # a_get_first_user_only , NULL # a_ids_user , 'auth0|6582b95c895d09a70ba10fef' # a_ids_user_auth0 , 0 -- a_debug @@ -502,7 +530,7 @@ CALL p_get_many_user( , 'auth0|6582b95c895d09a70ba10fef' -- :a_id_user_auth0, , 1 -- :a_get_all_user, , 0 -- :a_get_inactive_user, - , 0 -- :a_get_first_user_only, + -- , 0 -- :a_get_first_user_only, , NULL -- :a_ids_user, , 'auth0|6582b95c895d09a70ba10fef' -- :a_ids_user_auth0 ); diff --git a/static/MySQL/9000_populate.sql b/static/MySQL/9000_populate.sql index ca962db8..e5f29ab0 100644 --- a/static/MySQL/9000_populate.sql +++ b/static/MySQL/9000_populate.sql @@ -875,8 +875,6 @@ INSERT INTO Shop_User ( , email , is_super_user , active - , created_by - , created_on ) VALUES ( @@ -886,8 +884,6 @@ VALUES , 'edward.middletonsmith@gmail.com' -- email , 1 -- is_super_user , 1 -- active - , 1 -- created_by - , current_timestamp() -- created_on ), ( 'parts_guest' -- id_user_auth0 @@ -896,19 +892,15 @@ VALUES , '' -- email , 0 -- is_super_user , 1 -- active - , 1 -- created_by - , current_timestamp() -- created_on ), ( - 'auth0|672659014296b7f94a9bab45' -- id_user_auth0 - , 'Tierney' -- firstname - , 'Gullen' -- surname - , 'tierneybailey13@gmail.com' -- email - , 1 -- is_super_user - , 1 -- active - , 1 -- created_by - , current_timestamp() -- created_on -) + 'auth0|672659014296b7f94a9bab45' -- id_user_auth0 + , 'Tierney' -- firstname + , 'Gullen' -- surname + , 'tierneybailey13@gmail.com' -- email + , 1 -- is_super_user + , 1 -- active + ) ; # User Role link diff --git a/templates/pages/user/_user.html b/templates/pages/user/_user.html index 9edff528..5b0f028c 100644 --- a/templates/pages/user/_user.html +++ b/templates/pages/user/_user.html @@ -1,32 +1,56 @@ - - {% extends 'layouts/layout.html' %} {% block page_body %} - - -
- {% set firstname = 'new user' if user.firstname is none else user.firstname %} -

Welcome, {{ firstname }}

- {% set block_id = 'button_get_in_touch' %} - {% include 'components/common/buttons/_buttons_save_cancel.html' %} + + + {% set user = model.users[0] %} +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + {% set currency = user.currency_default %} + {% include 'components/store/_preview_DDL_currency.html' %} +
+
+
+
+ +
+ {{ user.region_default.name }} +
+
+
+
+
+ + +
+
+
- + {% include 'components/common/temporary/_overlay_confirm.html' %} + {% include 'components/common/temporary/_overlay_error.html' %} - {% endblock %} \ No newline at end of file