feat(web): Store Product UI created and hooked up for viewing, editing, and saving.
This commit is contained in:
@@ -3,6 +3,12 @@ Website with online store
|
|||||||
|
|
||||||
Powered by flask
|
Powered by flask
|
||||||
|
|
||||||
|
enter virtual environment:
|
||||||
|
python -m venv VIRTUAL_ENVIRONMENT_NAME
|
||||||
|
|
||||||
|
run module bundler:
|
||||||
|
npm run build
|
||||||
|
|
||||||
host for machine:
|
host for machine:
|
||||||
python -m flask run
|
python -m flask run
|
||||||
|
|
||||||
|
|||||||
98
app.log
98
app.log
@@ -1,20 +1,4 @@
|
|||||||
Traceback: Traceback (most recent call last):
|
Traceback: Traceback (most recent call last):
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
|
|
||||||
res = self._query(mogrified_query)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
|
|
||||||
db.query(q)
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
|
|
||||||
_mysql.connection.query(self, query)
|
|
||||||
MySQLdb.OperationalError: (1318, 'Incorrect number of arguments for PROCEDURE partsltd_prod.p_shop_get_many_product_variation; expected 8, got 10')
|
|
||||||
|
|
||||||
The above exception was the direct cause of the following exception:
|
|
||||||
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||||
response = self.full_dispatch_request()
|
response = self.full_dispatch_request()
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@@ -30,59 +14,33 @@ Traceback (most recent call last):
|
|||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 114, in products
|
||||||
model = Model_View_Store_Product(form_filters)
|
return render_template('pages/store/_products.html', model = model)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 115, in __init__
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
return _render(app, template, context)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store.py", line 454, in get_many_product_variation
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||||
variation_types, variations, errors = DataStore_Store_Base().get_many_product_variation(variation_filters)
|
rv = template.render(context)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 290, in get_many_product_variation
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||||
result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
self.environment.handle_exception()
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_base.py", line 95, in db_procedure_execute
|
raise rewrite_traceback_stack(source=source)
|
||||||
result = db.session.execute(proc_string, argument_dict_list)
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_products.html", line 1, in top-level template code
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
{% extends 'layouts/layout.html' %}
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\scoping.py", line 778, in execute
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
return self._proxied.execute(
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 316, in top-level template code
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
{% block page_body %}{% endblock %}
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
return self._execute_internal(
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_products.html", line 89, in block 'page_body'
|
||||||
|
{% include 'components/store/_row_product.html' %}
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_product.html", line 38, in top-level template code
|
||||||
|
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.id_category }}">
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 487, in getattr
|
||||||
|
return getattr(obj, attribute)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2245, in _execute_internal
|
jinja2.exceptions.UndefinedError: 'permutation' is undefined
|
||||||
result = conn.execute(
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute
|
|
||||||
return meth(
|
|
||||||
^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection
|
|
||||||
return connection._execute_clauseelement(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement
|
|
||||||
ret = self._execute_context(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context
|
|
||||||
return self._exec_single_context(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context
|
|
||||||
self._handle_dbapi_exception(
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2353, in _handle_dbapi_exception
|
|
||||||
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
|
|
||||||
res = self._query(mogrified_query)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
|
|
||||||
db.query(q)
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
|
|
||||||
_mysql.connection.query(self, query)
|
|
||||||
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1318, 'Incorrect number of arguments for PROCEDURE partsltd_prod.p_shop_get_many_product_variation; expected 8, got 10')
|
|
||||||
[SQL: CALL p_shop_get_many_product_variation(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)]
|
|
||||||
[parameters: (1, 0, True, False, False, '', True, False, False, '')]
|
|
||||||
(Background on this error at: https://sqlalche.me/e/20/e3q8)
|
|
||||||
|
|
||||||
|
|||||||
47
app.log.1
47
app.log.1
@@ -1,3 +1,50 @@
|
|||||||
|
Exception on /store/products [GET]
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||||
|
response = self.full_dispatch_request()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||||
|
rv = self.handle_user_exception(e)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||||
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||||
|
rv = self.dispatch_request()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||||
|
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 114, in products
|
||||||
|
return render_template('pages/store/_products.html', model = model)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
|
||||||
|
return _render(app, template, context)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
|
||||||
|
rv = template.render(context)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
|
||||||
|
self.environment.handle_exception()
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
|
||||||
|
raise rewrite_traceback_stack(source=source)
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_products.html", line 1, in top-level template code
|
||||||
|
{% extends 'layouts/layout.html' %}
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 316, in top-level template code
|
||||||
|
{% block page_body %}{% endblock %}
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_products.html", line 89, in block 'page_body'
|
||||||
|
{% include 'components/store/_row_product.html' %}
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_product.html", line 38, in top-level template code
|
||||||
|
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.id_category }}">
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 487, in getattr
|
||||||
|
return getattr(obj, attribute)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
jinja2.exceptions.UndefinedError: 'permutation' is undefined
|
||||||
|
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|
||||||
Request: 127.0.0.1 GET http /store/products? Host: 127.0.0.1:5000
|
Request: 127.0.0.1 GET http /store/products? Host: 127.0.0.1:5000
|
||||||
|
|
||||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0
|
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0
|
||||||
|
|||||||
192
app.log.2
192
app.log.2
@@ -1,89 +1,103 @@
|
|||||||
Exception on /store/products [GET]
|
Exception on /store/products [GET]
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||||
self.dialect.do_execute(
|
response = self.full_dispatch_request()
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
cursor.execute(statement, parameters)
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
|
rv = self.handle_user_exception(e)
|
||||||
res = self._query(mogrified_query)
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
db.query(q)
|
^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||||
_mysql.connection.query(self, query)
|
rv = self.dispatch_request()
|
||||||
MySQLdb.OperationalError: (1318, 'Incorrect number of arguments for PROCEDURE partsltd_prod.p_shop_get_many_product_variation; expected 8, got 10')
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||||
The above exception was the direct cause of the following exception:
|
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Traceback (most recent call last):
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
model = Model_View_Store_Product(form_filters)
|
||||||
response = self.full_dispatch_request()
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 101, in __init__
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||||
rv = self.handle_user_exception(e)
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 110, in get_many_product
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
category_list.add_product(new_product)
|
||||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 337, in add_product
|
||||||
^^^^^^^^^^^^^^^^^^
|
self.categories[index_category].add_product(product)
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 100, in add_product
|
||||||
rv = self.dispatch_request()
|
raise ValueError(f"{av.error_msg_str(product, 'product', _m, Product)}\nProduct already in category.")
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
ValueError: Invalid Category.add_product <class 'business_objects.store.product.Product'> argument product. Type = <class 'business_objects.store.product.Product'>. Value = Product
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
id_product: 1
|
||||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
id_category: 1
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
name: Braille Keyboard Translator
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
display_order: 1
|
||||||
model = Model_View_Store_Product(form_filters)
|
can_view: False
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
can_edit: False
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 115, in __init__
|
can_admin: False
|
||||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
has_variations: True
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
permutations: []
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store.py", line 454, in get_many_product_variation
|
variation trees: []
|
||||||
variation_types, variations, errors = DataStore_Store_Base().get_many_product_variation(variation_filters)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Product already in category.
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 290, in get_many_product_variation
|
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|
||||||
result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
Request: 127.0.0.1 GET http /store/products? Host: 127.0.0.1:5000
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_base.py", line 95, in db_procedure_execute
|
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0
|
||||||
result = db.session.execute(proc_string, argument_dict_list)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\scoping.py", line 778, in execute
|
|
||||||
return self._proxied.execute(
|
Accept-Language: en-GB,en;q=0.5
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute
|
Accept-Encoding: gzip, deflate, br, zstd
|
||||||
return self._execute_internal(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
Dnt: 1
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2245, in _execute_internal
|
|
||||||
result = conn.execute(
|
Connection: keep-alive
|
||||||
^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute
|
Cookie: session=.eJytVlmzqkgS_isdRnQ_9fGyKyfixoyKAh5BQWR7IaCqkGJXQIGe-9-n8Nzu2w89W8REuFCVReaXlV8uv83Crk2qO24QvDToPnv_bQbCMghhgcugaas7mr239w79-qft7nXwcxcVIc5n7zMEn-EdzgsMYY7aqmwK3CZ_v07SOaiK2a-zGN-btgwLonBmIQgHsodhALr7HZVgCCCKwy5vZ-9ll-cv0R1dcVX-heATAP3HczA5QRG9r_9_CPySiUQeLEUeUmK4oKKQpmIUTwab4IU4eKA7jjGCs_c4zBv0kuAS5B1EMLBX1g-rn34ScdPVxNSfnW-6-3eHtN_9fjtPjs--kftq7nHQVhkqJ2AxRECkKQQBtVjwUBRYCjIAiSwLUMwxgAc8omiRQOy-hyEEADXNHxrQsE8iGeAj3mehq-LDZp9HhTat11p6YUxK11X8xKGrj2pa4VAxKaBowmEQM9_12qiESTiqTz31cz_1q6OccxHmaTDwCXTNStvwacRQD7Wk5nP69pEeN63Xs9qCtY7SPNPvelBJyWjCRoVL5xS_qcch6jvTfFv64zBIvtZq7DFmesA01INmH8M1UvcX6oPpRemNH24tqHUlTNHxKGin8-3UFH2lItye1Kpiec9glm9e6Ny2fT_y8IFF-Tgm0nmzUFSLSx4XvEykeC1KciuiJyuBvJIr1ts-ojI5yZuyP-XVclPvW1PHhxJFHYkuXgyHoaUT0fKTzEhE1m-kYH3gtos8o07W6iOV2coJ-BAd1K0aLJPuiQqVF_L1QU7PV1_sKnUXMzGIrxqDW3e4sSPd2HveXudvzaa63xB73nXJ5ZwPmmr2sd0v8rTJ8JA8alzRwZFyVsYQO81eFV0uyNvjkG9OaprWhwwgq8TRfC3rqwh_SLorJ9ytrKWjtpQNQgPU1_iOmiAkFKQXzIJb8Cwl_NjHhBRLgaOoVxb8BUvOl1Gldaw2amnyYKMKala79oasi7b2p3VpP5DrX8yM46J0__CVK21nu4O2S2hz2ItzoqwLHf0eFbvWP5MXCjuDzG7wN3wbOmYWyTYVMfwYOTkVvhTzSeRcJuO5r8AEFEZHZJkv9zmUxQ4wdA3lZOUzdBI6z85jxHaiLJDzFCr28GkjoaCyHo94-SDULEGxYzzXTAD-pKfn-gmUd8NhvIy-pBdaalCaBDPdIs4yHqfL3qAzeqJJgNNHE_uSR51YTdSl63NfqiKQQeFLdAUV8wmGy2icL4OJybfQM5IOf06FXMuIrWJHee5-3Ft72XeMDsh8OWGG7jojuHJ_JyZwusxUfRIsrSZlrZb6Fy1VBc26CJqkdZqljs4UiMJuPSdvpvT0HZMlerNDQde-bDa-axIq621I7BsyfJ07FPojOv94z2X9HBR5ETp2pqZ14Tn96J__DylP_PHcSSfBRcEbcs3eymjXYBIrdJPeGslN5TvBzhLXcHb5OauFS5FNJaj2XAMf0y2rpWA8Slee-Dvh5SbCaRYY9NEYdCl7agOJM2vjyQaxRYXSeqmnF04jCac7Gne07EyT8kQf19iztk-_sIsXN5j8E5eja2gLlShLSv3SmtEWjkamF7aUqOedeNEKj7HovW6UYMLVEV6mLz5luu3IKuXRJqex9tYo7Ifv7lL74vVTqasUVbPtymBpJ6WuPCmoSu4bT4aT1Nj4uLjMVcq8K7nM5Iykw5PnYLg2WXtVNxQ2Y1nBNAu45hQssjcufabSJUJ8TDJsOCtKCarTIj6p5rgZF0bAhdZtw36sFXf4WIVUsQKatH8AihMUwHCHmw2b2CrDTblqgnO81LitVfHr5NzXYXuWRy5ERd3E-TVZ9fx221egdsL6Lm8Fz1oeOit-eLlB6tSmaSk6CPEu_bAt2G0dUX-uFS4By_gSX_lYZy05FAWmk-W3Rx7oMtrwxoe9Pev1oQ8_qrRopdUTq3WlC8qyHMaTE-_larMbvVawbCE7DXfTrg8nuiL9mKSgnqzMnbq-YWXTNGi8Bt6T1K8GVPXUGclvieFP9b2KcY5--pwXfp29ClbQDq8zaxTeSdP77H24jKtX_-tIc55d5XRob7rmbJIz7m_HBWMao604qxDt9yS_Z__LCPIvWj8pqd9rLMOJFEsK6u9Fl10uPzeahhhI2rZu3r98gejxVj7DjKEEAcVCssR9Oe-a-Wv6mEx9Iba-Dwb_GVSJQfbvDk9HqhJM8s3FjThg9WwnrVGFbuCyo4m4xqDtpkHtD4TN_HoPH2Eb3l9wPh-_8CxkY4bjqAXkGX4RL7mYWYCQWiwXXAQF7m_NV25J_XL_Wl9_gV9fun5mVz8zO_IBsPzhH1l_qmzIE4LzurxOEcdTwBA49LJcKlf-w8jlZr2JraWiBBYTC0dTW7-o0UX_zazW1TBsyTQ2BWPGUAz3RolvjGAxzDvNv1PsnGZYf_bt27d_Agdyo3I.ZvXc6g.WpR0PQjTMWhM_qBkpa9CVzq95M8
|
||||||
return meth(
|
|
||||||
^^^^^
|
Upgrade-Insecure-Requests: 1
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection
|
|
||||||
return connection._execute_clauseelement(
|
Sec-Fetch-Dest: document
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement
|
Sec-Fetch-Mode: navigate
|
||||||
ret = self._execute_context(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
Sec-Fetch-Site: none
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context
|
|
||||||
return self._exec_single_context(
|
Sec-Fetch-User: ?1
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context
|
Sec-Gpc: 1
|
||||||
self._handle_dbapi_exception(
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2353, in _handle_dbapi_exception
|
Priority: u=0, i
|
||||||
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
Request data: b''
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
|
Traceback: Traceback (most recent call last):
|
||||||
res = self._query(mogrified_query)
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
response = self.full_dispatch_request()
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
db.query(q)
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
|
rv = self.handle_user_exception(e)
|
||||||
_mysql.connection.query(self, query)
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1318, 'Incorrect number of arguments for PROCEDURE partsltd_prod.p_shop_get_many_product_variation; expected 8, got 10')
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||||
[SQL: CALL p_shop_get_many_product_variation(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)]
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
[parameters: (1, 0, True, False, False, '', True, False, False, '')]
|
^^^^^^^^^^^^^^^^^^
|
||||||
(Background on this error at: https://sqlalche.me/e/20/e3q8)
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||||
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|
rv = self.dispatch_request()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||||
|
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
||||||
|
model = Model_View_Store_Product(form_filters)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 101, in __init__
|
||||||
|
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 110, in get_many_product
|
||||||
|
category_list.add_product(new_product)
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 337, in add_product
|
||||||
|
self.categories[index_category].add_product(product)
|
||||||
|
|||||||
191
app.log.3
191
app.log.3
@@ -1,88 +1,103 @@
|
|||||||
Traceback: Traceback (most recent call last):
|
Exception on /store/products [GET]
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
|
Traceback (most recent call last):
|
||||||
self.dialect.do_execute(
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
|
response = self.full_dispatch_request()
|
||||||
cursor.execute(statement, parameters)
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||||
res = self._query(mogrified_query)
|
rv = self.handle_user_exception(e)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||||
db.query(q)
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
|
^^^^^^^^^^^^^^^^^^
|
||||||
_mysql.connection.query(self, query)
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||||
MySQLdb.OperationalError: (1318, 'Incorrect number of arguments for PROCEDURE partsltd_prod.p_shop_get_many_product_variation; expected 8, got 9')
|
rv = self.dispatch_request()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
The above exception was the direct cause of the following exception:
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||||
|
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||||
Traceback (most recent call last):
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
||||||
response = self.full_dispatch_request()
|
model = Model_View_Store_Product(form_filters)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 101, in __init__
|
||||||
rv = self.handle_user_exception(e)
|
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 109, in get_many_product
|
||||||
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
category_list.add_product(new_product)
|
||||||
^^^^^^^^^^^^^^^^^^
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 337, in add_product
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
self.categories[index_category].add_product(product)
|
||||||
rv = self.dispatch_request()
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 100, in add_product
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
raise ValueError(f"{av.error_msg_str(product, 'product', _m, Product)}\nProduct already in category.")
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
ValueError: Invalid Category.add_product <class 'business_objects.store.product.Product'> argument product. Type = <class 'business_objects.store.product.Product'>. Value = Product
|
||||||
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
id_product: 1
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
id_category: 1
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
name: Braille Keyboard Translator
|
||||||
model = Model_View_Store_Product(form_filters)
|
display_order: 1
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
can_view: False
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 115, in __init__
|
can_edit: False
|
||||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
can_admin: False
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
has_variations: True
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store.py", line 454, in get_many_product_variation
|
permutations: []
|
||||||
variation_types, variations, errors = DataStore_Store_Base().get_many_product_variation(variation_filters)
|
variation trees: []
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 289, in get_many_product_variation
|
Product already in category.
|
||||||
result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Request: 127.0.0.1 GET http /store/products? Host: 127.0.0.1:5000
|
||||||
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_base.py", line 95, in db_procedure_execute
|
|
||||||
result = db.session.execute(proc_string, argument_dict_list)
|
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\scoping.py", line 778, in execute
|
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
|
||||||
return self._proxied.execute(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
Accept-Language: en-GB,en;q=0.5
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute
|
|
||||||
return self._execute_internal(
|
Accept-Encoding: gzip, deflate, br, zstd
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2245, in _execute_internal
|
Dnt: 1
|
||||||
result = conn.execute(
|
|
||||||
^^^^^^^^^^^^^
|
Connection: keep-alive
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute
|
|
||||||
return meth(
|
Cookie: session=.eJytVlmzqkgS_isdRnQ_9fGyKyfixoyKAh5BQWR7IaCqkGJXQIGe-9-n8Nzu2w89W8REuFCVReaXlV8uv83Crk2qO24QvDToPnv_bQbCMghhgcugaas7mr239w79-qft7nXwcxcVIc5n7zMEn-EdzgsMYY7aqmwK3CZ_v07SOaiK2a-zGN-btgwLonBmIQgHsodhALr7HZVgCCCKwy5vZ-9ll-cv0R1dcVX-heATAP3HczA5QRG9r_9_CPySiUQeLEUeUmK4oKKQpmIUTwab4IU4eKA7jjGCs_c4zBv0kuAS5B1EMLBX1g-rn34ScdPVxNSfnW-6-3eHtN_9fjtPjs--kftq7nHQVhkqJ2AxRECkKQQBtVjwUBRYCjIAiSwLUMwxgAc8omiRQOy-hyEEADXNHxrQsE8iGeAj3mehq-LDZp9HhTat11p6YUxK11X8xKGrj2pa4VAxKaBowmEQM9_12qiESTiqTz31cz_1q6OccxHmaTDwCXTNStvwacRQD7Wk5nP69pEeN63Xs9qCtY7SPNPvelBJyWjCRoVL5xS_qcch6jvTfFv64zBIvtZq7DFmesA01INmH8M1UvcX6oPpRemNH24tqHUlTNHxKGin8-3UFH2lItye1Kpiec9glm9e6Ny2fT_y8IFF-Tgm0nmzUFSLSx4XvEykeC1KciuiJyuBvJIr1ts-ojI5yZuyP-XVclPvW1PHhxJFHYkuXgyHoaUT0fKTzEhE1m-kYH3gtos8o07W6iOV2coJ-BAd1K0aLJPuiQqVF_L1QU7PV1_sKnUXMzGIrxqDW3e4sSPd2HveXudvzaa63xB73nXJ5ZwPmmr2sd0v8rTJ8JA8alzRwZFyVsYQO81eFV0uyNvjkG9OaprWhwwgq8TRfC3rqwh_SLorJ9ytrKWjtpQNQgPU1_iOmiAkFKQXzIJb8Cwl_NjHhBRLgaOoVxb8BUvOl1Gldaw2amnyYKMKala79oasi7b2p3VpP5DrX8yM46J0__CVK21nu4O2S2hz2ItzoqwLHf0eFbvWP5MXCjuDzG7wN3wbOmYWyTYVMfwYOTkVvhTzSeRcJuO5r8AEFEZHZJkv9zmUxQ4wdA3lZOUzdBI6z85jxHaiLJDzFCr28GkjoaCyHo94-SDULEGxYzzXTAD-pKfn-gmUd8NhvIy-pBdaalCaBDPdIs4yHqfL3qAzeqJJgNNHE_uSR51YTdSl63NfqiKQQeFLdAUV8wmGy2icL4OJybfQM5IOf06FXMuIrWJHee5-3Ft72XeMDsh8OWGG7jojuHJ_JyZwusxUfRIsrSZlrZb6Fy1VBc26CJqkdZqljs4UiMJuPSdvpvT0HZMlerNDQde-bDa-axIq621I7BsyfJ07FPojOv94z2X9HBR5ETp2pqZ14Tn96J__DylP_PHcSSfBRcEbcs3eymjXYBIrdJPeGslN5TvBzhLXcHb5OauFS5FNJaj2XAMf0y2rpWA8Slee-Dvh5SbCaRYY9NEYdCl7agOJM2vjyQaxRYXSeqmnF04jCac7Gne07EyT8kQf19iztk-_sIsXN5j8E5eja2gLlShLSv3SmtEWjkamF7aUqOedeNEKj7HovW6UYMLVEV6mLz5luu3IKuXRJqex9tYo7Ifv7lL74vVTqasUVbPtymBpJ6WuPCmoSu4bT4aT1Nj4uLjMVcq8K7nM5Iykw5PnYLg2WXtVNxQ2Y1nBNAu45hQssjcufabSJUJ8TDJsOCtKCarTIj6p5rgZF0bAhdZtw36sFXf4WIVUsQKatH8AihMUwHCHmw2b2CrDTblqgnO81LitVfHr5NzXYXuWRy5ERd3E-TVZ9fx221egdsL6Lm8Fz1oeOit-eLlB6tSmaSk6CPEu_bAt2G0dUX-uFS4By_gSX_lYZy05FAWmk-W3Rx7oMtrwxoe9Pev1oQ8_qrRopdUTq3WlC8qyHMaTE-_larMbvVawbCE7DXfTrg8nuiL9mKSgnqzMnbq-YWXTNGi8Bt6T1K8GVPXUGclvieFP9b2KcY5--pwXfp29ClbQDq8zaxTeSdP77H24jKtX_-tIc55d5XRob7rmbJIz7m_HBWMao604qxDt9yS_Z__LCPIvWj8pqd9rLMOJFEsK6u9Fl10uPzeahhhI2rZu3r98gejxVj7DjKEEAcVCssR9Oe-a-Wv6mEx9Iba-Dwb_GVSJQfbvDk9HqhJM8s3FjThg9WwnrVGFbuCyo4m4xqDtpkHtD4TN_HoPH2Eb3l9wPh-_8CxkY4bjqAXkGX4RL7mYWYCQWiwXXAQF7m_NV25J_XL_Wl9_gV9fun5mVz8zO_IBsPzhH1l_qmzIE4LzurxOEcdTwBA49LJcKlf-w8jlZr2JraWiBBYTC0dTW7-o0UX_zazW1TBsyTQ2BWPGUAz3RolvjGAxzDvNv1PsnGZYf_bt27d_Agdyo3I.ZvXc6g.WpR0PQjTMWhM_qBkpa9CVzq95M8
|
||||||
^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection
|
Upgrade-Insecure-Requests: 1
|
||||||
return connection._execute_clauseelement(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Sec-Fetch-Dest: document
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement
|
|
||||||
ret = self._execute_context(
|
Sec-Fetch-Mode: navigate
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context
|
Sec-Fetch-Site: none
|
||||||
return self._exec_single_context(
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Sec-Fetch-User: ?1
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context
|
|
||||||
self._handle_dbapi_exception(
|
Sec-Gpc: 1
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2353, in _handle_dbapi_exception
|
|
||||||
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
|
Priority: u=0, i
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
|
Request data: b''
|
||||||
res = self._query(mogrified_query)
|
Traceback: Traceback (most recent call last):
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
|
response = self.full_dispatch_request()
|
||||||
db.query(q)
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
|
||||||
_mysql.connection.query(self, query)
|
rv = self.handle_user_exception(e)
|
||||||
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1318, 'Incorrect number of arguments for PROCEDURE partsltd_prod.p_shop_get_many_product_variation; expected 8, got 9')
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
[SQL: CALL p_shop_get_many_product_variation(%s, %s, %s, %s, %s, %s, %s, %s, %s)]
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
|
||||||
[parameters: (1, True, False, False, '', True, False, False, '')]
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
(Background on this error at: https://sqlalche.me/e/20/e3q8)
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
|
||||||
|
rv = self.dispatch_request()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
|
||||||
|
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product.py", line 113, in products
|
||||||
|
model = Model_View_Store_Product(form_filters)
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product.py", line 101, in __init__
|
||||||
|
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 109, in get_many_product
|
||||||
|
category_list.add_product(new_product)
|
||||||
|
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\business_objects\store\product_category.py", line 337, in add_product
|
||||||
|
self.categories[index_category].add_product(product)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -34,6 +34,7 @@ db = SQLAlchemy()
|
|||||||
# CLASSES
|
# CLASSES
|
||||||
class SQL_Error(db.Model):
|
class SQL_Error(db.Model):
|
||||||
display_order = db.Column(db.Integer, primary_key=True)
|
display_order = db.Column(db.Integer, primary_key=True)
|
||||||
|
id_type = db.Column(db.Integer)
|
||||||
code = db.Column(db.String(50))
|
code = db.Column(db.String(50))
|
||||||
msg = db.Column(db.String(4000))
|
msg = db.Column(db.String(4000))
|
||||||
name = db.Column(db.String(500))
|
name = db.Column(db.String(500))
|
||||||
@@ -58,8 +59,9 @@ class SQL_Error(db.Model):
|
|||||||
def from_DB_record(record):
|
def from_DB_record(record):
|
||||||
error = SQL_Error()
|
error = SQL_Error()
|
||||||
error.display_order = record[0]
|
error.display_order = record[0]
|
||||||
error.code = record[1]
|
error.id_type = record[1]
|
||||||
error.msg = record[2]
|
error.code = record[2]
|
||||||
error.name = record[3]
|
error.msg = record[3]
|
||||||
error.description = record[4]
|
error.name = record[4]
|
||||||
|
error.description = record[5]
|
||||||
return error
|
return error
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -56,7 +56,7 @@ class Enum_Status_Stock(Enum):
|
|||||||
class Product(SQLAlchemy_ABC, Store_Base):
|
class Product(SQLAlchemy_ABC, Store_Base):
|
||||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_PRODUCT
|
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_PRODUCT
|
||||||
NAME_ATTR_OPTION_TEXT = Store_Base.FLAG_NAME
|
NAME_ATTR_OPTION_TEXT = Store_Base.FLAG_NAME
|
||||||
FLAG_HAS_VARIATIONS: ClassVar[str] = 'has-variations-product'
|
# FLAG_HAS_VARIATIONS: ClassVar[str] = 'has-variations-product'
|
||||||
FLAG_INDEX_PERMUTATION_SELECTED: ClassVar[str] = 'index-permutation-selected'
|
FLAG_INDEX_PERMUTATION_SELECTED: ClassVar[str] = 'index-permutation-selected'
|
||||||
FLAG_PRODUCT_VARIATION_TREES: ClassVar[str] = 'variation-trees'
|
FLAG_PRODUCT_VARIATION_TREES: ClassVar[str] = 'variation-trees'
|
||||||
|
|
||||||
@@ -74,6 +74,12 @@ class Product(SQLAlchemy_ABC, Store_Base):
|
|||||||
# has_variations: bool
|
# has_variations: bool
|
||||||
# index_permutation_selected: int
|
# index_permutation_selected: int
|
||||||
|
|
||||||
|
"""
|
||||||
|
permutations: list = None
|
||||||
|
permutation_index: dict = None
|
||||||
|
variation_trees: list = None
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.permutations = []
|
self.permutations = []
|
||||||
self.permutation_index = {}
|
self.permutation_index = {}
|
||||||
@@ -179,10 +185,26 @@ class Product(SQLAlchemy_ABC, Store_Base):
|
|||||||
permutation = Product_Permutation.from_DB_Stripe_price(query_row)
|
permutation = Product_Permutation.from_DB_Stripe_price(query_row)
|
||||||
product = Product.from_permutation(permutation)
|
product = Product.from_permutation(permutation)
|
||||||
return product
|
return product
|
||||||
|
"""
|
||||||
def from_json(json_basket_item, key_id_product, key_id_permutation):
|
def from_json(json_basket_item, key_id_product, key_id_permutation):
|
||||||
permutation = Product_Permutation.from_json(json_basket_item, key_id_product, key_id_permutation)
|
permutation = Product_Permutation.from_json(json_basket_item, key_id_product, key_id_permutation)
|
||||||
product = Product.from_permutation(permutation)
|
product = Product.from_permutation(permutation)
|
||||||
return product
|
return product
|
||||||
|
"""
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json):
|
||||||
|
product = cls()
|
||||||
|
product.id_product = json[cls.ATTR_ID_PRODUCT]
|
||||||
|
product.display_order = json[cls.FLAG_DISPLAY_ORDER]
|
||||||
|
product.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY]
|
||||||
|
product.name = json[cls.FLAG_NAME]
|
||||||
|
product.has_variations = av.input_bool(json.get(cls.FLAG_HAS_VARIATIONS, None), cls.FLAG_HAS_VARIATIONS, f'{cls.__name__}.from_json')
|
||||||
|
product.id_access_level_required = json.get(cls.ATTR_ID_ACCESS_LEVEL, None)
|
||||||
|
product.active = av.input_bool(json.get(cls.FLAG_ACTIVE, None), cls.FLAG_ACTIVE, f'{cls.__name__}.from_json')
|
||||||
|
product.can_view = json.get(cls.FLAG_CAN_VIEW, None)
|
||||||
|
product.can_edit = json.get(cls.FLAG_CAN_EDIT, None)
|
||||||
|
product.can_admin = json.get(cls.FLAG_CAN_ADMIN, None)
|
||||||
|
return product
|
||||||
def get_permutation_selected(self):
|
def get_permutation_selected(self):
|
||||||
try:
|
try:
|
||||||
return self.permutations[self.index_permutation_selected]
|
return self.permutations[self.index_permutation_selected]
|
||||||
@@ -288,6 +310,7 @@ class Product(SQLAlchemy_ABC, Store_Base):
|
|||||||
for permutation in self.permutations:
|
for permutation in self.permutations:
|
||||||
list_rows.append(permutation.to_row_permutation())
|
list_rows.append(permutation.to_row_permutation())
|
||||||
return list_rows
|
return list_rows
|
||||||
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, json):
|
def from_json(cls, json):
|
||||||
product = cls()
|
product = cls()
|
||||||
@@ -307,6 +330,7 @@ class Product(SQLAlchemy_ABC, Store_Base):
|
|||||||
for json_tree in json[cls.FLAG_PRODUCT_VARIATION_TREES]:
|
for json_tree in json[cls.FLAG_PRODUCT_VARIATION_TREES]:
|
||||||
product.variation_trees.append(Product_Variation_Tree.from_json(json_tree))
|
product.variation_trees.append(Product_Variation_Tree.from_json(json_tree))
|
||||||
return product
|
return product
|
||||||
|
"""
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
return {
|
return {
|
||||||
**self.get_shared_json_attributes(self),
|
**self.get_shared_json_attributes(self),
|
||||||
@@ -422,7 +446,7 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
|||||||
def from_form_filters_product(form):
|
def from_form_filters_product(form):
|
||||||
# if not (form is Filters_Product_Permutation): raise ValueError(f'Invalid form type: {type(form)}')
|
# if not (form is Filters_Product_Permutation): raise ValueError(f'Invalid form type: {type(form)}')
|
||||||
av.val_instance(form, 'form', 'Parameters_Product.from_form', Filters_Product)
|
av.val_instance(form, 'form', 'Parameters_Product.from_form', Filters_Product)
|
||||||
has_filter_category = not (form.id_category.data == '0' or form.id_category.data == '')
|
has_filter_category = not (form.id_category.data == '0' or form.id_category.data == '' or form.id_category.data is None)
|
||||||
is_not_empty = av.input_bool(form.is_not_empty.data, "is_not_empty", "Parameters_Product.from_form_filters_product")
|
is_not_empty = av.input_bool(form.is_not_empty.data, "is_not_empty", "Parameters_Product.from_form_filters_product")
|
||||||
active = av.input_bool(form.active.data, "active", "Parameters_Product.from_form_filters_product")
|
active = av.input_bool(form.active.data, "active", "Parameters_Product.from_form_filters_product")
|
||||||
return Parameters_Product(
|
return Parameters_Product(
|
||||||
@@ -812,4 +836,50 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_filters_stock_item(cls, filters_stock_item):
|
def from_filters_stock_item(cls, filters_stock_item):
|
||||||
return cls.from_form_filters_product_permutation(filters_stock_item)
|
return cls.from_form_filters_product_permutation(filters_stock_item)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class Product_Temp(db.Model, Store_Base):
|
||||||
|
__tablename__ = 'Shop_Product_Temp'
|
||||||
|
__table_args__ = { 'extend_existing': True }
|
||||||
|
id_product: int = db.Column(db.Integer, primary_key=True)
|
||||||
|
id_category: int = db.Column(db.Integer)
|
||||||
|
name: str = db.Column(db.String(255))
|
||||||
|
has_variations: bool = db.Column(db.Boolean)
|
||||||
|
id_access_level_required: int = db.Column(db.Integer)
|
||||||
|
active: bool = db.Column(db.Boolean)
|
||||||
|
display_order: int = db.Column(db.Integer)
|
||||||
|
guid: str = db.Column(db.BINARY(36))
|
||||||
|
# created_on: datetime = db.Column(db.DateTime)
|
||||||
|
# created_by: int = db.Column(db.Integer)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_product(cls, product):
|
||||||
|
row = cls()
|
||||||
|
row.id_product = product.id_product[0] if isinstance(product.id_product, tuple) else product.id_product
|
||||||
|
row.id_category = product.id_category[0] if isinstance(product.id_category, tuple) else product.id_category
|
||||||
|
row.name = product.name[0] if isinstance(product.name, tuple) else product.name
|
||||||
|
row.has_variations = product.has_variations
|
||||||
|
row.id_access_level_required = product.id_access_level_required[0] if isinstance(product.id_access_level_required, tuple) else product.id_access_level_required
|
||||||
|
row.active = product.active
|
||||||
|
row.display_order = product.display_order
|
||||||
|
"""
|
||||||
|
row.guid = product.guid
|
||||||
|
row.created_on = product.created_on
|
||||||
|
row.created_by = product.created_by
|
||||||
|
"""
|
||||||
|
return row
|
||||||
|
def to_json(self):
|
||||||
|
return {
|
||||||
|
'id_product': self.id_product,
|
||||||
|
'id_category': self.id_category,
|
||||||
|
'name': self.name,
|
||||||
|
'has_variations': av.input_bool(self.has_variations, self.FLAG_HAS_VARIATIONS, f'{self.__class__.__name__}.to_json'),
|
||||||
|
'id_access_level_required': self.id_access_level_required,
|
||||||
|
'active': av.input_bool(self.active, self.FLAG_ACTIVE, f'{self.__class__.__name__}.to_json'),
|
||||||
|
'display_order': self.display_order,
|
||||||
|
'guid': self.guid,
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
'created_on': self.created_on,
|
||||||
|
'created_by': self.created_by
|
||||||
|
"""
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
|
|||||||
can_admin = db.Column(db.Boolean)
|
can_admin = db.Column(db.Boolean)
|
||||||
created_on = db.Column(db.DateTime)
|
created_on = db.Column(db.DateTime)
|
||||||
created_by = db.Column(db.Integer)
|
created_by = db.Column(db.Integer)
|
||||||
|
|
||||||
|
"""
|
||||||
|
products: list = None # []
|
||||||
|
product_index: dict = None # {}
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.products = []
|
self.products = []
|
||||||
self.product_index = {}
|
self.product_index = {}
|
||||||
@@ -95,6 +101,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
|
|||||||
# self.product_index[Category.key_product_index_from_ids_product_permutation(product.id_product, product.id_permutation)] = len(self.products)
|
# self.product_index[Category.key_product_index_from_ids_product_permutation(product.id_product, product.id_permutation)] = len(self.products)
|
||||||
try:
|
try:
|
||||||
self.get_index_product(product)
|
self.get_index_product(product)
|
||||||
|
print(f'category: {self}')
|
||||||
raise ValueError(f"{av.error_msg_str(product, 'product', _m, Product)}\nProduct already in category.")
|
raise ValueError(f"{av.error_msg_str(product, 'product', _m, Product)}\nProduct already in category.")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.product_index[product.id_product] = len(self.products)
|
self.product_index[product.id_product] = len(self.products)
|
||||||
@@ -441,7 +448,7 @@ class Table_Shop_Product_Category(db.Model):
|
|||||||
created_by: int = db.Column(db.Integer)
|
created_by: int = db.Column(db.Integer)
|
||||||
id_change_set: int = db.Column(db.Integer)
|
id_change_set: int = db.Column(db.Integer)
|
||||||
"""
|
"""
|
||||||
class Product_Category_Temp(db.Model):
|
class Product_Category_Temp(db.Model, Store_Base):
|
||||||
__tablename__ = 'Shop_Product_Category_Temp'
|
__tablename__ = 'Shop_Product_Category_Temp'
|
||||||
__table_args__ = { 'extend_existing': True }
|
__table_args__ = { 'extend_existing': True }
|
||||||
id_category: int = db.Column(db.Integer, primary_key=True)
|
id_category: int = db.Column(db.Integer, primary_key=True)
|
||||||
|
|||||||
@@ -120,22 +120,22 @@ class Product_Variation(db.Model, Store_Base):
|
|||||||
class Product_Variation_Filters():
|
class Product_Variation_Filters():
|
||||||
get_all_variation_type: bool
|
get_all_variation_type: bool
|
||||||
get_inactive_variation_type: bool
|
get_inactive_variation_type: bool
|
||||||
get_first_variation_type: bool
|
# get_first_variation_type: bool
|
||||||
ids_variation_type: str
|
ids_variation_type: str
|
||||||
get_all_variation: bool
|
get_all_variation: bool
|
||||||
get_inactive_variation: bool
|
get_inactive_variation: bool
|
||||||
get_first_variation: bool
|
# get_first_variation: bool
|
||||||
ids_variation: str
|
ids_variation: str
|
||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
return {
|
return {
|
||||||
'a_get_all_variation_type': self.get_all_variation_type,
|
'a_get_all_variation_type': self.get_all_variation_type,
|
||||||
'a_get_inactive_variation_type': self.get_inactive_variation_type,
|
'a_get_inactive_variation_type': self.get_inactive_variation_type,
|
||||||
'a_get_first_variation_type': self.get_first_variation_type,
|
# 'a_get_first_variation_type': self.get_first_variation_type,
|
||||||
'a_ids_variation_type': self.ids_variation_type,
|
'a_ids_variation_type': self.ids_variation_type,
|
||||||
'a_get_all_variation': self.get_all_variation,
|
'a_get_all_variation': self.get_all_variation,
|
||||||
'a_get_inactive_variation': self.get_inactive_variation,
|
'a_get_inactive_variation': self.get_inactive_variation,
|
||||||
'a_get_first_variation': self.get_first_variation,
|
# 'a_get_first_variation': self.get_first_variation,
|
||||||
'a_ids_variation': self.ids_variation,
|
'a_ids_variation': self.ids_variation,
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -170,11 +170,11 @@ class Product_Variation_Filters():
|
|||||||
return Product_Variation_Filters(
|
return Product_Variation_Filters(
|
||||||
get_all_variation_type = True,
|
get_all_variation_type = True,
|
||||||
get_inactive_variation_type = False,
|
get_inactive_variation_type = False,
|
||||||
get_first_variation_type = False,
|
# get_first_variation_type = False,
|
||||||
ids_variation_type = '',
|
ids_variation_type = '',
|
||||||
get_all_variation = True,
|
get_all_variation = True,
|
||||||
get_inactive_variation = False,
|
get_inactive_variation = False,
|
||||||
get_first_variation = False,
|
# get_first_variation = False,
|
||||||
ids_variation = ''
|
ids_variation = ''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class User_Filters():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_default(datastore_store):
|
def get_default(datastore_store):
|
||||||
user = datastore_store.get_login_user()
|
user = datastore_store.get_user_session()
|
||||||
return User_Filters(
|
return User_Filters(
|
||||||
get_all_user = False,
|
get_all_user = False,
|
||||||
get_inactive_user = False,
|
get_inactive_user = False,
|
||||||
|
|||||||
Binary file not shown.
@@ -158,7 +158,7 @@ def save_product():
|
|||||||
objsProduct.append(Product.from_json(product))
|
objsProduct.append(Product.from_json(product))
|
||||||
# model_save = Model_View_Store_Product() # filters_product=filters_form)
|
# model_save = Model_View_Store_Product() # filters_product=filters_form)
|
||||||
print(f'objsProduct={objsProduct}')
|
print(f'objsProduct={objsProduct}')
|
||||||
Model_View_Store_Product.save_products(data.get('comment', 'No comment'), objsProduct)
|
save_errors = Model_View_Store_Product.save_products(data.get('comment', 'No comment'), objsProduct)
|
||||||
|
|
||||||
model_return = Model_View_Store_Product(form_filters=form_filters)
|
model_return = Model_View_Store_Product(form_filters=form_filters)
|
||||||
print('nips')
|
print('nips')
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,7 +20,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
|||||||
from business_objects.store.delivery_region import Delivery_Region
|
from business_objects.store.delivery_region import Delivery_Region
|
||||||
from business_objects.store.discount import Discount
|
from business_objects.store.discount import Discount
|
||||||
from business_objects.store.order import Order
|
from business_objects.store.order import Order
|
||||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Parameters_Product
|
from business_objects.store.product import Product, Product_Permutation, Parameters_Product
|
||||||
from business_objects.sql_error import SQL_Error
|
from business_objects.sql_error import SQL_Error
|
||||||
from business_objects.store.stock_item import Stock_Item
|
from business_objects.store.stock_item import Stock_Item
|
||||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||||
@@ -61,8 +61,15 @@ class DataStore_Store_Base(DataStore_Base):
|
|||||||
av.val_instance(product_filters, 'product_filters', _m, Parameters_Product)
|
av.val_instance(product_filters, 'product_filters', _m, Parameters_Product)
|
||||||
argument_dict = product_filters.to_json()
|
argument_dict = product_filters.to_json()
|
||||||
user = cls.get_user_session()
|
user = cls.get_user_session()
|
||||||
|
"""
|
||||||
argument_dict['a_id_user'] = user.id_user # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
argument_dict['a_id_user'] = user.id_user # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||||
argument_dict['a_debug'] = 0
|
argument_dict['a_debug'] = 0
|
||||||
|
"""
|
||||||
|
argument_dict = {
|
||||||
|
'a_id_user': user.id_user
|
||||||
|
, **argument_dict
|
||||||
|
, 'a_debug': 0
|
||||||
|
}
|
||||||
print(f'argument_dict: {argument_dict}')
|
print(f'argument_dict: {argument_dict}')
|
||||||
print('executing p_shop_get_many_product')
|
print('executing p_shop_get_many_product')
|
||||||
result = cls.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
result = cls.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
||||||
@@ -71,77 +78,57 @@ class DataStore_Store_Base(DataStore_Base):
|
|||||||
|
|
||||||
|
|
||||||
category_list = Product_Category_Container()
|
category_list = Product_Category_Container()
|
||||||
|
print(f'initial category_list: {category_list}')
|
||||||
|
|
||||||
# Categories
|
# Categories
|
||||||
result_set_1 = cursor.fetchall()
|
result_set_1 = cursor.fetchall()
|
||||||
print(f'raw categories: {result_set_1}')
|
print(f'raw categories: {result_set_1}')
|
||||||
# categories = [Product_Category(row[0], row[1], row[2], row[3]) for row in result_set_1]
|
|
||||||
# categories = []
|
|
||||||
# category_index = {}
|
|
||||||
for row in result_set_1:
|
for row in result_set_1:
|
||||||
new_category = Product_Category.from_DB_get_many_product_catalogue(row) # Product_Category(row[0], row[1], row[2], row[3])
|
new_category = Product_Category.from_DB_get_many_product_catalogue(row)
|
||||||
# category_index[new_category.id_category] = len(categories)
|
print(f'new_category: {new_category}')
|
||||||
# categories.append(new_category)
|
|
||||||
category_list.add_product_category(new_category)
|
category_list.add_product_category(new_category)
|
||||||
# print(f'categories: {[c.id_category for c in categories]}')
|
|
||||||
|
print(f'category-loaded category_list: {category_list}')
|
||||||
|
|
||||||
# Products
|
# Products
|
||||||
cursor.nextset()
|
cursor.nextset()
|
||||||
result_set_2 = cursor.fetchall()
|
result_set_2 = cursor.fetchall()
|
||||||
# print(f'products: {result_set_2}')
|
print(f'raw products: {result_set_2}')
|
||||||
# products = [] # [Product(**row) for row in result_set_2]
|
|
||||||
# product_index = {}
|
|
||||||
for row in result_set_2:
|
for row in result_set_2:
|
||||||
new_product = Product.from_DB_get_many_product_catalogue(row) # (row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19])
|
print(f'row: {row}')
|
||||||
index_category = category_list.get_index_category_from_id(new_product.id_category)
|
new_product = Product.from_DB_get_many_product_catalogue(row)
|
||||||
category = category_list.categories[index_category]
|
print(f'new_product: {new_product}')
|
||||||
category_list.add_product(new_product)
|
try:
|
||||||
# products.append(new_product)
|
category_list.add_product(new_product)
|
||||||
print(f'category_list: {category_list}')
|
except Exception as e:
|
||||||
|
print(f'Error adding product: {e}')
|
||||||
|
|
||||||
# Permutations
|
# Permutations
|
||||||
cursor.nextset()
|
cursor.nextset()
|
||||||
result_set_3 = cursor.fetchall()
|
result_set_3 = cursor.fetchall()
|
||||||
# print(f'Permutations: {result_set_3}')
|
|
||||||
permutations = [] # [Product(**row) for row in result_set_2]
|
|
||||||
# permutation_index = {}
|
|
||||||
for row in result_set_3:
|
for row in result_set_3:
|
||||||
new_permutation = Product_Permutation.from_DB_get_many_product_catalogue(row) # (row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19])
|
new_permutation = Product_Permutation.from_DB_get_many_product_catalogue(row)
|
||||||
index_category = category_list.get_index_category_from_id(new_permutation.id_category)
|
try:
|
||||||
category = category_list.categories[index_category]
|
category_list.add_product_permutation(new_permutation)
|
||||||
category_list.add_product_permutation(new_permutation)
|
except Exception as e:
|
||||||
print(f'category_list: {category_list}')
|
print(f'Error adding permutation: {e}')
|
||||||
|
|
||||||
# Product_Variations
|
# Product_Variations
|
||||||
cursor.nextset()
|
cursor.nextset()
|
||||||
result_set_4 = cursor.fetchall()
|
result_set_4 = cursor.fetchall()
|
||||||
# print(f'variations: {result_set_4}')
|
|
||||||
# variations = [Product_Variation(**row) for row in result_set_4]
|
|
||||||
variations = []
|
|
||||||
for row in result_set_4:
|
for row in result_set_4:
|
||||||
new_variation = Product_Variation.from_DB_get_many_product_catalogue(row)
|
new_variation = Product_Variation.from_DB_get_many_product_catalogue(row)
|
||||||
variations.append(new_variation)
|
try:
|
||||||
category_list.add_product_variation(new_variation)
|
category_list.add_product_variation(new_variation)
|
||||||
# print(f'variations: {variations}')
|
except Exception as e:
|
||||||
# print(f'products: {[p.id_product for p in products]}')
|
print(f'Error adding variation: {e}')
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
cursor.nextset()
|
cursor.nextset()
|
||||||
result_set_5 = cursor.fetchall()
|
result_set_5 = cursor.fetchall()
|
||||||
# print(f'images: {result_set_5}')
|
|
||||||
# images = [Image(**row) for row in result_set_5]
|
|
||||||
images = []
|
|
||||||
for row in result_set_5:
|
for row in result_set_5:
|
||||||
new_image = Image.from_DB_get_many_product_catalogue(row) # (row[0], row[1], row[2], row[3], row[4])
|
new_image = Image.from_DB_get_many_product_catalogue(row)
|
||||||
images.append(new_image)
|
|
||||||
# products[product_index[new_image.id_product]].images.append(new_image)
|
|
||||||
"""
|
|
||||||
index_category = category_index[new_image.id_category]
|
|
||||||
index_product = categories[index_category].index_product_from_ids_product_permutation(new_image.id_product, new_image.id_permutation)
|
|
||||||
categories[index_category].products[index_product].images.append(new_image)
|
|
||||||
"""
|
|
||||||
category_list.add_product_image(new_image)
|
category_list.add_product_image(new_image)
|
||||||
# print(f'images: {images}')
|
|
||||||
# print(f'products: {[p.id_product for p in products]}')
|
|
||||||
|
|
||||||
# Errors
|
# Errors
|
||||||
cursor.nextset()
|
cursor.nextset()
|
||||||
@@ -181,6 +168,7 @@ class DataStore_Store_Base(DataStore_Base):
|
|||||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
|
print(f'get many category_list: {category_list}')
|
||||||
return category_list, errors # categories, category_index
|
return category_list, errors # categories, category_index
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -283,8 +271,8 @@ class DataStore_Store_Base(DataStore_Base):
|
|||||||
argument_dict_list = {
|
argument_dict_list = {
|
||||||
# 'a_guid': guid
|
# 'a_guid': guid
|
||||||
'a_id_user': user.id_user
|
'a_id_user': user.id_user
|
||||||
, 'a_debug': 0
|
|
||||||
, **variation_filters.to_json()
|
, **variation_filters.to_json()
|
||||||
|
, 'a_debug': 0
|
||||||
}
|
}
|
||||||
# argument_dict_list['a_guid'] = guid
|
# argument_dict_list['a_guid'] = guid
|
||||||
result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
||||||
|
|||||||
@@ -12,20 +12,8 @@ Datastore for Store Products
|
|||||||
|
|
||||||
# internal
|
# internal
|
||||||
import lib.argument_validation as av
|
import lib.argument_validation as av
|
||||||
from business_objects.store.basket import Basket, Basket_Item
|
|
||||||
from business_objects.store.product_category import Product_Category_Container, Product_Category
|
|
||||||
from business_objects.store.currency import Currency
|
|
||||||
from business_objects.store.image import Image
|
|
||||||
from business_objects.store.delivery_option import Delivery_Option
|
|
||||||
from business_objects.store.delivery_region import Delivery_Region
|
|
||||||
from business_objects.store.discount import Discount
|
|
||||||
from business_objects.store.order import Order
|
|
||||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Parameters_Product
|
|
||||||
from business_objects.sql_error import SQL_Error
|
from business_objects.sql_error import SQL_Error
|
||||||
from business_objects.store.stock_item import Stock_Item
|
from business_objects.store.product import Product, Product_Permutation, Product_Price, Parameters_Product, Product_Temp
|
||||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
|
||||||
from business_objects.store.product_variation import Product_Variation, Product_Variation_Filters, Product_Variation_Container
|
|
||||||
# from datastores.datastore_base import Table_Shop_Product_Category, Table_Shop_Product_Category_Temp
|
|
||||||
from datastores.datastore_store_base import DataStore_Store_Base
|
from datastores.datastore_store_base import DataStore_Store_Base
|
||||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||||
@@ -56,6 +44,7 @@ class Table_Shop_Product_Category(db.Model):
|
|||||||
created_by: int = db.Column(db.Integer)
|
created_by: int = db.Column(db.Integer)
|
||||||
id_change_set: int = db.Column(db.Integer)
|
id_change_set: int = db.Column(db.Integer)
|
||||||
"""
|
"""
|
||||||
|
"""
|
||||||
class Row_Shop_Product_Temp(db.Model):
|
class Row_Shop_Product_Temp(db.Model):
|
||||||
__tablename__ = 'Shop_Product_Temp'
|
__tablename__ = 'Shop_Product_Temp'
|
||||||
__table_args__ = { 'extend_existing': True }
|
__table_args__ = { 'extend_existing': True }
|
||||||
@@ -80,50 +69,70 @@ class Row_Shop_Product_Temp(db.Model):
|
|||||||
return row
|
return row
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
return {
|
return {
|
||||||
|
'id_product': self.id_product,
|
||||||
'id_category': self.id_category,
|
'id_category': self.id_category,
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
|
'has_variations': self.has_variations,
|
||||||
'id_access_level_required': self.id_access_level_required,
|
'id_access_level_required': self.id_access_level_required,
|
||||||
'active': av.input_bool(self.active, self.FLAG_ACTIVE, f'{self.__class__.__name__}.to_json'),
|
'active': av.input_bool(self.active, self.FLAG_ACTIVE, f'{self.__class__.__name__}.to_json'),
|
||||||
'display_order': self.display_order,
|
'display_order': self.display_order,
|
||||||
'guid': self.guid,
|
'guid': self.guid,
|
||||||
}
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
class DataStore_Store_Product(DataStore_Store_Base):
|
class DataStore_Store_Product(DataStore_Store_Base):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@classmethod
|
@classmethod
|
||||||
def save_categories(cls, comment, categories):
|
def save_products(cls, comment, products):
|
||||||
_m = 'DataStore_Store_Product_Category.save_categories'
|
_m = 'DataStore_Store_Product.save_products'
|
||||||
print(f'{_m}\nstarting...')
|
print(f'{_m}\nstarting...')
|
||||||
print(f'comment: {comment}\ncategories: {categories}')
|
print(f'comment: {comment}\nproducts: {products}')
|
||||||
# av.val_str(comment, 'comment', _m)
|
|
||||||
# av.val_list_instances(categories, 'categories', _m, Product_Category, 1)
|
|
||||||
|
|
||||||
guid = Helper_DB_MySQL.create_guid()
|
guid = Helper_DB_MySQL.create_guid()
|
||||||
user = cls.get_user_session()
|
user = cls.get_user_session()
|
||||||
rows = []
|
rows = []
|
||||||
id_category_new = 0
|
id_product_new = 0
|
||||||
for category in categories:
|
for product in products:
|
||||||
row = Row_Shop_Product_Temp.from_product(category)
|
row = Product_Temp.from_product(product)
|
||||||
if row.id_category == '':
|
if row.id_product == '':
|
||||||
id_category_new -= 1
|
id_product_new -= 1
|
||||||
row.id_category = id_category_new
|
row.id_product = id_product_new
|
||||||
else:
|
else:
|
||||||
print(f'row.id_category: {row.id_category}')
|
print(f'row.id_product: {row.id_product}')
|
||||||
row.guid = guid
|
row.guid = guid
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
|
|
||||||
print(f'rows: {rows}')
|
print(f'rows: {rows}')
|
||||||
|
DataStore_Store_Base.upload_bulk(Product_Temp.__tablename__, rows, 1000)
|
||||||
DataStore_Store_Base.upload_bulk(rows, Row_Shop_Product_Temp, 1000)
|
|
||||||
|
|
||||||
argument_dict_list = {
|
argument_dict_list = {
|
||||||
'a_id_user': user.id_user,
|
|
||||||
'a_guid': guid,
|
|
||||||
'a_comment': comment,
|
'a_comment': comment,
|
||||||
|
'a_guid': guid,
|
||||||
|
'a_id_user': user.id_user,
|
||||||
|
'a_debug': 0,
|
||||||
}
|
}
|
||||||
save_result = cls.db_procedure_execute('p_shop_save_product', argument_dict_list)
|
save_result = cls.db_procedure_execute('p_shop_save_product', argument_dict_list)
|
||||||
|
|
||||||
|
cursor = save_result # .cursor
|
||||||
|
print('data received')
|
||||||
|
|
||||||
|
# Errors
|
||||||
|
# cursor.nextset()
|
||||||
|
result_set_e = cursor.fetchall()
|
||||||
|
print(f'raw errors: {result_set_e}')
|
||||||
|
errors = []
|
||||||
|
if len(result_set_e) > 0:
|
||||||
|
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # (row[0], row[1])
|
||||||
|
for error in errors:
|
||||||
|
print(f"Error [{error.code}]: {error.msg}")
|
||||||
|
try:
|
||||||
|
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Error clearing cursor: {e}')
|
||||||
|
cursor.close()
|
||||||
|
|
||||||
save_result.close()
|
save_result.close()
|
||||||
print('save procedure executed')
|
print('save procedure executed')
|
||||||
|
return errors
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
|
|||||||
DataStore_Store_Base.upload_bulk(Product_Category_Temp.__tablename__, rows, 1000)
|
DataStore_Store_Base.upload_bulk(Product_Category_Temp.__tablename__, rows, 1000)
|
||||||
|
|
||||||
argument_dict_list = {
|
argument_dict_list = {
|
||||||
'a_id_user': user.id_user,
|
|
||||||
'a_guid': guid,
|
|
||||||
'a_comment': comment,
|
'a_comment': comment,
|
||||||
|
'a_guid': guid,
|
||||||
|
'a_id_user': user.id_user,
|
||||||
}
|
}
|
||||||
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
|
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
|
||||||
save_result.close()
|
save_result.close()
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
|
|||||||
print('bulk uploaded')
|
print('bulk uploaded')
|
||||||
|
|
||||||
argument_dict_list = {
|
argument_dict_list = {
|
||||||
'a_id_user': user.id_user,
|
|
||||||
'a_comment': comment,
|
'a_comment': comment,
|
||||||
'a_guid': guid
|
'a_guid': guid,
|
||||||
|
'a_id_user': user.id_user,
|
||||||
}
|
}
|
||||||
cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list)
|
cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list)
|
||||||
print('saved product permutations')
|
print('saved product permutations')
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from business_objects.store.stock_item import Stock_Item
|
|||||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||||
from business_objects.store.product_variation import Product_Variation, Product_Variation_Filters, Product_Variation_Container
|
from business_objects.store.product_variation import Product_Variation, Product_Variation_Filters, Product_Variation_Container
|
||||||
from datastores.datastore_store_base import DataStore_Store_Base
|
from datastores.datastore_store_base import DataStore_Store_Base
|
||||||
# from helpers.helper_db_mysql import Helper_DB_MySQL
|
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||||
from extensions import db
|
from extensions import db
|
||||||
# external
|
# external
|
||||||
@@ -41,59 +41,9 @@ from pydantic import BaseModel, ConfigDict
|
|||||||
from typing import ClassVar
|
from typing import ClassVar
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
# db = SQLAlchemy()
|
|
||||||
|
|
||||||
|
|
||||||
class DataStore_Store_Product_Variation(DataStore_Store_Base):
|
class DataStore_Store_Product_Variation(DataStore_Store_Base):
|
||||||
# Global constants
|
|
||||||
# Attributes
|
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def get_many_product_variation(self, variation_filters):
|
|
||||||
_m = 'DataStore_Store_Product_Variation.get_many_product_variation'
|
|
||||||
print(_m)
|
|
||||||
av.val_instance(variation_filters, 'variation_filters', _m, Product_Variation_Filters)
|
|
||||||
|
|
||||||
guid = Helper_DB_MySQL.create_guid()
|
|
||||||
# now = datetime.now()
|
|
||||||
# user = self.get_user_session()
|
|
||||||
|
|
||||||
"""
|
|
||||||
argument_dict_list = {
|
|
||||||
'a_id_user': id_user,
|
|
||||||
'a_comment': comment,
|
|
||||||
'a_guid': guid
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
user = self.get_user_session()
|
|
||||||
argument_dict_list = {
|
|
||||||
# 'a_guid': guid
|
|
||||||
'a_id_user': user.id_user
|
|
||||||
, **variation_filters.to_json()
|
|
||||||
}
|
|
||||||
# argument_dict_list['a_guid'] = guid
|
|
||||||
result = self.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
|
||||||
|
|
||||||
cursor = result.cursor
|
|
||||||
result_set = cursor.fetchall()
|
|
||||||
|
|
||||||
# Product_Variations
|
|
||||||
variations = Product_Variation_Container()
|
|
||||||
for row in result_set:
|
|
||||||
new_variation = Product_Variation.from_DB_variation(row)
|
|
||||||
variations.add_product_variation(new_variation)
|
|
||||||
|
|
||||||
errors = []
|
|
||||||
cursor.nextset()
|
|
||||||
result_set_e = cursor.fetchall()
|
|
||||||
print(f'raw errors: {result_set_e}')
|
|
||||||
if len(result_set_e) > 0:
|
|
||||||
errors = [SQL_Error.from_DB_record(row) for row in result_set_e] # [SQL_Error(row[0], row[1]) for row in result_set_e]
|
|
||||||
for error in errors:
|
|
||||||
print(f"Error [{error.code}]: {error.msg}")
|
|
||||||
|
|
||||||
DataStore_Store_Product_Variation.db_cursor_clear(cursor)
|
|
||||||
|
|
||||||
return variations, errors
|
|
||||||
@@ -58,8 +58,15 @@ class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
|||||||
av.val_instance(Parameters_Stock_Item, 'Parameters_Stock_Item', _m, Parameters_Stock_Item)
|
av.val_instance(Parameters_Stock_Item, 'Parameters_Stock_Item', _m, Parameters_Stock_Item)
|
||||||
argument_dict = Parameters_Stock_Item.to_json()
|
argument_dict = Parameters_Stock_Item.to_json()
|
||||||
user = self.get_user_session()
|
user = self.get_user_session()
|
||||||
argument_dict['a_id_user'] = user.id_user # 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
"""
|
||||||
|
argument_dict['a_id_user'] = user.id_user # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||||
argument_dict['a_debug'] = 0
|
argument_dict['a_debug'] = 0
|
||||||
|
"""
|
||||||
|
argument_dict = {
|
||||||
|
'a_id_user': user.id_user
|
||||||
|
, **argument_dict
|
||||||
|
, 'a_debug': 0
|
||||||
|
}
|
||||||
print(f'argument_dict: {argument_dict}')
|
print(f'argument_dict: {argument_dict}')
|
||||||
print('executing p_shop_get_many_stock_item')
|
print('executing p_shop_get_many_stock_item')
|
||||||
result = self.db_procedure_execute('p_shop_get_many_stock_item', argument_dict)
|
result = self.db_procedure_execute('p_shop_get_many_stock_item', argument_dict)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -40,9 +40,8 @@ class Form_Base(FlaskForm, metaclass=Form_Base_Meta):
|
|||||||
def from_json(cls, json):
|
def from_json(cls, json):
|
||||||
pass
|
pass
|
||||||
@classmethod
|
@classmethod
|
||||||
@abstractmethod
|
|
||||||
def get_default(cls):
|
def get_default(cls):
|
||||||
pass
|
return cls()
|
||||||
"""
|
"""
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def test_69(self):
|
def test_69(self):
|
||||||
@@ -55,6 +54,12 @@ class Form_Base(FlaskForm, metaclass=Form_Base_Meta):
|
|||||||
form_filters.active.data = av.input_bool(data_form['active'], 'active', 'filter_category')
|
form_filters.active.data = av.input_bool(data_form['active'], 'active', 'filter_category')
|
||||||
return form_filters
|
return form_filters
|
||||||
"""
|
"""
|
||||||
|
@classmethod
|
||||||
|
def get_choices_blank(cls):
|
||||||
|
return [('', 'Select')]
|
||||||
|
@classmethod
|
||||||
|
def get_choice_all(cls):
|
||||||
|
return ('', 'All')
|
||||||
|
|
||||||
'''
|
'''
|
||||||
class Filters_Stored_Procedure_Base(Form_Base):
|
class Filters_Stored_Procedure_Base(Form_Base):
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -22,7 +22,7 @@ from flask_wtf.recaptcha import RecaptchaField
|
|||||||
|
|
||||||
|
|
||||||
class Filters_Product(FlaskForm):
|
class Filters_Product(FlaskForm):
|
||||||
id_category = SelectField('Category', validators=[Optional()], choices=[])
|
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')])
|
||||||
is_not_empty = BooleanField('Not empty only?')
|
is_not_empty = BooleanField('Not empty only?')
|
||||||
active = BooleanField("Active only?")
|
active = BooleanField("Active only?")
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -33,4 +33,11 @@ class Filters_Product(FlaskForm):
|
|||||||
form.active.data = filters_product.active
|
form.active.data = filters_product.active
|
||||||
return form
|
return form
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'Filters_Product(id_category={self.id_category}, is_not_empty={self.is_not_empty.data}, active={self.active.data})'
|
return f'Filters_Product(id_category={self.id_category}, is_not_empty={self.is_not_empty.data}, active={self.active.data})'
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json):
|
||||||
|
filters = cls()
|
||||||
|
filters.id_category.data = json['id_category']
|
||||||
|
filters.is_not_empty.data = json['is_not_empty']
|
||||||
|
filters.active.data = json['active']
|
||||||
|
return filters
|
||||||
@@ -26,8 +26,8 @@ from abc import ABCMeta, abstractmethod
|
|||||||
|
|
||||||
|
|
||||||
class Filters_Product_Permutation(Form_Base):
|
class Filters_Product_Permutation(Form_Base):
|
||||||
id_category = SelectField('Category', validators=[Optional()], choices=[])
|
id_category = SelectField('Category', validators=[Optional()], choices=[('', 'All')])
|
||||||
id_product = SelectField('Product', validators=[Optional()], choices=[])
|
id_product = SelectField('Product', validators=[Optional()], choices=[('', 'All')])
|
||||||
is_out_of_stock = BooleanField('Out of stock only?')
|
is_out_of_stock = BooleanField('Out of stock only?')
|
||||||
quantity_min = FloatField('Min stock')
|
quantity_min = FloatField('Min stock')
|
||||||
quantity_max = FloatField('Max stock')
|
quantity_max = FloatField('Max stock')
|
||||||
|
|||||||
@@ -64,4 +64,5 @@ class Filters_Stock_Item(Form_Base):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_default(cls):
|
def get_default(cls):
|
||||||
filters = cls()
|
filters = cls()
|
||||||
filters.id_category.choices = [('', 'Select category')]
|
filters.id_category.choices = cls.get_choices_blank()
|
||||||
|
filters.id_product.choices = cls.get_choices_blank()
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -204,6 +204,7 @@ class Model_View_Base(BaseModel, ABC):
|
|||||||
session: None = None
|
session: None = None
|
||||||
is_page_store: bool = None
|
is_page_store: bool = None
|
||||||
is_user_logged_in: bool = None
|
is_user_logged_in: bool = None
|
||||||
|
user: User = None
|
||||||
access_levels: list = None
|
access_levels: list = None
|
||||||
|
|
||||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||||
@@ -253,6 +254,7 @@ class Model_View_Base(BaseModel, ABC):
|
|||||||
|
|
||||||
datastore_user = DataStore_User()
|
datastore_user = DataStore_User()
|
||||||
user = datastore_user.get_user_session()
|
user = datastore_user.get_user_session()
|
||||||
|
self.user = user
|
||||||
self.is_user_logged_in = user.is_logged_in
|
self.is_user_logged_in = user.is_logged_in
|
||||||
|
|
||||||
def output_bool(self, boolean):
|
def output_bool(self, boolean):
|
||||||
@@ -318,13 +320,13 @@ class Model_View_Base(BaseModel, ABC):
|
|||||||
return {getattr(obj, key): obj.to_json() for obj in list_objects}
|
return {getattr(obj, key): obj.to_json() for obj in list_objects}
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def convert_list_objects_to_dict_by_attribute_key_default(list_objects):
|
def convert_list_objects_to_dict_by_attribute_key_default(list_objects):
|
||||||
if len(list_objects) == 0:
|
if list_objects is None or len(list_objects) == 0:
|
||||||
return {}
|
return {}
|
||||||
obj_class = list_objects[0].__class__
|
obj_class = list_objects[0].__class__
|
||||||
return Model_View_Base.convert_list_objects_to_dict_by_attribute_key(list_objects, getattr(obj_class, obj_class.FLAG_NAME_ATTR_OPTION_VALUE))
|
return Model_View_Base.convert_list_objects_to_dict_by_attribute_key(list_objects, getattr(obj_class, obj_class.FLAG_NAME_ATTR_OPTION_VALUE))
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def convert_list_objects_to_dict_json_by_attribute_key_default(list_objects):
|
def convert_list_objects_to_dict_json_by_attribute_key_default(list_objects):
|
||||||
if len(list_objects) == 0:
|
if list_objects is None or len(list_objects) == 0:
|
||||||
return {}
|
return {}
|
||||||
obj_class = list_objects[0].__class__
|
obj_class = list_objects[0].__class__
|
||||||
return Model_View_Base.convert_list_objects_to_dict_json_by_attribute_key(list_objects, getattr(obj_class, obj_class.FLAG_NAME_ATTR_OPTION_VALUE))
|
return Model_View_Base.convert_list_objects_to_dict_json_by_attribute_key(list_objects, getattr(obj_class, obj_class.FLAG_NAME_ATTR_OPTION_VALUE))
|
||||||
|
|||||||
@@ -104,9 +104,9 @@ class Model_View_Store(Model_View_Base):
|
|||||||
HASH_STORE_BASKET_LOAD : ClassVar[str] = '/store/basket_load'
|
HASH_STORE_BASKET_LOAD : ClassVar[str] = '/store/basket_load'
|
||||||
HASH_GET_STORE_PRODUCT: ClassVar[str] = '/store/product_get'
|
HASH_GET_STORE_PRODUCT: ClassVar[str] = '/store/product_get'
|
||||||
HASH_GET_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/category_get'
|
HASH_GET_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/category_get'
|
||||||
HASH_SAVE_STORE_PRODUCT: ClassVar[str] = '/store/save_product'
|
|
||||||
HASH_GET_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_get'
|
HASH_GET_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_get'
|
||||||
HASH_GET_STORE_STOCK_ITEM: ClassVar[str] = '/store/stock_item_get'
|
HASH_GET_STORE_STOCK_ITEM: ClassVar[str] = '/store/stock_item_get'
|
||||||
|
HASH_SAVE_STORE_PRODUCT: ClassVar[str] = '/store/save_product'
|
||||||
HASH_SAVE_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/save_category'
|
HASH_SAVE_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/save_category'
|
||||||
HASH_SAVE_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/save_permutation'
|
HASH_SAVE_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/save_permutation'
|
||||||
HASH_SAVE_STORE_STOCK_ITEM: ClassVar[str] = '/store/save_stock_item'
|
HASH_SAVE_STORE_STOCK_ITEM: ClassVar[str] = '/store/save_stock_item'
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Data model for store product view
|
|||||||
from business_objects.store.product import Product, Parameters_Product
|
from business_objects.store.product import Product, Parameters_Product
|
||||||
from business_objects.store.product_category import Product_Category_Container
|
from business_objects.store.product_category import Product_Category_Container
|
||||||
from datastores.datastore_store_product import DataStore_Store_Product
|
from datastores.datastore_store_product import DataStore_Store_Product
|
||||||
|
from forms.access_level import Filters_Access_Level
|
||||||
from forms.store.product import Filters_Product
|
from forms.store.product import Filters_Product
|
||||||
from models.model_view_store import Model_View_Store
|
from models.model_view_store import Model_View_Store
|
||||||
# from routes import bp_home
|
# from routes import bp_home
|
||||||
@@ -86,12 +87,17 @@ class Model_View_Store_Product(Model_View_Store):
|
|||||||
return 'Products'
|
return 'Products'
|
||||||
|
|
||||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
|
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
|
||||||
_m = 'Model_View_Store_Permutation.__init__'
|
_m = 'Model_View_Store_Product.__init__'
|
||||||
print(f'{_m}\nstarting...')
|
print(f'{_m}\nstarting...')
|
||||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
|
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
|
||||||
|
self.access_levels = self.get_many_access_level(Filters_Access_Level())
|
||||||
parameters_product = Parameters_Product.from_form_filters_product(self.form_filters)
|
parameters_product = Parameters_Product.from_form_filters_product(self.form_filters)
|
||||||
datastore_store = DataStore_Store_Product()
|
datastore_store = DataStore_Store_Product()
|
||||||
self.category_list, errors = datastore_store.get_many_product(parameters_product)
|
self.category_list, errors = datastore_store.get_many_product(parameters_product)
|
||||||
|
countProducts = 0
|
||||||
|
for category in self.category_list.categories:
|
||||||
|
countProducts += len(category.products)
|
||||||
|
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||||
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||||
Parameters_Product(
|
Parameters_Product(
|
||||||
get_all_product_category = True,
|
get_all_product_category = True,
|
||||||
@@ -110,7 +116,7 @@ class Model_View_Store_Product(Model_View_Store):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
print(f'category filters: {self.category_list_filters.categories}')
|
print(f'category filters: {self.category_list_filters.categories}')
|
||||||
self.form_filters.id_category.choices = [('0', 'All')] + [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||||
print(f'category options: {self.form_filters.id_category.choices}')
|
print(f'category options: {self.form_filters.id_category.choices}')
|
||||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||||
self.units_measurement = self.get_many_unit_measurement()
|
self.units_measurement = self.get_many_unit_measurement()
|
||||||
@@ -118,7 +124,8 @@ class Model_View_Store_Product(Model_View_Store):
|
|||||||
self.currencies = self.get_many_currency()
|
self.currencies = self.get_many_currency()
|
||||||
self.currency_options = [currency.to_json_option() for currency in self.currencies]
|
self.currency_options = [currency.to_json_option() for currency in self.currencies]
|
||||||
|
|
||||||
|
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def save_products(comment, list_products):
|
def save_products(comment, list_products):
|
||||||
_m = 'Model_View_Store_Product.save_products'
|
_m = 'Model_View_Store_Product.save_products'
|
||||||
DataStore_Store_Product.save_products(comment, list_products)
|
return DataStore_Store_Product.save_products(comment, list_products)
|
||||||
@@ -7411,7 +7411,7 @@ BEGIN
|
|||||||
, t_C.can_admin = UE_T.can_admin
|
, t_C.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
CALL p_shop_calc_user_clear_temp(a_guid);
|
CALL p_shop_clear_calc_user(a_guid);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
@@ -7727,7 +7727,7 @@ BEGIN
|
|||||||
, t_P.can_admin = UE_T.can_admin
|
, t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
CALL p_shop_calc_user_clear_temp(a_guid);
|
CALL p_shop_clear_calc_user(a_guid);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
@@ -11495,7 +11495,7 @@ BEGIN
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM partsltd_prod.Shop_Calc_User_Temp
|
DELETE FROM partsltd_prod.Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
@@ -14368,7 +14368,7 @@ BEGIN
|
|||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = a_guid;
|
WHERE GUID = a_guid;
|
||||||
@@ -15903,7 +15903,7 @@ BEGIN
|
|||||||
t_P.can_admin = UE_T.can_admin
|
t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
@@ -17186,7 +17186,7 @@ BEGIN
|
|||||||
t_P.can_admin = UE_T.can_admin
|
t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
@@ -17496,7 +17496,7 @@ BEGIN
|
|||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = a_guid;
|
WHERE GUID = a_guid;
|
||||||
@@ -19071,7 +19071,7 @@ BEGIN
|
|||||||
t_P.can_admin = UE_T.can_admin
|
t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ DROP PROCEDURE IF EXISTS p_shop_save_product_category;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_product_category (
|
CREATE PROCEDURE p_shop_save_product_category (
|
||||||
IN a_id_user INT,
|
IN a_comment VARCHAR(500),
|
||||||
IN a_guid BINARY(36),
|
IN a_guid BINARY(36),
|
||||||
IN a_comment VARCHAR(500)
|
IN a_id_user INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
||||||
@@ -206,59 +206,59 @@ BEGIN
|
|||||||
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
|
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
IF NOT ISNULL(v_ids_product_permission) THEN
|
|
||||||
INSERT INTO Shop_Product_Change_Set ( comment )
|
|
||||||
VALUES ( a_comment )
|
|
||||||
;
|
|
||||||
|
|
||||||
SET v_id_change_set := LAST_INSERT_ID();
|
IF NOT ISNULL(v_ids_product_permission) THEN
|
||||||
|
INSERT INTO Shop_Product_Change_Set ( comment )
|
||||||
|
VALUES ( a_comment )
|
||||||
|
;
|
||||||
|
|
||||||
|
SET v_id_change_set := LAST_INSERT_ID();
|
||||||
|
|
||||||
|
UPDATE Shop_Product_Category PC
|
||||||
|
INNER JOIN tmp_Category t_C ON PC.id_category = t_C.id_category
|
||||||
|
SET
|
||||||
|
PC.id_category = t_C.id_category
|
||||||
|
, PC.code = t_C.code
|
||||||
|
, PC.name = t_C.name
|
||||||
|
, PC.description = t_C.description
|
||||||
|
, PC.id_access_level_required = t_C.id_access_level_required
|
||||||
|
, PC.active = t_C.active
|
||||||
|
, PC.display_order = t_C.display_order
|
||||||
|
, PC.id_change_set = v_id_change_set
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
UPDATE Shop_Product_Category PC
|
INSERT INTO Shop_Product_Category (
|
||||||
INNER JOIN tmp_Category t_C ON PC.id_category = t_C.id_category
|
code
|
||||||
SET
|
, name
|
||||||
PC.id_category = t_C.id_category
|
, description
|
||||||
, PC.code = t_C.code
|
, id_access_level_required
|
||||||
, PC.name = t_C.name
|
, active
|
||||||
, PC.description = t_C.description
|
, display_order
|
||||||
, PC.id_access_level_required = t_C.id_access_level_required
|
, created_by
|
||||||
, PC.active = t_C.active
|
, created_on
|
||||||
, PC.display_order = t_C.display_order
|
)
|
||||||
, PC.id_change_set = v_id_change_set
|
SELECT
|
||||||
|
-- t_C.id_category AS id_category
|
||||||
|
t_C.code AS code
|
||||||
|
, t_C.name AS name
|
||||||
|
, t_C.description AS description
|
||||||
|
, t_C.id_access_level_required AS id_access_level_required
|
||||||
|
, t_C.active AS active
|
||||||
|
, t_C.display_order AS display_order
|
||||||
|
, a_id_user AS created_by
|
||||||
|
, v_now AS created_on
|
||||||
|
FROM tmp_Category t_C
|
||||||
|
WHERE is_new = 1
|
||||||
|
AND active = 1
|
||||||
;
|
;
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO Shop_Product_Category (
|
|
||||||
code
|
|
||||||
, name
|
|
||||||
, description
|
|
||||||
, id_access_level_required
|
|
||||||
, active
|
|
||||||
, display_order
|
|
||||||
, created_by
|
|
||||||
, created_on
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
-- t_C.id_category AS id_category
|
|
||||||
t_C.code AS code
|
|
||||||
, t_C.name AS name
|
|
||||||
, t_C.description AS description
|
|
||||||
, t_C.id_access_level_required AS id_access_level_required
|
|
||||||
, t_C.active AS active
|
|
||||||
, t_C.display_order AS display_order
|
|
||||||
, a_id_user AS created_by
|
|
||||||
, v_now AS created_on
|
|
||||||
FROM tmp_Category t_C
|
|
||||||
WHERE is_new = 1
|
|
||||||
AND active = 1
|
|
||||||
;
|
|
||||||
|
|
||||||
|
DELETE FROM Shop_Product_Category_Temp
|
||||||
|
WHERE GUID = a_guid;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
DELETE FROM Shop_Product_Category_Temp
|
|
||||||
WHERE GUID = a_guid;
|
|
||||||
|
|
||||||
SELECT * FROM tmp_Msg_Error;
|
SELECT * FROM tmp_Msg_Error;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp_Catgory;
|
DROP TEMPORARY TABLE IF EXISTS tmp_Catgory;
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ BEGIN
|
|||||||
, t_C.can_admin = UE_T.can_admin
|
, t_C.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
CALL p_shop_calc_user_clear_temp(a_guid);
|
CALL p_shop_clear_calc_user(a_guid);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,19 @@ DROP PROCEDURE IF EXISTS p_shop_save_product;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_product (
|
CREATE PROCEDURE p_shop_save_product (
|
||||||
|
IN a_comment VARCHAR(500),
|
||||||
IN a_guid BINARY(36),
|
IN a_guid BINARY(36),
|
||||||
IN a_id_user INT,
|
IN a_id_user INT,
|
||||||
IN a_comment VARCHAR(500)
|
IN a_debug BIT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
||||||
|
DECLARE v_id_access_level_edit INT;
|
||||||
DECLARE v_id_type_error_bad_data INT;
|
DECLARE v_id_type_error_bad_data INT;
|
||||||
DECLARE v_id_permission_product INT;
|
DECLARE v_id_permission_product INT;
|
||||||
DECLARE v_ids_product_permission LONGTEXT;
|
DECLARE v_ids_product_permission LONGTEXT;
|
||||||
DECLARE v_id_change_set INT;
|
DECLARE v_id_change_set INT;
|
||||||
|
DECLARE v_time_start TIMESTAMP(6);
|
||||||
|
|
||||||
DECLARE exit handler for SQLEXCEPTION
|
DECLARE exit handler for SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
@@ -35,24 +38,44 @@ BEGIN
|
|||||||
-- Select the error information
|
-- Select the error information
|
||||||
-- SELECT 'Error' AS status, @errno AS error_code, @sqlstate AS sql_state, @text AS message;
|
-- SELECT 'Error' AS status, @errno AS error_code, @sqlstate AS sql_state, @text AS message;
|
||||||
INSERT INTO tmp_Msg_Error (
|
INSERT INTO tmp_Msg_Error (
|
||||||
guid
|
-- guid
|
||||||
, id_type
|
id_type
|
||||||
, code
|
, code
|
||||||
, msg
|
, msg
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
a_guid
|
-- a_guid
|
||||||
, NULL
|
(SELECT id_type FROM Shop_Msg_Error_Type WHERE code = 'MYSQL_ERROR' LIMIT 1)
|
||||||
, @errno
|
, @errno
|
||||||
, @text
|
, IFNULL(@text, 'NULL')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM tmp_Msg_Error t_ME
|
||||||
|
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
|
||||||
|
;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_Product;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
SET v_code_type_error_bad_data := 'BAD_DATA';
|
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||||
|
SET v_code_type_error_bad_data := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
|
||||||
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_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 a_guid := IFNULL(a_guid, UUID());
|
SET a_guid := IFNULL(a_guid, UUID());
|
||||||
|
SET a_debug := IFNULL(a_debug, 0);
|
||||||
|
|
||||||
|
IF a_debug = 1 THEN
|
||||||
|
SELECT
|
||||||
|
v_code_type_error_bad_data
|
||||||
|
, v_id_type_error_bad_data
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_Product;
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp_Product (
|
CREATE TEMPORARY TABLE tmp_Product (
|
||||||
id_category INT NOT NULL
|
id_category INT NOT NULL
|
||||||
@@ -71,7 +94,7 @@ BEGIN
|
|||||||
|
|
||||||
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
|
||||||
, id_type INT NOT NULL
|
, id_type INT NOT NULL
|
||||||
/*
|
/*
|
||||||
CONSTRAINT FK_tmp_Msg_Error_id_type
|
CONSTRAINT FK_tmp_Msg_Error_id_type
|
||||||
@@ -98,79 +121,115 @@ BEGIN
|
|||||||
SELECT
|
SELECT
|
||||||
IFNULL(P_T.id_category, P.id_category) AS id_category
|
IFNULL(P_T.id_category, P.id_category) AS id_category
|
||||||
, IFNULL(P_T.id_product, 0) AS id_product
|
, IFNULL(P_T.id_product, 0) AS id_product
|
||||||
, IFNULL(PT.name, P.name) AS name
|
, IFNULL(P_T.name, P.name) AS name
|
||||||
, IFNULL(PT.has_variations, P.has_variations) AS has_variations
|
, IFNULL(P_T.has_variations, P.has_variations) AS has_variations
|
||||||
, IFNULL(PT.id_access_level_required, P.id_access_level_required) AS id_access_level_required
|
, IFNULL(P_T.id_access_level_required, P.id_access_level_required) AS id_access_level_required
|
||||||
, IFNULL(P_T.active, P.active) AS active
|
, IFNULL(P_T.active, P.active) AS active
|
||||||
, IFNULL(P_T.display_order, P.display_order) AS display_order
|
, IFNULL(P_T.display_order, P.display_order) AS display_order
|
||||||
, IFNULL(PT.name, IFNULL(P.name, IFNULL(P_T.id_product, '(No Product)'))) AS name_error
|
, IFNULL(P_T.name, IFNULL(P.name, IFNULL(P_T.id_product, '(No Product)'))) AS name_error
|
||||||
, CASE WHEN IFNULL(P_T.id_product, 0) < 1 THEN 1 ELSE 0 END AS is_new
|
, CASE WHEN IFNULL(P_T.id_product, 0) < 1 THEN 1 ELSE 0 END AS is_new
|
||||||
FROM Shop_Product_Tenp P_T
|
FROM partsltd_prod.Shop_Product_Temp P_T
|
||||||
LEFT JOIN Shop_Product P ON P_T.id_product = P.id_product
|
LEFT JOIN partsltd_prod.Shop_Product P ON P_T.id_product = P.id_product
|
||||||
;
|
;
|
||||||
|
|
||||||
-- Validation
|
-- Validation
|
||||||
-- Missing mandatory fields
|
-- Missing mandatory fields
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid
|
|
||||||
, id_type
|
|
||||||
, code
|
|
||||||
, msg
|
|
||||||
)
|
|
||||||
-- id_category
|
-- id_category
|
||||||
SELECT
|
IF EXISTS (SELECT * FROM tmp_Product t_P WHERE ISNULL(t_P.id_category) LIMIT 1) THEN
|
||||||
a_guid AS GUID
|
INSERT INTO tmp_Msg_Error (
|
||||||
, v_id_type_error_bad_data
|
id_type
|
||||||
, v_code_error_bad_data
|
, code
|
||||||
, CONCAT('The following product(s) do not have a category: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', '))
|
, msg
|
||||||
FROM tmp_Product t_P
|
)
|
||||||
WHERE ISNULL(t_P.id_category)
|
SELECT
|
||||||
UNION
|
v_id_type_error_bad_data
|
||||||
|
, v_code_type_error_bad_data
|
||||||
|
, IFNULL(CONCAT('The following product(s) do not have a category: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')), 'NULL')
|
||||||
|
FROM tmp_Product t_P
|
||||||
|
WHERE ISNULL(t_P.id_category)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- name
|
-- name
|
||||||
SELECT
|
IF EXISTS (SELECT * FROM tmp_Product t_P WHERE ISNULL(t_P.name) LIMIT 1) THEN
|
||||||
a_guid AS GUID
|
INSERT INTO tmp_Msg_Error (
|
||||||
, v_id_type_error_bad_data
|
id_type
|
||||||
, v_code_error_bad_data
|
, code
|
||||||
, CONCAT('The following product(s) do not have a name: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', '))
|
, msg
|
||||||
FROM tmp_Product t_P
|
)
|
||||||
WHERE ISNULL(t_P.name)
|
SELECT
|
||||||
UNION
|
v_id_type_error_bad_data
|
||||||
|
, v_code_type_error_bad_data
|
||||||
|
, IFNULL(CONCAT('The following product(s) do not have a name: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')), 'NULL')
|
||||||
|
FROM tmp_Product t_P
|
||||||
|
WHERE ISNULL(t_P.name)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- has_variations
|
-- has_variations
|
||||||
SELECT
|
IF EXISTS (SELECT * FROM tmp_Product t_P WHERE ISNULL(t_P.has_variations) LIMIT 1) THEN
|
||||||
a_guid AS GUID
|
INSERT INTO tmp_Msg_Error (
|
||||||
, v_id_type_error_bad_data
|
id_type
|
||||||
, v_code_error_bad_data
|
, code
|
||||||
, CONCAT('The following product(s) do not have a has-variations setting: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', '))
|
, msg
|
||||||
FROM tmp_Product t_P
|
)
|
||||||
WHERE ISNULL(t_P.has_variations)
|
SELECT
|
||||||
UNION
|
v_id_type_error_bad_data
|
||||||
|
, v_code_type_error_bad_data
|
||||||
|
, IFNULL(CONCAT('The following product(s) do not have a has-variations setting: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')), 'NULL')
|
||||||
|
FROM tmp_Product t_P
|
||||||
|
WHERE ISNULL(t_P.has_variations)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- id_access_level_required
|
-- id_access_level_required
|
||||||
SELECT
|
IF EXISTS (SELECT * FROM tmp_Product t_P WHERE ISNULL(t_P.id_access_level_required) LIMIT 1) THEN
|
||||||
a_guid AS GUID
|
INSERT INTO tmp_Msg_Error (
|
||||||
, v_id_type_error_bad_data
|
id_type
|
||||||
, v_code_error_bad_data
|
, code
|
||||||
, CONCAT('The following product(s) do not have a required access level ID: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', '))
|
, msg
|
||||||
FROM tmp_Product t_P
|
)
|
||||||
WHERE ISNULL(t_P.id_access_level_required)
|
SELECT
|
||||||
UNION
|
v_id_type_error_bad_data
|
||||||
|
, v_code_type_error_bad_data
|
||||||
|
, IFNULL(CONCAT('The following product(s) do not have a required access level ID: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')), 'NULL')
|
||||||
|
FROM tmp_Product t_P
|
||||||
|
WHERE ISNULL(t_P.id_access_level_required)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- display_order
|
-- display_order
|
||||||
SELECT
|
IF EXISTS (SELECT * FROM tmp_Product t_P WHERE ISNULL(t_P.display_order) LIMIT 1) THEN
|
||||||
a_guid AS GUID
|
INSERT INTO tmp_Msg_Error (
|
||||||
, v_id_type_error_bad_data
|
id_type
|
||||||
, v_code_error_bad_data
|
, code
|
||||||
, CONCAT('The following product(s) do not have a display order: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', '))
|
, msg
|
||||||
FROM tmp_Product t_P
|
)
|
||||||
WHERE ISNULL(t_P.display_order)
|
SELECT
|
||||||
;
|
v_id_type_error_bad_data
|
||||||
|
, v_code_type_error_bad_data
|
||||||
|
, IFNULL(CONCAT('The following product(s) do not have a display order: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')), 'NULL')
|
||||||
|
FROM tmp_Product t_P
|
||||||
|
WHERE ISNULL(t_P.display_order)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
-- Permissions
|
-- Permissions
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN
|
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(item SEPARATOR ',') FROM tmp_Shop_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
|
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 p_shop_calc_user(a_guid, a_id_user, v_id_permission_product, v_ids_product_permission);
|
CALL partsltd_prod.p_shop_calc_user(
|
||||||
|
a_guid
|
||||||
|
, a_id_user
|
||||||
|
, FALSE -- get_inactive_users
|
||||||
|
, v_id_permission_product
|
||||||
|
, v_id_access_level_edit
|
||||||
|
, v_ids_product_permission
|
||||||
|
, 0 -- debug
|
||||||
|
);
|
||||||
|
|
||||||
UPDATE tmp_Product t_P
|
UPDATE tmp_Product t_P
|
||||||
INNER JOIN Shop_Calc_User_Temp UE_T
|
INNER JOIN Shop_Calc_User_Temp UE_T
|
||||||
@@ -182,64 +241,72 @@ BEGIN
|
|||||||
, t_P.can_admin = UE_T.can_admin
|
, t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
CALL p_shop_calc_user_clear_temp(a_guid);
|
CALL partsltd_prod.p_shop_clear_calc_user(
|
||||||
|
a_guid
|
||||||
|
, 0 -- debug
|
||||||
|
);
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
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 the transaction
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
IF NOT ISNULL(v_ids_product_permission) THEN
|
||||||
-- Your transaction logic goes here
|
INSERT INTO partsltd_prod.Shop_Product_Change_Set ( comment )
|
||||||
IF NOT ISNULL(v_ids_product_permission) THEN
|
VALUES ( a_comment )
|
||||||
INSERT INTO Shop_Product_Change_Set ( 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
|
||||||
|
INNER JOIN tmp_Product t_P ON P.id_product = t_P.id_product
|
||||||
UPDATE Shop_Product P
|
SET
|
||||||
INNER JOIN tmp_Product t_P ON P.id_product = t_P.id_product
|
P.id_category = t_P.id_category
|
||||||
SET
|
, P.name = t_P.name
|
||||||
P.id_category = t_P.id_category
|
, P.has_variations = t_P.has_variations
|
||||||
, P.name = t_P.name
|
, P.id_access_level_required = t_P.id_access_level_required
|
||||||
, P.has_variations = t_P.has_variations
|
, P.display_order = t_P.display_order
|
||||||
, P.id_access_level_required = t_P.id_access_level_required
|
, P.id_change_set = v_id_change_set
|
||||||
, P.display_order = t_P.display_order
|
;
|
||||||
, P.id_change_set = v_id_change_set
|
END IF;
|
||||||
;
|
|
||||||
END IF;
|
INSERT INTO partsltd_prod.Shop_Product (
|
||||||
|
id_category
|
||||||
INSERT INTO Shop_Product (
|
, name
|
||||||
id_category
|
, has_variations
|
||||||
, name
|
, id_access_level_required
|
||||||
, has_variations
|
, display_order
|
||||||
, id_access_level_required
|
, created_by
|
||||||
, display_order
|
, created_on
|
||||||
, created_by
|
)
|
||||||
, created_on
|
SELECT
|
||||||
)
|
t_P.id_category AS id_category
|
||||||
SELECT
|
, t_P.name AS name
|
||||||
t_P.id_category AS id_category
|
, t_P.has_variations AS has_variations
|
||||||
, t_P.name AS name
|
, t_P.id_access_level_required AS id_access_level_required
|
||||||
, t_P.has_variations AS has_variations
|
, t_P.display_order AS display_order
|
||||||
, t_P.id_access_level_required AS id_access_level_required
|
, a_id_user AS created_by
|
||||||
, t_P.display_order AS display_order
|
, v_time_start AS created_on
|
||||||
, a_id_user AS created_by
|
FROM tmp_Product t_P
|
||||||
, v_now AS created_on
|
WHERE is_new = 1
|
||||||
FROM tmp_Product t_P
|
;
|
||||||
WHERE is_new = 1
|
|
||||||
;
|
DELETE FROM partsltd_prod.Shop_Product_Category_Temp
|
||||||
|
WHERE GUID = a_guid;
|
||||||
-- If we reach here without error, commit the transaction
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT * FROM tmp_Msg_Error;
|
SELECT *
|
||||||
|
FROM tmp_Msg_Error t_ME
|
||||||
|
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
|
||||||
|
;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp_Product;
|
DROP TEMPORARY TABLE IF EXISTS tmp_Product;
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
|
||||||
|
IF a_debug = 1 THEN
|
||||||
|
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
|
||||||
|
END IF;
|
||||||
END //
|
END //
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
|
|
||||||
|
|||||||
78
static/MySQL/7203_p_shop_save_product_test.sql
Normal file
78
static/MySQL/7203_p_shop_save_product_test.sql
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
|
||||||
|
-- Clear previous proc
|
||||||
|
DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_test;
|
||||||
|
|
||||||
|
|
||||||
|
DELIMITER //
|
||||||
|
CREATE PROCEDURE p_shop_save_product_test ()
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
DECLARE v_guid BINARY(36);
|
||||||
|
DECLARE v_time_start TIMESTAMP(6);
|
||||||
|
|
||||||
|
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||||
|
SET v_guid := 'nips';
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM partsltd_prod.Shop_Product
|
||||||
|
;
|
||||||
|
SELECT *
|
||||||
|
FROM partsltd_prod.Shop_Product_Temp
|
||||||
|
;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
INSERT INTO partsltd_prod.Shop_Product_Temp (
|
||||||
|
id_product
|
||||||
|
, id_category
|
||||||
|
, name
|
||||||
|
, has_variations
|
||||||
|
, id_access_level_required
|
||||||
|
, display_order
|
||||||
|
, active
|
||||||
|
, guid
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
4 -- id_product
|
||||||
|
, 1 -- id_category
|
||||||
|
, 'Laptops' -- name
|
||||||
|
, 1 -- has_variations
|
||||||
|
, 2 -- id_access_level_required
|
||||||
|
, 2 -- display_order
|
||||||
|
, 1 -- active
|
||||||
|
, v_guid
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM partsltd_prod.Shop_Product_Temp
|
||||||
|
WHERE GUID = v_guid
|
||||||
|
;
|
||||||
|
|
||||||
|
CALL partsltd_prod.p_shop_save_product (
|
||||||
|
'Test save product' -- comment
|
||||||
|
, v_guid -- guid
|
||||||
|
, 1 -- id_user
|
||||||
|
, 1 -- debug
|
||||||
|
);
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM partsltd_prod.Shop_Product
|
||||||
|
;
|
||||||
|
SELECT *
|
||||||
|
FROM partsltd_prod.Shop_Product_Temp
|
||||||
|
;
|
||||||
|
|
||||||
|
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
|
||||||
|
END //
|
||||||
|
DELIMITER ;;
|
||||||
|
|
||||||
|
CALL partsltd_prod.p_shop_save_product_test ();
|
||||||
|
|
||||||
|
DELETE FROM partsltd_prod.Shop_Product_Temp;
|
||||||
|
/*
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS tmp_Msg_Error;
|
||||||
|
*/
|
||||||
@@ -1,605 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Clear previous proc
|
|
||||||
DROP PROCEDURE IF EXISTS p_shop_save_permutation;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS tmp_Shop_Manufacturing_Purchase_Order_Product_Link;
|
|
||||||
DROP TABLE IF EXISTS tmp_Msg_Error;
|
|
||||||
|
|
||||||
DELIMITER //
|
|
||||||
CREATE PROCEDURE p_shop_save_permutation (
|
|
||||||
IN a_guid VARCHAR(500),
|
|
||||||
IN a_id_user INT,
|
|
||||||
IN a_id_order INT,
|
|
||||||
-- IN a_id_supplier_ordered INT,
|
|
||||||
IN a_id_currency_cost INT,
|
|
||||||
IN a_active BIT,
|
|
||||||
IN a_comment VARCHAR(500)
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
DECLARE v_id_error_type_bad_data INT;
|
|
||||||
DECLARE v_code_error_type_bad_data VARCHAR(50);
|
|
||||||
DECLARE v_id_error_type_no_permission INT;
|
|
||||||
DECLARE v_code_error_type_no_permission VARCHAR(50);
|
|
||||||
DECLARE v_guid_permission BINARY(36);
|
|
||||||
-- DECLARE v_id_user VARCHAR(100);
|
|
||||||
DECLARE v_id_permission_manufacturing_purchase_order INT;
|
|
||||||
DECLARE v_id_access_level_EDIT INT;
|
|
||||||
DECLARE v_ids_product VARCHAR(4000);
|
|
||||||
DECLARE v_ids_product_no_permission VARCHAR(4000);
|
|
||||||
-- DECLARE v_id_order_new INT;
|
|
||||||
DECLARE v_id_change_set INT;
|
|
||||||
DECLARE v_is_new_manufacturing_purchase_order BIT;
|
|
||||||
|
|
||||||
SET SESSION sql_mode = sys.list_drop(@@session.sql_mode, 'ONLY_FULL_GROUP_BY');
|
|
||||||
|
|
||||||
SET v_code_error_type_bad_data = 'BAD_DATA';
|
|
||||||
SET v_id_error_type_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_error_type_bad_data LIMIT 1);
|
|
||||||
SET v_code_error_type_no_permission = 'NO_PERMISSION';
|
|
||||||
SET v_id_error_type_no_permission := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_error_type_no_permission LIMIT 1);
|
|
||||||
SET v_guid_permission = UUID();
|
|
||||||
-- SET v_id_user = CURRENT_USER();
|
|
||||||
SET v_id_permission_manufacturing_purchase_order := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_MANUFACTURING_PURCHASE_ORDER' LIMIT 1);
|
|
||||||
SET v_id_access_level_EDIT := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT');
|
|
||||||
|
|
||||||
-- Argument default values
|
|
||||||
IF a_guid IS NULL THEN
|
|
||||||
SET a_guid = UUID();
|
|
||||||
END IF;
|
|
||||||
IF a_active IS NULL THEN
|
|
||||||
SET a_active = 0;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Temporary tables
|
|
||||||
/*
|
|
||||||
CREATE TABLE tmp_Shop_Supplier_Purchase_Order (
|
|
||||||
id_order INT NOT NULL PRIMARY KEY,
|
|
||||||
id_supplier_ordered INT NOT NULL,
|
|
||||||
CONSTRAINT FK_tmp_Shop_Supplier_Purchase_Order_id_supplier_ordered
|
|
||||||
FOREIGN KEY (id_supplier_ordered)
|
|
||||||
REFERENCES Shop_Supplier(id_supplier),
|
|
||||||
cost_total_local FLOAT NOT NULL,
|
|
||||||
id_currency_cost INT NOT NULL
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE TABLE tmp_Shop_Manufacturing_Purchase_Order_Product_Link (
|
|
||||||
id_link INT NOT NULL PRIMARY KEY,
|
|
||||||
id_order INT NOT NULL,
|
|
||||||
/*
|
|
||||||
CONSTRAINT FK_tmp_Supplier_Purchase_Order_Product_Link_id_order
|
|
||||||
FOREIGN KEY (id_order)
|
|
||||||
REFERENCES Shop_Manufacturing_Purchase_Order(id_order),
|
|
||||||
*/
|
|
||||||
id_permutation INT NOT NULL,
|
|
||||||
CONSTRAINT FK_tmp_Manuf_Purch_Order_Product_Link_id_permutation
|
|
||||||
FOREIGN KEY (id_permutation)
|
|
||||||
REFERENCES Shop_Product_Permutation(id_permutation),
|
|
||||||
cost_total_local FLOAT NOT NULL,
|
|
||||||
id_currency_cost INT NOT NULL,
|
|
||||||
value_produced_total_local FLOAT NOT NULL,
|
|
||||||
quantity_used FLOAT NOT NULL,
|
|
||||||
id_unit_quantity INT NOT NULL,
|
|
||||||
CONSTRAINT FK_tmp_Manuf_Purch_Order_Product_Link_id_unit_quantity
|
|
||||||
FOREIGN KEY (id_unit_quantity)
|
|
||||||
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
|
|
||||||
quantity_produced FLOAT NULL,
|
|
||||||
latency_manufacture_days INT NOT NULL,
|
|
||||||
display_order INT NOT NULL,
|
|
||||||
active BIT NOT NULL,
|
|
||||||
name_error VARCHAR(200) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
|
|
||||||
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
||||||
guid BINARY(36) NOT NULL,
|
|
||||||
id_type INT NOT NULL,
|
|
||||||
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
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
-- Argument validation
|
|
||||||
# User ID
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF ISNULL(a_id_user) OR NOT EXISTS (SELECT * FROM Shop_User WHERE id_user = a_id_user) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(a_guid, v_id_error_type_bad_data, v_code_error_type_bad_data, CONCAT('Invalid User ID: ', IFNULL(a_id_user, 'NULL')))
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
# Order ID
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF ISNULL(a_id_order) OR ((a_id_order > 0) AND NOT EXISTS (SELECT * FROM Shop_Manufacturing_Purchase_Order WHERE id_order = a_id_order)) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(a_guid, v_id_error_type_bad_data, v_code_error_type_bad_data, CONCAT('Invalid Manufacturing Purchase Order ID: ', IFNULL(a_id_order, 'NULL')))
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
/*
|
|
||||||
# Supplier ID
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF ISNULL(a_id_supplier_ordered) OR NOT EXISTS (SELECT * FROM Shop_Supplier WHERE id_supplier = a_id_supplier_ordered) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(a_guid, v_id_error_type_bad_data, v_code_error_type_bad_data, CONCAT('Invalid supplier ID: ', IFNULL(a_id_supplier_ordered, 'NULL')))
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
*/
|
|
||||||
|
|
||||||
# Currency ID
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF ISNULL(a_id_currency_cost) OR NOT EXISTS (SELECT * FROM Shop_Currency WHERE id_currency = a_id_currency_cost) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(a_guid, v_id_error_type_bad_data, v_code_error_type_bad_data, CONCAT('Invalid currency ID: ', IFNULL(a_id_currency, 'NULL')))
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
# Comment
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF ISNULL(a_comment) OR TRIM(a_comment) = '' THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(a_guid, v_id_error_type_bad_data, v_code_error_type_bad_data, 'A comment must be provided.')
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
|
|
||||||
-- Get data from Temp table
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
SET v_is_new_manufacturing_purchase_order := CASE WHEN a_id_order <= 0 THEN 1 ELSE 0 END;
|
|
||||||
|
|
||||||
INSERT INTO tmp_Shop_Manufacturing_Purchase_Order_Product_Link (
|
|
||||||
id_link,
|
|
||||||
id_order,
|
|
||||||
id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
quantity_used,
|
|
||||||
id_unit_quantity,
|
|
||||||
quantity_produced,
|
|
||||||
value_produced_total_local,
|
|
||||||
latency_manufacture_days,
|
|
||||||
display_order,
|
|
||||||
active,
|
|
||||||
name_error
|
|
||||||
)
|
|
||||||
/*
|
|
||||||
VALUES
|
|
||||||
(a_id_supplier, a_name_company, a_name_contact, a_department_contact, a_id_address, a_phone_number, a_fax, a_email, a_website, a_id_currency, a_active)
|
|
||||||
*/
|
|
||||||
SELECT
|
|
||||||
MPOPL_T.id_link,
|
|
||||||
MPOPL_T.id_order,
|
|
||||||
MPOPL_T.id_permutation,
|
|
||||||
PP.cost_local * MPOPL_T.quantity_used AS cost_total_local,
|
|
||||||
MPOPL_T.id_currency_cost,
|
|
||||||
MPOPL_T.quantity_used,
|
|
||||||
MPOPL_T.id_unit_quantity,
|
|
||||||
MPOPL_T.quantity_produced,
|
|
||||||
(PP.cost_local + PP.profit_local_min) * MPOPL_T.quantity_produced AS value_produced_total_local,
|
|
||||||
MPOPL_T.latency_manufacture_days,
|
|
||||||
MPOPL_T.display_order,
|
|
||||||
MPOPL_T.active,
|
|
||||||
CONCAT(PP.id_permutation, ' - ', IFNULL(P.name ,'')) AS name_error
|
|
||||||
FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
|
|
||||||
INNER JOIN Shop_Product_Permutation PP ON MPOPL_T.id_permutation = PP.id_permutation
|
|
||||||
INNER JOIN Shop_Product P ON PP.id_product = P.id_product
|
|
||||||
WHERE MPOPL_T.GUID = a_guid
|
|
||||||
-- GROUP BY MPOPL_T.id_order, name_error, MPOPL_T.id_link
|
|
||||||
/*
|
|
||||||
group by
|
|
||||||
MPOPL_T.id_link,
|
|
||||||
MPOPL_T.id_order,
|
|
||||||
MPOPL_T.id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
MPOPL_T.id_currency_cost,
|
|
||||||
MPOPL_T.quantity_used,
|
|
||||||
MPOPL_T.id_unit_quantity,
|
|
||||||
MPOPL_T.quantity_produced,
|
|
||||||
value_produced_total_local,
|
|
||||||
MPOPL_T.latency_manufacture_days,
|
|
||||||
MPOPL_T.display_order,
|
|
||||||
MPOPL_T.active,
|
|
||||||
name_error
|
|
||||||
*/
|
|
||||||
-- GROUP BY id_link, P.id_product, PP.id_permutation
|
|
||||||
-- GROUP BY name_error, ID_LINK, cost_total_local, value_produced_total_local
|
|
||||||
;
|
|
||||||
DELETE MPOPL_T
|
|
||||||
FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
|
|
||||||
WHERE MPOPL_T.GUID = a_guid
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Invalid quantity used
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF EXISTS (
|
|
||||||
SELECT *
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link
|
|
||||||
WHERE
|
|
||||||
NOT ISNULL(quantity_used)
|
|
||||||
AND quantity_used < 0
|
|
||||||
) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
a_guid,
|
|
||||||
v_id_error_type_bad_data,
|
|
||||||
v_code_error_type_bad_data,
|
|
||||||
CONCAT('Invalid quantity used property for the following permutations: ', GROUP_CONCAT(t_MPOPL.name_error SEPARATOR ', '))
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL
|
|
||||||
WHERE t_MPOPL.quantity_used < 0
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Invalid quantity produced
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF EXISTS (
|
|
||||||
SELECT *
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link
|
|
||||||
WHERE
|
|
||||||
NOT ISNULL(quantity_produced)
|
|
||||||
AND quantity_produced < 0
|
|
||||||
) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
a_guid,
|
|
||||||
v_id_error_type_bad_data,
|
|
||||||
v_code_error_type_bad_data,
|
|
||||||
CONCAT('Invalid quantity produced property for the following permutations: ', GROUP_CONCAT(t_MPOPL.name_error SEPARATOR ', '))
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL
|
|
||||||
WHERE t_MPOPL.quantity_produced < 0
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Duplicates
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
IF EXISTS (SELECT id_permutation, name_error, COUNT(*) FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL GROUP BY id_permutation HAVING COUNT(*) > 1) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
a_guid,
|
|
||||||
v_id_error_type_bad_data,
|
|
||||||
v_code_error_type_bad_data,
|
|
||||||
CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', '))
|
|
||||||
FROM (SELECT id_permutation, name_error, COUNT(*) FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL GROUP BY id_permutation HAVING COUNT(*) > 1) t_MPOPLC
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
|
|
||||||
-- Permissions
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
SET v_ids_product := (
|
|
||||||
SELECT GROUP_CONCAT(G.id_product SEPARATOR ',')
|
|
||||||
FROM (
|
|
||||||
SELECT DISTINCT PP.id_product
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPO
|
|
||||||
INNER JOIN Shop_Product_Permutation PP ON t_MPO.id_permutation = PP.id_permutation
|
|
||||||
) G
|
|
||||||
);
|
|
||||||
|
|
||||||
CALL p_shop_calc_user(v_guid_permission, a_id_user, 0, v_id_permission_manufacturing_purchase_order, v_id_access_level_edit, v_ids_product);
|
|
||||||
|
|
||||||
/*
|
|
||||||
UPDATE tmp_Shop_Supplier t_S
|
|
||||||
INNER JOIN Shop_Calc_User_Temp TP
|
|
||||||
ON TP.GUID = v_guid_permission
|
|
||||||
SET tP.can_view = TP.can_view,
|
|
||||||
tP.can_edit = TP.can_edit,
|
|
||||||
tP.can_admin = TP.can_admin;
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
SET v_has_permission := (
|
|
||||||
SELECT can_edit
|
|
||||||
FROM Shop_Calc_User_Temp
|
|
||||||
WHERE
|
|
||||||
GUID = v_guid_permission
|
|
||||||
AND can_edit = 0
|
|
||||||
);
|
|
||||||
|
|
||||||
IF v_has_permission = 0 THEN
|
|
||||||
SET v_id_error_type_no_permission := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, msg
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
a_guid,
|
|
||||||
v_id_error_type_no_permission,
|
|
||||||
CONCAT('You do not have ', name, ' permissions.')
|
|
||||||
FROM Shop_Permission
|
|
||||||
WHERE id_permission = v_id_permission_manufacturing_purchase_order
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
*/
|
|
||||||
SET v_ids_product_no_permission := (
|
|
||||||
SELECT GROUP_CONCAT(PT.id_product SEPARATOR ',')
|
|
||||||
FROM Shop_Calc_User_Temp PT
|
|
||||||
WHERE
|
|
||||||
PT.can_edit = 0
|
|
||||||
AND NOT ISNULL(PT.id_product)
|
|
||||||
);
|
|
||||||
IF NOT ISNULL(v_ids_product_no_permission) THEN
|
|
||||||
INSERT INTO tmp_Msg_Error (
|
|
||||||
guid, id_type, code, msg
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
a_guid,
|
|
||||||
v_id_error_type_no_permission,
|
|
||||||
v_code_error_type_no_permission,
|
|
||||||
CONCAT('You do not have permission to edit the following product IDs: ', v_ids_product_no_permission)
|
|
||||||
)
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Transaction
|
|
||||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
START TRANSACTION;
|
|
||||||
INSERT INTO Shop_Sales_And_Purchasing_Change_Set (
|
|
||||||
comment,
|
|
||||||
updated_last_by,
|
|
||||||
updated_last_on
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
CONCAT(
|
|
||||||
'Save ',
|
|
||||||
CASE WHEN v_is_new_manufacturing_purchase_order = 1 THEN 'new ' ELSE '' END,
|
|
||||||
'Manufacturing Purchase Order - ',
|
|
||||||
a_comment
|
|
||||||
),
|
|
||||||
a_id_user,
|
|
||||||
CURRENT_TIME()
|
|
||||||
);
|
|
||||||
|
|
||||||
SET v_id_change_set := (SELECT id_change_set FROM Shop_Sales_And_Purchasing_Change_Set ORDER BY id_change_set DESC LIMIT 1);
|
|
||||||
|
|
||||||
IF (v_is_new_manufacturing_purchase_order = 1) THEN
|
|
||||||
INSERT INTO Shop_Manufacturing_Purchase_Order (
|
|
||||||
-- id_supplier_ordered,
|
|
||||||
cost_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
value_produced_total_local,
|
|
||||||
created_by,
|
|
||||||
id_change_set,
|
|
||||||
active
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
-- a_id_supplier_ordered,
|
|
||||||
SUM(t_MPOPL.cost_total_local),
|
|
||||||
a_id_currency_cost,
|
|
||||||
SUM(t_MPOPL.value_produced_total_local),
|
|
||||||
a_id_user,
|
|
||||||
v_id_change_set,
|
|
||||||
a_active
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL
|
|
||||||
;
|
|
||||||
-- SET v_id_order_new
|
|
||||||
SET a_id_order := (SELECT id_order FROM Shop_Manufacturing_Purchase_Order ORDER BY id_order DESC LIMIT 1);
|
|
||||||
|
|
||||||
INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link (
|
|
||||||
id_order,
|
|
||||||
id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
value_produced_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
quantity_used,
|
|
||||||
id_unit_quantity,
|
|
||||||
quantity_produced,
|
|
||||||
latency_manufacture_days,
|
|
||||||
display_order,
|
|
||||||
active,
|
|
||||||
created_by,
|
|
||||||
id_change_set
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
a_id_order, -- v_id_order_new,
|
|
||||||
id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
value_produced_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
quantity_used,
|
|
||||||
id_unit_quantity,
|
|
||||||
quantity_produced,
|
|
||||||
latency_manufacture_days,
|
|
||||||
display_order,
|
|
||||||
active,
|
|
||||||
a_id_user,
|
|
||||||
v_id_change_set
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL
|
|
||||||
;
|
|
||||||
ELSE
|
|
||||||
UPDATE Shop_Manufacturing_Purchase_Order MPO
|
|
||||||
INNER JOIN tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON MPO.id_order = t_MPOPL.id_order
|
|
||||||
SET
|
|
||||||
-- MPO.id_supplier_ordered = a_id_supplier_ordered,
|
|
||||||
MPO.cost_total_local = SUM(t_MPOPL.cost_total_local),
|
|
||||||
MPO.value_produced_total_local = SUM(t_MPOPL.value_produced_total_local),
|
|
||||||
MPO.id_currency = a_id_currency_cost,
|
|
||||||
MPO.id_change_set = v_id_change_set,
|
|
||||||
MPO.active = a_active
|
|
||||||
WHERE MPO.id_order = a_id_order
|
|
||||||
;
|
|
||||||
IF EXISTS (SELECT * FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL INNER JOIN Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPOPL.id_link = MPOPL.id_link) THEN
|
|
||||||
UPDATE Shop_Manufacturing_Purchase_Order_Product_Link MPOPL
|
|
||||||
INNER JOIN tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL
|
|
||||||
ON MPOPL.id_link = t_MPOPL.id_link
|
|
||||||
SET
|
|
||||||
MPOPL.id_order = t_MPOPL.id_order,
|
|
||||||
MPOPL.id_permutation = t_MPOPL.id_permutation,
|
|
||||||
MPOPL.cost_total_local = t_MPOPL.cost_total_local,
|
|
||||||
MPOPL.value_produced_total_local = t_MPOPL.value_produced_total_local,
|
|
||||||
MPOPL.id_currency_cost = t_MPOPL.id_currency_cost,
|
|
||||||
MPOPL.quantity_used = t_MPOPL.quantity_used,
|
|
||||||
MPOPL.id_unit_quantity = t_MPOPL.id_unit_quantity,
|
|
||||||
MPOPL.quantity_produced = t_MPOPL.quantity_produced,
|
|
||||||
MPOPL.latency_manufacture_days = t_MPOPL.latency_manufacture_days,
|
|
||||||
MPOPL.display_order = t_MPOPL.display_order,
|
|
||||||
MPOPL.active = t_MPOPL.active,
|
|
||||||
MPOPL.id_change_set = v_id_change_set
|
|
||||||
;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link (
|
|
||||||
id_order,
|
|
||||||
id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
value_produced_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
quantity_used,
|
|
||||||
id_unit_quantity,
|
|
||||||
quantity_produced,
|
|
||||||
latency_manufacture_days,
|
|
||||||
display_order,
|
|
||||||
active,
|
|
||||||
created_by,
|
|
||||||
id_change_set
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
id_order,
|
|
||||||
id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
value_produced_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
quantity_used,
|
|
||||||
id_unit_quantity,
|
|
||||||
quantity_produced,
|
|
||||||
latency_manufacture_days,
|
|
||||||
display_order,
|
|
||||||
active,
|
|
||||||
a_id_user,
|
|
||||||
v_id_change_set
|
|
||||||
FROM tmp_Shop_Manufacturing_Purchase_Order_Product_Link t_MPOPL
|
|
||||||
WHERE t_MPOPL.id_link < 0
|
|
||||||
;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF EXISTS (SELECT * FROM tmp_Msg_Error) THEN
|
|
||||||
ROLLBACK;
|
|
||||||
ELSE
|
|
||||||
COMMIT;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Returns
|
|
||||||
# SET v_now = NOW();
|
|
||||||
|
|
||||||
# Manufacturing Purchase Orders
|
|
||||||
SELECT *
|
|
||||||
FROM Shop_Manufacturing_Purchase_Order
|
|
||||||
WHERE
|
|
||||||
id_order = a_id_order
|
|
||||||
-- GUID = a_guid
|
|
||||||
;
|
|
||||||
|
|
||||||
# Manufacturing Purchase Order Product Links
|
|
||||||
SELECT *
|
|
||||||
FROM Shop_Manufacturing_Purchase_Order_Product_Link
|
|
||||||
WHERE
|
|
||||||
id_order = a_id_order
|
|
||||||
-- GUID = a_guid
|
|
||||||
;
|
|
||||||
|
|
||||||
# Errors
|
|
||||||
SELECT *
|
|
||||||
FROM tmp_Msg_Error
|
|
||||||
;
|
|
||||||
|
|
||||||
# DROP TABLE tmp_Shop_Manufacturing_Purchase_Order;
|
|
||||||
DROP TABLE tmp_Shop_Manufacturing_Purchase_Order_Product_Link;
|
|
||||||
DROP TABLE tmp_Msg_Error;
|
|
||||||
END //
|
|
||||||
DELIMITER ;;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Product_Link_Audit;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Product_Link;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Audit;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order;
|
|
||||||
|
|
||||||
INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
|
|
||||||
guid,
|
|
||||||
id_link,
|
|
||||||
id_order,
|
|
||||||
id_permutation,
|
|
||||||
cost_total_local,
|
|
||||||
id_currency_cost,
|
|
||||||
quantity_used,
|
|
||||||
id_unit_quantity,
|
|
||||||
quantity_produced,
|
|
||||||
latency_manufacture_days,
|
|
||||||
display_order,
|
|
||||||
active
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(
|
|
||||||
'NIPS', # guid
|
|
||||||
-1, # id_link,
|
|
||||||
-1, # id_order,
|
|
||||||
1, # id_permutation,
|
|
||||||
100, # cost_total_local,
|
|
||||||
1, # id_currency_cost,
|
|
||||||
1, # quantity_used,
|
|
||||||
1, # id_unit_quantity,
|
|
||||||
1, # quantity_produced,
|
|
||||||
14, # latency_manufacture_days ,
|
|
||||||
1, # display_order
|
|
||||||
1 # active
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
SELECT * FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
|
|
||||||
|
|
||||||
CALL p_shop_save_manufacturing_purchase_order (
|
|
||||||
'NIPS', # a_guid
|
|
||||||
'auth0|6582b95c895d09a70ba10fef', # a_id_user
|
|
||||||
-1, # a_id_order
|
|
||||||
1, # a_id_currency_cost
|
|
||||||
1, # a_active
|
|
||||||
'Initial data' # a_comment
|
|
||||||
);
|
|
||||||
|
|
||||||
SELECT * FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
|
|
||||||
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Product_Link_Audit;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Product_Link;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order_Audit;
|
|
||||||
DELETE FROM Shop_Manufacturing_Purchase_Order;
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@@ -6,9 +6,9 @@ DROP PROCEDURE IF EXISTS p_shop_save_product_permutation;
|
|||||||
|
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE PROCEDURE p_shop_save_product_permutation (
|
CREATE PROCEDURE p_shop_save_product_permutation (
|
||||||
IN a_id_user INT,
|
|
||||||
IN a_comment VARCHAR(500),
|
IN a_comment VARCHAR(500),
|
||||||
IN a_guid BINARY(36)
|
IN a_guid BINARY(36),
|
||||||
|
IN a_id_user INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ BEGIN
|
|||||||
DECLARE v_id_access_level_view INT;
|
DECLARE v_id_access_level_view INT;
|
||||||
DECLARE v_time_start TIMESTAMP(6);
|
DECLARE v_time_start TIMESTAMP(6);
|
||||||
DECLARE v_id_minimum INT;
|
DECLARE v_id_minimum INT;
|
||||||
DECLARE v_code_error_data VARCHAR(50);
|
DECLARE v_code_error_bad_data VARCHAR(50);
|
||||||
DECLARE v_id_type_error_data INT;
|
DECLARE v_id_type_error_bad_data INT;
|
||||||
|
|
||||||
SET v_time_start := CURRENT_TIMESTAMP(6);
|
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||||
SET v_guid := UUID();
|
SET v_guid := UUID();
|
||||||
SET v_id_access_level_view := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
|
SET v_id_access_level_view := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
|
||||||
SET v_code_error_data := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
|
SET v_code_error_bad_data := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
|
||||||
SET v_id_type_error_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_error_data LIMIT 1);
|
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_error_bad_data LIMIT 1);
|
||||||
|
|
||||||
-- Argument validation + default values
|
-- Argument validation + default values
|
||||||
SET a_id_user = IFNULL(a_id_user, 0);
|
SET a_id_user = IFNULL(a_id_user, 0);
|
||||||
@@ -282,8 +282,8 @@ BEGIN
|
|||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
-- v_guid,
|
-- v_guid,
|
||||||
v_id_type_error_data,
|
v_id_type_error_bad_data,
|
||||||
v_code_error_data,
|
v_code_error_bad_data,
|
||||||
CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_variation LIMIT 1))
|
CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_variation LIMIT 1))
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ BEGIN
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM partsltd_prod.Shop_Calc_User_Temp
|
DELETE FROM partsltd_prod.Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ BEGIN
|
|||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = a_guid;
|
WHERE GUID = a_guid;
|
||||||
|
|||||||
@@ -615,7 +615,7 @@ BEGIN
|
|||||||
t_P.can_admin = UE_T.can_admin
|
t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ BEGIN
|
|||||||
t_P.can_admin = UE_T.can_admin
|
t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ BEGIN
|
|||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = a_guid;
|
WHERE GUID = a_guid;
|
||||||
|
|||||||
@@ -627,7 +627,7 @@ BEGIN
|
|||||||
t_P.can_admin = UE_T.can_admin
|
t_P.can_admin = UE_T.can_admin
|
||||||
;
|
;
|
||||||
|
|
||||||
# CALL p_shop_calc_user_clear_temp(v_guid);
|
# CALL p_shop_clear_calc_user(v_guid);
|
||||||
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
# DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -33,9 +33,10 @@ INSERT INTO Shop_Msg_Error_Type (
|
|||||||
code, name, description
|
code, name, description
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
('BAD_DATA', 'Invalid data', 'Rubbish data'),
|
('BAD_DATA', 'Invalid data', 'Rubbish data')
|
||||||
('NO_PERMISSION', 'No permission', 'Not authorised'),
|
, ('NO_PERMISSION', 'No permission', 'Not authorised')
|
||||||
('PRODUCT_AVAILABILITY', 'Product not available', 'Product not available')
|
, ('PRODUCT_AVAILABILITY', 'Product not available', 'Product not available')
|
||||||
|
, ('MYSQL_ERROR', 'MySQL error', 'MySQL execution error.')
|
||||||
;
|
;
|
||||||
|
|
||||||
# File Types
|
# File Types
|
||||||
|
|||||||
@@ -6982,7 +6982,7 @@ BEGIN
|
|||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid;
|
WHERE GUID = v_guid;
|
||||||
@@ -7878,7 +7878,7 @@ BEGIN
|
|||||||
*/
|
*/
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid;
|
WHERE GUID = v_guid;
|
||||||
@@ -10368,7 +10368,7 @@ BEGIN
|
|||||||
OR t_P.can_view = FALSE
|
OR t_P.can_view = FALSE
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
@@ -12527,7 +12527,7 @@ BEGIN
|
|||||||
AND UE_T.GUID = v_guid
|
AND UE_T.GUID = v_guid
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
@@ -13156,7 +13156,7 @@ BEGIN
|
|||||||
AND UE_T.GUID = v_guid
|
AND UE_T.GUID = v_guid
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
@@ -14099,7 +14099,7 @@ BEGIN
|
|||||||
AND UE_T.GUID = v_guid
|
AND UE_T.GUID = v_guid
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ BEGIN
|
|||||||
tP.can_edit = TP.can_edit,
|
tP.can_edit = TP.can_edit,
|
||||||
tP.can_admin = TP.can_admin;
|
tP.can_admin = TP.can_admin;
|
||||||
|
|
||||||
CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ BEGIN
|
|||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid;
|
WHERE GUID = v_guid;
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ BEGIN
|
|||||||
*/
|
*/
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid_permission);
|
-- CALL p_shop_clear_calc_user(v_guid_permission);
|
||||||
|
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid;
|
WHERE GUID = v_guid;
|
||||||
|
|||||||
@@ -822,7 +822,7 @@ BEGIN
|
|||||||
OR t_P.can_view = FALSE
|
OR t_P.can_view = FALSE
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ BEGIN
|
|||||||
AND UE_T.GUID = v_guid
|
AND UE_T.GUID = v_guid
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ BEGIN
|
|||||||
AND UE_T.GUID = v_guid
|
AND UE_T.GUID = v_guid
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ BEGIN
|
|||||||
AND UE_T.GUID = v_guid
|
AND UE_T.GUID = v_guid
|
||||||
;
|
;
|
||||||
|
|
||||||
-- CALL p_shop_calc_user_clear_temp(v_guid);
|
-- CALL p_shop_clear_calc_user(v_guid);
|
||||||
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
-- DROP TABLE IF EXISTS Shop_Calc_User_Temp;
|
||||||
DELETE FROM Shop_Calc_User_Temp
|
DELETE FROM Shop_Calc_User_Temp
|
||||||
WHERE GUID = v_guid
|
WHERE GUID = v_guid
|
||||||
|
|||||||
76
static/css/pages/store/products.css
Normal file
76
static/css/pages/store/products.css
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
#formFilters {
|
||||||
|
width: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#formFilters .container {
|
||||||
|
max-width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
#formFilters .container-input.filter.is_not_empty {
|
||||||
|
width: 10vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#formFilters .container-input.filter.active {
|
||||||
|
width: 8vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
#tableMain {
|
||||||
|
max-width: min(calc(1vh * 79), calc(1vw * 90));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#tableMain tbody tr td.display_order, #tableMain thead tr th.display_order {
|
||||||
|
width: 5vh;
|
||||||
|
min-width: 5vh;
|
||||||
|
}
|
||||||
|
#tableMain tbody tr td.product_category, #tableMain thead tr th.product_category {
|
||||||
|
width: 15vh;
|
||||||
|
min-width: 15vh;
|
||||||
|
}
|
||||||
|
#tableMain tbody tr td.name, #tableMain thead tr th.name {
|
||||||
|
width: 15vh;
|
||||||
|
min-width: 15vh;
|
||||||
|
}
|
||||||
|
#tableMain thead tr th.has_variations, #tableMain tbody tr td.has_variations {
|
||||||
|
width: 5vh;
|
||||||
|
min-width: 5vh;
|
||||||
|
}
|
||||||
|
#tableMain tbody tr td.access_level, #tableMain thead tr th.access_level {
|
||||||
|
width: 7vh;
|
||||||
|
min-width: 7vh;
|
||||||
|
}
|
||||||
|
#tableMain tbody tr td.active, #tableMain thead tr th.active {
|
||||||
|
width: 5vh;
|
||||||
|
min-width: 5vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td > input, td > select, td > textarea, .container-input > input, .container-input > select, .container-input > textarea {
|
||||||
|
border: 2px solid var(--c_purple);
|
||||||
|
border-radius: 0.5vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tableMain tbody tr td button {
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tableMain tbody tr td table thead tr th.id_variation_type, #tableMain tbody tr td table tbody tr td.id_variation_type, #tableMain tbody tr td table thead tr th.id_variation, #tableMain tbody tr td table tbody tr td.id_variation {
|
||||||
|
width: 47.5%;
|
||||||
|
}
|
||||||
|
|
||||||
2
static/dist/js/main.bundle.js
vendored
2
static/dist/js/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
@@ -95,6 +95,21 @@ export default class API {
|
|||||||
return await API.request(hashSaveStoreProductCategory, 'POST', dataRequest);
|
return await API.request(hashSaveStoreProductCategory, 'POST', dataRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// products
|
||||||
|
static async getProducts() {
|
||||||
|
return await API.request(hashGetStoreProduct);
|
||||||
|
}
|
||||||
|
static async getProductsByFilters(filtersJson) {
|
||||||
|
API.goToHash(hashPageStoreProducts, filtersJson);
|
||||||
|
}
|
||||||
|
static async saveProducts(products, formFilters, comment) {
|
||||||
|
let dataRequest = {};
|
||||||
|
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||||
|
dataRequest[flagProduct] = products;
|
||||||
|
dataRequest[flagComment] = comment;
|
||||||
|
return await API.request(hashSaveStoreProduct, 'POST', dataRequest);
|
||||||
|
}
|
||||||
|
|
||||||
// product permutations
|
// product permutations
|
||||||
static async getProductPermutations() {
|
static async getProductPermutations() {
|
||||||
return await API.request(hashGetStoreProductPermutation);
|
return await API.request(hashGetStoreProductPermutation);
|
||||||
|
|||||||
@@ -118,20 +118,36 @@ export default class DOM {
|
|||||||
}
|
}
|
||||||
static getElementAttributeValueCurrent(element) {
|
static getElementAttributeValueCurrent(element) {
|
||||||
return element.getAttribute(attrValueCurrent);
|
return element.getAttribute(attrValueCurrent);
|
||||||
|
if (!Validation.isEmpty(value) && element.type === "checkbox") {
|
||||||
|
value = (value === 'true');
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
static getElementAttributeValuePrevious(element) {
|
static getElementAttributeValuePrevious(element) {
|
||||||
return element.getAttribute(attrValuePrevious);
|
return element.getAttribute(attrValuePrevious);
|
||||||
|
if (!Validation.isEmpty(value) && element.type === "checkbox") {
|
||||||
|
value = (value === 'true');
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
/* base_table.handleChangeElementCellTable
|
||||||
static updateAndCheckIsTableElementDirty(element) {
|
static updateAndCheckIsTableElementDirty(element) {
|
||||||
|
let wasDirty = DOM.isElementDirty(element);
|
||||||
|
let row = DOM.getRowFromElement(element);
|
||||||
|
let wasDirtyRow = DOM.hasDirtyChildrenContainer(row);
|
||||||
let isDirty = DOM.updateAndCheckIsElementDirty(element);
|
let isDirty = DOM.updateAndCheckIsElementDirty(element);
|
||||||
let cell = DOM.getCellFromElement(element);
|
let cell = DOM.getCellFromElement(element);
|
||||||
if (isDirty) {
|
console.log({element, row, cell, isDirty, wasDirty});
|
||||||
cell.classList.add(flagDirty);
|
if (isDirty != wasDirty) {
|
||||||
} else {
|
DOM.handleDirtyElement(cell, isDirty);
|
||||||
cell.classList.remove(flagDirty);
|
let isDirtyRow = DOM.hasDirtyChildrenContainer(row);
|
||||||
|
console.log({isDirtyRow, wasDirtyRow});
|
||||||
|
if (isDirtyRow != wasDirtyRow) {
|
||||||
|
DOM.handleDirtyElement(row, isDirtyRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
static updateElement(id, data) {
|
static updateElement(id, data) {
|
||||||
const element = document.getElementById(id);
|
const element = document.getElementById(id);
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ export default class TableBasePage extends BasePage {
|
|||||||
}
|
}
|
||||||
return isDirty;
|
return isDirty;
|
||||||
}
|
}
|
||||||
|
hookupFilterIsNotEmpty() {
|
||||||
|
this.hookupFilter(flagIsNotEmpty);
|
||||||
|
}
|
||||||
hookupButtonApplyFilters() {
|
hookupButtonApplyFilters() {
|
||||||
this.hookupEventHandler("click", idButtonApplyFilters, (event, button) => {
|
this.hookupEventHandler("click", idButtonApplyFilters, (event, button) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -275,35 +278,27 @@ export default class TableBasePage extends BasePage {
|
|||||||
this.hookupChangeHandlerTableCells(selectorDisplayOrder);
|
this.hookupChangeHandlerTableCells(selectorDisplayOrder);
|
||||||
}
|
}
|
||||||
hookupChangeHandlerTableCells(inputSelector, handler = (event, element) => { this.handleChangeElementCellTable(event, element); }) {
|
hookupChangeHandlerTableCells(inputSelector, handler = (event, element) => { this.handleChangeElementCellTable(event, element); }) {
|
||||||
/*
|
|
||||||
Events.initialiseEventHandler(inputSelector, flagInitialised, (input) => {
|
Events.initialiseEventHandler(inputSelector, flagInitialised, (input) => {
|
||||||
input.addEventListener("change", (event) => {
|
input.addEventListener("change", (event) => {
|
||||||
handler(event, input);
|
handler(event, input);
|
||||||
});
|
});
|
||||||
|
this.handleChangeElementCellTable(null, input);
|
||||||
});
|
});
|
||||||
*/
|
// this.hookupEventHandler("change", inputSelector, handler);
|
||||||
this.hookupEventHandler("change", inputSelector, handler);
|
|
||||||
}
|
}
|
||||||
handleChangeElementCellTable(event, element) {
|
handleChangeElementCellTable(event, element) {
|
||||||
let row = DOM.getRowFromElement(element);
|
let row = DOM.getRowFromElement(element);
|
||||||
let td = DOM.getCellFromElement(element);
|
let td = DOM.getCellFromElement(element);
|
||||||
console.log("td: ", td);
|
|
||||||
let wasDirtyRow = DOM.hasDirtyChildrenContainer(row);
|
let wasDirtyRow = DOM.hasDirtyChildrenContainer(row);
|
||||||
let wasDirtyElement = element.classList.contains(flagDirty);
|
let wasDirtyElement = element.classList.contains(flagDirty);
|
||||||
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
|
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
|
||||||
console.log("isDirtyElement: ", isDirtyElement);
|
|
||||||
console.log("wasDirtyElement: ", wasDirtyElement);
|
|
||||||
if (isDirtyElement != wasDirtyElement) {
|
if (isDirtyElement != wasDirtyElement) {
|
||||||
DOM.handleDirtyElement(td, isDirtyElement);
|
DOM.handleDirtyElement(td, isDirtyElement);
|
||||||
let isNowDirtyRow = DOM.hasDirtyChildrenContainer(row);
|
let isNowDirtyRow = DOM.hasDirtyChildrenContainer(row);
|
||||||
console.log("isNowDirtyRow: ", isNowDirtyRow);
|
|
||||||
console.log("wasDirtyRow: ", wasDirtyRow);
|
|
||||||
if (isNowDirtyRow != wasDirtyRow) {
|
if (isNowDirtyRow != wasDirtyRow) {
|
||||||
DOM.handleDirtyElement(row, isNowDirtyRow);
|
DOM.handleDirtyElement(row, isNowDirtyRow);
|
||||||
let rows = this.getTableRecords(true);
|
let rows = this.getTableRecords(true);
|
||||||
let existsDirtyRecord = rows.length > 0;
|
let existsDirtyRecord = rows.length > 0;
|
||||||
console.log("dirty records:", rows);
|
|
||||||
console.log("existsDirtyRecord:", existsDirtyRecord);
|
|
||||||
this.toggleShowButtonsSaveCancel(existsDirtyRecord);
|
this.toggleShowButtonsSaveCancel(existsDirtyRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
150
static/js/pages/store/products.js
Normal file
150
static/js/pages/store/products.js
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
|
||||||
|
import Events from "../../lib/events.js";
|
||||||
|
import TableBasePage from "../base_table.js";
|
||||||
|
import API from "../../api.js";
|
||||||
|
import DOM from "../../dom.js";
|
||||||
|
import StoreTableMixinPage from "./mixin_table.js";
|
||||||
|
import Utils from "../../lib/utils.js";
|
||||||
|
|
||||||
|
export default class PageStoreProducts extends TableBasePage {
|
||||||
|
static hash = hashPageStoreProducts;
|
||||||
|
callFilterTableContent = API.getProductsByFilters;
|
||||||
|
callSaveTableContent = API.saveProducts;
|
||||||
|
|
||||||
|
constructor(router) {
|
||||||
|
super(router);
|
||||||
|
this.storeMixin = new StoreTableMixinPage(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
initialize() {
|
||||||
|
this.sharedInitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
hookupFilters() {
|
||||||
|
this.sharedHookupFilters();
|
||||||
|
this.hookupFilterProductCategory();
|
||||||
|
this.hookupFilterIsNotEmpty();
|
||||||
|
this.hookupFilterActive();
|
||||||
|
}
|
||||||
|
hookupFilterProductCategory() {
|
||||||
|
this.hookupFilter(flagProductCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadRowTable(rowJson) {
|
||||||
|
return;
|
||||||
|
if (rowJson == null) return;
|
||||||
|
let row = _rowBlank.cloneNode(true);
|
||||||
|
row.classList.remove(flagRowNew);
|
||||||
|
row.classList.remove(flagInitialised);
|
||||||
|
row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
|
||||||
|
element.classList.remove(flagInitialised);
|
||||||
|
});
|
||||||
|
console.log("applying data row: ", rowJson);
|
||||||
|
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
|
||||||
|
let tdProductCategory = row.querySelector('td.' + flagProductCategory);
|
||||||
|
let divProductCategory = tdProductCategory.querySelector('div.' + flagProductCategory);
|
||||||
|
let textareaName = row.querySelector('td.' + flagName + ' textarea');
|
||||||
|
let tdAccessLevel = row.querySelector('td.' + flagAccessLevel);
|
||||||
|
let divAccessLevel = tdAccessLevel.querySelector('div.' + flagAccessLevel);
|
||||||
|
let inputActive = row.querySelector('td.' + flagActive + ' input[type="checkbox"]');
|
||||||
|
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(sliderDisplayOrder, rowJson[flagDisplayOrder]);
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(textareaCode, rowJson[flagCode]);
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(textareaName, rowJson[flagName]);
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(textareaDescription, rowJson[flagDescription]);
|
||||||
|
tdAccessLevel.setAttribute(attrIdAccessLevel, rowJson[attrIdAccessLevel]);
|
||||||
|
tdAccessLevel.setAttribute(flagAccessLevelRequired, rowJson[flagAccessLevelRequired]);
|
||||||
|
divAccessLevel.setAttribute(attrIdAccessLevel, rowJson[attrIdAccessLevel]);
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(divAccessLevel, rowJson[attrIdAccessLevel]);
|
||||||
|
divAccessLevel.textContent = rowJson[flagAccessLevelRequired];
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(inputActive, rowJson[flagActive]);
|
||||||
|
row.setAttribute(rowJson[flagKeyPrimary], rowJson[rowJson[flagKeyPrimary]]);
|
||||||
|
|
||||||
|
let table = this.getTableMain();
|
||||||
|
let bodyTable = table.querySelector('tbody');
|
||||||
|
bodyTable.appendChild(row);
|
||||||
|
}
|
||||||
|
getJsonRow(row) {
|
||||||
|
if (row == null) return;
|
||||||
|
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
|
||||||
|
let tdProductCategory = row.querySelector('td.' + flagProductCategory);
|
||||||
|
let textareaName = row.querySelector('td.' + flagName + ' textarea');
|
||||||
|
// let tdProductVariations = row.querySelector('td.' + flagProductVariations);
|
||||||
|
let inputHasVariations = row.querySelector('td.' + flagHasVariations + ' input[type="checkbox"]');
|
||||||
|
let tdAccessLevel = row.querySelector('td.' + flagAccessLevel);
|
||||||
|
let inputActive = row.querySelector('td.' + flagActive + ' input[type="checkbox"]');
|
||||||
|
|
||||||
|
let jsonProduct = {};
|
||||||
|
jsonProduct[attrIdProduct] = row.getAttribute(attrIdProduct);
|
||||||
|
jsonProduct[attrIdProductCategory] = DOM.getElementAttributeValueCurrent(tdProductCategory);
|
||||||
|
jsonProduct[flagName] = DOM.getElementAttributeValueCurrent(textareaName);
|
||||||
|
// jsonRow[flagProductVariations] = DOM.getElementAttributeValueCurrent(tdProductVariations);
|
||||||
|
// jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
|
||||||
|
jsonProduct[flagHasVariations] = DOM.getElementAttributeValueCurrent(inputHasVariations);
|
||||||
|
// jsonProduct[flagAccessLevelRequired] = tdAccessLevel.getAttribute(flagAccessLevelRequired);
|
||||||
|
jsonProduct[attrIdAccessLevel] = DOM.getElementAttributeValueCurrent(tdAccessLevel);
|
||||||
|
jsonProduct[flagActive] = DOM.getElementAttributeValueCurrent(inputActive);
|
||||||
|
jsonProduct[flagDisplayOrder] = DOM.getElementAttributeValueCurrent(sliderDisplayOrder);
|
||||||
|
return jsonProduct;
|
||||||
|
}
|
||||||
|
initialiseRowNew(row) {
|
||||||
|
if (row == null) return;
|
||||||
|
let slidersDisplayOrder = document.querySelectorAll('td.' + flagDisplayOrder + ' input.' + flagSlider);
|
||||||
|
let maxDisplayOrder = 0;
|
||||||
|
slidersDisplayOrder.forEach((slider) => {
|
||||||
|
maxDisplayOrder = Math.max(maxDisplayOrder, parseFloat(DOM.getElementValueCurrent(slider)));
|
||||||
|
});
|
||||||
|
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
|
||||||
|
DOM.setElementValuesCurrentAndPrevious(sliderDisplayOrder, maxDisplayOrder + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
hookupTableMain() {
|
||||||
|
super.hookupTableMain();
|
||||||
|
this.hookupSlidersDisplayOrderTable();
|
||||||
|
this.hookupTdsProductCategory();
|
||||||
|
this.hookupTextareasNameTable();
|
||||||
|
this.hookupInputsHasVariationsTable();
|
||||||
|
this.hookupTdsAccessLevel();
|
||||||
|
this.hookupInputsActiveTable();
|
||||||
|
}
|
||||||
|
hookupTdsProductCategory() {
|
||||||
|
let cellSelector = idTableMain + ' tbody td.' + flagProductCategory;
|
||||||
|
this.hookupTableCellDdlPreviews(cellSelector, Utils.getListFromDict(productCategories));
|
||||||
|
}
|
||||||
|
hookupInputsHasVariationsTable() {
|
||||||
|
let cellSelector = idTableMain + ' tbody td.' + flagHasVariations + ' input[type="checkbox"]';
|
||||||
|
this.hookupChangeHandlerTableCells(cellSelector);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
isDirtyRow(row) {
|
||||||
|
if (row == null) return false;
|
||||||
|
console.log("Product Product isDirtyRow");
|
||||||
|
console.log("row: ", row);
|
||||||
|
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder);
|
||||||
|
let inputCode = row.querySelector('td.' + flagCode + ' textarea');
|
||||||
|
let inputName = row.querySelector('td.' + flagName + ' textarea');
|
||||||
|
let inputDescription = row.querySelector('td.' + flagDescription + ' textarea');
|
||||||
|
let tdAccessLevel = row.querySelector('td.' + flagAccessLevel);
|
||||||
|
let inputActive = row.querySelector('td.' + flagActive + ' input[type="checkbox"]');
|
||||||
|
let isDirty = sliderDisplayOrder.classList.contains(flagDirty) || inputCode.classList.contains(flagDirty) || inputName.classList.contains(flagDirty) ||
|
||||||
|
inputDescription.classList.contains(flagDirty) || tdAccessLevel.classList.contains(flagDirty) || inputActive.classList.contains(flagDirty);
|
||||||
|
DOM.handleDirtyElement(row, isDirty);
|
||||||
|
return isDirty;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
leave() {
|
||||||
|
super.leave();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
getFiltersDefaults() {
|
||||||
|
filters = {};
|
||||||
|
filters.flagIsNotEmpty = true;
|
||||||
|
filters.flagActive = true;
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import PageStoreHome from './pages/store/home.js';
|
|||||||
import PageStoreProductCategories from './pages/store/product_categories.js';
|
import PageStoreProductCategories from './pages/store/product_categories.js';
|
||||||
import PageStoreProductPermutations from './pages/store/product_permutations.js';
|
import PageStoreProductPermutations from './pages/store/product_permutations.js';
|
||||||
// import PageStoreProductPrices from './pages/store/product_prices.js';
|
// import PageStoreProductPrices from './pages/store/product_prices.js';
|
||||||
// import PageStoreProducts from './pages/store/products.js';
|
import PageStoreProducts from './pages/store/products.js';
|
||||||
// import PageStoreProductVariations from './pages/store/product_variations.js';
|
// import PageStoreProductVariations from './pages/store/product_variations.js';
|
||||||
import PageStoreStockItems from './pages/store/stock_items.js';
|
import PageStoreStockItems from './pages/store/stock_items.js';
|
||||||
// User
|
// User
|
||||||
@@ -80,7 +80,7 @@ export default class Router {
|
|||||||
this.pages[hashPageStoreProductCategories] = { name: 'PageStoreProductCategories', module: PageStoreProductCategories }; // pathModule: './pages/store/product_categories.js' };
|
this.pages[hashPageStoreProductCategories] = { name: 'PageStoreProductCategories', module: PageStoreProductCategories }; // pathModule: './pages/store/product_categories.js' };
|
||||||
this.pages[hashPageStoreProductPermutations] = { name: 'PageStoreProductPermutations', module: PageStoreProductPermutations }; // pathModule: './pages/store/product_permutations.js' };
|
this.pages[hashPageStoreProductPermutations] = { name: 'PageStoreProductPermutations', module: PageStoreProductPermutations }; // pathModule: './pages/store/product_permutations.js' };
|
||||||
// this.pages[hashPageStoreProductPrices] = { name: 'PageStoreProductPrices', module: PageStoreProductPrices }; // pathModule: './pages/store/product_prices.js' };
|
// this.pages[hashPageStoreProductPrices] = { name: 'PageStoreProductPrices', module: PageStoreProductPrices }; // pathModule: './pages/store/product_prices.js' };
|
||||||
// this.pages[hashPageStoreProducts] = { name: 'PageStoreProducts', module: PageStoreProducts }; // pathModule: './pages/store/products.js' };
|
this.pages[hashPageStoreProducts] = { name: 'PageStoreProducts', module: PageStoreProducts }; // pathModule: './pages/store/products.js' };
|
||||||
// this.pages[hashPageStoreProductVariations] = { name: 'PageStoreProductVariations', module: PageStoreProductVariations }; // pathModule: './pages/store/product_variations.js' };
|
// this.pages[hashPageStoreProductVariations] = { name: 'PageStoreProductVariations', module: PageStoreProductVariations }; // pathModule: './pages/store/product_variations.js' };
|
||||||
this.pages[hashPageStoreStockItems] = { name: 'PageStoreStockItems', module: PageStoreStockItems };
|
this.pages[hashPageStoreStockItems] = { name: 'PageStoreStockItems', module: PageStoreStockItems };
|
||||||
// User
|
// User
|
||||||
@@ -106,6 +106,7 @@ export default class Router {
|
|||||||
// this.routes[hashPageStoreProductPrices] = (isPopState = false) => this.navigateToHash(hashPageStoreProductPrices, isPopState);
|
// this.routes[hashPageStoreProductPrices] = (isPopState = false) => this.navigateToHash(hashPageStoreProductPrices, isPopState);
|
||||||
this.routes[hashPageStoreProducts] = (isPopState = false) => this.navigateToHash(hashPageStoreProducts, isPopState);
|
this.routes[hashPageStoreProducts] = (isPopState = false) => this.navigateToHash(hashPageStoreProducts, isPopState);
|
||||||
// this.routes[hashPageStoreProductVariations] = (isPopState = false) => this.navigateToHash(hashPageStoreProductVariations, isPopState);
|
// this.routes[hashPageStoreProductVariations] = (isPopState = false) => this.navigateToHash(hashPageStoreProductVariations, isPopState);
|
||||||
|
this.routes[hashPageStoreStockItems] = (isPopState = false) => this.navigateToHash(hashPageStoreStockItems, isPopState);
|
||||||
// User
|
// User
|
||||||
// this.routes[hashPageUserLogin] = (isPopState = false) => this.navigateToHash(hashPageUserLogin, isPopState);
|
// this.routes[hashPageUserLogin] = (isPopState = false) => this.navigateToHash(hashPageUserLogin, isPopState);
|
||||||
// this.routes[hashPageUserLogout] = (isPopState = false) => this.navigateToHash(hashPageUserLogout, isPopState);
|
// this.routes[hashPageUserLogout] = (isPopState = false) => this.navigateToHash(hashPageUserLogout, isPopState);
|
||||||
|
|||||||
@@ -3,15 +3,25 @@
|
|||||||
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
|
<td class="{{ model.FLAG_DISPLAY_ORDER }}">
|
||||||
{% include 'components/common/buttons/_slider_display_order.html' %}
|
{% include 'components/common/buttons/_slider_display_order.html' %}
|
||||||
</td>
|
</td>
|
||||||
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}">
|
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}="0">
|
||||||
<textarea class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_ID_PRODUCT_CATEGORY }} {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
<select class="{{ model.FLAG_PRODUCT_CATEGORY}}" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}="0">
|
||||||
|
{% include 'components/common/inputs/_option_blank.html' %}
|
||||||
|
{% for cat in model.category_list_filters.categories %}
|
||||||
|
<option value="{{ cat.id_category }}">{{ cat.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td class="{{ model.FLAG_NAME }}">
|
<td class="{{ model.FLAG_NAME }}">
|
||||||
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
||||||
</td>
|
</td>
|
||||||
|
{#
|
||||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }}">
|
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }}">
|
||||||
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}></textarea>
|
||||||
</td>
|
</td>
|
||||||
|
#}
|
||||||
|
<td class="{{ model.FLAG_HAS_VARIATIONS }}">
|
||||||
|
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="false" {{ model.ATTR_VALUE_PREVIOUS }}="false">
|
||||||
|
</td>
|
||||||
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View">
|
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View">
|
||||||
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div>
|
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -25,16 +35,22 @@
|
|||||||
{% set display_order = category.display_order %}
|
{% set display_order = category.display_order %}
|
||||||
{% include 'components/common/buttons/_slider_display_order.html' %}
|
{% include 'components/common/buttons/_slider_display_order.html' %}
|
||||||
</td>
|
</td>
|
||||||
<td class="{{ model.FLAG_CODE }}">
|
<td class="{{ model.FLAG_PRODUCT_CATEGORY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_category }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_category }}">
|
||||||
<textarea class="{{ model.FLAG_CODE }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.code }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.code }}">{{ product.code }}</textarea>
|
{% include 'components/store/_preview_DDL_product_category.html' %}
|
||||||
</td>
|
</td>
|
||||||
<td class="{{ model.FLAG_NAME }}">
|
<td class="{{ model.FLAG_NAME }}">
|
||||||
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.name }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.name }}">{{ product.name }}</textarea>
|
<textarea class="{{ model.FLAG_NAME }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.name }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.name }}">{{ product.name }}</textarea>
|
||||||
</td>
|
</td>
|
||||||
|
{#
|
||||||
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }}">
|
<td class="{{ model.FLAG_PRODUCT_VARIATIONS }}">
|
||||||
{% include 'components/common/inputs/_textarea_product_variation_types.html' %}
|
{% include 'components/common/inputs/_textarea_product_variation_types.html' %}
|
||||||
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.description }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.description }}">{{ product.description }}</textarea>
|
<textarea class="{{ model.FLAG_PRODUCT_VARIATIONS }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.description }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.description }}">{{ product.description }}</textarea>
|
||||||
</td>
|
</td>
|
||||||
|
#}
|
||||||
|
<td class="{{ model.FLAG_HAS_VARIATIONS }}">
|
||||||
|
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {% if product.has_variations %}checked{% endif %}
|
||||||
|
{{ model.ATTR_VALUE_CURRENT }}="{{ product.has_variations | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.has_variations | lower }}">
|
||||||
|
</td>
|
||||||
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}">
|
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}">
|
||||||
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}">{{ product.name_access_level_required }}</div>
|
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}">{{ product.name_access_level_required }}</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ var attrIdProductVariation = "{{ model.ATTR_ID_PRODUCT_VARIATION }}";
|
|||||||
var attrIdProductVariationType = "{{ model.ATTR_ID_PRODUCT_VARIATION_TYPE }}";
|
var attrIdProductVariationType = "{{ model.ATTR_ID_PRODUCT_VARIATION_TYPE }}";
|
||||||
var flagButtonBasketAdd = "{{ model.FLAG_BUTTON_BASKET_ADD }}";
|
var flagButtonBasketAdd = "{{ model.FLAG_BUTTON_BASKET_ADD }}";
|
||||||
var flagButtonBuyNow = "{{ model.FLAG_BUTTON_BUY_NOW }}";
|
var flagButtonBuyNow = "{{ model.FLAG_BUTTON_BUY_NOW }}";
|
||||||
var flagProductCategory = "{{ model.FLAG_PRODUCT_CATEGORY }}";
|
|
||||||
var flagCostLocal = "{{ model.FLAG_COST_LOCAL }}";
|
var flagCostLocal = "{{ model.FLAG_COST_LOCAL }}";
|
||||||
var flagCountUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}";
|
var flagCountUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}";
|
||||||
var flagCountUnitMeasurementIntervalRecurrence = "{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
|
var flagCountUnitMeasurementIntervalRecurrence = "{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
|
||||||
@@ -49,10 +48,14 @@ var flagUnitMeasurementIntervalExpirationUnsealed = "{{ model.FLAG_UNIT_MEASUREM
|
|||||||
var flagUnitMeasurementIntervalRecurrence = "{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
|
var flagUnitMeasurementIntervalRecurrence = "{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_RECURRENCE }}";
|
||||||
var flagUnitMeasurementQuantity = "{{ model.FLAG_UNIT_MEASUREMENT_QUANTITY }}";
|
var flagUnitMeasurementQuantity = "{{ model.FLAG_UNIT_MEASUREMENT_QUANTITY }}";
|
||||||
var flagProductVariations = "{{ model.FLAG_PRODUCT_VARIATIONS }}";
|
var flagProductVariations = "{{ model.FLAG_PRODUCT_VARIATIONS }}";
|
||||||
|
var hashGetStoreProduct = "{{ model.HASH_GET_STORE_PRODUCT }}";
|
||||||
var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}";
|
var hashGetStoreProductCategory = "{{ model.HASH_GET_STORE_PRODUCT_CATEGORY }}";
|
||||||
var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}";
|
var hashGetStoreProductPermutation = "{{ model.HASH_GET_STORE_PRODUCT_PERMUTATION }}";
|
||||||
|
var hashGetStoreStockItem = "{{ model.HASH_GET_STORE_STOCK_ITEM }}";
|
||||||
|
var hashSaveStoreProduct = "{{ model.HASH_SAVE_STORE_PRODUCT }}";
|
||||||
var hashSaveStoreProductCategory = "{{ model.HASH_SAVE_STORE_PRODUCT_CATEGORY }}";
|
var hashSaveStoreProductCategory = "{{ model.HASH_SAVE_STORE_PRODUCT_CATEGORY }}";
|
||||||
var hashSaveStoreProductPermutation = "{{ model.HASH_SAVE_STORE_PRODUCT_PERMUTATION }}";
|
var hashSaveStoreProductPermutation = "{{ model.HASH_SAVE_STORE_PRODUCT_PERMUTATION }}";
|
||||||
|
var hashSaveStoreStockItem = "{{ model.HASH_SAVE_STORE_STOCK_ITEM }}";
|
||||||
var hashStoreBasketAdd = "{{ model.HASH_STORE_BASKET_ADD }}";
|
var hashStoreBasketAdd = "{{ model.HASH_STORE_BASKET_ADD }}";
|
||||||
var hashStoreBasketDelete = "{{ model.HASH_STORE_BASKET_DELETE }}";
|
var hashStoreBasketDelete = "{{ model.HASH_STORE_BASKET_DELETE }}";
|
||||||
var hashStoreBasketEdit = "{{ model.HASH_STORE_BASKET_EDIT }}";
|
var hashStoreBasketEdit = "{{ model.HASH_STORE_BASKET_EDIT }}";
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/pages/store/products.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/pages/store/products.css') }}">
|
||||||
-->
|
-->
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_products.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_products.bundle.css') }}">
|
||||||
|
|
||||||
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_product.save_product') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
|
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_product.save_product') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
|
||||||
{{ model.form_filters.hidden_tag() }}
|
{{ model.form_filters.hidden_tag() }}
|
||||||
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
|
||||||
<div class="{{ model.FLAG_CONTAINER_INPUT }}">
|
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_FILTER }}">
|
||||||
{{ model.form_filters.id_category.label }}
|
{{ model.form_filters.id_category.label }}
|
||||||
{{ model.form_filters.id_category() }}
|
{{ model.form_filters.id_category() }}
|
||||||
{% for error in model.form_filters.id_category.errors %}
|
{% for error in model.form_filters.id_category.errors %}
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
<th class="{{ model.FLAG_DISPLAY_ORDER }}">Display Order</th>
|
<th class="{{ model.FLAG_DISPLAY_ORDER }}">Display Order</th>
|
||||||
<th class="{{ model.FLAG_PRODUCT_CATEGORY }}">Category</th>
|
<th class="{{ model.FLAG_PRODUCT_CATEGORY }}">Category</th>
|
||||||
<th class="{{ model.FLAG_NAME }}">Name</th>
|
<th class="{{ model.FLAG_NAME }}">Name</th>
|
||||||
<th class="{{ model.FLAG_PRODUCT_VARIATIONS }}">Variations</th>
|
<th class="{{ model.FLAG_HAS_VARIATIONS }}">Has Variations?</th>
|
||||||
<th class="{{ model.FLAG_ACCESS_LEVEL }}">Access Level Required</th>
|
<th class="{{ model.FLAG_ACCESS_LEVEL }}">Access Level Required</th>
|
||||||
<th class="{{ model.FLAG_ACTIVE}}">Active</th>
|
<th class="{{ model.FLAG_ACTIVE}}">Active</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -102,10 +102,12 @@
|
|||||||
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
|
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
|
||||||
<script type="module" src="{{ url_for('static', filename='js/pages/store/products.js') }}"></script>
|
<script type="module" src="{{ url_for('static', filename='js/pages/store/products.js') }}"></script>
|
||||||
-->
|
-->
|
||||||
|
<script src="{{ url_for('routes_store.scripts_section_store') }}"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// pass arguments from model to JS
|
// pass arguments from model to JS
|
||||||
var flagIsNotEmpty = "{{ model.FLAG_IS_NOT_EMPTY }}";
|
|
||||||
var accessLevels = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.access_levels) | tojson | safe }};
|
var accessLevels = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.access_levels) | tojson | safe }};
|
||||||
|
{# var products = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list.get_list_products()) | tojson | safe }}; #}
|
||||||
|
var productCategories = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.category_list_filters.categories) | tojson | safe }};
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -80,6 +80,11 @@ module.exports = {
|
|||||||
path.resolve(__dirname, 'static/css/sections/store.css'),
|
path.resolve(__dirname, 'static/css/sections/store.css'),
|
||||||
path.resolve(__dirname, 'static/css/pages/store/home.css')
|
path.resolve(__dirname, 'static/css/pages/store/home.css')
|
||||||
],
|
],
|
||||||
|
store_products: [
|
||||||
|
// path.resolve(__dirname, 'static/js/pages/store/product_categories.js'),
|
||||||
|
path.resolve(__dirname, 'static/css/sections/store.css'),
|
||||||
|
path.resolve(__dirname, 'static/css/pages/store/products.css')
|
||||||
|
],
|
||||||
store_product_categories: [
|
store_product_categories: [
|
||||||
// path.resolve(__dirname, 'static/js/pages/store/product_categories.js'),
|
// path.resolve(__dirname, 'static/js/pages/store/product_categories.js'),
|
||||||
path.resolve(__dirname, 'static/css/sections/store.css'),
|
path.resolve(__dirname, 'static/css/sections/store.css'),
|
||||||
|
|||||||
Reference in New Issue
Block a user